Compare commits
2 Commits
fbe5f0b202
...
b627f52272
Author | SHA1 | Date | |
---|---|---|---|
b627f52272 | |||
d723290e57 |
@ -32,6 +32,7 @@ typedef struct Globals_s
|
|||||||
bool hasDTC; /**< Flag indicating the presence of Diagnostic Trouble Codes (DTC) */
|
bool hasDTC; /**< Flag indicating the presence of Diagnostic Trouble Codes (DTC) */
|
||||||
bool measurementActive; /**< Flag indicating active measurement */
|
bool measurementActive; /**< Flag indicating active measurement */
|
||||||
uint32_t measuredPulses; /**< Number of measured pulses */
|
uint32_t measuredPulses; /**< Number of measured pulses */
|
||||||
|
bool toggle_wifi;
|
||||||
} Globals_t;
|
} Globals_t;
|
||||||
|
|
||||||
extern Globals_t globals; /**< Global variable struct */
|
extern Globals_t globals; /**< Global variable struct */
|
||||||
|
@ -11,20 +11,13 @@
|
|||||||
[platformio]
|
[platformio]
|
||||||
extra_configs =
|
extra_configs =
|
||||||
wifi_credentials.ini
|
wifi_credentials.ini
|
||||||
default_envs = pcb_rev_1-3, pcb_rev_1-2
|
default_envs = pcb_rev_1-3_serial, pcb_rev_1-3_ota, pcb_rev_1-2_serial, pcb_rev_1-2_ota
|
||||||
|
|
||||||
[env]
|
[env]
|
||||||
platform = espressif8266
|
platform = espressif8266
|
||||||
board = d1_mini
|
board = d1_mini
|
||||||
framework = arduino
|
framework = arduino
|
||||||
|
upload_speed = 921600
|
||||||
upload_speed = 921600
|
|
||||||
|
|
||||||
upload_protocol = espota
|
|
||||||
upload_port = 10.0.1.14
|
|
||||||
upload_flags =
|
|
||||||
--port=8266
|
|
||||||
--auth=${wifi_cred.admin_password}
|
|
||||||
|
|
||||||
build_flags =
|
build_flags =
|
||||||
!python codegen/git_rev_macro.py
|
!python codegen/git_rev_macro.py
|
||||||
@ -58,21 +51,48 @@ lib_deps =
|
|||||||
coryjfowler/mcp_can @ ^1.5.0
|
coryjfowler/mcp_can @ ^1.5.0
|
||||||
mikalhart/TinyGPSPlus @ ^1.0.3
|
mikalhart/TinyGPSPlus @ ^1.0.3
|
||||||
|
|
||||||
[env:pcb_rev_1-3]
|
|
||||||
;build_type = debug
|
[env:pcb_rev_1-3_serial]
|
||||||
|
extends = env
|
||||||
custom_pcb_revision = 3
|
custom_pcb_revision = 3
|
||||||
|
upload_protocol = esptool
|
||||||
build_flags =
|
build_flags =
|
||||||
${env.build_flags}
|
${env.build_flags}
|
||||||
-DPCB_REV=${this.custom_pcb_revision}
|
-DPCB_REV=${this.custom_pcb_revision}
|
||||||
|
|
||||||
board_build.ldscript = eagle.flash.4m1m.ld
|
board_build.ldscript = eagle.flash.4m1m.ld
|
||||||
|
|
||||||
[env:pcb_rev_1-2]
|
[env:pcb_rev_1-3_ota]
|
||||||
;build_type = debug
|
extends = env
|
||||||
|
custom_pcb_revision = 3
|
||||||
|
upload_protocol = espota
|
||||||
|
upload_port = 10.0.1.14
|
||||||
|
upload_flags =
|
||||||
|
--port=8266
|
||||||
|
--auth=${wifi_cred.admin_password}
|
||||||
|
build_flags =
|
||||||
|
${env.build_flags}
|
||||||
|
-DPCB_REV=${this.custom_pcb_revision}
|
||||||
|
board_build.ldscript = eagle.flash.4m1m.ld
|
||||||
|
|
||||||
|
|
||||||
|
[env:pcb_rev_1-2_serial]
|
||||||
|
extends = env
|
||||||
custom_pcb_revision = 2
|
custom_pcb_revision = 2
|
||||||
|
upload_protocol = esptool
|
||||||
build_flags =
|
build_flags =
|
||||||
${env.build_flags}
|
${env.build_flags}
|
||||||
-DPCB_REV=${this.custom_pcb_revision}
|
-DPCB_REV=${this.custom_pcb_revision}
|
||||||
|
|
||||||
board_build.ldscript = eagle.flash.4m1m.ld
|
board_build.ldscript = eagle.flash.4m1m.ld
|
||||||
|
|
||||||
|
[env:pcb_rev_1-2_ota]
|
||||||
|
extends = env
|
||||||
|
custom_pcb_revision = 2
|
||||||
|
upload_protocol = espota
|
||||||
|
upload_port = 10.0.1.14
|
||||||
|
upload_flags =
|
||||||
|
--port=8266
|
||||||
|
--auth=${wifi_cred.admin_password}
|
||||||
|
build_flags =
|
||||||
|
${env.build_flags}
|
||||||
|
-DPCB_REV=${this.custom_pcb_revision}
|
||||||
|
board_build.ldscript = eagle.flash.4m1m.ld
|
||||||
|
@ -26,6 +26,7 @@ void Debug_dumpPersistance();
|
|||||||
void Debug_ShowDTCs();
|
void Debug_ShowDTCs();
|
||||||
void Debug_dumpGlobals();
|
void Debug_dumpGlobals();
|
||||||
void Debug_printHelp();
|
void Debug_printHelp();
|
||||||
|
void Debug_Purge();
|
||||||
const char *uint32_to_binary_string(uint32_t num);
|
const char *uint32_to_binary_string(uint32_t num);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -273,6 +274,10 @@ void processCmdDebug(String command)
|
|||||||
Websocket_PushNotification("Debug Success Notification", success);
|
Websocket_PushNotification("Debug Success Notification", success);
|
||||||
else if (command == "notify_info")
|
else if (command == "notify_info")
|
||||||
Websocket_PushNotification("Debug Info Notification", info);
|
Websocket_PushNotification("Debug Info Notification", info);
|
||||||
|
else if (command == "purge")
|
||||||
|
Debug_Purge();
|
||||||
|
else if (command == "toggle_wifi")
|
||||||
|
globals.toggle_wifi = true;
|
||||||
else
|
else
|
||||||
Debug_pushMessage("unknown Command\n");
|
Debug_pushMessage("unknown Command\n");
|
||||||
}
|
}
|
||||||
@ -488,6 +493,18 @@ void Debug_printHelp()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Start purging for 10 pulses.
|
||||||
|
*/
|
||||||
|
void Debug_Purge()
|
||||||
|
{
|
||||||
|
globals.purgePulses = 10;
|
||||||
|
globals.resumeStatus = globals.systemStatus;
|
||||||
|
globals.systemStatus = sysStat_Purge;
|
||||||
|
|
||||||
|
Debug_pushMessage("Purging 10 pulses\n");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Convert a uint32_t value to a binary string with nibbles separated by a space.
|
* @brief Convert a uint32_t value to a binary string with nibbles separated by a space.
|
||||||
*
|
*
|
||||||
@ -501,12 +518,15 @@ void Debug_printHelp()
|
|||||||
* @return A pointer to a const char string containing the binary representation
|
* @return A pointer to a const char string containing the binary representation
|
||||||
* of the input number with nibbles separated by a space.
|
* of the input number with nibbles separated by a space.
|
||||||
*/
|
*/
|
||||||
const char* uint32_to_binary_string(uint32_t num) {
|
const char *uint32_to_binary_string(uint32_t num)
|
||||||
|
{
|
||||||
static char binary_str[65]; // 32 bits + 31 spaces + null terminator
|
static char binary_str[65]; // 32 bits + 31 spaces + null terminator
|
||||||
int i, j;
|
int i, j;
|
||||||
for (i = 31, j = 0; i >= 0; i--, j++) {
|
for (i = 31, j = 0; i >= 0; i--, j++)
|
||||||
|
{
|
||||||
binary_str[j] = ((num >> i) & 1) ? '1' : '0';
|
binary_str[j] = ((num >> i) & 1) ? '1' : '0';
|
||||||
if (i % 4 == 0 && i != 0) {
|
if (i % 4 == 0 && i != 0)
|
||||||
|
{
|
||||||
binary_str[++j] = ' '; // Insert space after every nibble
|
binary_str[++j] = ' '; // Insert space after every nibble
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,4 +26,5 @@ void initGlobals()
|
|||||||
globals.systemStatus = sysStat_Startup;
|
globals.systemStatus = sysStat_Startup;
|
||||||
globals.measurementActive = false;
|
globals.measurementActive = false;
|
||||||
globals.measuredPulses = 0;
|
globals.measuredPulses = 0;
|
||||||
|
globals.toggle_wifi = false;
|
||||||
}
|
}
|
||||||
|
@ -249,6 +249,12 @@ void loop()
|
|||||||
DTC_Process();
|
DTC_Process();
|
||||||
Debug_Process();
|
Debug_Process();
|
||||||
|
|
||||||
|
if (globals.toggle_wifi == true){
|
||||||
|
|
||||||
|
globals.toggle_wifi = false;
|
||||||
|
toggleWiFiAP();
|
||||||
|
}
|
||||||
|
|
||||||
// Handle OTA updates and update cyclic EEPROM tasks for Persistence Data Structure (PDS)
|
// Handle OTA updates and update cyclic EEPROM tasks for Persistence Data Structure (PDS)
|
||||||
ArduinoOTA.handle();
|
ArduinoOTA.handle();
|
||||||
EEPROMCyclicPDSTicker.update();
|
EEPROMCyclicPDSTicker.update();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user