Merge pull request #184 from cyberman54/development

v1.6.1
This commit is contained in:
Verkehrsrot 2018-10-17 07:32:44 +02:00 committed by GitHub
commit 1041137de8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 25 additions and 9 deletions

View File

@ -16,5 +16,6 @@ typedef struct {
} cmd_t;
void rcommand(uint8_t cmd[], uint8_t cmdlength);
void do_reset();
#endif

View File

@ -27,7 +27,7 @@ description = Paxcounter is a proof-of-concept ESP32 device for metering passeng
[common]
; for release_version use max. 10 chars total, use any decimal format like "a.b.c"
release_version = 1.6.0
release_version = 1.6.1
; DEBUG LEVEL: For production run set to 0, otherwise device will leak RAM while running!
; 0=None, 1=Error, 2=Warn, 3=Info, 4=Debug, 5=Verbose
debug_level = 0

View File

@ -15,7 +15,7 @@ void doHousekeeping() {
// check if update mode trigger switch was set
if (cfg.runmode == 1)
ESP.restart();
do_reset();
// task storage debugging //
ESP_LOGD(TAG, "Wifiloop %d bytes left",
@ -60,7 +60,7 @@ void doHousekeeping() {
get_salt(); // get new salt for salting hashes
if (esp_get_minimum_free_heap_size() <= MEM_LOW) // check again
esp_restart(); // memory leak, reset device
do_reset(); // memory leak, reset device
}
} // doHousekeeping()

View File

@ -122,7 +122,18 @@ void ledLoop(void *parameter) {
LEDState =
((millis() % 200) < 20) ? LED_ON : LED_OFF; // TX data pending
} else if (LMIC.opmode & (OP_TXDATA | OP_TXRXPEND)) {
LEDColor = COLOR_BLUE;
// select color to blink by message port
switch (LMIC.pendTxPort) {
case STATUSPORT:
LEDColor = COLOR_RED;
break;
case CONFIGPORT:
LEDColor = COLOR_CYAN;
break;
default:
LEDColor = COLOR_BLUE;
break;
}
// small blink 10ms on each 1/2sec (not when joining)
LEDState = ((millis() % 500) < 10) ? LED_ON : LED_OFF;
// This should not happen so indicate a problem

View File

@ -53,7 +53,7 @@
#define COUNTERPORT 1 // Port on which device sends counts
#define RCMDPORT 2 // Port on which device listenes for remote commands
#define STATUSPORT 2 // Port on which device sends remote command results
#define CONFIGPORT 3 // Port on which device sends gps query results
#define CONFIGPORT 3 // Port on which device sends config query results
#define GPSPORT 4 // Port on which device sends gps query results
#define BUTTONPORT 5 // Port on which device sends button pressed signal
#define LPP1PORT 1 // Port for Cayenne LPP 1.0 dynamic sensor encoding

View File

@ -5,15 +5,19 @@
// Local logging tag
static const char TAG[] = "main";
// helper function
void do_reset() {
ESP_LOGI(TAG, "Remote command: restart device");
LMIC_shutdown();
esp_restart();
}
// set of functions that can be triggered by remote commands
void set_reset(uint8_t val[]) {
switch (val[0]) {
case 0: // restart device
ESP_LOGI(TAG, "Remote command: restart device");
sprintf(display_line6, "Reset pending");
vTaskDelay(10000 / portTICK_PERIOD_MS); // wait for LMIC to confirm LoRa
// downlink to server
esp_restart();
do_reset();
break;
case 1: // reset MAC counter
ESP_LOGI(TAG, "Remote command: reset MAC counter");