Merge pull request #404 from TD-er/bugfix/altitude_decoder_signed
Fix altitude in packed decoder to be signed (#403)
This commit is contained in:
commit
5eb5923b73
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
; ---> SELECT THE TARGET PLATFORM HERE! <---
|
; ---> SELECT THE TARGET PLATFORM HERE! <---
|
||||||
[board]
|
[board]
|
||||||
;halfile = generic.h
|
halfile = generic.h
|
||||||
;halfile = ebox.h
|
;halfile = ebox.h
|
||||||
;halfile = eboxtube.h
|
;halfile = eboxtube.h
|
||||||
;halfile = ecopower.h
|
;halfile = ecopower.h
|
||||||
@ -18,7 +18,7 @@
|
|||||||
;halfile = ttgov21old.h
|
;halfile = ttgov21old.h
|
||||||
;halfile = ttgov21new.h
|
;halfile = ttgov21new.h
|
||||||
;halfile = ttgofox.h
|
;halfile = ttgofox.h
|
||||||
halfile = ttgobeam.h
|
;halfile = ttgobeam.h
|
||||||
;halfile = fipy.h
|
;halfile = fipy.h
|
||||||
;halfile = lopy.h
|
;halfile = lopy.h
|
||||||
;halfile = lopy4.h
|
;halfile = lopy4.h
|
||||||
@ -81,7 +81,7 @@ lib_deps_all =
|
|||||||
build_flags_basic =
|
build_flags_basic =
|
||||||
-include "src/hal/${board.halfile}"
|
-include "src/hal/${board.halfile}"
|
||||||
-include "src/paxcounter.conf"
|
-include "src/paxcounter.conf"
|
||||||
;-w
|
-w
|
||||||
'-DCORE_DEBUG_LEVEL=${common.debug_level}'
|
'-DCORE_DEBUG_LEVEL=${common.debug_level}'
|
||||||
'-DLOG_LOCAL_LEVEL=${common.debug_level}'
|
'-DLOG_LOCAL_LEVEL=${common.debug_level}'
|
||||||
'-DPROGVERSION="${common.release_version}"'
|
'-DPROGVERSION="${common.release_version}"'
|
||||||
|
@ -20,11 +20,11 @@ function Decoder(bytes, port) {
|
|||||||
}
|
}
|
||||||
// combined wifi counter and gps data
|
// combined wifi counter and gps data
|
||||||
if (bytes.length === 15) {
|
if (bytes.length === 15) {
|
||||||
return decode(bytes, [uint16, latLng, latLng, uint8, hdop, uint16], ['wifi', 'latitude', 'longitude', 'sats', 'hdop', 'altitude']);
|
return decode(bytes, [uint16, latLng, latLng, uint8, hdop, altitude], ['wifi', 'latitude', 'longitude', 'sats', 'hdop', 'altitude']);
|
||||||
}
|
}
|
||||||
// combined wifi + ble counter and gps data
|
// combined wifi + ble counter and gps data
|
||||||
if (bytes.length === 17) {
|
if (bytes.length === 17) {
|
||||||
return decode(bytes, [uint16, uint16, latLng, latLng, uint8, hdop, uint16], ['wifi', 'ble', 'latitude', 'longitude', 'sats', 'hdop', 'altitude']);
|
return decode(bytes, [uint16, uint16, latLng, latLng, uint8, hdop, altitude], ['wifi', 'ble', 'latitude', 'longitude', 'sats', 'hdop', 'altitude']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -42,7 +42,7 @@ function Decoder(bytes, port) {
|
|||||||
|
|
||||||
if (port === 4) {
|
if (port === 4) {
|
||||||
// gps data
|
// gps data
|
||||||
return decode(bytes, [latLng, latLng, uint8, hdop, uint16], ['latitude', 'longitude', 'sats', 'hdop', 'altitude']);
|
return decode(bytes, [latLng, latLng, uint8, hdop, altitude], ['latitude', 'longitude', 'sats', 'hdop', 'altitude']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (port === 5) {
|
if (port === 5) {
|
||||||
@ -147,6 +147,18 @@ var hdop = function (bytes) {
|
|||||||
};
|
};
|
||||||
hdop.BYTES = 2;
|
hdop.BYTES = 2;
|
||||||
|
|
||||||
|
var altitude = function (bytes) {
|
||||||
|
if (bytes.length !== altitude.BYTES) {
|
||||||
|
throw new Error('Altitude must have exactly 2 bytes');
|
||||||
|
}
|
||||||
|
var alt = bytesToInt(bytes);
|
||||||
|
if (alt > 32767) {
|
||||||
|
alt -= 65536;
|
||||||
|
}
|
||||||
|
return alt;
|
||||||
|
};
|
||||||
|
altitude.BYTES = 2;
|
||||||
|
|
||||||
var float = function (bytes) {
|
var float = function (bytes) {
|
||||||
if (bytes.length !== float.BYTES) {
|
if (bytes.length !== float.BYTES) {
|
||||||
throw new Error('Float must have exactly 2 bytes');
|
throw new Error('Float must have exactly 2 bytes');
|
||||||
@ -253,6 +265,7 @@ if (typeof module === 'object' && typeof module.exports !== 'undefined') {
|
|||||||
pressure: pressure,
|
pressure: pressure,
|
||||||
latLng: latLng,
|
latLng: latLng,
|
||||||
hdop: hdop,
|
hdop: hdop,
|
||||||
|
altitude: altitude,
|
||||||
bitmap1: bitmap1,
|
bitmap1: bitmap1,
|
||||||
bitmap2: bitmap2,
|
bitmap2: bitmap2,
|
||||||
version: version,
|
version: version,
|
||||||
|
@ -25,13 +25,13 @@
|
|||||||
// GPS settings
|
// GPS settings
|
||||||
#define HAS_GPS 1 // use on board GPS
|
#define HAS_GPS 1 // use on board GPS
|
||||||
#define GPS_SERIAL 9600, SERIAL_8N1, GPIO_NUM_12, GPIO_NUM_15 // UBlox NEO 6M
|
#define GPS_SERIAL 9600, SERIAL_8N1, GPIO_NUM_12, GPIO_NUM_15 // UBlox NEO 6M
|
||||||
#define GPS_INT GPIO_NUM_34 // 30ns accurary timepulse, to be external wired on pcb: NEO 6M Pin#3 -> GPIO34
|
//#define GPS_INT GPIO_NUM_34 // 30ns accurary timepulse, to be external wired on pcb: NEO 6M Pin#3 -> GPIO34
|
||||||
|
|
||||||
// enable only if device has these sensors, otherwise comment these lines
|
// enable only if device has these sensors, otherwise comment these lines
|
||||||
// BME680 sensor on I2C bus
|
// BME680 sensor on I2C bus
|
||||||
#define HAS_BME 1 // Enable BME sensors in general
|
//#define HAS_BME 1 // Enable BME sensors in general
|
||||||
#define HAS_BME680 SDA, SCL
|
//#define HAS_BME680 SDA, SCL
|
||||||
#define BME680_ADDR BME680_I2C_ADDR_PRIMARY // !! connect SDIO of BME680 to GND !!
|
//#define BME680_ADDR BME680_I2C_ADDR_PRIMARY // !! connect SDIO of BME680 to GND !!
|
||||||
|
|
||||||
// display (if connected)
|
// display (if connected)
|
||||||
#define HAS_DISPLAY U8X8_SSD1306_128X64_NONAME_HW_I2C
|
#define HAS_DISPLAY U8X8_SSD1306_128X64_NONAME_HW_I2C
|
||||||
|
@ -35,7 +35,7 @@ clockloop 1 4 generates realtime telegrams for external clock
|
|||||||
timesync_req 1 3 processes realtime time sync requests
|
timesync_req 1 3 processes realtime time sync requests
|
||||||
irqhandler 1 2 display, timesync, gps, etc. triggered by timers
|
irqhandler 1 2 display, timesync, gps, etc. triggered by timers
|
||||||
gpsloop 1 2 reads data from GPS via serial or i2c
|
gpsloop 1 2 reads data from GPS via serial or i2c
|
||||||
bmeloop 1 1 reads data from BME sensor via i2c
|
bmeloop 1 2 reads data from BME sensor via i2c
|
||||||
looptask 1 1 runs the LMIC LoRa stack (arduino loop)
|
looptask 1 1 runs the LMIC LoRa stack (arduino loop)
|
||||||
IDLE 1 0 ESP32 arduino scheduler -> runs wifi channel rotator
|
IDLE 1 0 ESP32 arduino scheduler -> runs wifi channel rotator
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@
|
|||||||
#define TIME_SYNC_INTERVAL_RETRY 10 // retry time sync after lost sync each .. minutes [default = 10], 0 means off
|
#define TIME_SYNC_INTERVAL_RETRY 10 // retry time sync after lost sync each .. minutes [default = 10], 0 means off
|
||||||
#define TIME_SYNC_COMPILEDATE 0 // set to 1 to use compile date to initialize RTC after power outage [default = 0]
|
#define TIME_SYNC_COMPILEDATE 0 // set to 1 to use compile date to initialize RTC after power outage [default = 0]
|
||||||
#define TIME_SYNC_LORAWAN 0 // set to 1 to use LORA network as time source, 0 means off [default = 0]
|
#define TIME_SYNC_LORAWAN 0 // set to 1 to use LORA network as time source, 0 means off [default = 0]
|
||||||
#define TIME_SYNC_LORASERVER 1 // set to 1 to use LORA timeserver as time source, 0 means off [default = 0]
|
#define TIME_SYNC_LORASERVER 0 // set to 1 to use LORA timeserver as time source, 0 means off [default = 0]
|
||||||
|
|
||||||
// settings for syncing time with timeserver applications
|
// settings for syncing time with timeserver applications
|
||||||
#define TIME_SYNC_SAMPLES 1 // number of time requests for averaging
|
#define TIME_SYNC_SAMPLES 1 // number of time requests for averaging
|
||||||
|
Loading…
Reference in New Issue
Block a user