Merge branch 'master' of https://github.com/cyberman54/ESP32-Paxcounter
This commit is contained in:
commit
96ded0a87f
@ -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 1-2: Battery or USB Voltage [mV], 0 if no battery probe
|
||||||
byte 3-10: Uptime [seconds]
|
byte 3-10: Uptime [seconds]
|
||||||
bytes 11-14: CPU temperature [°C]
|
byte 11: CPU temperature [°C]
|
||||||
bytes 15-18: Free RAM [bytes]
|
bytes 12-15: Free RAM [bytes]
|
||||||
|
|
||||||
**Port #3:** Device configuration query result
|
**Port #3:** Device configuration query result
|
||||||
|
|
||||||
|
@ -28,12 +28,12 @@ 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.
|
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]
|
[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
|
;platform_espressif32 = https://github.com/platformio/platform-espressif32.git#feature/stage
|
||||||
board_build.partitions = no_ota.csv
|
board_build.partitions = no_ota.csv
|
||||||
lib_deps_all =
|
lib_deps_all =
|
||||||
lib_deps_display =
|
lib_deps_display =
|
||||||
U8g2@>=2.23.12
|
U8g2@>=2.23.16
|
||||||
lib_deps_rgbled =
|
lib_deps_rgbled =
|
||||||
SmartLeds@>=1.1.3
|
SmartLeds@>=1.1.3
|
||||||
lib_deps_gps =
|
lib_deps_gps =
|
||||||
@ -44,11 +44,11 @@ build_flags =
|
|||||||
; otherwise device may leak RAM
|
; otherwise device may leak RAM
|
||||||
;
|
;
|
||||||
; None
|
; None
|
||||||
; -DCORE_DEBUG_LEVEL=0
|
-DCORE_DEBUG_LEVEL=0
|
||||||
; Error
|
; Error
|
||||||
; -DCORE_DEBUG_LEVEL=1
|
; -DCORE_DEBUG_LEVEL=1
|
||||||
; Warn
|
; Warn
|
||||||
-DCORE_DEBUG_LEVEL=2
|
; -DCORE_DEBUG_LEVEL=2
|
||||||
; Info
|
; Info
|
||||||
; -DCORE_DEBUG_LEVEL=3
|
; -DCORE_DEBUG_LEVEL=3
|
||||||
; Debug
|
; Debug
|
||||||
|
@ -18,7 +18,7 @@ function Decoder(bytes, port) {
|
|||||||
|
|
||||||
if (port === 2) {
|
if (port === 2) {
|
||||||
// device status data
|
// 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']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ function Decoder(bytes, port) {
|
|||||||
if (bytes.length > 4) {
|
if (bytes.length > 4) {
|
||||||
decoded.latitude = ((bytes[i++] << 24) | (bytes[i++] << 16) | (bytes[i++] << 8) | bytes[i++]);
|
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.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.hdop = (bytes[i++] << 8) | (bytes[i++]);
|
||||||
decoded.altitude = (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.battery = ((bytes[i++] << 8) | bytes[i++]);
|
||||||
decoded.uptime = ((bytes[i++] << 56) | (bytes[i++] << 48) | (bytes[i++] << 40) | (bytes[i++] << 32) |
|
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++]);
|
(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) {
|
if (port === 5) {
|
||||||
var i = 0;
|
var i = 0;
|
||||||
decoded.button = (bytes[i++]);
|
decoded.button = bytes[i++];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (port === 6) {
|
if (port === 6) {
|
||||||
var i = 0;
|
var i = 0;
|
||||||
decoded.rssi = (bytes[i++]);
|
decoded.rssi = bytes[i++];
|
||||||
decoded.beacon = (bytes[i++]);
|
decoded.beacon = bytes[i++];
|
||||||
}
|
}
|
||||||
|
|
||||||
return decoded;
|
return decoded;
|
||||||
|
@ -54,7 +54,6 @@ void PayloadConvert::addConfig(configData_t value) {
|
|||||||
|
|
||||||
void PayloadConvert::addStatus(uint16_t voltage, uint64_t uptime,
|
void PayloadConvert::addStatus(uint16_t voltage, uint64_t uptime,
|
||||||
float cputemp, uint32_t mem) {
|
float cputemp, uint32_t mem) {
|
||||||
uint32_t temp = (uint32_t)cputemp;
|
|
||||||
buffer[cursor++] = highByte(voltage);
|
buffer[cursor++] = highByte(voltage);
|
||||||
buffer[cursor++] = lowByte(voltage);
|
buffer[cursor++] = lowByte(voltage);
|
||||||
buffer[cursor++] = (byte)((uptime & 0xFF00000000000000) >> 56);
|
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 & 0x0000000000FF0000) >> 16);
|
||||||
buffer[cursor++] = (byte)((uptime & 0x000000000000FF00) >> 8);
|
buffer[cursor++] = (byte)((uptime & 0x000000000000FF00) >> 8);
|
||||||
buffer[cursor++] = (byte)((uptime & 0x00000000000000FF));
|
buffer[cursor++] = (byte)((uptime & 0x00000000000000FF));
|
||||||
buffer[cursor++] = (byte)((temp & 0xFF000000) >> 24);
|
buffer[cursor++] = (byte)(cputemp);
|
||||||
buffer[cursor++] = (byte)((temp & 0x00FF0000) >> 16);
|
|
||||||
buffer[cursor++] = (byte)((temp & 0x0000FF00) >> 8);
|
|
||||||
buffer[cursor++] = (byte)((temp & 0x000000FF));
|
|
||||||
buffer[cursor++] = (byte)((mem & 0xFF000000) >> 24);
|
buffer[cursor++] = (byte)((mem & 0xFF000000) >> 24);
|
||||||
buffer[cursor++] = (byte)((mem & 0x00FF0000) >> 16);
|
buffer[cursor++] = (byte)((mem & 0x00FF0000) >> 16);
|
||||||
buffer[cursor++] = (byte)((mem & 0x0000FF00) >> 8);
|
buffer[cursor++] = (byte)((mem & 0x0000FF00) >> 8);
|
||||||
@ -131,7 +127,7 @@ void PayloadConvert::addStatus(uint16_t voltage, uint64_t uptime,
|
|||||||
float cputemp, uint32_t mem) {
|
float cputemp, uint32_t mem) {
|
||||||
writeUint16(voltage);
|
writeUint16(voltage);
|
||||||
writeUptime(uptime);
|
writeUptime(uptime);
|
||||||
writeTemperature(cputemp);
|
writeUint8((byte)cputemp);
|
||||||
writeUint32(mem);
|
writeUint32(mem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,7 +138,7 @@ void set_loraadr(uint8_t val[]) {
|
|||||||
ESP_LOGI(TAG, "Remote command: set LoRa ADR mode to %s",
|
ESP_LOGI(TAG, "Remote command: set LoRa ADR mode to %s",
|
||||||
val[0] ? "on" : "off");
|
val[0] ? "on" : "off");
|
||||||
cfg.adrmode = val[0] ? 1 : 0;
|
cfg.adrmode = val[0] ? 1 : 0;
|
||||||
LMIC_setAdrMode(cfg.adrmode);
|
LMIC_setAdrMode(cfg.adrmode);
|
||||||
#else
|
#else
|
||||||
ESP_LOGW(TAG, "Remote command: LoRa not implemented");
|
ESP_LOGW(TAG, "Remote command: LoRa not implemented");
|
||||||
#endif // HAS_LORA
|
#endif // HAS_LORA
|
||||||
@ -267,10 +267,13 @@ void rcommand(uint8_t cmd[], uint8_t cmdlength) {
|
|||||||
TAG,
|
TAG,
|
||||||
"Remote command x%02X called with missing parameter(s), skipped",
|
"Remote command x%02X called with missing parameter(s), skipped",
|
||||||
table[i].opcode);
|
table[i].opcode);
|
||||||
break; // exit table lookup loop, command was found
|
break; // command found -> exit table lookup loop
|
||||||
} // command validation
|
} // end of command validation
|
||||||
} // command table lookup loop
|
} // 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
|
} // command parsing loop
|
||||||
|
|
||||||
if (storeflag)
|
if (storeflag)
|
||||||
|
Loading…
Reference in New Issue
Block a user