merge
This commit is contained in:
commit
8876c58b12
10 files changed
+68
-34
No files matched your search
@@ -18,10 +18,9 @@ function Decoder(bytes, port) {
|
||||
|
||||
if (port === 2) {
|
||||
// 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) {
|
||||
// device config data
|
||||
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) {
|
||||
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;
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
#define CFG_sx1276_radio 1
|
||||
|
||||
#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_BUTTON GPIO_NUM_0 // button "PROG" on board
|
||||
|
||||
|
||||
+40
-7
@@ -1,18 +1,52 @@
|
||||
/* Hardware related definitions for TTGO V2.1 Board
|
||||
/ ATTENTION: check your board version!
|
||||
/ Different versions are on the market which need different settings in this file:
|
||||
/ - without label -> "old"
|
||||
/ - labelled v1.5 on pcb -> "old"
|
||||
/ - labelled v1.6 on pcb -> "new"
|
||||
/ - without label -> use settings (2)
|
||||
/ - labeled V1.5 on pcb -> use settings (2)
|
||||
/ - 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_SPI 1 // comment out if device shall not send data via SPI
|
||||
#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 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 BATT_FACTOR 2 // voltage divider 100k/100k on board
|
||||
|
||||
@@ -24,8 +58,7 @@
|
||||
|
||||
// non arduino pin definitions
|
||||
#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_19 //(new board)
|
||||
//#define RST GPIO_NUM_12 // (boards labeled v1.5)
|
||||
#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
|
||||
@@ -33,4 +66,4 @@
|
||||
// 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
|
||||
#define OLED_SCL GPIO_NUM_22 // ESP32 GPIO22 -- SD1306 D0
|
||||
+5
-8
@@ -52,9 +52,9 @@ void PayloadConvert::addConfig(configData_t value) {
|
||||
cursor += 10;
|
||||
}
|
||||
|
||||
void PayloadConvert::addStatus(uint16_t voltage, uint64_t uptime, float cputemp,
|
||||
uint32_t mem, uint8_t reset1, uint8_t reset2) {
|
||||
uint32_t temp = (uint32_t)cputemp;
|
||||
void PayloadConvert::addStatus(uint16_t voltage, uint64_t uptime,
|
||||
float cputemp, uint32_t mem) {
|
||||
|
||||
buffer[cursor++] = highByte(voltage);
|
||||
buffer[cursor++] = lowByte(voltage);
|
||||
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 & 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);
|
||||
@@ -133,7 +130,7 @@ void PayloadConvert::addStatus(uint16_t voltage, uint64_t uptime, float cputemp,
|
||||
uint32_t mem, uint8_t reset1, uint8_t reset2) {
|
||||
writeUint16(voltage);
|
||||
writeUptime(uptime);
|
||||
writeTemperature(cputemp);
|
||||
writeUint8((byte)cputemp);
|
||||
writeUint32(mem);
|
||||
writeUint8(reset1);
|
||||
writeUint8(reset2);
|
||||
|
||||
+7
-4
@@ -273,10 +273,13 @@ 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
|
||||
ESP_LOGI(TAG, "Unknown remote command x%02X, ignored", cmd[cursor]);
|
||||
break;
|
||||
}
|
||||
} // command parsing loop
|
||||
|
||||
if (storeflag)
|
||||
|
||||
Reference in new issue
Block a user