Compare commits
6 Commits
a92b1edfd9
...
1.03
Author | SHA1 | Date | |
---|---|---|---|
268c204957 | |||
65d51f13aa | |||
f727bb3247 | |||
cd1379f90c | |||
0363b1eebc | |||
e6f1283aae |
BIN
Documentation/Pinout_UART_LoRa.png
Normal file
BIN
Documentation/Pinout_UART_LoRa.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 53 KiB |
Binary file not shown.
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 34 KiB |
Binary file not shown.
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 37 KiB |
@@ -1 +1 @@
|
|||||||
1.02
|
1.03
|
@@ -45,6 +45,7 @@ typedef struct Globals_s
|
|||||||
bool hasDTC;
|
bool hasDTC;
|
||||||
int loadvoltage_mV = 0;
|
int loadvoltage_mV = 0;
|
||||||
int battery_level = 0;
|
int battery_level = 0;
|
||||||
|
bool timer_disabled = false;
|
||||||
} Globals_t;
|
} Globals_t;
|
||||||
|
|
||||||
extern Globals_t globals;
|
extern Globals_t globals;
|
||||||
@@ -58,8 +59,8 @@ typedef struct Constants_s
|
|||||||
} Constants_t;
|
} Constants_t;
|
||||||
|
|
||||||
const Constants_t constants PROGMEM = {
|
const Constants_t constants PROGMEM = {
|
||||||
1,2, // Firmware_Version
|
1,3, // Firmware_Version
|
||||||
1,2, // Required Flash Version
|
1,3, // Required Flash Version
|
||||||
GIT_REV // Git-Hash-String
|
GIT_REV // Git-Hash-String
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -2,10 +2,16 @@
|
|||||||
#define _LORA_NET_H_
|
#define _LORA_NET_H_
|
||||||
|
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
|
|
||||||
|
#ifdef LORA_FEATURE_ENABLED
|
||||||
#include <LoRa_E220.h>
|
#include <LoRa_E220.h>
|
||||||
|
#elif defined(FEATURE_ENABLE_UARTLORA)
|
||||||
|
#include <SoftwareSerial.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
// local includes
|
// local includes
|
||||||
#include "lora_messages.h"
|
#include "lora_messages.h"
|
||||||
|
#include "debugger.h"
|
||||||
#include "defaults.h"
|
#include "defaults.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "globals.h"
|
#include "globals.h"
|
||||||
|
@@ -14,6 +14,9 @@
|
|||||||
#error "You must define an WIFI_AP_PASSWORD for Standalone AP-Mode"
|
#error "You must define an WIFI_AP_PASSWORD for Standalone AP-Mode"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(FEATURE_ENABLE_UARTLORA) && defined(FEATURE_ENABLE_LORA)
|
||||||
|
#error "You cannot enable LoRa and UART-Protocol at the same time!"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef FEATURE_ENABLE_WIFI_CLIENT
|
#ifdef FEATURE_ENABLE_WIFI_CLIENT
|
||||||
#ifndef WIFI_CLIENT_PASSWORD
|
#ifndef WIFI_CLIENT_PASSWORD
|
||||||
|
@@ -22,16 +22,17 @@ upload_speed = 921600
|
|||||||
;upload_port = 10.0.1.48
|
;upload_port = 10.0.1.48
|
||||||
;upload_protocol = espota
|
;upload_protocol = espota
|
||||||
;upload_flags =
|
;upload_flags =
|
||||||
; --auth=${wifi_cred.admin_password}
|
; --auth=${wifi_cred.ota_password}
|
||||||
|
|
||||||
build_flags=
|
build_flags=
|
||||||
!python git_rev_macro.py
|
!python git_rev_macro.py
|
||||||
-DATOMIC_FS_UPDATE
|
-DATOMIC_FS_UPDATE
|
||||||
-DFEATURE_ENABLE_WIFI_CLIENT
|
;-DFEATURE_ENABLE_WIFI_CLIENT
|
||||||
;-DFEATURE_ENABLE_LORA
|
;-DFEATURE_ENABLE_LORA
|
||||||
;-DCAPTIVE
|
;-DCAPTIVE
|
||||||
|
-DFEATURE_ENABLE_UARTLORA
|
||||||
-DWIFI_AP_IP_GW=10,0,0,1
|
-DWIFI_AP_IP_GW=10,0,0,1
|
||||||
-DADMIN_PASSWORD=${wifi_cred.admin_password}
|
-DADMIN_PASSWORD=${wifi_cred.ota_password}
|
||||||
-DWIFI_CLIENT_SSID=${wifi_cred.wifi_client_ssid}
|
-DWIFI_CLIENT_SSID=${wifi_cred.wifi_client_ssid}
|
||||||
-DWIFI_CLIENT_PASSWORD=${wifi_cred.wifi_client_password}
|
-DWIFI_CLIENT_PASSWORD=${wifi_cred.wifi_client_password}
|
||||||
-DWIFI_AP_SSID=${wifi_cred.wifi_ap_ssid}
|
-DWIFI_AP_SSID=${wifi_cred.wifi_ap_ssid}
|
||||||
|
@@ -1,13 +1,19 @@
|
|||||||
#include "lora_net.h"
|
#include "lora_net.h"
|
||||||
|
|
||||||
|
#ifdef FEATURE_ENABLE_LORA
|
||||||
LoRa_E220 e220ttl(GPIO_LORA_TX, GPIO_LORA_RX, GPIO_LORA_AUX, 3, 4); // Arduino RX <-- e220 TX, Arduino TX --> e220 RX AUX M0 M1
|
LoRa_E220 e220ttl(GPIO_LORA_TX, GPIO_LORA_RX, GPIO_LORA_AUX, 3, 4); // Arduino RX <-- e220 TX, Arduino TX --> e220 RX AUX M0 M1
|
||||||
|
|
||||||
void printParameters(struct Configuration configuration);
|
void printParameters(struct Configuration configuration);
|
||||||
void printModuleInformation(struct ModuleInformation moduleInformation);
|
void printModuleInformation(struct ModuleInformation moduleInformation);
|
||||||
|
#elif defined(FEATURE_ENABLE_UARTLORA)
|
||||||
|
SoftwareSerial SerialLoRa(GPIO_LORA_RX, GPIO_LORA_TX); // RX, TX
|
||||||
|
void Parse_LoRa_UartCommand(char input[], int size);
|
||||||
|
#endif
|
||||||
|
|
||||||
bool InitLoRa(void (*MPinHelper)(int, int))
|
bool InitLoRa(void (*MPinHelper)(int, int))
|
||||||
{
|
{
|
||||||
bool returnval;
|
bool returnval = false;
|
||||||
|
|
||||||
|
#ifdef FEATURE_ENABLE_LORA
|
||||||
|
|
||||||
e220ttl.setMPins = MPinHelper;
|
e220ttl.setMPins = MPinHelper;
|
||||||
returnval = e220ttl.begin();
|
returnval = e220ttl.begin();
|
||||||
@@ -60,11 +66,15 @@ bool InitLoRa(void (*MPinHelper)(int, int))
|
|||||||
{
|
{
|
||||||
MaintainDTC(DTC_NO_LORA_FOUND, DTC_WARN, true);
|
MaintainDTC(DTC_NO_LORA_FOUND, DTC_WARN, true);
|
||||||
}
|
}
|
||||||
|
#elif defined(FEATURE_ENABLE_UARTLORA)
|
||||||
|
SerialLoRa.begin(9600);
|
||||||
|
#endif
|
||||||
return returnval;
|
return returnval;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoRa_Process()
|
void LoRa_Process()
|
||||||
{
|
{
|
||||||
|
#ifdef FEATURE_ENABLE_LORA
|
||||||
if (e220ttl.available() > 1)
|
if (e220ttl.available() > 1)
|
||||||
{
|
{
|
||||||
ResponseContainer rc = e220ttl.receiveMessageRSSI();
|
ResponseContainer rc = e220ttl.receiveMessageRSSI();
|
||||||
@@ -82,10 +92,50 @@ void LoRa_Process()
|
|||||||
Serial.println(rc.rssi, DEC);
|
Serial.println(rc.rssi, DEC);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#elif defined(FEATURE_ENABLE_UARTLORA)
|
||||||
|
|
||||||
|
char packageInput[16];
|
||||||
|
bool packageRecieved = false;
|
||||||
|
unsigned int bufferPtr = 0;
|
||||||
|
|
||||||
|
if (SerialLoRa.available() && packageRecieved == false)
|
||||||
|
{
|
||||||
|
while (bufferPtr < sizeof(packageInput))
|
||||||
|
{
|
||||||
|
packageInput[bufferPtr] = SerialLoRa.read();
|
||||||
|
if (packageInput[bufferPtr] == '\n')
|
||||||
|
{
|
||||||
|
packageInput[bufferPtr] = 0; // terminate String
|
||||||
|
packageRecieved = true;
|
||||||
|
Debug_pushMessage("Got LoRa UART: %s\n", packageInput);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else if ((packageInput[bufferPtr] >= 0x30) || (packageInput[bufferPtr] <= 0x5A)) // only accept Numbers, UpperCase-Letters and some special chars
|
||||||
|
{
|
||||||
|
if (bufferPtr < sizeof(packageInput) - 1)
|
||||||
|
{
|
||||||
|
bufferPtr++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
packageInput[bufferPtr] = 0; // terminate String, bc Buffer is full (package to long)
|
||||||
|
packageRecieved = true; // send it anyway to the parser
|
||||||
|
Debug_pushMessage("Got LoRa UART: %s\n", packageInput);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (packageRecieved)
|
||||||
|
Parse_LoRa_UartCommand(packageInput, bufferPtr);
|
||||||
|
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void sendStatus_LoRa()
|
void sendStatus_LoRa()
|
||||||
{
|
{
|
||||||
|
#ifdef FEATURE_ENABLE_LORA
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
MessageType_t type = "STATUS";
|
MessageType_t type = "STATUS";
|
||||||
@@ -101,8 +151,25 @@ void sendStatus_LoRa()
|
|||||||
|
|
||||||
ResponseStatus rs = e220ttl.sendFixedMessage(0xFF, 0xFF, 23, (byte *)&sendStatus, sizeof(sendStatus));
|
ResponseStatus rs = e220ttl.sendFixedMessage(0xFF, 0xFF, 23, (byte *)&sendStatus, sizeof(sendStatus));
|
||||||
Serial.println(rs.getResponseDescription());
|
Serial.println(rs.getResponseDescription());
|
||||||
|
|
||||||
|
#elif defined(FEATURE_ENABLE_UARTLORA)
|
||||||
|
|
||||||
|
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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef FEATURE_ENABLE_LORA
|
||||||
|
|
||||||
void printParameters(struct Configuration configuration)
|
void printParameters(struct Configuration configuration)
|
||||||
{
|
{
|
||||||
Serial.println("----------------------------------------");
|
Serial.println("----------------------------------------");
|
||||||
@@ -169,3 +236,70 @@ void printParameters(struct Configuration configuration)
|
|||||||
|
|
||||||
Serial.println("----------------------------------------");
|
Serial.println("----------------------------------------");
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef FEATURE_ENABLE_UARTLORA
|
||||||
|
void Parse_LoRa_UartCommand(char input[], int size)
|
||||||
|
{
|
||||||
|
|
||||||
|
char delimiter[] = ";";
|
||||||
|
char *ptr;
|
||||||
|
char command[8];
|
||||||
|
char value[8];
|
||||||
|
|
||||||
|
ptr = strtok(input, delimiter);
|
||||||
|
|
||||||
|
while (ptr != NULL)
|
||||||
|
{
|
||||||
|
strncpy(command, ptr, sizeof(command));
|
||||||
|
ptr = strtok(NULL, delimiter);
|
||||||
|
strncpy(value, ptr, sizeof(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
@@ -19,7 +19,7 @@
|
|||||||
#include "globals.h"
|
#include "globals.h"
|
||||||
#include "dtc.h"
|
#include "dtc.h"
|
||||||
#include "debugger.h"
|
#include "debugger.h"
|
||||||
#ifdef FEATURE_ENABLE_LORA
|
#if defined(FEATURE_ENABLE_LORA) || defined(FEATURE_ENABLE_UARTLORA)
|
||||||
#include "lora_net.h"
|
#include "lora_net.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -49,7 +49,7 @@ void OverrideDisplay(uint32_t time, const char *message1, const char *message2,
|
|||||||
void initGlobals();
|
void initGlobals();
|
||||||
void maintainSysStat();
|
void maintainSysStat();
|
||||||
|
|
||||||
#ifdef FEATURE_ENABLE_LORA
|
#if defined(FEATURE_ENABLE_UARTLORA) || defined(FEATURE_ENABLE_LORA)
|
||||||
void setMPins_Helper(int pin, int status);
|
void setMPins_Helper(int pin, int status);
|
||||||
void tmrCallback_StatusSender();
|
void tmrCallback_StatusSender();
|
||||||
Ticker tmrStatusSender(tmrCallback_StatusSender, 30000, 0, MILLIS);
|
Ticker tmrStatusSender(tmrCallback_StatusSender, 30000, 0, MILLIS);
|
||||||
@@ -72,7 +72,7 @@ Ticker tmrWiFiMaintainConnection(tmrCallback_WiFiMaintainConnection, 1000, 0, MI
|
|||||||
uint32_t DisplayOverrideFlag = 0;
|
uint32_t DisplayOverrideFlag = 0;
|
||||||
char DisplayOverrideValue[3][5] = {0};
|
char DisplayOverrideValue[3][5] = {0};
|
||||||
|
|
||||||
#ifdef FEATURE_ENABLE_LORA
|
#if defined(FEATURE_ENABLE_UARTLORA) || defined(FEATURE_ENABLE_LORA)
|
||||||
void setMPins_Helper(int pin, int status)
|
void setMPins_Helper(int pin, int status)
|
||||||
{
|
{
|
||||||
i2c_io.write(pin, status);
|
i2c_io.write(pin, status);
|
||||||
@@ -119,7 +119,7 @@ void setup()
|
|||||||
Serial.print("INA219 not Initialized\n");
|
Serial.print("INA219 not Initialized\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FEATURE_ENABLE_LORA
|
#if defined(FEATURE_ENABLE_UARTLORA) || defined(FEATURE_ENABLE_LORA)
|
||||||
if (InitLoRa(&setMPins_Helper))
|
if (InitLoRa(&setMPins_Helper))
|
||||||
{
|
{
|
||||||
Serial.print("Initialized LoRa_Transceiver\n");
|
Serial.print("Initialized LoRa_Transceiver\n");
|
||||||
@@ -229,9 +229,9 @@ void loop()
|
|||||||
DTC_Process();
|
DTC_Process();
|
||||||
Debug_Process();
|
Debug_Process();
|
||||||
|
|
||||||
#ifdef FEATURE_ENABLE_LORA
|
#if defined(FEATURE_ENABLE_LORA) || defined(FEATURE_ENABLE_UARTLORA)
|
||||||
tmrStatusSender.update();
|
|
||||||
LoRa_Process();
|
LoRa_Process();
|
||||||
|
tmrStatusSender.update();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CAPTIVE
|
#ifdef CAPTIVE
|
||||||
@@ -289,25 +289,28 @@ void SevenSeg_Output()
|
|||||||
disp_FAC_1.refresh();
|
disp_FAC_1.refresh();
|
||||||
snprintf(sevenSegBuff, sizeof(sevenSegBuff), "%4d", PersistenceData.faction_1_timer / 60);
|
snprintf(sevenSegBuff, sizeof(sevenSegBuff), "%4d", PersistenceData.faction_1_timer / 60);
|
||||||
disp_FAC_1.display(String(sevenSegBuff), false, false);
|
disp_FAC_1.display(String(sevenSegBuff), false, false);
|
||||||
disp_FAC_1.setDp((PersistenceData.activeFaction == FACTION_1) && (millis() % 1000 > 500));
|
disp_FAC_1.setDp((PersistenceData.activeFaction == FACTION_1) && (millis() % 1000 > 500) ? 0x08 : 0x00);
|
||||||
|
|
||||||
disp_FAC_2.setBrightness(PersistenceData.activeFaction == FACTION_2 ? 5 : 1);
|
disp_FAC_2.setBrightness(PersistenceData.activeFaction == FACTION_2 ? 5 : 1);
|
||||||
disp_FAC_2.refresh();
|
disp_FAC_2.refresh();
|
||||||
snprintf(sevenSegBuff, sizeof(sevenSegBuff), "%4d", PersistenceData.faction_2_timer / 60);
|
snprintf(sevenSegBuff, sizeof(sevenSegBuff), "%4d", PersistenceData.faction_2_timer / 60);
|
||||||
disp_FAC_2.display(String(sevenSegBuff), false, false);
|
disp_FAC_2.display(String(sevenSegBuff), false, false);
|
||||||
disp_FAC_2.setDp((PersistenceData.activeFaction == FACTION_2) && (millis() % 1000 > 500));
|
disp_FAC_2.setDp((PersistenceData.activeFaction == FACTION_2) && (millis() % 1000 > 500) ? 0x08 : 0x00);
|
||||||
|
|
||||||
disp_FAC_3.setBrightness(PersistenceData.activeFaction == FACTION_3 ? 5 : 1);
|
disp_FAC_3.setBrightness(PersistenceData.activeFaction == FACTION_3 ? 5 : 1);
|
||||||
disp_FAC_3.refresh();
|
disp_FAC_3.refresh();
|
||||||
snprintf(sevenSegBuff, sizeof(sevenSegBuff), "%4d", PersistenceData.faction_3_timer / 60);
|
snprintf(sevenSegBuff, sizeof(sevenSegBuff), "%4d", PersistenceData.faction_3_timer / 60);
|
||||||
disp_FAC_3.display(String(sevenSegBuff), false, false);
|
disp_FAC_3.display(String(sevenSegBuff), false, false);
|
||||||
disp_FAC_3.setDp((PersistenceData.activeFaction == FACTION_3) && (millis() % 1000 > 500));
|
disp_FAC_3.setDp((PersistenceData.activeFaction == FACTION_3) && (millis() % 1000 > 500) ? 0x08 : 0x00);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void tmrCallback_FactionTicker()
|
void tmrCallback_FactionTicker()
|
||||||
{
|
{
|
||||||
|
if (globals.timer_disabled == true)
|
||||||
|
PersistenceData.activeFaction = NONE;
|
||||||
|
|
||||||
switch (PersistenceData.activeFaction)
|
switch (PersistenceData.activeFaction)
|
||||||
{
|
{
|
||||||
case FACTION_1:
|
case FACTION_1:
|
||||||
@@ -344,43 +347,43 @@ void tmrCallback_InputGetter()
|
|||||||
|
|
||||||
if (keysPressed > 1)
|
if (keysPressed > 1)
|
||||||
{
|
{
|
||||||
Serial.println("ERROR: More than one Flag active - setting no Faction active");
|
Debug_pushMessage("ERROR: More than one Flag active - setting no Faction active");
|
||||||
PersistenceData.activeFaction = NONE;
|
PersistenceData.activeFaction = NONE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (btnState[0] == FAC_1_TRG_PRESSED)
|
if (btnState[0] == FAC_1_TRG_PRESSED && globals.timer_disabled == false)
|
||||||
{
|
{
|
||||||
if (PersistenceData.activeFaction != FACTION_1)
|
if (PersistenceData.activeFaction != FACTION_1)
|
||||||
{
|
{
|
||||||
Serial.println("Faction 1 captured !");
|
Debug_pushMessage("Faction 1 captured !");
|
||||||
globals.requestEEAction = EE_PDS_SAVE;
|
globals.requestEEAction = EE_PDS_SAVE;
|
||||||
}
|
}
|
||||||
PersistenceData.activeFaction = FACTION_1;
|
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)
|
if (PersistenceData.activeFaction != FACTION_2)
|
||||||
{
|
{
|
||||||
Serial.println("Faction 2 captured !");
|
Debug_pushMessage("Faction 2 captured !");
|
||||||
globals.requestEEAction = EE_PDS_SAVE;
|
globals.requestEEAction = EE_PDS_SAVE;
|
||||||
}
|
}
|
||||||
PersistenceData.activeFaction = FACTION_2;
|
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)
|
if (PersistenceData.activeFaction != FACTION_3)
|
||||||
{
|
{
|
||||||
Serial.println("Faction 3 captured !");
|
Debug_pushMessage("Faction 3 captured !");
|
||||||
globals.requestEEAction = EE_PDS_SAVE;
|
globals.requestEEAction = EE_PDS_SAVE;
|
||||||
}
|
}
|
||||||
PersistenceData.activeFaction = FACTION_3;
|
PersistenceData.activeFaction = FACTION_3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FEATURE_ENABLE_LORA
|
#if defined(FEATURE_ENABLE_LORA) || defined(FEATURE_ENABLE_UARTLORA)
|
||||||
void tmrCallback_StatusSender()
|
void tmrCallback_StatusSender()
|
||||||
{
|
{
|
||||||
sendStatus_LoRa();
|
sendStatus_LoRa();
|
||||||
@@ -564,17 +567,17 @@ void ProcessKeyCombos(bool *btnState)
|
|||||||
if (btnState[0] != FAC_1_TRG_PRESSED && keyStatus_Fac1 == KEY_PRESSED)
|
if (btnState[0] != FAC_1_TRG_PRESSED && keyStatus_Fac1 == KEY_PRESSED)
|
||||||
{
|
{
|
||||||
if (keyCount_Fac2 > 0 || keyCount_Fac3 > 0)
|
if (keyCount_Fac2 > 0 || keyCount_Fac3 > 0)
|
||||||
Serial.printf("KeyCombo 2: %d | 3: %d\n", keyCount_Fac2, keyCount_Fac3);
|
Debug_pushMessage("KeyCombo 2: %d | 3: %d\n", keyCount_Fac2, keyCount_Fac3);
|
||||||
|
|
||||||
if (keyCount_Fac2 == 2 && keyCount_Fac3 == 0)
|
if (keyCount_Fac2 == 2 && keyCount_Fac3 == 0)
|
||||||
{
|
{
|
||||||
Serial.println("KeyCombo: WiFi AP ON");
|
Debug_pushMessage("KeyCombo: WiFi AP ON");
|
||||||
OverrideDisplay(5000, "NET ", " ", " ");
|
OverrideDisplay(5000, "NET ", " ", " ");
|
||||||
toggleWiFiAP(false);
|
toggleWiFiAP(false);
|
||||||
}
|
}
|
||||||
else if (keyCount_Fac2 == 4 && keyCount_Fac3 == 0)
|
else if (keyCount_Fac2 == 4 && keyCount_Fac3 == 0)
|
||||||
{
|
{
|
||||||
Serial.printf("KeyCombo: Reset Timer\n");
|
Debug_pushMessage("KeyCombo: Reset Timer\n");
|
||||||
if (globals.systemStatus == sysStat_Startup)
|
if (globals.systemStatus == sysStat_Startup)
|
||||||
{
|
{
|
||||||
OverrideDisplay(5000, "RST ", " ", " ");
|
OverrideDisplay(5000, "RST ", " ", " ");
|
||||||
@@ -587,7 +590,7 @@ void ProcessKeyCombos(bool *btnState)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
OverrideDisplay(5000, "ERR ", " ", " ");
|
OverrideDisplay(5000, "ERR ", " ", " ");
|
||||||
Serial.printf("ERROR: only %d seconds after Startup!\n", STARTUP_DELAY_MS / 1000);
|
Debug_pushMessage("ERROR: only %d seconds after Startup!\n", STARTUP_DELAY_MS / 1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -407,6 +407,9 @@ void WebserverEERestore_Callback(AsyncWebServerRequest *request, const String &f
|
|||||||
|
|
||||||
ConfigData.batteryType = (batteryType_t)doc["config"]["batteryType"].as<uint32_t>();
|
ConfigData.batteryType = (batteryType_t)doc["config"]["batteryType"].as<uint32_t>();
|
||||||
ConfigData.EEPROM_Version = doc["config"]["EEPROM_Version"].as<uint32_t>();
|
ConfigData.EEPROM_Version = doc["config"]["EEPROM_Version"].as<uint32_t>();
|
||||||
|
strncpy(ConfigData.Faction_1_Name, doc["config"]["Faction_1_Name"].as<String>().c_str(), sizeof(ConfigData.Faction_1_Name));
|
||||||
|
strncpy(ConfigData.Faction_2_Name, doc["config"]["Faction_2_Name"].as<String>().c_str(), sizeof(ConfigData.Faction_2_Name));
|
||||||
|
strncpy(ConfigData.Faction_3_Name, doc["config"]["Faction_3_Name"].as<String>().c_str(), sizeof(ConfigData.Faction_3_Name));
|
||||||
|
|
||||||
PersistenceData.writeCycleCounter = doc["persis"]["writeCycleCounter"].as<uint16_t>();
|
PersistenceData.writeCycleCounter = doc["persis"]["writeCycleCounter"].as<uint16_t>();
|
||||||
PersistenceData.activeFaction = (factions_t)doc["persis"]["activeFaction"].as<uint32_t>();
|
PersistenceData.activeFaction = (factions_t)doc["persis"]["activeFaction"].as<uint32_t>();
|
||||||
@@ -456,6 +459,9 @@ void WebServerEEJSON_Callback(AsyncWebServerRequest *request)
|
|||||||
|
|
||||||
config["EEPROM_Version"] = ConfigData.EEPROM_Version;
|
config["EEPROM_Version"] = ConfigData.EEPROM_Version;
|
||||||
config["batteryType"] = ConfigData.batteryType;
|
config["batteryType"] = ConfigData.batteryType;
|
||||||
|
config["Faction_1_Name"] = ConfigData.Faction_1_Name;
|
||||||
|
config["Faction_2_Name"] = ConfigData.Faction_2_Name;
|
||||||
|
config["Faction_3_Name"] = ConfigData.Faction_3_Name;
|
||||||
sprintf(buffer, "0x%08X", ConfigData.checksum);
|
sprintf(buffer, "0x%08X", ConfigData.checksum);
|
||||||
config["checksum"] = buffer;
|
config["checksum"] = buffer;
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
[wifi_cred]
|
[wifi_cred]
|
||||||
wifi_ap_ssid = wifi-ap-ssid
|
wifi_ap_ssid = wifi-ap-ssid
|
||||||
wifi_ap_password = wifiappass
|
wifi_ap_password = wifiappass
|
||||||
wifi_ssid = wifi-ssid
|
wifi_client_ssid = wifi-ssid
|
||||||
wifi_password = wifi-pass
|
wifi_client_password = wifi-pass
|
||||||
admin_password = ota-password
|
ota_password = ota-password
|
Reference in New Issue
Block a user