Skip to content

Commit

Permalink
Merge pull request #1 from OpenShock/feature/estop-config
Browse files Browse the repository at this point in the history
Allow setting/disabling Emergency Stop during setup/via Serial commands
  • Loading branch information
hhvrc authored Oct 3, 2024
2 parents 1dfea17 + d4ee499 commit 60bfc42
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ obj/
.idea
.vs
.vscode
*.generated.sln
*.sln
10 changes: 10 additions & 0 deletions HubConfig.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ table RFConfig {
keepalive_enabled:bool;
}

table EStopConfig {
enabled:bool;

/// The GPIO pin connected to the E-Stop button
gpio_pin:uint8;
}

table WiFiCredentials {
/// ID of the WiFi network credentials, used for referencing the credentials with a low memory footprint
id:uint8;
Expand Down Expand Up @@ -118,4 +125,7 @@ table HubConfig {

/// OTA update configuration
ota_update:OtaUpdateConfig;

/// E-Stop configuration
estop:EStopConfig;
}
20 changes: 17 additions & 3 deletions HubToLocalMessage.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,24 @@ struct AccountLinkCommandResult {
result:AccountLinkResultCode;
}

enum SetRfPinResultCode : uint8 {
enum SetGPIOResultCode : uint8 {
Success = 0,
InvalidPin = 1,
InternalError = 2
}
struct SetRfTxPinCommandResult {
pin:uint8;
result:SetRfPinResultCode;
result:SetGPIOResultCode;
}

struct SetEstopEnabledCommandResult {
enabled:bool;
success:bool;
}

struct SetEstopPinCommandResult {
gpio_pin:uint8;
result:SetGPIOResultCode;
}

union HubToLocalMessagePayload {
Expand All @@ -72,7 +82,11 @@ union HubToLocalMessagePayload {
AccountLinkCommandResult,

// RF transmitter stuff
SetRfTxPinCommandResult
SetRfTxPinCommandResult,

// E-stop stuff
SetEstopEnabledCommandResult,
SetEstopPinCommandResult
}

table HubToLocalMessage (fs_serializer) {
Expand Down
12 changes: 11 additions & 1 deletion LocalToHubMessage.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ struct AccountUnlinkCommand {
struct SetRfTxPinCommand {
pin:uint8;
}
struct SetEstopEnabledCommand {
enabled:bool;
}
struct SetEstopPinCommand {
pin:uint8;
}

union LocalToHubMessagePayload {

Expand All @@ -84,7 +90,11 @@ union LocalToHubMessagePayload {
AccountUnlinkCommand,

// RF Transmitter stuff
SetRfTxPinCommand
SetRfTxPinCommand,

// E-Stop stuff
SetEstopEnabledCommand,
SetEstopPinCommand
}

table LocalToHubMessage (fs_serializer) {
Expand Down

0 comments on commit 60bfc42

Please sign in to comment.