From 92176b0118b0be4fdcc36489d89d3c10048204e3 Mon Sep 17 00:00:00 2001 From: Fabio C Date: Tue, 27 May 2025 11:17:00 +0200 Subject: [PATCH 1/9] Rename variable matrix to ledMatrixAnimationHandler (#12) --- src/utility/LEDFeedback.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/utility/LEDFeedback.cpp b/src/utility/LEDFeedback.cpp index bcbf864..10abfe7 100644 --- a/src/utility/LEDFeedback.cpp +++ b/src/utility/LEDFeedback.cpp @@ -18,7 +18,7 @@ #ifdef BOARD_HAS_LED_MATRIX #include "Arduino_LED_Matrix.h" -ArduinoLEDMatrix matrix; +ArduinoLEDMatrix ledMatrixAnimationHandler; const uint32_t bluetooth[3] = { 0x401600d, @@ -158,7 +158,7 @@ void LEDFeedbackClass::begin() { #endif #ifdef BOARD_HAS_LED_MATRIX - matrix.begin(); + ledMatrixAnimationHandler.begin(); #endif } @@ -179,7 +179,7 @@ void LEDFeedbackClass::setMode(LEDFeedbackMode mode) { { _ledChangeInterval = 0; #ifdef BOARD_HAS_LED_MATRIX - matrix.clear(); + ledMatrixAnimationHandler.clear(); #endif } break; @@ -192,11 +192,11 @@ void LEDFeedbackClass::setMode(LEDFeedbackMode mode) { #endif #ifdef BOARD_HAS_LED_MATRIX _framePtr = nullptr; - matrix.loadSequence(snake); - matrix.play(true); + ledMatrixAnimationHandler.loadSequence(snake); + ledMatrixAnimationHandler.play(true); /* For fixing the issue that the first * frame of the first run is not shown */ - matrix.loadSequence(snake); + ledMatrixAnimationHandler.loadSequence(snake); #endif _ledChangeInterval = HEARTBEAT_INTERVAL; _count = 0; @@ -211,7 +211,7 @@ void LEDFeedbackClass::setMode(LEDFeedbackMode mode) { _ledPin = GREEN_LED; #endif #ifdef BOARD_HAS_LED_MATRIX - matrix.loadFrame(bluetooth); + ledMatrixAnimationHandler.loadFrame(bluetooth); _framePtr = (uint32_t*)bluetooth; #endif _ledChangeInterval = ALWAYS_ON_INTERVAL; @@ -225,8 +225,8 @@ void LEDFeedbackClass::setMode(LEDFeedbackMode mode) { _ledPin = GREEN_LED; #ifdef BOARD_HAS_LED_MATRIX _framePtr = nullptr; - matrix.loadSequence(LEDMATRIX_ANIMATION_WIFI_SEARCH); - matrix.play(true); + ledMatrixAnimationHandler.loadSequence(LEDMATRIX_ANIMATION_WIFI_SEARCH); + ledMatrixAnimationHandler.play(true); #endif _ledChangeInterval = ALWAYS_ON_INTERVAL; @@ -239,8 +239,8 @@ void LEDFeedbackClass::setMode(LEDFeedbackMode mode) { #endif #ifdef BOARD_HAS_LED_MATRIX _framePtr = nullptr; - matrix.loadSequence(cloud); - matrix.play(true); + ledMatrixAnimationHandler.loadSequence(cloud); + ledMatrixAnimationHandler.play(true); #endif _ledPin = GREEN_LED; _ledChangeInterval = SLOWBLINK_INTERVAL; @@ -258,7 +258,7 @@ void LEDFeedbackClass::setMode(LEDFeedbackMode mode) { #endif #ifdef BOARD_HAS_LED_MATRIX _framePtr = (uint32_t*)LEDMATRIX_EMOJI_SAD; - matrix.loadFrame(LEDMATRIX_EMOJI_SAD); + ledMatrixAnimationHandler.loadFrame(LEDMATRIX_EMOJI_SAD); #endif } break; @@ -327,7 +327,7 @@ void LEDFeedbackClass::turnOFF() { #endif #ifdef BOARD_HAS_LED_MATRIX if(_framePtr != nullptr){ - matrix.clear(); + ledMatrixAnimationHandler.clear(); } #endif @@ -342,7 +342,7 @@ void LEDFeedbackClass::turnON() { #endif #ifdef BOARD_HAS_LED_MATRIX if(_framePtr != nullptr){ - matrix.loadFrame(_framePtr); + ledMatrixAnimationHandler.loadFrame(_framePtr); } #endif _ledState = true; From 30febb26388a751e66d41d1e3adf3a4756b34c6a Mon Sep 17 00:00:00 2001 From: fabik111 Date: Tue, 27 May 2025 13:32:40 +0200 Subject: [PATCH 2/9] Release version 0.1.4 --- library.properties | 2 +- src/ANetworkConfigurator_Config.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/library.properties b/library.properties index 7792473..d960065 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=Arduino_NetworkConfigurator -version=0.1.3 +version=0.1.4 author=Arduino maintainer=Arduino sentence=This library allows to configure and update the network settings of a ConnectionHandler instance. diff --git a/src/ANetworkConfigurator_Config.h b/src/ANetworkConfigurator_Config.h index 315ce41..e1ca4cd 100644 --- a/src/ANetworkConfigurator_Config.h +++ b/src/ANetworkConfigurator_Config.h @@ -7,7 +7,7 @@ */ #pragma once -#define ANetworkConfigurator_LIB_VERSION "0.1.3" +#define ANetworkConfigurator_LIB_VERSION "0.1.4" #if defined(ARDUINO_SAMD_MKRWIFI1010) #define NETWORK_CONFIGURATOR_COMPATIBLE 1 From 2352608d87e03a44c5603e571804b0beb9d37fe5 Mon Sep 17 00:00:00 2001 From: Fabio C Date: Wed, 25 Jun 2025 11:50:05 +0200 Subject: [PATCH 3/9] update unit test ci dep of Arduino_ConnectionHandler (#13) --- extras/test/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extras/test/CMakeLists.txt b/extras/test/CMakeLists.txt index b4c0898..b3736e9 100644 --- a/extras/test/CMakeLists.txt +++ b/extras/test/CMakeLists.txt @@ -24,8 +24,8 @@ FetchContent_Declare( FetchContent_Declare( connectionhandler - GIT_REPOSITORY https://github.com/andreagilardoni/Arduino_ConnectionHandler.git - GIT_TAG connectionhandler-settings + GIT_REPOSITORY https://github.com/arduino-libraries/Arduino_ConnectionHandler.git + GIT_TAG master CONFIGURE_COMMAND "" BUILD_COMMAND "" ) From c00467a0f9e4ab42c6aa1e47f3db83b218f3d864 Mon Sep 17 00:00:00 2001 From: Fabio C Date: Wed, 25 Jun 2025 11:51:36 +0200 Subject: [PATCH 4/9] Change reset pin of Portenta boards for clashing with Portenta Carriers and Shields (#15) * change reset pin for portenta h7 and disable the reset procedure for machine control * change reset pin for portenta c33 to 0 --- README.md | 16 ++++++++++ .../NetworkConfiguratorDemo.ino | 3 ++ src/ANetworkConfigurator_Config.h | 6 ++-- src/Arduino_NetworkConfigurator.cpp | 3 ++ src/Arduino_NetworkConfigurator.h | 3 ++ src/utility/ResetInput.cpp | 29 ++++++++++++++++++- 6 files changed, 57 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 0546307..48b1085 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,23 @@ The procedure: * `Arduino MKR WiFi 1010`: short the pin 7 to GND until the led turns off * `Arduino GIGA R1 WiFi`: short the pin 7 to GND until the led turns off * `Arduino Nano RP2040 Connect`: short the pin 2 to 3.3V until the led turns off +* `Arduino Portenta H7`: short the pin 0 to GND until the led turns off +* `Arduino Portenta C33`: short the pin 0 to GND until the led turns off * Other boards: short the pin 2 to GND until the led turns off +* `Portenta Machine Control`: currently the reset procedure is not available + +### More on the reconfiguration pin +Internally, the pin indicated in the procedure is set as `INPUT_PULLUP` (except for `Arduino Opta` ) and it's attached to an ISR fired on every change of the pin's status. + +In order to be notified when the ISR is fired, it's possible to register a callback function using the function `NetworkConfigurator.addReconfigurePinCallback(callback)`. Please take the example as reference. + +### Change the reconfiguration pin +In order to change the default pin for resetting the board, it's possible to use the function `NetworkConfigurator.setReconfigurePin(your_pin)` specifying the new pin. +The pin must be in the list of digital pins usable for interrupts. Please refer to the Arduino documentation for more details: https://docs.arduino.cc/language-reference/en/functions/external-interrupts/attachInterrupt/ + +### Disable the reconfiguration feature +In order to disable the reconfiguration procedure, use this function in the sketch `NetworkConfigurator.setReconfigurePin(DISABLE_PIN)` + ## Configurator Agents The library provides a set of *Configurator Agents* that added as plug-in to the sketch handle the communication between the Arduino Network Configurator and an external client ([*Arduino IoT App*](https://cloud.arduino.cc/iot-remote-app/) and Arduino IoT Cloud) for configuring the board. diff --git a/examples/NetworkConfiguratorDemo/NetworkConfiguratorDemo.ino b/examples/NetworkConfiguratorDemo/NetworkConfiguratorDemo.ino index 1bb8e6c..bc03b42 100644 --- a/examples/NetworkConfiguratorDemo/NetworkConfiguratorDemo.ino +++ b/examples/NetworkConfiguratorDemo/NetworkConfiguratorDemo.ino @@ -21,6 +21,9 @@ * - Arduino MKR WiFi 1010: short the pin 7 to GND until the led turns off * - Arduino GIGA R1 WiFi: short the pin 7 to GND until the led turns off * - Arduino Nano RP2040 Connect: short the pin 2 to 3.3V until the led turns off + * - Portenta H7: short the pin 0 to GND until the led turns off + * - Portenta C33: short the pin 0 to GND until the led turns off + * - Portenta Machine Control: the reset is not available * - Other boards: short the pin 2 to GND until the led turns off * * In this sketch the BLE and Serial interfaces are always enabled and ready for accepting diff --git a/src/ANetworkConfigurator_Config.h b/src/ANetworkConfigurator_Config.h index e1ca4cd..b6e3593 100644 --- a/src/ANetworkConfigurator_Config.h +++ b/src/ANetworkConfigurator_Config.h @@ -57,7 +57,9 @@ #if defined(ARDUINO_PORTENTA_H7_M7) #define NETWORK_CONFIGURATOR_COMPATIBLE 1 #define ZERO_TOUCH_ENABLED 1 - #define PIN_RECONFIGURE 2 + #define I2C_ADD_DETECT_MACHINE_CONTROL_1 0x23 + #define I2C_ADD_DETECT_MACHINE_CONTROL_2 0x22 + #define PIN_RECONFIGURE 0 #define LED_RECONFIGURE LED_BUILTIN #define BOARD_HAS_RGB #define GREEN_LED LEDG @@ -108,7 +110,7 @@ #if defined(ARDUINO_PORTENTA_C33) #define NETWORK_CONFIGURATOR_COMPATIBLE 1 #define ZERO_TOUCH_ENABLED 1 - #define PIN_RECONFIGURE 2 + #define PIN_RECONFIGURE 0 #define LED_RECONFIGURE LEDG #define BOARD_HAS_RGB #define GREEN_LED LEDG diff --git a/src/Arduino_NetworkConfigurator.cpp b/src/Arduino_NetworkConfigurator.cpp index f448b1f..40c33c4 100644 --- a/src/Arduino_NetworkConfigurator.cpp +++ b/src/Arduino_NetworkConfigurator.cpp @@ -122,6 +122,9 @@ NetworkConfiguratorStates NetworkConfiguratorClass::update() { * - Arduino MKR WiFi 1010: short the pin 7 to GND until the led turns off * - Arduino GIGA R1 WiFi: short the pin 7 to GND until the led turns off * - Arduino Nano RP2040 Connect: short the pin 2 to 3.3V until the led turns off + * - Portenta H7: short the pin 0 to GND until the led turns off + * - Portenta C33: short the pin 0 to GND until the led turns off + * - Portenta Machine Control: the reset is not available * - Other boards: short the pin 2 to GND until the led turns off */ diff --git a/src/Arduino_NetworkConfigurator.h b/src/Arduino_NetworkConfigurator.h index d68bbdb..fafe125 100644 --- a/src/Arduino_NetworkConfigurator.h +++ b/src/Arduino_NetworkConfigurator.h @@ -58,6 +58,9 @@ enum class NetworkConfiguratorStates { ZERO_TOUCH_CONFIG, * - Arduino MKR WiFi 1010: short the pin 7 to GND until the led turns off * - Arduino GIGA R1 WiFi: short the pin 7 to GND until the led turns off * - Arduino Nano RP2040 Connect: short the pin 2 to 3.3V until the led turns off + * - Portenta H7: short the pin 0 to GND until the led turns off + * - Portenta C33: short the pin 0 to GND until the led turns off + * - Portenta Machine Control: the reset is not available * - Other boards: short the pin 2 to GND until the led turns off * */ diff --git a/src/utility/ResetInput.cpp b/src/utility/ResetInput.cpp index 0df5fc0..70d322e 100644 --- a/src/utility/ResetInput.cpp +++ b/src/utility/ResetInput.cpp @@ -11,6 +11,28 @@ #include "ResetInput.h" #include "utility/LEDFeedback.h" +#if defined(ARDUINO_PORTENTA_H7_M7) +#include + + +bool isPortentaMachineControlAttached() { + Wire.begin(); + Wire.beginTransmission(I2C_ADD_DETECT_MACHINE_CONTROL_1); + if (Wire.endTransmission() != 0) { + return false; + } + + Wire.beginTransmission(I2C_ADD_DETECT_MACHINE_CONTROL_2); + if (Wire.endTransmission() != 0) { + return false; + } + + Wire.end(); + return true; +} + +#endif + ResetInput &ResetInput::getInstance() { static ResetInput instance; return instance; @@ -25,6 +47,12 @@ ResetInput::ResetInput() { } void ResetInput::begin() { +#if defined(ARDUINO_PORTENTA_H7_M7) + if(isPortentaMachineControlAttached()) { + return; // Portenta Machine Control is not supported + } +#endif + if(_pin == DISABLE_PIN){ return; } @@ -35,7 +63,6 @@ void ResetInput::begin() { #endif pinMode(LED_RECONFIGURE, OUTPUT); digitalWrite(LED_RECONFIGURE, LED_OFF); - attachInterrupt(digitalPinToInterrupt(_pin),_pressedCallback, CHANGE); } From 7bf56c8c07c3c4c4ffcd95bd2583d9123f6b46e7 Mon Sep 17 00:00:00 2001 From: fabik111 Date: Thu, 26 Jun 2025 11:03:28 +0200 Subject: [PATCH 5/9] Release version 0.2.0 --- library.properties | 2 +- src/ANetworkConfigurator_Config.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/library.properties b/library.properties index d960065..14cbfa0 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=Arduino_NetworkConfigurator -version=0.1.4 +version=0.2.0 author=Arduino maintainer=Arduino sentence=This library allows to configure and update the network settings of a ConnectionHandler instance. diff --git a/src/ANetworkConfigurator_Config.h b/src/ANetworkConfigurator_Config.h index b6e3593..465659f 100644 --- a/src/ANetworkConfigurator_Config.h +++ b/src/ANetworkConfigurator_Config.h @@ -7,7 +7,7 @@ */ #pragma once -#define ANetworkConfigurator_LIB_VERSION "0.1.4" +#define ANetworkConfigurator_LIB_VERSION "0.2.0" #if defined(ARDUINO_SAMD_MKRWIFI1010) #define NETWORK_CONFIGURATOR_COMPATIBLE 1 From 4bcfe6a6f09a942b7f68015ad526119dcbc3ca11 Mon Sep 17 00:00:00 2001 From: Fabio C Date: Thu, 3 Jul 2025 11:13:06 +0200 Subject: [PATCH 6/9] use wifi cbor encoder of cloud utils (#14) --- .../src/test_provisioning_command_encode.cpp | 27 ------------------- .../CBORAdapter.cpp | 6 ++--- .../cbor/CBORInstances.h | 1 - .../cbor/Encoder.cpp | 19 ------------- .../boardConfigurationProtocol/cbor/Encoder.h | 8 ------ .../cbor/ProvisioningMessage.h | 10 +------ 6 files changed, 4 insertions(+), 67 deletions(-) diff --git a/extras/test/src/test_provisioning_command_encode.cpp b/extras/test/src/test_provisioning_command_encode.cpp index 64872fc..529df0c 100644 --- a/extras/test/src/test_provisioning_command_encode.cpp +++ b/extras/test/src/test_provisioning_command_encode.cpp @@ -209,33 +209,6 @@ } } - WHEN("Encode a message with provisioning wifi fw version ") - { - WiFiFWVersionProvisioningMessage command; - command.c.id = ProvisioningMessageId::WiFiFWVersionProvisioningMessageId; - command.wifiFwVersion = "1.6.0"; - uint8_t buffer[512]; - size_t bytes_encoded = sizeof(buffer); - - CBORMessageEncoder encoder; - MessageEncoder::Status err = encoder.encode((Message*)&command, buffer, bytes_encoded); - - uint8_t expected_result[] = { - 0xda, 0x00, 0x01, 0x20, 0x14, 0x81, 0x65, 0x31, 0x2E, 0x36, 0x2E, 0x30 - }; - - // Test the encoding is - //DA 00012014 # tag(73748) - // 81 # array(1) - // 65 # text(5) - // 312E362E30 # "1.6.0" - THEN("The encoding is successful") { - REQUIRE(err == MessageEncoder::Status::Complete); - REQUIRE(bytes_encoded == sizeof(expected_result)); - REQUIRE(memcmp(buffer, expected_result, sizeof(expected_result)) == 0); - } - } - WHEN("Encode a message with provisioning sketch version ") { ProvSketchVersionProvisioningMessage command; diff --git a/src/configuratorAgents/agents/boardConfigurationProtocol/CBORAdapter.cpp b/src/configuratorAgents/agents/boardConfigurationProtocol/CBORAdapter.cpp index 96fcbf5..5442932 100644 --- a/src/configuratorAgents/agents/boardConfigurationProtocol/CBORAdapter.cpp +++ b/src/configuratorAgents/agents/boardConfigurationProtocol/CBORAdapter.cpp @@ -87,9 +87,9 @@ bool CBORAdapter::wifiFWVersionToCBOR(const char *wifiFWVersion, uint8_t *data, if(*len < CBOR_MIN_WIFI_FW_VERSION_LEN + strlen(wifiFWVersion)) { return false; } - WiFiFWVersionProvisioningMessage wifiFWVersionMsg; - wifiFWVersionMsg.c.id = ProvisioningMessageId::WiFiFWVersionProvisioningMessageId; - wifiFWVersionMsg.wifiFwVersion = wifiFWVersion; + VersionMessage wifiFWVersionMsg; + wifiFWVersionMsg.c.id = StandardMessageId::WiFiFWVersionMessageId; + wifiFWVersionMsg.params.version = wifiFWVersion; MessageEncoder::Status status = encoder.encode((Message *)&wifiFWVersionMsg, data, *len); diff --git a/src/configuratorAgents/agents/boardConfigurationProtocol/cbor/CBORInstances.h b/src/configuratorAgents/agents/boardConfigurationProtocol/cbor/CBORInstances.h index b726e0f..dbca315 100644 --- a/src/configuratorAgents/agents/boardConfigurationProtocol/cbor/CBORInstances.h +++ b/src/configuratorAgents/agents/boardConfigurationProtocol/cbor/CBORInstances.h @@ -8,7 +8,6 @@ static ListWifiNetworksProvisioningMessageEncoder listWifiNetworksProvisioning static UniqueHardwareIdProvisioningMessageEncoder uniqueHardwareIdProvisioningMessageEncoder; static JWTProvisioningMessageEncoder jWTProvisioningMessageEncoder; static BLEMacAddressProvisioningMessageEncoder bLEMacAddressProvisioningMessageEncoder; -static WiFiFWVersionProvisioningMessageEncoder wiFiFWVersionProvisioningMessageEncoder; static ProvSketchVersionProvisioningMessageEncoder provSketchVersionProvisioningMessageEncoder; static NetConfigLibVersProvisioningMessageEncoder netConfigLibVersProvisioningMessageEncoder; diff --git a/src/configuratorAgents/agents/boardConfigurationProtocol/cbor/Encoder.cpp b/src/configuratorAgents/agents/boardConfigurationProtocol/cbor/Encoder.cpp index fd0bb07..6c501f9 100644 --- a/src/configuratorAgents/agents/boardConfigurationProtocol/cbor/Encoder.cpp +++ b/src/configuratorAgents/agents/boardConfigurationProtocol/cbor/Encoder.cpp @@ -116,25 +116,6 @@ MessageEncoder::Status BLEMacAddressProvisioningMessageEncoder::encode(CborEncod return MessageEncoder::Status::Complete; } -MessageEncoder::Status WiFiFWVersionProvisioningMessageEncoder::encode(CborEncoder* encoder, Message *msg) { - WiFiFWVersionProvisioningMessage * provisioningWiFiFWVersion = (WiFiFWVersionProvisioningMessage*) msg; - CborEncoder array_encoder; - - if(cbor_encoder_create_array(encoder, &array_encoder, 1) != CborNoError) { - return MessageEncoder::Status::Error; - } - - if(cbor_encode_text_stringz(&array_encoder, provisioningWiFiFWVersion->wifiFwVersion) != CborNoError) { - return MessageEncoder::Status::Error; - } - - if(cbor_encoder_close_container(encoder, &array_encoder) != CborNoError) { - return MessageEncoder::Status::Error; - } - - return MessageEncoder::Status::Complete; -} - MessageEncoder::Status ProvSketchVersionProvisioningMessageEncoder::encode(CborEncoder* encoder, Message *msg) { ProvSketchVersionProvisioningMessage * provisioningSketchVersion = (ProvSketchVersionProvisioningMessage*) msg; CborEncoder array_encoder; diff --git a/src/configuratorAgents/agents/boardConfigurationProtocol/cbor/Encoder.h b/src/configuratorAgents/agents/boardConfigurationProtocol/cbor/Encoder.h index fd02dfa..25934f4 100644 --- a/src/configuratorAgents/agents/boardConfigurationProtocol/cbor/Encoder.h +++ b/src/configuratorAgents/agents/boardConfigurationProtocol/cbor/Encoder.h @@ -52,14 +52,6 @@ class BLEMacAddressProvisioningMessageEncoder: public CBORMessageEncoderInterfac MessageEncoder::Status encode(CborEncoder* encoder, Message *msg) override; }; -class WiFiFWVersionProvisioningMessageEncoder: public CBORMessageEncoderInterface { -public: - WiFiFWVersionProvisioningMessageEncoder() - : CBORMessageEncoderInterface(CBORWiFiFWVersionProvisioningMessage, WiFiFWVersionProvisioningMessageId) {} -protected: - MessageEncoder::Status encode(CborEncoder* encoder, Message *msg) override; -}; - class ProvSketchVersionProvisioningMessageEncoder: public CBORMessageEncoderInterface { public: ProvSketchVersionProvisioningMessageEncoder() diff --git a/src/configuratorAgents/agents/boardConfigurationProtocol/cbor/ProvisioningMessage.h b/src/configuratorAgents/agents/boardConfigurationProtocol/cbor/ProvisioningMessage.h index 240a7b5..d48800d 100644 --- a/src/configuratorAgents/agents/boardConfigurationProtocol/cbor/ProvisioningMessage.h +++ b/src/configuratorAgents/agents/boardConfigurationProtocol/cbor/ProvisioningMessage.h @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -47,7 +48,6 @@ enum CBORProvisioningMessageTag: CBORTag { CBORUniqueHardwareIdProvisioningMessage = 0x012010, CBORJWTProvisioningMessage = 0x012011, CBORBLEMacAddressProvisioningMessage = 0x012013, - CBORWiFiFWVersionProvisioningMessage = 0x012014, CBORProvSketchVersionProvisioningMessage = 0x012015, CBORNetConfigLibVersProvisioningMessage = 0x012016, }; @@ -58,7 +58,6 @@ enum ProvisioningMessageId: MessageId { ListWifiNetworksProvisioningMessageId, UniqueHardwareIdProvisioningMessageId, BLEMacAddressProvisioningMessageId, - WiFiFWVersionProvisioningMessageId, ProvSketchVersionProvisioningMessageId, NetConfigLibVersProvisioningMessageId, JWTProvisioningMessageId, @@ -116,13 +115,6 @@ struct BLEMacAddressProvisioningMessage { }; }; -struct WiFiFWVersionProvisioningMessage { - ProvisioningMessage c; - struct { - const char *wifiFwVersion; //The payload is a string. - }; -}; - struct ProvSketchVersionProvisioningMessage { ProvisioningMessage c; struct { From bede629b56b108116daca7d084d975cfdde87457 Mon Sep 17 00:00:00 2001 From: Fabio C Date: Thu, 3 Jul 2025 16:26:22 +0200 Subject: [PATCH 7/9] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 48b1085..57199a7 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ In order to disable the reconfiguration procedure, use this function in the sket ## Configurator Agents -The library provides a set of *Configurator Agents* that added as plug-in to the sketch handle the communication between the Arduino Network Configurator and an external client ([*Arduino IoT App*](https://cloud.arduino.cc/iot-remote-app/) and Arduino IoT Cloud) for configuring the board. +The library provides a set of *Configurator Agents* that added as plug-in to the sketch handle the communication between the Arduino Network Configurator and an external client ([*Arduino IoT App*](https://cloud.arduino.cc/iot-remote-app/), Arduino IoT Cloud, [*Arduino Cloud CLI from v0.3.4*](https://github.com/arduino/arduino-cloud-cli)) for configuring the board. Out-of-the box there are 2 Configurator Agents * `BLEAgent`: manage the BLE interface From 899af0a38ea7bab2dddaa5018e3ff8706b06d136 Mon Sep 17 00:00:00 2001 From: Fabio C Date: Fri, 4 Jul 2025 09:18:17 +0200 Subject: [PATCH 8/9] Add new animation for board connected with Serial or BLE Agent(#16) --- src/configuratorAgents/AgentsManager.cpp | 10 +++- src/utility/LEDFeedback.cpp | 62 ++++++++++++++++-------- src/utility/LEDFeedback.h | 3 ++ 3 files changed, 53 insertions(+), 22 deletions(-) diff --git a/src/configuratorAgents/AgentsManager.cpp b/src/configuratorAgents/AgentsManager.cpp index 71f8f34..bff98ee 100644 --- a/src/configuratorAgents/AgentsManager.cpp +++ b/src/configuratorAgents/AgentsManager.cpp @@ -239,7 +239,15 @@ AgentsManagerStates AgentsManagerClass::handleInit() { (*agent)->end(); } } - LEDFeedbackClass::getInstance().setMode(LEDFeedbackClass::LEDFeedbackMode::PEER_CONNECTED); + + if(_selectedAgent->getAgentType() == ConfiguratorAgent::AgentTypes::BLE) { + LEDFeedbackClass::getInstance().setMode(LEDFeedbackClass::LEDFeedbackMode::PEER_CONNECTED_BLE); + } else if(_selectedAgent->getAgentType() == ConfiguratorAgent::AgentTypes::USB_SERIAL) { + LEDFeedbackClass::getInstance().setMode(LEDFeedbackClass::LEDFeedbackMode::PEER_CONNECTED_SERIAL); + } else { + LEDFeedbackClass::getInstance().setMode(LEDFeedbackClass::LEDFeedbackMode::PEER_CONNECTED); + } + } return nextState; } diff --git a/src/utility/LEDFeedback.cpp b/src/utility/LEDFeedback.cpp index 10abfe7..2ae9dc7 100644 --- a/src/utility/LEDFeedback.cpp +++ b/src/utility/LEDFeedback.cpp @@ -19,6 +19,14 @@ #include "Arduino_LED_Matrix.h" ArduinoLEDMatrix ledMatrixAnimationHandler; + +const uint32_t usb_image[3] = { + 0x3c, + 0x267fe0, + 0x160e0000, + +}; + const uint32_t bluetooth[3] = { 0x401600d, @@ -28,22 +36,16 @@ const uint32_t bluetooth[3] = { const uint32_t cloud[][4] = { { - 0xc013, - 0x82644424, - 0x24023fc, - 66 - }, - { - 0xc013, - 0x82644424, - 0x24023fc, - 66 + 0x1c023, + 0x4484044, + 0x43f8000, + 500 }, { - 0xc013, - 0x82644824, - 0x24023fc, - 66 + 0xe011, + 0x82242022, + 0x21fc000, + 500 } }; @@ -204,17 +206,25 @@ void LEDFeedbackClass::setMode(LEDFeedbackMode mode) { break; case LEDFeedbackMode::PEER_CONNECTED: { - #ifdef BOARD_HAS_RGB - turnOFF(); - _ledPin = BLUE_LED; - #else - _ledPin = GREEN_LED; - #endif + configurePeerConnectedMode(); + } + break; + case LEDFeedbackMode::PEER_CONNECTED_BLE: + { + configurePeerConnectedMode(); #ifdef BOARD_HAS_LED_MATRIX ledMatrixAnimationHandler.loadFrame(bluetooth); _framePtr = (uint32_t*)bluetooth; #endif - _ledChangeInterval = ALWAYS_ON_INTERVAL; + } + break; + case LEDFeedbackMode::PEER_CONNECTED_SERIAL: + { + configurePeerConnectedMode(); + #ifdef BOARD_HAS_LED_MATRIX + ledMatrixAnimationHandler.loadFrame(usb_image); + _framePtr = (uint32_t*)usb_image; + #endif } break; case LEDFeedbackMode::CONNECTING_TO_NETWORK: @@ -348,4 +358,14 @@ void LEDFeedbackClass::turnON() { _ledState = true; } +void LEDFeedbackClass::configurePeerConnectedMode() { + #ifdef BOARD_HAS_RGB + turnOFF(); + _ledPin = BLUE_LED; + #else + _ledPin = GREEN_LED; + #endif + _ledChangeInterval = ALWAYS_ON_INTERVAL; +} + #endif // NETWORK_CONFIGURATOR_COMPATIBLE diff --git a/src/utility/LEDFeedback.h b/src/utility/LEDFeedback.h index 2360e04..46d08ba 100644 --- a/src/utility/LEDFeedback.h +++ b/src/utility/LEDFeedback.h @@ -16,6 +16,8 @@ class LEDFeedbackClass { NONE, BLE_AVAILABLE, PEER_CONNECTED, + PEER_CONNECTED_BLE, + PEER_CONNECTED_SERIAL, CONNECTING_TO_NETWORK, CONNECTED_TO_CLOUD, ERROR @@ -30,6 +32,7 @@ class LEDFeedbackClass { LEDFeedbackClass() {}; void turnON(); void turnOFF(); + void configurePeerConnectedMode(); LEDFeedbackMode _mode = LEDFeedbackMode::NONE; uint32_t _lastUpdate = 0; uint32_t _count = 0; From bd82bd621a03b7963a842613fb93ba301b15c1c3 Mon Sep 17 00:00:00 2001 From: fabik111 Date: Mon, 7 Jul 2025 09:28:42 +0200 Subject: [PATCH 9/9] Release version 0.2.1 --- library.properties | 2 +- src/ANetworkConfigurator_Config.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/library.properties b/library.properties index 14cbfa0..89fcfba 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=Arduino_NetworkConfigurator -version=0.2.0 +version=0.2.1 author=Arduino maintainer=Arduino sentence=This library allows to configure and update the network settings of a ConnectionHandler instance. diff --git a/src/ANetworkConfigurator_Config.h b/src/ANetworkConfigurator_Config.h index 465659f..6fb9ec0 100644 --- a/src/ANetworkConfigurator_Config.h +++ b/src/ANetworkConfigurator_Config.h @@ -7,7 +7,7 @@ */ #pragma once -#define ANetworkConfigurator_LIB_VERSION "0.2.0" +#define ANetworkConfigurator_LIB_VERSION "0.2.1" #if defined(ARDUINO_SAMD_MKRWIFI1010) #define NETWORK_CONFIGURATOR_COMPATIBLE 1