Compare commits

...

8 Commits

11 changed files with 142 additions and 61 deletions

View File

@ -73,6 +73,38 @@
<input class="form-control" type="text" placeholder="%SYSTEM_STATUS%" readonly>
</p>
<!-- Div Group current Mode -->
<!-- Div Group Faction Points -->
<hr />
<p>
<h4>aktueller Punktestand</h4>
<div class="table-responsive">
<table class="table table-borderless table-dark">
<thead>
<tr>
<th class="text-center" scope="col">%NAME_FAC_1%</th>
<th class="text-center" scope="col">%NAME_FAC_2%</th>
<th class="text-center" scope="col">%NAME_FAC_3%</th>
</tr>
</thead>
<tbody>
<tr>
<td class="mx-auto"><img src="static/img/logo_fac1.png" class="rounded mx-auto img-fluid d-block"
alt="..."></td>
<td class="mx-auto"><img src="static/img/logo_fac2.png" class="rounded mx-auto img-fluid d-block"
alt="..."></td>
<td class="mx-auto"><img src="static/img/logo_fac3.png" class="rounded mx-auto img-fluid d-block"
alt="..."></td>
</tr>
<tr>
<td class="text-center">%POINTS_FAC_1%</td>
<td class="text-center">%POINTS_FAC_2%</td>
<td class="text-center">%POINTS_FAC_3%</td>
</tr>
</tbody>
</table>
</div>
</p>
<!-- Div GroupFaction Points -->
<!-- Div Group DTC Table -->
<div %SHOW_DTC_TABLE%>
<hr />
@ -98,6 +130,19 @@
<!-- Div Tab Maintenance -->
<div id="tab_maintenance" class="tab-pane fade" role="tabpanel">
<h3>Wartung</h3>
<!-- Div Group Reset Timers -->
<hr />
<p>
<h4>Punkte zur&uuml;cksetzen</h4>
<form action="post.htm" method="POST" class="form-horizontal">
<div class="form-group row">
<div class="col text-center">
<button name="resetpoints" type="submit" class="btn btn-outline-primary">Reset</button>
</div>
</div>
</form>
</p>
<!-- Div Group Reset Timers -->
<!-- Div Group EEPROM formatting -->
<hr />
<p>

View File

@ -21,7 +21,7 @@
--white: #fff;
--gray: #6c757d;
--gray-dark: #343a40;
--primary: #FF550B;
--primary: #bb1515;
--secondary: #303030;
--success: #015668;
--info: #0F81C7;
@ -1450,8 +1450,8 @@ fieldset:disabled a.btn {
.btn-primary {
color: #fff;
background-color: #ff550b;
border-color: #ff550b;
background-color: #bb1515;
border-color: #bb1515;
box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15), 0 1px 1px rgba(0, 0, 0, .075)
}
@ -1469,8 +1469,8 @@ fieldset:disabled a.btn {
.btn-primary.disabled,
.btn-primary:disabled {
color: #fff;
background-color: #ff550b;
border-color: #ff550b
background-color: #bb1515;
border-color: #bb1515
}
.btn-primary:not(:disabled):not(.disabled).active,
@ -1761,16 +1761,16 @@ fieldset:disabled a.btn {
}
.btn-outline-primary {
color: #ff550b;
color: #bb1515;
background-color: transparent;
background-image: none;
border-color: #ff550b
border-color: #bb1515
}
.btn-outline-primary:hover {
color: #fff;
background-color: #ff550b;
border-color: #ff550b
background-color: #bb1515;
border-color: #bb1515
}
.btn-outline-primary.focus,
@ -1780,7 +1780,7 @@ fieldset:disabled a.btn {
.btn-outline-primary.disabled,
.btn-outline-primary:disabled {
color: #ff550b;
color: #bb1515;
background-color: transparent
}
@ -1788,8 +1788,8 @@ fieldset:disabled a.btn {
.btn-outline-primary:not(:disabled):not(.disabled):active,
.show>.btn-outline-primary.dropdown-toggle {
color: #fff;
background-color: #ff550b;
border-color: #ff550b
background-color: #bb1515;
border-color: #bb1515
}
.btn-outline-primary:not(:disabled):not(.disabled).active:focus,
@ -2335,7 +2335,7 @@ input[type=submit].btn-block {
.dropdown-item:active {
color: #fff;
text-decoration: none;
background-color: #ff550b
background-color: #bb1515
}
.dropdown-item.disabled,
@ -2661,7 +2661,7 @@ input[type=submit].btn-block {
.custom-control-input:checked~.custom-control-label::before {
color: #fff;
background-color: #ff550b;
background-color: #bb1515;
box-shadow: none
}
@ -2720,7 +2720,7 @@ input[type=submit].btn-block {
}
.custom-checkbox .custom-control-input:checked~.custom-control-label::before {
background-color: #ff550b
background-color: #bb1515
}
.custom-checkbox .custom-control-input:checked~.custom-control-label::after {
@ -2728,7 +2728,7 @@ input[type=submit].btn-block {
}
.custom-checkbox .custom-control-input:indeterminate~.custom-control-label::before {
background-color: #ff550b;
background-color: #bb1515;
box-shadow: none
}
@ -2749,7 +2749,7 @@ input[type=submit].btn-block {
}
.custom-radio .custom-control-input:checked~.custom-control-label::before {
background-color: #ff550b
background-color: #bb1515
}
.custom-radio .custom-control-input:checked~.custom-control-label::after {
@ -2898,7 +2898,7 @@ input[type=submit].btn-block {
width: 1rem;
height: 1rem;
margin-top: -.25rem;
background-color: #ff550b;
background-color: #bb1515;
border: 0;
border-radius: 1rem;
box-shadow: 0 .1rem .25rem rgba(0, 0, 0, .1);
@ -2928,7 +2928,7 @@ input[type=submit].btn-block {
.custom-range::-moz-range-thumb {
width: 1rem;
height: 1rem;
background-color: #ff550b;
background-color: #bb1515;
border: 0;
border-radius: 1rem;
box-shadow: 0 .1rem .25rem rgba(0, 0, 0, .1);
@ -2958,7 +2958,7 @@ input[type=submit].btn-block {
.custom-range::-ms-thumb {
width: 1rem;
height: 1rem;
background-color: #ff550b;
background-color: #bb1515;
border: 0;
border-radius: 1rem;
box-shadow: 0 .1rem .25rem rgba(0, 0, 0, .1);
@ -3063,7 +3063,7 @@ input[type=submit].btn-block {
.nav-pills .nav-link.active,
.nav-pills .show>.nav-link {
color: #fff;
background-color: #ff550b
background-color: #bb1515
}
.nav-fill .nav-item {
@ -3905,7 +3905,7 @@ input[type=submit].btn-block {
.badge-primary {
color: #fff;
background-color: #ff550b
background-color: #bb1515
}
.badge-primary[href]:focus,
@ -4185,7 +4185,7 @@ input[type=submit].btn-block {
color: #6c757d;
text-align: center;
white-space: nowrap;
background-color: #ff550b;
background-color: #bb1515;
transition: width .6s ease
}
@ -5184,7 +5184,7 @@ button.close {
}
.bg-primary {
background-color: #ff550b !important
background-color: #bb1515 !important
}
a.bg-primary:focus,
@ -5320,7 +5320,7 @@ button.bg-dark:hover {
}
.border-primary {
border-color: #ff550b !important
border-color: #bb1515 !important
}
.border-secondary {
@ -8234,7 +8234,7 @@ button.bg-dark:hover {
}
.text-primary {
color: #ff550b !important
color: #bb1515 !important
}
a.text-primary:focus,

View File

@ -13,7 +13,7 @@
#define HOST_NAME "AirsoftTimer_%08X"
#define SHUTDOWN_DELAY_MS 5000
#define RESETABLE_AFTER_STARTUP_MS 30000
#define STARTUP_DELAY_MS 20000
#define GPIO_LORA_TX D3
#define GPIO_LORA_RX D4

View File

@ -9,7 +9,7 @@
#include "dtc.h"
#include "common.h"
#define EEPROM_SIZE_BYTES I2C_DEVICESIZE_24LC01
#define EEPROM_SIZE_BYTES I2C_DEVICESIZE_24LC64
#define EEPROM_ENDURANCE 1000000
typedef enum

View File

@ -11,6 +11,13 @@ typedef enum eSystem_Status
sysStat_Shutdown
} tSystem_Status;
const char sSystem_Status_txt[][9] = {
"Startup",
"Normal",
"Error",
"Shutdown"
};
typedef enum eEERequest
{
EE_IDLE,
@ -31,8 +38,6 @@ typedef struct Globals_s
char DeviceName_ID[43];
char FlashVersion[10];
tSystem_Status systemStatus = sysStat_Startup;
tSystem_Status resumeStatus = sysStat_Startup;
char systemStatustxt[16] = "";
eEERequest requestEEAction = EE_IDLE;
uint16_t eePersistanceAdress;
bool hasDTC;

View File

@ -4,18 +4,25 @@
#ifndef ADMIN_PASSWORD
#error "You need to define ADMIN_PASSWORD for OTA-Update"
#endif
#ifndef WIFI_PASSWORD
#error "You must define an WIFI_PASSWORD for OTA-Update"
#endif
#ifndef WIFI_SSID
#error "You must define an WIFI_SSID for OTA-Update"
#endif
#ifndef WIFI_AP_SSID
#warning "No WIFI_AP_SSID defined. Using DeviceName"
#define WIFI_AP_SSID DEVICE_NAME
#endif
#ifndef WIFI_AP_PASSWORD
#error "You must define an WIFI_AP_PASSWORD for Standalone AP-Mode"
#endif
#ifdef FEATURE_ENABLE_WIFI_CLIENT
#ifndef WIFI_CLIENT_PASSWORD
#error "You must define an WIFI_PASSWORD for OTA-Update"
#endif
#ifndef WIFI_CLIENT_SSID
#error "You must define an WIFI_SSID for OTA-Update"
#endif
#endif
#endif //_SANITYCHECK_H_

View File

@ -27,13 +27,13 @@ upload_speed = 921600
build_flags=
!python git_rev_macro.py
-DATOMIC_FS_UPDATE
;-DFEATURE_ENABLE_WIFI_CLIENT
-DFEATURE_ENABLE_WIFI_CLIENT
;-DFEATURE_ENABLE_LORA
;-DCAPTIVE
-DWIFI_AP_IP_GW=10,0,0,1
-DADMIN_PASSWORD=${wifi_cred.admin_password}
-DWIFI_SSID=${wifi_cred.wifi_ssid}
-DWIFI_PASSWORD=${wifi_cred.wifi_password}
-DWIFI_CLIENT_SSID=${wifi_cred.wifi_client_ssid}
-DWIFI_CLIENT_PASSWORD=${wifi_cred.wifi_client_password}
-DWIFI_AP_SSID=${wifi_cred.wifi_ap_ssid}
-DWIFI_AP_PASSWORD=${wifi_cred.wifi_ap_password}
-DDEVICE_NAME='"Dark Emergency Timer"'

View File

@ -33,7 +33,7 @@ void Debug_Process()
CMD_OVERFLOW
} InputProcessed_t;
static int inputCnt = 0;
static unsigned int inputCnt = 0;
static char inputBuffer[32];
InputProcessed_t InputProcessed = IDLE;
@ -204,8 +204,6 @@ void Debug_dumpConfig()
void Debug_dumpGlobals()
{
Debug_pushMessage("systemStatus: %d\n", globals.systemStatus);
Debug_pushMessage("resumeStatus: %d\n", globals.resumeStatus);
Debug_pushMessage("systemStatustxt: %s\n", globals.systemStatustxt);
Debug_pushMessage("battery_level: %d\n", globals.battery_level);
Debug_pushMessage("loadvoltage_mV: %d\n", globals.loadvoltage_mV);
Debug_pushMessage("requestEEAction: %d\n", globals.requestEEAction);
@ -266,7 +264,7 @@ void Debug_ShowDTCs()
char buff_timestamp[16]; // Format: DD-hh:mm:ss:xxx
char buff_active[9];
Debug_pushMessage("\n timestamp | DTC-Nr. | status | severity\n");
Debug_pushMessage("\n timestamp | DTC-Nr. | status | severity | debugVal\n");
for (uint32_t i = 0; i < MAX_DTC_STORAGE; i++)
{
@ -286,7 +284,7 @@ void Debug_ShowDTCs()
else
strcpy(buff_active, "none");
Debug_pushMessage("%s %7d %8s %8d\n", buff_timestamp, DTCStorage[i].Number, buff_active, DTCStorage[i].severity);
Debug_pushMessage("%s %7d %8s %8d %8d\n", buff_timestamp, DTCStorage[i].Number, buff_active, DTCStorage[i].severity, DTCStorage[i].debugVal);
}
}
}

View File

@ -5,6 +5,5 @@ Globals_t globals;
void initGlobals()
{
globals.systemStatus = sysStat_Startup;
globals.resumeStatus = sysStat_Normal;
globals.requestEEAction = EE_IDLE;
}

View File

@ -89,15 +89,16 @@ void setup()
Serial.begin(115200);
Serial.setDebugOutput(false);
Serial.println("\n\nDark Emergency Timer - by Hiabuto Defense");
Serial.println(globals.DeviceName);
Serial.print("\n\n-------------------START-------------------\n");
Serial.print(globals.DeviceName);
Serial.print("\nby Hiabuto Defense\n");
ClearAllDTC(); // Init DTC-Storage
InitEEPROM();
GetConfig_EEPROM();
GetPersistence_EEPROM();
Serial.print("\nEE-Init done");
Serial.print("EE-Init done\n");
if (i2c_io.begin())
{
@ -133,7 +134,7 @@ void setup()
#ifdef FEATURE_ENABLE_WIFI_CLIENT
WiFi.mode(WIFI_STA);
WiFi.setHostname(globals.DeviceName);
wifiMulti.addAP(QUOTE(WIFI_SSID_CLIENT), QUOTE(WIFI_PASSWORD_CLIENT));
wifiMulti.addAP(QUOTE(WIFI_CLIENT_SSID), QUOTE(WIFI_CLIENT_PASSWORD));
tmrWiFiMaintainConnection.start();
Serial.print("WiFi-Client Initialized\n");
#else
@ -235,8 +236,26 @@ void loop()
#ifdef FEATURE_ENABLE_WIFI_CLIENT
tmrWiFiMaintainConnection.update();
#endif
if (globals.systemStatus == sysStat_Shutdown)
switch (globals.systemStatus)
{
case sysStat_Error:
/* code */
break;
case sysStat_Normal:
/* code */
break;
case sysStat_Shutdown:
SystemShutdown();
break;
case sysStat_Startup:
if (millis() > STARTUP_DELAY_MS)
globals.systemStatus = sysStat_Normal;
break;
default:
break;
}
yield();
}
@ -564,7 +583,7 @@ void ProcessKeyCombos(bool *btnState)
else if (keyCount_Fac2 == 4 && keyCount_Fac3 == 0)
{
Serial.printf("KeyCombo: Reset Timer\n");
if (millis() < RESETABLE_AFTER_STARTUP_MS)
if (globals.systemStatus == sysStat_Startup)
{
OverrideDisplay("RST ", 5000);
PersistenceData.faction_1_timer = 0;
@ -576,7 +595,7 @@ void ProcessKeyCombos(bool *btnState)
else
{
OverrideDisplay("ERR ", 5000);
Serial.printf("ERROR: only %d seconds after Startup!\n", RESETABLE_AFTER_STARTUP_MS / 1000);
Serial.printf("ERROR: only %d seconds after Startup!\n", STARTUP_DELAY_MS / 1000);
}
}

View File

@ -66,7 +66,7 @@ String processor(const String &var)
if (var == "HOSTNAME")
return String(globals.DeviceName);
if (var == "SYSTEM_STATUS")
return String(globals.systemStatustxt);
return String(sSystem_Status_txt[globals.systemStatus]);
if (var == "SW_VERSION")
{
char buffer[6];
@ -239,6 +239,14 @@ void WebserverPOST_Callback(AsyncWebServerRequest *request)
{
globals.systemStatus = sysStat_Shutdown;
}
if (p->name() == "resetpoints")
{
PersistenceData.faction_1_timer = 0;
PersistenceData.faction_2_timer = 0;
PersistenceData.faction_3_timer = 0;
PersistenceData.activeFaction = NONE;
globals.requestEEAction == EE_PDS_SAVE;
}
// end: POST Form Maintenance
// begin: POST Form Settings