Skip to content

Add new animation for board connected with Serial or with BLE Agent #16

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/configuratorAgents/AgentsManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
62 changes: 41 additions & 21 deletions src/utility/LEDFeedback.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
}
};

Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
3 changes: 3 additions & 0 deletions src/utility/LEDFeedback.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ class LEDFeedbackClass {
NONE,
BLE_AVAILABLE,
PEER_CONNECTED,
PEER_CONNECTED_BLE,
PEER_CONNECTED_SERIAL,
CONNECTING_TO_NETWORK,
CONNECTED_TO_CLOUD,
ERROR
Expand All @@ -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;
Expand Down
Loading