From 16b4b38c9d254a9ed02501d9a1aac5fab6f0b3be Mon Sep 17 00:00:00 2001 From: hhvrc Date: Fri, 23 Aug 2024 14:20:12 +0200 Subject: [PATCH 1/5] Add EStop config --- HubConfig.fbs | 8 ++++++++ HubToLocalMessage.fbs | 14 +++++++++++--- LocalToHubMessage.fbs | 8 +++++++- 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/HubConfig.fbs b/HubConfig.fbs index b021e5a..33d0fb2 100644 --- a/HubConfig.fbs +++ b/HubConfig.fbs @@ -8,6 +8,11 @@ table RFConfig { keepalive_enabled:bool; } +table EStopConfig { + /// The GPIO pin connected to the E-Stop button + estop_pin:uint8; +} + table WiFiCredentials { /// ID of the WiFi network credentials, used for referencing the credentials with a low memory footprint id:uint8; @@ -117,6 +122,9 @@ table DnsConfig { table HubConfig { /// RF Transmitter configuration rf:RFConfig; + + /// E-Stop configuration + estop:EStopConfig; /// WiFi configuration wifi:WiFiConfig; diff --git a/HubToLocalMessage.fbs b/HubToLocalMessage.fbs index 7cf7516..f4d628d 100644 --- a/HubToLocalMessage.fbs +++ b/HubToLocalMessage.fbs @@ -46,14 +46,19 @@ 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 SetEstopPinCommandResult { + pin:uint8; + result:SetGPIOResultCode; } union HubToLocalMessagePayload { @@ -72,7 +77,10 @@ union HubToLocalMessagePayload { AccountLinkCommandResult, // RF transmitter stuff - SetRfTxPinCommandResult + SetRfTxPinCommandResult, + + // E-stop stuff + SetEstopPinCommandResult } table HubToLocalMessage (fs_serializer) { diff --git a/LocalToHubMessage.fbs b/LocalToHubMessage.fbs index 8361de5..263a5f0 100644 --- a/LocalToHubMessage.fbs +++ b/LocalToHubMessage.fbs @@ -58,6 +58,9 @@ struct AccountUnlinkCommand { struct SetRfTxPinCommand { pin:uint8; } +struct SetEstopPinCommand { + pin:uint8; +} union LocalToHubMessagePayload { @@ -84,7 +87,10 @@ union LocalToHubMessagePayload { AccountUnlinkCommand, // RF Transmitter stuff - SetRfTxPinCommand + SetRfTxPinCommand, + + // E-Stop stuff + SetEstopPinCommand } table LocalToHubMessage (fs_serializer) { From 2df927da8551fda02ec07fc5e211fba13695dc1c Mon Sep 17 00:00:00 2001 From: hhvrc Date: Mon, 2 Sep 2024 12:39:28 +0200 Subject: [PATCH 2/5] add enabled flag --- HubConfig.fbs | 4 +++- HubToLocalMessage.fbs | 6 ++++++ LocalToHubMessage.fbs | 4 ++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/HubConfig.fbs b/HubConfig.fbs index 9e7534f..250c12c 100644 --- a/HubConfig.fbs +++ b/HubConfig.fbs @@ -9,8 +9,10 @@ table RFConfig { } table EStopConfig { + enabled:bool; + /// The GPIO pin connected to the E-Stop button - estop_pin:uint8; + gpio_pin:uint8; } table WiFiCredentials { diff --git a/HubToLocalMessage.fbs b/HubToLocalMessage.fbs index f4d628d..9a9f601 100644 --- a/HubToLocalMessage.fbs +++ b/HubToLocalMessage.fbs @@ -56,6 +56,11 @@ struct SetRfTxPinCommandResult { result:SetGPIOResultCode; } +struct SetEstopEnabledCommandResult { + enabled:bool; + result:SetGPIOResultCode; +} + struct SetEstopPinCommandResult { pin:uint8; result:SetGPIOResultCode; @@ -80,6 +85,7 @@ union HubToLocalMessagePayload { SetRfTxPinCommandResult, // E-stop stuff + SetEstopEnabledCommandResult, SetEstopPinCommandResult } diff --git a/LocalToHubMessage.fbs b/LocalToHubMessage.fbs index 263a5f0..f63ad33 100644 --- a/LocalToHubMessage.fbs +++ b/LocalToHubMessage.fbs @@ -58,6 +58,9 @@ struct AccountUnlinkCommand { struct SetRfTxPinCommand { pin:uint8; } +struct SetEstopEnabledCommand { + enabled:bool; +} struct SetEstopPinCommand { pin:uint8; } @@ -90,6 +93,7 @@ union LocalToHubMessagePayload { SetRfTxPinCommand, // E-Stop stuff + SetEstopEnabledCommand, SetEstopPinCommand } From 0ad5209c34bb2aa433486c0da4371a98c720850a Mon Sep 17 00:00:00 2001 From: hhvrc Date: Mon, 2 Sep 2024 13:13:54 +0200 Subject: [PATCH 3/5] a --- HubToLocalMessage.fbs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/HubToLocalMessage.fbs b/HubToLocalMessage.fbs index 9a9f601..7f0f14a 100644 --- a/HubToLocalMessage.fbs +++ b/HubToLocalMessage.fbs @@ -58,11 +58,11 @@ struct SetRfTxPinCommandResult { struct SetEstopEnabledCommandResult { enabled:bool; - result:SetGPIOResultCode; + success:bool; } struct SetEstopPinCommandResult { - pin:uint8; + gpioPin:uint8; result:SetGPIOResultCode; } From c63c2769ecacf5bd7d3f630ded443e5a9090c29e Mon Sep 17 00:00:00 2001 From: hhvrc Date: Mon, 2 Sep 2024 13:14:57 +0200 Subject: [PATCH 4/5] A --- HubToLocalMessage.fbs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HubToLocalMessage.fbs b/HubToLocalMessage.fbs index 7f0f14a..b6977bb 100644 --- a/HubToLocalMessage.fbs +++ b/HubToLocalMessage.fbs @@ -62,7 +62,7 @@ struct SetEstopEnabledCommandResult { } struct SetEstopPinCommandResult { - gpioPin:uint8; + gpio_pin:uint8; result:SetGPIOResultCode; } From d4ee49920a02cf094d1728c510c11c5708a78c4e Mon Sep 17 00:00:00 2001 From: hhvrc Date: Wed, 2 Oct 2024 10:13:22 +0200 Subject: [PATCH 5/5] Make buffer compatible --- .gitignore | 2 +- HubConfig.fbs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 3a55f22..2bdf47d 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,4 @@ obj/ .idea .vs .vscode -*.generated.sln \ No newline at end of file +*.sln \ No newline at end of file diff --git a/HubConfig.fbs b/HubConfig.fbs index 250c12c..856b028 100644 --- a/HubConfig.fbs +++ b/HubConfig.fbs @@ -110,9 +110,6 @@ table OtaUpdateConfig { table HubConfig { /// RF Transmitter configuration rf:RFConfig; - - /// E-Stop configuration - estop:EStopConfig; /// WiFi configuration wifi:WiFiConfig; @@ -128,4 +125,7 @@ table HubConfig { /// OTA update configuration ota_update:OtaUpdateConfig; + + /// E-Stop configuration + estop:EStopConfig; }