From 8873a7ce705bd1a7c08461c8df74c898cca62127 Mon Sep 17 00:00:00 2001 From: Klaus K Wilting Date: Sat, 11 Aug 2018 21:47:51 +0200 Subject: [PATCH 1/8] cpu temp reduced to 8bit --- src/TTN/packed_decoder.js | 2 +- src/TTN/plain_decoder.js | 10 +++++----- src/payload.cpp | 8 ++------ 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/TTN/packed_decoder.js b/src/TTN/packed_decoder.js index 6bf29f09..21097634 100644 --- a/src/TTN/packed_decoder.js +++ b/src/TTN/packed_decoder.js @@ -18,7 +18,7 @@ function Decoder(bytes, port) { if (port === 2) { // device status data - return decode(bytes, [uint16, uptime, temperature, uint32], ['voltage', 'uptime', 'cputemp', 'memory']); + return decode(bytes, [uint16, uptime, uint8, uint32], ['voltage', 'uptime', 'cputemp', 'memory']); } diff --git a/src/TTN/plain_decoder.js b/src/TTN/plain_decoder.js index 32850474..ba674d35 100644 --- a/src/TTN/plain_decoder.js +++ b/src/TTN/plain_decoder.js @@ -13,7 +13,7 @@ function Decoder(bytes, port) { if (bytes.length > 4) { decoded.latitude = ((bytes[i++] << 24) | (bytes[i++] << 16) | (bytes[i++] << 8) | bytes[i++]); decoded.longitude = ((bytes[i++] << 24) | (bytes[i++] << 16) | (bytes[i++] << 8) | bytes[i++]); - decoded.sats = (bytes[i++]); + decoded.sats = bytes[i++]; decoded.hdop = (bytes[i++] << 8) | (bytes[i++]); decoded.altitude = (bytes[i++] << 8) | (bytes[i++]); } @@ -24,18 +24,18 @@ function Decoder(bytes, port) { decoded.battery = ((bytes[i++] << 8) | bytes[i++]); decoded.uptime = ((bytes[i++] << 56) | (bytes[i++] << 48) | (bytes[i++] << 40) | (bytes[i++] << 32) | (bytes[i++] << 24) | (bytes[i++] << 16) | (bytes[i++] << 8) | bytes[i++]); - decoded.temp = ((bytes[i++] << 24) | (bytes[i++] << 16) | (bytes[i++] << 8) | bytes[i++]); + decoded.temp = bytes[i++]; } if (port === 5) { var i = 0; - decoded.button = (bytes[i++]); + decoded.button = bytes[i++]; } if (port === 6) { var i = 0; - decoded.rssi = (bytes[i++]); - decoded.beacon = (bytes[i++]); + decoded.rssi = bytes[i++]; + decoded.beacon = bytes[i++]; } return decoded; diff --git a/src/payload.cpp b/src/payload.cpp index ab3d2c91..87334b83 100644 --- a/src/payload.cpp +++ b/src/payload.cpp @@ -54,7 +54,6 @@ void PayloadConvert::addConfig(configData_t value) { void PayloadConvert::addStatus(uint16_t voltage, uint64_t uptime, float cputemp, uint32_t mem) { - uint32_t temp = (uint32_t)cputemp; buffer[cursor++] = highByte(voltage); buffer[cursor++] = lowByte(voltage); buffer[cursor++] = (byte)((uptime & 0xFF00000000000000) >> 56); @@ -65,10 +64,7 @@ void PayloadConvert::addStatus(uint16_t voltage, uint64_t uptime, buffer[cursor++] = (byte)((uptime & 0x0000000000FF0000) >> 16); buffer[cursor++] = (byte)((uptime & 0x000000000000FF00) >> 8); buffer[cursor++] = (byte)((uptime & 0x00000000000000FF)); - buffer[cursor++] = (byte)((temp & 0xFF000000) >> 24); - buffer[cursor++] = (byte)((temp & 0x00FF0000) >> 16); - buffer[cursor++] = (byte)((temp & 0x0000FF00) >> 8); - buffer[cursor++] = (byte)((temp & 0x000000FF)); + buffer[cursor++] = (byte)(cputemp); buffer[cursor++] = (byte)((mem & 0xFF000000) >> 24); buffer[cursor++] = (byte)((mem & 0x00FF0000) >> 16); buffer[cursor++] = (byte)((mem & 0x0000FF00) >> 8); @@ -131,7 +127,7 @@ void PayloadConvert::addStatus(uint16_t voltage, uint64_t uptime, float cputemp, uint32_t mem) { writeUint16(voltage); writeUptime(uptime); - writeTemperature(cputemp); + writeUint8((byte)cputemp); writeUint32(mem); } From f659d18390837e589760b94506759ee5bca1d845 Mon Sep 17 00:00:00 2001 From: Klaus K Wilting Date: Tue, 14 Aug 2018 15:39:36 +0200 Subject: [PATCH 2/8] bugfix rcommand.cpp (illegal commands chrash) --- src/rcommand.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/rcommand.cpp b/src/rcommand.cpp index 8899a805..0335877e 100644 --- a/src/rcommand.cpp +++ b/src/rcommand.cpp @@ -138,7 +138,7 @@ void set_loraadr(uint8_t val[]) { ESP_LOGI(TAG, "Remote command: set LoRa ADR mode to %s", val[0] ? "on" : "off"); cfg.adrmode = val[0] ? 1 : 0; -LMIC_setAdrMode(cfg.adrmode); + LMIC_setAdrMode(cfg.adrmode); #else ESP_LOGW(TAG, "Remote command: LoRa not implemented"); #endif // HAS_LORA @@ -267,10 +267,11 @@ void rcommand(uint8_t cmd[], uint8_t cmdlength) { TAG, "Remote command x%02X called with missing parameter(s), skipped", table[i].opcode); - break; // exit table lookup loop, command was found - } // command validation - } // command table lookup loop - + break; // command found -> exit table lookup loop + } // end of command validation + } // end of command table lookup loop + if (i < 0) // command not found -> exit parser + break; } // command parsing loop if (storeflag) From f6dc5efab33ee0a09bd87c5fb291813c19ced559 Mon Sep 17 00:00:00 2001 From: Klaus K Wilting Date: Tue, 14 Aug 2018 15:50:17 +0200 Subject: [PATCH 3/8] espressif 1.3.0 --- platformio.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio.ini b/platformio.ini index 98296872..498ffd27 100644 --- a/platformio.ini +++ b/platformio.ini @@ -28,7 +28,7 @@ env_default = generic description = Paxcounter is a proof-of-concept ESP32 device for metering passenger flows in realtime. It counts how many mobile devices are around. [common_env_data] -platform_espressif32 = espressif32@1.2.0 +platform_espressif32 = espressif32@1.3.0 ;platform_espressif32 = https://github.com/platformio/platform-espressif32.git#feature/stage board_build.partitions = no_ota.csv lib_deps_all = From b9327100f2079705a57e1ffb8e90dd71ef15f944 Mon Sep 17 00:00:00 2001 From: cyberman54 Date: Tue, 14 Aug 2018 22:28:34 +0200 Subject: [PATCH 4/8] rcommand.cpp: bugfix issue #139 --- src/rcommand.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/rcommand.cpp b/src/rcommand.cpp index 0335877e..84af6cd6 100644 --- a/src/rcommand.cpp +++ b/src/rcommand.cpp @@ -267,11 +267,13 @@ void rcommand(uint8_t cmd[], uint8_t cmdlength) { TAG, "Remote command x%02X called with missing parameter(s), skipped", table[i].opcode); - break; // command found -> exit table lookup loop - } // end of command validation - } // end of command table lookup loop - if (i < 0) // command not found -> exit parser + break; // command found -> exit table lookup loop + } // end of command validation + } // end of command table lookup loop + if (i < 0) { // command not found -> exit parser + ESP_LOGI(TAG, "Unknown remote command x%02X, ignored", cmd[cursor]); break; + } } // command parsing loop if (storeflag) From 758918bf7e6c2acaebcbb6456bcf3d4e5e914826 Mon Sep 17 00:00:00 2001 From: cyberman54 Date: Tue, 14 Aug 2018 22:41:21 +0200 Subject: [PATCH 5/8] espressif32 v1.3.0 --- README.md | 4 ++-- platformio.ini | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 6d5b64d5..8c6400aa 100644 --- a/README.md +++ b/README.md @@ -140,8 +140,8 @@ Hereafter described is the default *plain* format, which uses MSB bit numbering. byte 1-2: Battery or USB Voltage [mV], 0 if no battery probe byte 3-10: Uptime [seconds] - bytes 11-14: CPU temperature [°C] - bytes 15-18: Free RAM [bytes] + byte 11: CPU temperature [°C] + bytes 12-15: Free RAM [bytes] **Port #3:** Device configuration query result diff --git a/platformio.ini b/platformio.ini index 98296872..6f198ad0 100644 --- a/platformio.ini +++ b/platformio.ini @@ -28,7 +28,7 @@ env_default = generic description = Paxcounter is a proof-of-concept ESP32 device for metering passenger flows in realtime. It counts how many mobile devices are around. [common_env_data] -platform_espressif32 = espressif32@1.2.0 +platform_espressif32 = espressif32@1.3.0 ;platform_espressif32 = https://github.com/platformio/platform-espressif32.git#feature/stage board_build.partitions = no_ota.csv lib_deps_all = @@ -48,9 +48,9 @@ build_flags = ; Error ; -DCORE_DEBUG_LEVEL=1 ; Warn - -DCORE_DEBUG_LEVEL=2 +; -DCORE_DEBUG_LEVEL=2 ; Info -; -DCORE_DEBUG_LEVEL=3 + -DCORE_DEBUG_LEVEL=3 ; Debug ; -DCORE_DEBUG_LEVEL=4 ; Verbose From 4883497a6bbd981e07e36c4af40acdcae4948639 Mon Sep 17 00:00:00 2001 From: Klaus K Wilting Date: Wed, 15 Aug 2018 21:02:15 +0200 Subject: [PATCH 6/8] rcommand.cpp: code sanitization --- src/rcommand.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/rcommand.cpp b/src/rcommand.cpp index 0335877e..76f7ba9b 100644 --- a/src/rcommand.cpp +++ b/src/rcommand.cpp @@ -269,10 +269,10 @@ void rcommand(uint8_t cmd[], uint8_t cmdlength) { table[i].opcode); break; // command found -> exit table lookup loop } // end of command validation - } // end of command table lookup loop - if (i < 0) // command not found -> exit parser + } // end of table lookup loop + if (i < 0) // command not found -> exit parser loop break; - } // command parsing loop + } // end of command parsing loop if (storeflag) saveConfig(); From 051272063553be51efcdf6e87416b71da27486a3 Mon Sep 17 00:00:00 2001 From: Klaus K Wilting Date: Wed, 15 Aug 2018 21:04:48 +0200 Subject: [PATCH 7/8] upgrade u8g2 in platformio.ini --- platformio.ini | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/platformio.ini b/platformio.ini index 498ffd27..bb895931 100644 --- a/platformio.ini +++ b/platformio.ini @@ -33,7 +33,7 @@ platform_espressif32 = espressif32@1.3.0 board_build.partitions = no_ota.csv lib_deps_all = lib_deps_display = - U8g2@>=2.23.12 + U8g2@>=2.23.16 lib_deps_rgbled = SmartLeds@>=1.1.3 lib_deps_gps = @@ -44,11 +44,11 @@ build_flags = ; otherwise device may leak RAM ; ; None -; -DCORE_DEBUG_LEVEL=0 + -DCORE_DEBUG_LEVEL=0 ; Error ; -DCORE_DEBUG_LEVEL=1 ; Warn - -DCORE_DEBUG_LEVEL=2 +; -DCORE_DEBUG_LEVEL=2 ; Info ; -DCORE_DEBUG_LEVEL=3 ; Debug From aa5909e613dc507d668e693dfadb654bd4fbe014 Mon Sep 17 00:00:00 2001 From: Verkehrsrot Date: Thu, 16 Aug 2018 14:33:54 +0200 Subject: [PATCH 8/8] Update platformio.ini --- platformio.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio.ini b/platformio.ini index ce164811..bb895931 100644 --- a/platformio.ini +++ b/platformio.ini @@ -50,7 +50,7 @@ build_flags = ; Warn ; -DCORE_DEBUG_LEVEL=2 ; Info - -DCORE_DEBUG_LEVEL=3 +; -DCORE_DEBUG_LEVEL=3 ; Debug ; -DCORE_DEBUG_LEVEL=4 ; Verbose