From 367f2c675e3f522806cb0016547803c7621b36d9 Mon Sep 17 00:00:00 2001 From: Balazs Racz Date: Wed, 7 Apr 2021 09:12:47 +0200 Subject: [PATCH] Fixup in the ESP32 arduino examples: (#530) - make sure they all have different Node IDs. - make sure they all have different canonical versions. This is useful when the user switches from one example to another to correctly reset the settings. Further fixes: - removes unnecessary "ACDI version number" segment. - ensures that all segments have a name, which is essential in the new JMRI UI. --- .../ESP32CanLoadTest/ESP32CanLoadTest.ino | 2 +- arduino/examples/ESP32CanLoadTest/config.h | 16 +++------------- arduino/examples/ESP32IOBoard/ESP32IOBoard.ino | 2 +- arduino/examples/ESP32IOBoard/config.h | 16 +++------------- .../ESP32SerialBridge/ESP32SerialBridge.ino | 2 +- arduino/examples/ESP32SerialBridge/config.h | 16 +++------------- .../ESP32WifiCanBridge/ESP32WifiCanBridge.ino | 2 +- arduino/examples/ESP32WifiCanBridge/config.h | 16 +++------------- 8 files changed, 16 insertions(+), 56 deletions(-) diff --git a/arduino/examples/ESP32CanLoadTest/ESP32CanLoadTest.ino b/arduino/examples/ESP32CanLoadTest/ESP32CanLoadTest.ino index 62ad5e57b..19b5fd99c 100644 --- a/arduino/examples/ESP32CanLoadTest/ESP32CanLoadTest.ino +++ b/arduino/examples/ESP32CanLoadTest/ESP32CanLoadTest.ino @@ -69,7 +69,7 @@ /// This is the node id to assign to this device, this must be unique /// on the CAN bus. -static constexpr uint64_t NODE_ID = UINT64_C(0x050101011823); +static constexpr uint64_t NODE_ID = UINT64_C(0x05010101182b); #if defined(USE_WIFI) // Configuring WiFi accesspoint name and password diff --git a/arduino/examples/ESP32CanLoadTest/config.h b/arduino/examples/ESP32CanLoadTest/config.h index 6884c7fd4..eeeb2bbc2 100644 --- a/arduino/examples/ESP32CanLoadTest/config.h +++ b/arduino/examples/ESP32CanLoadTest/config.h @@ -56,7 +56,7 @@ using AllProducers = RepeatedGroup; /// Modify this value every time the EEPROM needs to be cleared on the node /// after an update. -static constexpr uint16_t CANONICAL_VERSION = 0x1000; +static constexpr uint16_t CANONICAL_VERSION = 0x100b; /// Defines the main segment in the configuration CDI. This is laid out at /// origin 128 to give space for the ACDI user data at the beginning. @@ -71,14 +71,6 @@ CDI_GROUP_ENTRY(wifi, WiFiConfiguration, Name("WiFi Configuration")); #endif CDI_GROUP_END(); -/// This segment is only needed temporarily until there is program code to set -/// the ACDI user data version byte. -CDI_GROUP(VersionSeg, Segment(MemoryConfigDefs::SPACE_CONFIG), - Name("Version information")); -CDI_GROUP_ENTRY(acdi_user_version, Uint8ConfigEntry, - Name("ACDI User Data version"), Description("Set to 2 and do not change.")); -CDI_GROUP_END(); - /// The main structure of the CDI. ConfigDef is the symbol we use in main.cxx /// to refer to the configuration defined here. CDI_GROUP(ConfigDef, MainCdi()); @@ -88,11 +80,9 @@ CDI_GROUP_ENTRY(ident, Identification); CDI_GROUP_ENTRY(acdi, Acdi); /// Adds a segment for changing the values in the ACDI user-defined /// space. UserInfoSegment is defined in the system header. -CDI_GROUP_ENTRY(userinfo, UserInfoSegment); +CDI_GROUP_ENTRY(userinfo, UserInfoSegment, Name("User Info")); /// Adds the main configuration segment. -CDI_GROUP_ENTRY(seg, IoBoardSegment); -/// Adds the versioning segment. -CDI_GROUP_ENTRY(version, VersionSeg); +CDI_GROUP_ENTRY(seg, IoBoardSegment, Name("Settings")); CDI_GROUP_END(); } // namespace openlcb diff --git a/arduino/examples/ESP32IOBoard/ESP32IOBoard.ino b/arduino/examples/ESP32IOBoard/ESP32IOBoard.ino index de76b7e8b..a9ecfb2ba 100644 --- a/arduino/examples/ESP32IOBoard/ESP32IOBoard.ino +++ b/arduino/examples/ESP32IOBoard/ESP32IOBoard.ino @@ -64,7 +64,7 @@ /// This is the node id to assign to this device, this must be unique /// on the CAN bus. -static constexpr uint64_t NODE_ID = UINT64_C(0x050101011823); +static constexpr uint64_t NODE_ID = UINT64_C(0x05010101182a); #if defined(USE_WIFI) // Configuring WiFi accesspoint name and password diff --git a/arduino/examples/ESP32IOBoard/config.h b/arduino/examples/ESP32IOBoard/config.h index a9ac639d9..78bad363d 100644 --- a/arduino/examples/ESP32IOBoard/config.h +++ b/arduino/examples/ESP32IOBoard/config.h @@ -56,7 +56,7 @@ using AllProducers = RepeatedGroup; /// Modify this value every time the EEPROM needs to be cleared on the node /// after an update. -static constexpr uint16_t CANONICAL_VERSION = 0x1002; +static constexpr uint16_t CANONICAL_VERSION = 0x100a; /// Defines the main segment in the configuration CDI. This is laid out at /// origin 128 to give space for the ACDI user data at the beginning. @@ -71,14 +71,6 @@ CDI_GROUP_ENTRY(wifi, WiFiConfiguration, Name("WiFi Configuration")); #endif CDI_GROUP_END(); -/// This segment is only needed temporarily until there is program code to set -/// the ACDI user data version byte. -CDI_GROUP(VersionSeg, Segment(MemoryConfigDefs::SPACE_CONFIG), - Name("Version information")); -CDI_GROUP_ENTRY(acdi_user_version, Uint8ConfigEntry, - Name("ACDI User Data version"), Description("Set to 2 and do not change.")); -CDI_GROUP_END(); - /// The main structure of the CDI. ConfigDef is the symbol we use in main.cxx /// to refer to the configuration defined here. CDI_GROUP(ConfigDef, MainCdi()); @@ -88,11 +80,9 @@ CDI_GROUP_ENTRY(ident, Identification); CDI_GROUP_ENTRY(acdi, Acdi); /// Adds a segment for changing the values in the ACDI user-defined /// space. UserInfoSegment is defined in the system header. -CDI_GROUP_ENTRY(userinfo, UserInfoSegment); +CDI_GROUP_ENTRY(userinfo, UserInfoSegment, Name("User Info")); /// Adds the main configuration segment. -CDI_GROUP_ENTRY(seg, IoBoardSegment); -/// Adds the versioning segment. -CDI_GROUP_ENTRY(version, VersionSeg); +CDI_GROUP_ENTRY(seg, IoBoardSegment, Name("Settings")); CDI_GROUP_END(); } // namespace openlcb diff --git a/arduino/examples/ESP32SerialBridge/ESP32SerialBridge.ino b/arduino/examples/ESP32SerialBridge/ESP32SerialBridge.ino index 4d9a9aba9..870457596 100644 --- a/arduino/examples/ESP32SerialBridge/ESP32SerialBridge.ino +++ b/arduino/examples/ESP32SerialBridge/ESP32SerialBridge.ino @@ -72,7 +72,7 @@ constexpr gpio_num_t CAN_TX_PIN = GPIO_NUM_5; /// This is the node id to assign to this device, this must be unique /// on the CAN bus. -static constexpr uint64_t NODE_ID = UINT64_C(0x050101011822); +static constexpr uint64_t NODE_ID = UINT64_C(0x050101011829); /// This is the primary entrypoint for the OpenMRN/LCC stack. OpenMRN openmrn(NODE_ID); diff --git a/arduino/examples/ESP32SerialBridge/config.h b/arduino/examples/ESP32SerialBridge/config.h index 38ed3dd1a..6df063fa3 100644 --- a/arduino/examples/ESP32SerialBridge/config.h +++ b/arduino/examples/ESP32SerialBridge/config.h @@ -31,7 +31,7 @@ extern const SimpleNodeStaticValues SNIP_STATIC_DATA = { /// Modify this value every time the EEPROM needs to be cleared on the node /// after an update. -static constexpr uint16_t CANONICAL_VERSION = 0x1000; +static constexpr uint16_t CANONICAL_VERSION = 0x1009; /// Defines the main segment in the configuration CDI. This is laid out at /// origin 128 to give space for the ACDI user data at the beginning. @@ -41,14 +41,6 @@ CDI_GROUP(IoBoardSegment, Segment(MemoryConfigDefs::SPACE_CONFIG), Offset(128)); CDI_GROUP_ENTRY(internal_config, InternalConfigData); CDI_GROUP_END(); -/// This segment is only needed temporarily until there is program code to set -/// the ACDI user data version byte. -CDI_GROUP(VersionSeg, Segment(MemoryConfigDefs::SPACE_CONFIG), - Name("Version information")); -CDI_GROUP_ENTRY(acdi_user_version, Uint8ConfigEntry, - Name("ACDI User Data version"), Description("Set to 2 and do not change.")); -CDI_GROUP_END(); - /// The main structure of the CDI. ConfigDef is the symbol we use in main.cxx /// to refer to the configuration defined here. CDI_GROUP(ConfigDef, MainCdi()); @@ -58,11 +50,9 @@ CDI_GROUP_ENTRY(ident, Identification); CDI_GROUP_ENTRY(acdi, Acdi); /// Adds a segment for changing the values in the ACDI user-defined /// space. UserInfoSegment is defined in the system header. -CDI_GROUP_ENTRY(userinfo, UserInfoSegment); +CDI_GROUP_ENTRY(userinfo, UserInfoSegment, Name("User Info")); /// Adds the main configuration segment. -CDI_GROUP_ENTRY(seg, IoBoardSegment); -/// Adds the versioning segment. -CDI_GROUP_ENTRY(version, VersionSeg); +CDI_GROUP_ENTRY(seg, IoBoardSegment, Name("Settings")); CDI_GROUP_END(); } // namespace openlcb diff --git a/arduino/examples/ESP32WifiCanBridge/ESP32WifiCanBridge.ino b/arduino/examples/ESP32WifiCanBridge/ESP32WifiCanBridge.ino index 0712c9859..b09e94bbc 100644 --- a/arduino/examples/ESP32WifiCanBridge/ESP32WifiCanBridge.ino +++ b/arduino/examples/ESP32WifiCanBridge/ESP32WifiCanBridge.ino @@ -62,7 +62,7 @@ constexpr gpio_num_t CAN_TX_PIN = GPIO_NUM_5; /// This is the node id to assign to this device, this must be unique /// on the CAN bus. -static constexpr uint64_t NODE_ID = UINT64_C(0x050101011821); +static constexpr uint64_t NODE_ID = UINT64_C(0x050101011828); // Configuring WiFi accesspoint name and password // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/arduino/examples/ESP32WifiCanBridge/config.h b/arduino/examples/ESP32WifiCanBridge/config.h index ea3e127a4..15a1c91a3 100644 --- a/arduino/examples/ESP32WifiCanBridge/config.h +++ b/arduino/examples/ESP32WifiCanBridge/config.h @@ -33,7 +33,7 @@ extern const SimpleNodeStaticValues SNIP_STATIC_DATA = { /// Modify this value every time the EEPROM needs to be cleared on the node /// after an update. -static constexpr uint16_t CANONICAL_VERSION = 0x1002; +static constexpr uint16_t CANONICAL_VERSION = 0x1008; /// Defines the main segment in the configuration CDI. This is laid out at /// origin 128 to give space for the ACDI user data at the beginning. @@ -44,14 +44,6 @@ CDI_GROUP_ENTRY(internal_config, InternalConfigData); CDI_GROUP_ENTRY(wifi, WiFiConfiguration, Name("WiFi Configuration")); CDI_GROUP_END(); -/// This segment is only needed temporarily until there is program code to set -/// the ACDI user data version byte. -CDI_GROUP(VersionSeg, Segment(MemoryConfigDefs::SPACE_CONFIG), - Name("Version information")); -CDI_GROUP_ENTRY(acdi_user_version, Uint8ConfigEntry, - Name("ACDI User Data version"), Description("Set to 2 and do not change.")); -CDI_GROUP_END(); - /// The main structure of the CDI. ConfigDef is the symbol we use in main.cxx /// to refer to the configuration defined here. CDI_GROUP(ConfigDef, MainCdi()); @@ -61,11 +53,9 @@ CDI_GROUP_ENTRY(ident, Identification); CDI_GROUP_ENTRY(acdi, Acdi); /// Adds a segment for changing the values in the ACDI user-defined /// space. UserInfoSegment is defined in the system header. -CDI_GROUP_ENTRY(userinfo, UserInfoSegment); +CDI_GROUP_ENTRY(userinfo, UserInfoSegment, Name("User Info")); /// Adds the main configuration segment. -CDI_GROUP_ENTRY(seg, IoBoardSegment); -/// Adds the versioning segment. -CDI_GROUP_ENTRY(version, VersionSeg); +CDI_GROUP_ENTRY(seg, IoBoardSegment, Name("Settings")); CDI_GROUP_END(); } // namespace openlcb