Merge pull request #151 from cyberman54/development
sync ota-test to development
This commit is contained in:
commit
ea92c7fbac
2
.gitignore
vendored
2
.gitignore
vendored
@ -5,8 +5,8 @@
|
|||||||
.vscode/c_cpp_properties.json
|
.vscode/c_cpp_properties.json
|
||||||
.vscode/settings.json
|
.vscode/settings.json
|
||||||
.vscode/launch.json
|
.vscode/launch.json
|
||||||
src/loraconf.h
|
|
||||||
.vscode/*.db
|
.vscode/*.db
|
||||||
.vscode/.browse.c_cpp.db*
|
.vscode/.browse.c_cpp.db*
|
||||||
.clang_complete
|
.clang_complete
|
||||||
.gcc-flags.json
|
.gcc-flags.json
|
||||||
|
src/loraconf.h
|
||||||
|
@ -140,9 +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]
|
||||||
bytes 19-20: Last reset reasons core 0 / core 1
|
|
||||||
|
|
||||||
**Port #3:** Device configuration query result
|
**Port #3:** Device configuration query result
|
||||||
|
|
||||||
|
@ -790,8 +790,12 @@ void radio_irq_handler (u1_t dio) {
|
|||||||
// now read the FIFO
|
// now read the FIFO
|
||||||
readBuf(RegFifo, LMIC.frame, LMIC.dataLen);
|
readBuf(RegFifo, LMIC.frame, LMIC.dataLen);
|
||||||
// read rx quality parameters
|
// read rx quality parameters
|
||||||
LMIC.snr = readReg(LORARegPktSnrValue); // SNR [dB] * 4
|
//LMIC.snr = readReg(LORARegPktSnrValue); // SNR [dB] * 4
|
||||||
LMIC.rssi = readReg(LORARegPktRssiValue) - 125 + 64; // RSSI [dBm] (-196...+63)
|
LMIC.snr = readReg(LORARegPktSnrValue) / 4;
|
||||||
|
//LMIC.rssi = readReg(LORARegPktRssiValue) - 125 + 64; // RSSI [dBm] (-196...+63)
|
||||||
|
LMIC.rssi = readReg(LORARegPktRssiValue) - 157; // RFI_HF for 868 and 915MHZ band
|
||||||
|
if (LMIC.snr < 0)
|
||||||
|
LMIC.rssi += LMIC.snr;
|
||||||
} else if( flags & IRQ_LORA_RXTOUT_MASK ) {
|
} else if( flags & IRQ_LORA_RXTOUT_MASK ) {
|
||||||
// indicate timeout
|
// indicate timeout
|
||||||
LMIC.dataLen = 0;
|
LMIC.dataLen = 0;
|
||||||
|
@ -31,7 +31,7 @@ description = Paxcounter is a proof-of-concept ESP32 device for metering passeng
|
|||||||
user = cyberman54
|
user = cyberman54
|
||||||
repository = paxcounter
|
repository = paxcounter
|
||||||
package = esp32-paxcounter
|
package = esp32-paxcounter
|
||||||
api_token = 9f02e2a2374c278fd79d5bcf4b4442fca9752012
|
api_token = ***
|
||||||
|
|
||||||
[wifi]
|
[wifi]
|
||||||
ssid = ***
|
ssid = ***
|
||||||
@ -42,7 +42,7 @@ platform = https://github.com/platformio/platform-espressif32.git
|
|||||||
|
|
||||||
; firmware version, please modify it between releases
|
; firmware version, please modify it between releases
|
||||||
; positive integer value
|
; positive integer value
|
||||||
release_version = 1
|
release_version = 4
|
||||||
|
|
||||||
; build configuration based on Bintray and Wi-Fi settings
|
; build configuration based on Bintray and Wi-Fi settings
|
||||||
build_flags =
|
build_flags =
|
||||||
@ -51,7 +51,7 @@ build_flags =
|
|||||||
'-DBINTRAY_USER="${bintray.user}"'
|
'-DBINTRAY_USER="${bintray.user}"'
|
||||||
'-DBINTRAY_REPO="${bintray.repository}"'
|
'-DBINTRAY_REPO="${bintray.repository}"'
|
||||||
'-DBINTRAY_PACKAGE="${bintray.package}"'
|
'-DBINTRAY_PACKAGE="${bintray.package}"'
|
||||||
'-DVERSION=0'
|
-DVERSION=${common.release_version}
|
||||||
;
|
;
|
||||||
; ---> NOTE: For production run set DEBUG_LEVEL level to NONE! <---
|
; ---> NOTE: For production run set DEBUG_LEVEL level to NONE! <---
|
||||||
; otherwise device may leak RAM
|
; otherwise device may leak RAM
|
||||||
@ -70,14 +70,14 @@ build_flags =
|
|||||||
; -DCORE_DEBUG_LEVEL=5
|
; -DCORE_DEBUG_LEVEL=5
|
||||||
|
|
||||||
[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
|
||||||
board_build.partitions = min_spiffs.csv
|
board_build.partitions = min_spiffs.csv
|
||||||
lib_deps_all =
|
lib_deps_all =
|
||||||
ArduinoJson
|
ArduinoJson
|
||||||
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 =
|
||||||
|
@ -18,10 +18,9 @@ function Decoder(bytes, port) {
|
|||||||
|
|
||||||
if (port === 2) {
|
if (port === 2) {
|
||||||
// device status data
|
// device status data
|
||||||
return decode(bytes, [uint16, uptime, temperature, uint32, uint8, uint8], ['voltage', 'uptime', 'cputemp', 'memory', 'reset', 'reset']);
|
return decode(bytes, [uint16, uptime, uint8, uint32], ['voltage', 'uptime', 'cputemp', 'memory']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (port === 3) {
|
if (port === 3) {
|
||||||
// device config data
|
// device config data
|
||||||
return decode(bytes, [uint8, uint8, uint16, uint8, uint8, uint8, uint8, bitmap], ['lorasf', 'txpower', 'rssilimit', 'sendcycle', 'wifichancycle', 'blescantime', 'rgblum', 'flags']);
|
return decode(bytes, [uint8, uint8, uint16, uint8, uint8, uint8, uint8, bitmap], ['lorasf', 'txpower', 'rssilimit', 'sendcycle', 'wifichancycle', 'blescantime', 'rgblum', 'flags']);
|
||||||
|
@ -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;
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
#define CFG_sx1276_radio 1
|
#define CFG_sx1276_radio 1
|
||||||
|
|
||||||
#define HAS_DISPLAY U8X8_SSD1306_128X64_NONAME_HW_I2C // OLED-Display on board
|
#define HAS_DISPLAY U8X8_SSD1306_128X64_NONAME_HW_I2C // OLED-Display on board
|
||||||
//#define DISPLAY_FLIP 1 // uncomment this for rotated display
|
|
||||||
#define HAS_LED GPIO_NUM_25 // white LED on board
|
#define HAS_LED GPIO_NUM_25 // white LED on board
|
||||||
#define HAS_BUTTON GPIO_NUM_0 // button "PROG" on board
|
#define HAS_BUTTON GPIO_NUM_0 // button "PROG" on board
|
||||||
|
|
||||||
|
@ -1,18 +1,52 @@
|
|||||||
/* Hardware related definitions for TTGO V2.1 Board
|
/* Hardware related definitions for TTGO V2.1 Board
|
||||||
/ ATTENTION: check your board version!
|
/ ATTENTION: check your board version!
|
||||||
/ Different versions are on the market which need different settings in this file:
|
/ Different versions are on the market which need different settings in this file:
|
||||||
/ - without label -> "old"
|
/ - without label -> use settings (2)
|
||||||
/ - labelled v1.5 on pcb -> "old"
|
/ - labeled V1.5 on pcb -> use settings (2)
|
||||||
/ - labelled v1.6 on pcb -> "new"
|
/ - labeled V1.6 on pcb -> use settings (1)
|
||||||
|
/ Choose the right configuration below
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
// (1) settings for board labeled "T3_V1.6" on pcb
|
||||||
|
|
||||||
#define HAS_LORA 1 // comment out if device shall not send data via LoRa
|
#define HAS_LORA 1 // comment out if device shall not send data via LoRa
|
||||||
#define HAS_SPI 1 // comment out if device shall not send data via SPI
|
#define HAS_SPI 1 // comment out if device shall not send data via SPI
|
||||||
#define CFG_sx1276_radio 1 // HPD13A LoRa SoC
|
#define CFG_sx1276_radio 1 // HPD13A LoRa SoC
|
||||||
|
|
||||||
|
#define HAS_DISPLAY U8X8_SSD1306_128X64_NONAME_HW_I2C
|
||||||
|
#define HAS_LED GPIO_NUM_25 // green on board LED
|
||||||
|
#define HAS_BATTERY_PROBE ADC1_GPIO35_CHANNEL // uses GPIO7
|
||||||
|
#define BATT_FACTOR 2 // voltage divider 100k/100k on board
|
||||||
|
|
||||||
|
// re-define pin definitions of pins_arduino.h
|
||||||
|
#define PIN_SPI_SS GPIO_NUM_18 // ESP32 GPIO18 (Pin18) -- HPD13A NSS/SEL (Pin4) SPI Chip Select Input
|
||||||
|
#define PIN_SPI_MOSI GPIO_NUM_27 // ESP32 GPIO27 (Pin27) -- HPD13A MOSI/DSI (Pin6) SPI Data Input
|
||||||
|
#define PIN_SPI_MISO GPIO_NUM_19 // ESP32 GPIO19 (Pin19) -- HPD13A MISO/DSO (Pin7) SPI Data Output
|
||||||
|
#define PIN_SPI_SCK GPIO_NUM_5 // ESP32 GPIO5 (Pin5) -- HPD13A SCK (Pin5) SPI Clock Input
|
||||||
|
|
||||||
|
// non arduino pin definitions
|
||||||
|
#define RST GPIO_NUM_23 // ESP32 GPIO23 <-> HPD13A RESET
|
||||||
|
#define DIO0 GPIO_NUM_26 // ESP32 GPIO26 <-> HPD13A IO0
|
||||||
|
#define DIO1 GPIO_NUM_33 // ESP32 GPIO33 <-> HPDIO1 <-> HPD13A IO1
|
||||||
|
#define DIO2 GPIO_NUM_32 // ESP32 GPIO32 <-> HPDIO2 <-> HPD13A IO2
|
||||||
|
|
||||||
|
// Hardware pin definitions for TTGO V2 Board with OLED SSD1306 0,96" I2C Display
|
||||||
|
#define OLED_RST U8X8_PIN_NONE // connected to CPU RST/EN
|
||||||
|
#define OLED_SDA GPIO_NUM_21 // ESP32 GPIO21 -- SD1306 D1+D2
|
||||||
|
#define OLED_SCL GPIO_NUM_22 // ESP32 GPIO22 -- SD1306 D0
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
// (2) settings for boards without label on pcb, or labeled v1.5 on pcb
|
||||||
|
|
||||||
|
#define HAS_LORA 1 // comment out if device shall not send data via LoRa
|
||||||
|
#define HAS_SPI 1 // comment out if device shall not send data via SPI
|
||||||
|
#define CFG_sx1276_radio 1 // HPD13A LoRa SoC
|
||||||
|
#define HAS_LED NOT_A_PIN // no usable LED on board
|
||||||
|
|
||||||
#define HAS_DISPLAY U8X8_SSD1306_128X64_NONAME_HW_I2C
|
#define HAS_DISPLAY U8X8_SSD1306_128X64_NONAME_HW_I2C
|
||||||
#define DISPLAY_FLIP 1 // rotated display
|
#define DISPLAY_FLIP 1 // rotated display
|
||||||
#define HAS_LED GPIO_NUM_23 // green on board LED (new board ONLY)
|
|
||||||
#define HAS_BATTERY_PROBE ADC1_GPIO35_CHANNEL // uses GPIO7
|
#define HAS_BATTERY_PROBE ADC1_GPIO35_CHANNEL // uses GPIO7
|
||||||
#define BATT_FACTOR 2 // voltage divider 100k/100k on board
|
#define BATT_FACTOR 2 // voltage divider 100k/100k on board
|
||||||
|
|
||||||
@ -24,8 +58,7 @@
|
|||||||
|
|
||||||
// non arduino pin definitions
|
// non arduino pin definitions
|
||||||
#define RST LMIC_UNUSED_PIN // connected to ESP32 RST/EN (old board)
|
#define RST LMIC_UNUSED_PIN // connected to ESP32 RST/EN (old board)
|
||||||
//#define RST GPIO_NUM_12 // (old board v1.5)
|
//#define RST GPIO_NUM_12 // (boards labeled v1.5)
|
||||||
//#define RST GPIO_NUM_19 //(new board)
|
|
||||||
#define DIO0 GPIO_NUM_26 // ESP32 GPIO26 <-> HPD13A IO0
|
#define DIO0 GPIO_NUM_26 // ESP32 GPIO26 <-> HPD13A IO0
|
||||||
#define DIO1 GPIO_NUM_33 // ESP32 GPIO33 <-> HPDIO1 <-> HPD13A IO1
|
#define DIO1 GPIO_NUM_33 // ESP32 GPIO33 <-> HPDIO1 <-> HPD13A IO1
|
||||||
#define DIO2 GPIO_NUM_32 // ESP32 GPIO32 <-> HPDIO2 <-> HPD13A IO2
|
#define DIO2 GPIO_NUM_32 // ESP32 GPIO32 <-> HPDIO2 <-> HPD13A IO2
|
||||||
@ -33,4 +66,4 @@
|
|||||||
// Hardware pin definitions for TTGO V2 Board with OLED SSD1306 0,96" I2C Display
|
// Hardware pin definitions for TTGO V2 Board with OLED SSD1306 0,96" I2C Display
|
||||||
#define OLED_RST U8X8_PIN_NONE // connected to CPU RST/EN
|
#define OLED_RST U8X8_PIN_NONE // connected to CPU RST/EN
|
||||||
#define OLED_SDA GPIO_NUM_21 // ESP32 GPIO21 -- SD1306 D1+D2
|
#define OLED_SDA GPIO_NUM_21 // ESP32 GPIO21 -- SD1306 D1+D2
|
||||||
#define OLED_SCL GPIO_NUM_22 // ESP32 GPIO22 -- SD1306 D0
|
#define OLED_SCL GPIO_NUM_22 // ESP32 GPIO22 -- SD1306 D0
|
||||||
|
@ -52,9 +52,9 @@ void PayloadConvert::addConfig(configData_t value) {
|
|||||||
cursor += 10;
|
cursor += 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PayloadConvert::addStatus(uint16_t voltage, uint64_t uptime, float cputemp,
|
void PayloadConvert::addStatus(uint16_t voltage, uint64_t uptime,
|
||||||
uint32_t mem, uint8_t reset1, uint8_t reset2) {
|
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 +65,7 @@ void PayloadConvert::addStatus(uint16_t voltage, uint64_t uptime, float cputemp,
|
|||||||
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);
|
||||||
@ -133,7 +130,7 @@ void PayloadConvert::addStatus(uint16_t voltage, uint64_t uptime, float cputemp,
|
|||||||
uint32_t mem, uint8_t reset1, uint8_t reset2) {
|
uint32_t mem, uint8_t reset1, uint8_t reset2) {
|
||||||
writeUint16(voltage);
|
writeUint16(voltage);
|
||||||
writeUptime(uptime);
|
writeUptime(uptime);
|
||||||
writeTemperature(cputemp);
|
writeUint8((byte)cputemp);
|
||||||
writeUint32(mem);
|
writeUint32(mem);
|
||||||
writeUint8(reset1);
|
writeUint8(reset1);
|
||||||
writeUint8(reset2);
|
writeUint8(reset2);
|
||||||
|
@ -273,10 +273,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