start configuration stuff

This commit is contained in:
2022-12-18 18:08:39 +01:00
parent f4bcf7fc01
commit 4052bea374
4 changed files with 78 additions and 1 deletions

View File

@ -93,6 +93,7 @@ static void prepareTxFrame( uint8_t port )
}
}
RTC_DATA_ATTR bool firstrun = true;
void productionSetup() {
@ -102,6 +103,12 @@ void productionSetup() {
pModbusClient->begin(9600, SERIAL_8N1);
Mcu.begin();
if(firstrun) {
LoRaWAN.displayMcuInit();
firstrun = false;
}
deviceState = DEVICE_STATE_INIT;
}
@ -122,12 +129,14 @@ void productionLoop()
}
case DEVICE_STATE_JOIN:
{
LoRaWAN.displayJoining();
LoRaWAN.join();
break;
}
case DEVICE_STATE_SEND:
digitalWrite(LED_BLUE, HIGH);
{
LoRaWAN.displaySending();
Serial.println("sending");
prepareTxFrame( appPort );
LoRaWAN.send();
@ -145,6 +154,7 @@ void productionLoop()
}
case DEVICE_STATE_SLEEP:
{
LoRaWAN.displayAck();
LoRaWAN.sleep(loraWanClass);
break;
}