Add reset-mcu with Props::resetMcu()

This commit is contained in:
fauresystems
2019-11-15 20:38:14 +01:00
parent 0d325560ed
commit ae28674d9a
5 changed files with 14 additions and 2 deletions
BIN
View File
Binary file not shown.
@@ -68,6 +68,10 @@ void InboxMessage::run(String a) {
props.sendAllData();
props.sendDone(a);
}
else if (a == u8"reset-mcu")
{
props.resetMcu(); // we prefer SSH command: echo %BROKER%> /root/broker && reset-mcu
}
else if (a == "clignoter:1")
{
clignoter.setValue(true);
@@ -52,7 +52,7 @@ void setup()
}
delay(1500); // time for shield stuff
// can do more static IP configuration, must be called after Ethernet.begin()
//Ethernet.setSubnetMask(IPAddress(255, 255, 255, 0));
//Ethernet.setGatewayIP(IPAddress(192, 168, 1, 1));
@@ -92,6 +92,10 @@ void InboxMessage::run(String a) {
props.sendAllData();
props.sendDone(a);
}
else if (a == u8"reset-mcu")
{
props.resetMcu();
}
else if (a == "clignoter:1")
{
clignoter.setValue(true);
@@ -105,6 +105,10 @@ void InboxMessage::run(String a) {
props.sendAllData();
props.sendDone(a);
}
else if (a == u8"reset-mcu")
{
props.resetMcu();
}
else if (a == "clignoter:1")
{
clignoter.setValue(true);
+1 -1
View File
@@ -102,7 +102,7 @@ void Props::resetMcu()
{
#if defined(ARDUINO_ARCH_SAMD)
NVIC_SystemReset();
#elif defined(__AVR__)
#elif defined(ARDUINO_ARCH_AVR)
wdt_enable(WDTO_15MS);
while (true);
#endif