fix bitshift in payload + configmask

This commit is contained in:
cyberman54 2021-01-09 23:52:08 +01:00
parent ecb94ab243
commit 241a19148b
2 changed files with 17 additions and 17 deletions

View File

@ -22,24 +22,24 @@
#define _bitl(b) (1UL << (b)) #define _bitl(b) (1UL << (b))
// bits in payloadmask for filtering payload data // bits in payloadmask for filtering payload data
#define COUNT_DATA _bit(1) #define COUNT_DATA _bit(0)
#define ALARM_DATA _bit(2) #define ALARM_DATA _bit(1)
#define MEMS_DATA _bit(3) #define MEMS_DATA _bit(2)
#define GPS_DATA _bit(4) #define GPS_DATA _bit(3)
#define SENSOR1_DATA _bit(5) #define SENSOR1_DATA _bit(4)
#define SENSOR2_DATA _bit(6) #define SENSOR2_DATA _bit(5)
#define SENSOR3_DATA _bit(7) #define SENSOR3_DATA _bit(6)
#define BATT_DATA _bit(8) #define BATT_DATA _bit(7)
// bits in configmask for device runmode control // bits in configmask for device runmode control
#define GPS_MODE _bit(1) #define GPS_MODE _bit(0)
#define ALARM_MODE _bit(2) #define ALARM_MODE _bit(1)
#define BEACON_MODE _bit(3) #define BEACON_MODE _bit(2)
#define UPDATE_MODE _bit(4) #define UPDATE_MODE _bit(3)
#define FILTER_MODE _bit(5) #define FILTER_MODE _bit(4)
#define ANTENNA_MODE _bit(6) #define ANTENNA_MODE _bit(5)
#define BLE_MODE _bit(7) #define BLE_MODE _bit(6)
#define SCREEN_MODE _bit(8) #define SCREEN_MODE _bit(7)
// length of display buffer for lmic event messages // length of display buffer for lmic event messages
#define LMIC_EVENTMSG_LEN 17 #define LMIC_EVENTMSG_LEN 17

View File

@ -262,7 +262,7 @@ var bitmap2 = function (byte) {
} }
var i = bytesToInt(byte); var i = bytesToInt(byte);
var bm = ('00000000' + Number(i).toString(2)).substr(-8).split('').map(Number).map(Boolean); var bm = ('00000000' + Number(i).toString(2)).substr(-8).split('').map(Number).map(Boolean);
return ['battery', 'sensor3', 'sensor2', 'sensor1', 'counter', 'bme', 'alarm', 'gps'] return ['battery', 'sensor3', 'sensor2', 'sensor1', 'gps', 'bme', 'alarm', 'counter']
.reduce(function (obj, pos, index) { .reduce(function (obj, pos, index) {
obj[pos] = +bm[index]; obj[pos] = +bm[index];
return obj; return obj;