added LoraUartCommand Interpreter
This commit is contained in:
parent
65d51f13aa
commit
268c204957
@ -45,6 +45,7 @@ typedef struct Globals_s
|
||||
bool hasDTC;
|
||||
int loadvoltage_mV = 0;
|
||||
int battery_level = 0;
|
||||
bool timer_disabled = false;
|
||||
} Globals_t;
|
||||
|
||||
extern Globals_t globals;
|
||||
|
@ -67,7 +67,7 @@ bool InitLoRa(void (*MPinHelper)(int, int))
|
||||
MaintainDTC(DTC_NO_LORA_FOUND, DTC_WARN, true);
|
||||
}
|
||||
#elif defined(FEATURE_ENABLE_UARTLORA)
|
||||
// LORA UART Stuff here
|
||||
SerialLoRa.begin(9600);
|
||||
#endif
|
||||
return returnval;
|
||||
}
|
||||
@ -151,8 +151,20 @@ void sendStatus_LoRa()
|
||||
|
||||
ResponseStatus rs = e220ttl.sendFixedMessage(0xFF, 0xFF, 23, (byte *)&sendStatus, sizeof(sendStatus));
|
||||
Serial.println(rs.getResponseDescription());
|
||||
|
||||
#elif defined(FEATURE_ENABLE_UARTLORA)
|
||||
// LORA UART SEND STUFF HERE
|
||||
|
||||
SerialLoRa.print(PersistenceData.faction_1_timer);
|
||||
SerialLoRa.write(";");
|
||||
SerialLoRa.print(PersistenceData.faction_2_timer);
|
||||
SerialLoRa.write(";");
|
||||
SerialLoRa.print(PersistenceData.faction_3_timer);
|
||||
SerialLoRa.write(";");
|
||||
SerialLoRa.print(PersistenceData.activeFaction);
|
||||
SerialLoRa.write(";");
|
||||
SerialLoRa.print(globals.battery_level);
|
||||
SerialLoRa.write('\n');
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -245,5 +257,49 @@ void Parse_LoRa_UartCommand(char input[], int size)
|
||||
}
|
||||
|
||||
Debug_pushMessage("Parsed LoRa UART Command: %s Value: %s\n", command, value);
|
||||
|
||||
if (!strcmp(command, "ENABLE"))
|
||||
{
|
||||
globals.timer_disabled = false;
|
||||
}
|
||||
else if (!strcmp(command, "DISABLE"))
|
||||
{
|
||||
globals.timer_disabled = false;
|
||||
}
|
||||
else if (!strcmp(command, "RESET"))
|
||||
{
|
||||
PersistenceData.activeFaction = NONE;
|
||||
PersistenceData.faction_1_timer = 0;
|
||||
PersistenceData.faction_2_timer = 0;
|
||||
PersistenceData.faction_3_timer = 0;
|
||||
}
|
||||
else if (!strcmp(command, "TMRSTP"))
|
||||
{
|
||||
PersistenceData.activeFaction = NONE;
|
||||
}
|
||||
else if (!strcmp(command, "TMR1"))
|
||||
{
|
||||
PersistenceData.faction_1_timer = atol(value);
|
||||
}
|
||||
else if (!strcmp(command, "TMR2"))
|
||||
{
|
||||
PersistenceData.faction_2_timer = atol(value);
|
||||
}
|
||||
else if (!strcmp(command, "TMR3"))
|
||||
{
|
||||
PersistenceData.faction_3_timer = atol(value);
|
||||
}
|
||||
else if (!strcmp(command, "EFAC1"))
|
||||
{
|
||||
PersistenceData.activeFaction = FACTION_1;
|
||||
}
|
||||
else if (!strcmp(command, "EFAC2"))
|
||||
{
|
||||
PersistenceData.activeFaction = FACTION_2;
|
||||
}
|
||||
else if (!strcmp(command, "EFAC3"))
|
||||
{
|
||||
PersistenceData.activeFaction = FACTION_3;
|
||||
}
|
||||
}
|
||||
#endif
|
@ -308,6 +308,9 @@ void SevenSeg_Output()
|
||||
|
||||
void tmrCallback_FactionTicker()
|
||||
{
|
||||
if (globals.timer_disabled == true)
|
||||
PersistenceData.activeFaction = NONE;
|
||||
|
||||
switch (PersistenceData.activeFaction)
|
||||
{
|
||||
case FACTION_1:
|
||||
@ -349,7 +352,7 @@ void tmrCallback_InputGetter()
|
||||
return;
|
||||
}
|
||||
|
||||
if (btnState[0] == FAC_1_TRG_PRESSED)
|
||||
if (btnState[0] == FAC_1_TRG_PRESSED && globals.timer_disabled == false)
|
||||
{
|
||||
if (PersistenceData.activeFaction != FACTION_1)
|
||||
{
|
||||
@ -359,7 +362,7 @@ void tmrCallback_InputGetter()
|
||||
PersistenceData.activeFaction = FACTION_1;
|
||||
}
|
||||
|
||||
if (btnState[1] == FAC_2_TRG_PRESSED)
|
||||
if (btnState[1] == FAC_2_TRG_PRESSED && globals.timer_disabled == false)
|
||||
{
|
||||
if (PersistenceData.activeFaction != FACTION_2)
|
||||
{
|
||||
@ -369,7 +372,7 @@ void tmrCallback_InputGetter()
|
||||
PersistenceData.activeFaction = FACTION_2;
|
||||
}
|
||||
|
||||
if (btnState[2] == FAC_3_TRG_PRESSED)
|
||||
if (btnState[2] == FAC_3_TRG_PRESSED && globals.timer_disabled == false)
|
||||
{
|
||||
if (PersistenceData.activeFaction != FACTION_3)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user