remove beacon monitormode

This commit is contained in:
cyberman54 2021-05-07 19:41:36 +02:00
parent de2e576599
commit 49aba50df1
17 changed files with 23 additions and 116 deletions

View File

@ -154,7 +154,6 @@ Paxcounter generates identifiers for sniffed Wifi or Bluetooth MAC adresses and
- Quick blink (20ms on each 1/5 second): joining LoRaWAN network in progress or pending
- Small blink (10ms on each 1/2 second): LoRaWAN data transmit in progress or pending
- Long blink (200ms on each 2 seconds): LoRaWAN stack error
- Single long flash (2sec): Known beacon detected
**RGB LED:**
@ -164,7 +163,6 @@ Paxcounter generates identifiers for sniffed Wifi or Bluetooth MAC adresses and
- Pink: LORAWAN MAC transmit in progress
- Blue: LoRaWAN data transmit in progress or pending
- Red: LoRaWAN stack error
- White: Known Beacon detected
# Display
@ -190,7 +188,7 @@ Output of sensor and peripheral data is internally switched by a bitmask registe
| Bit | Sensordata | Default
| --- | ------------- | -------
| 0 | Paxcounter | on
| 1 | Beacon alarm | on
| 1 | unused | off
| 2 | BME280/680 | on
| 3 | GPS* | on
| 4 | User sensor 1 | on
@ -320,7 +318,7 @@ Hereafter described is the default *plain* format, which uses MSB bit numbering.
byte 14: count randomizated MACs only (0=disabled, 1=enabled) [default 1]
byte 15: RGB LED luminosity (0..100 %) [default 30]
byte 16: 0 (reserved)
byte 17: Beacon proximity alarm mode (1=on, 0=off) [default 0]
byte 17: 0 (reserved)
bytes 18-28: Software version (ASCII format, terminating with zero)
@ -336,10 +334,7 @@ Hereafter described is the default *plain* format, which uses MSB bit numbering.
byte 1: static value 0x01
**Port #6:** Beacon proximity alarm
byte 1: Beacon RSSI reception level
byte 2: Beacon identifier (0..255)
**Port #6:** (unused)
**Port #7:** Environmental sensor data (only if device has feature BME)
@ -474,16 +469,6 @@ Send for example `83` `86` as Downlink on Port 2 to get battery status and time/
0 ... 100 percentage of luminosity (100% = full light)
e.g. 50 -> 50% of luminosity [default]
0x11 set beacon proximity alarm mode on/off
0 = Beacon monitor mode off [default]
1 = Beacon monitor mode on, enables proximity alarm if test beacons are seen
0x12 set or reset a beacon MAC for proximity alarm
byte 1 = beacon ID (0..255)
bytes 2..7 = beacon MAC with 6 digits (e.g. MAC 80:ab:00:01:02:03 -> 0x80ab00010203)
0x13 set user sensor mode
byte 1 = user sensor number (1..3)
@ -493,7 +478,7 @@ Send for example `83` `86` as Downlink on Port 2 to get battery status and time/
byte 1 = sensor data payload mask (0..255, meaning of bits see below)
0x01 = COUNT_DATA
0x02 = ALARM_DATA
0x02 = RESERVED_DATA
0x04 = MEMS_DATA
0x08 = GPS_DATA
0x10 = SENSOR_1_DATA (also ENS counter)

View File

@ -1,9 +0,0 @@
#ifndef _BEACON_ARRAY_H
#define _BEACON_ARRAY_H
std::array<uint64_t, 0xff>::iterator it;
std::array<uint64_t, 0xff> beacons = {0x0000010203040506, 0x0000aabbccddeeff,
0x0000112233445566};
#endif

View File

@ -21,7 +21,7 @@
// bits in payloadmask for filtering payload data
#define COUNT_DATA _bit(0)
#define ALARM_DATA _bit(1)
#define RESERVED_DATA _bit(1)
#define MEMS_DATA _bit(2)
#define GPS_DATA _bit(3)
#define SENSOR1_DATA _bit(4)
@ -72,7 +72,6 @@ typedef struct __attribute__((packed)) {
uint8_t wifiscan; // 0=disabled, 1=enabled
uint8_t wifiant; // 0=internal, 1=external (for LoPy/LoPy4)
uint8_t rgblum; // RGB Led luminosity (0..100%)
uint8_t monitormode; // 0=disabled, 1=enabled
uint8_t payloadmask; // bitswitches for payload data
uint8_t enscount; // 0=disabled 1= enabled
@ -113,9 +112,6 @@ typedef struct {
float pm25;
} sdsStatus_t;
extern std::array<uint64_t, 0xff>::iterator it;
extern std::array<uint64_t, 0xff> beacons;
extern char clientId[20]; // unique clientID
#endif

View File

@ -12,7 +12,6 @@
#include "i2c.h"
#include "configmanager.h"
#include "cyclic.h"
#include "beacon_array.h"
#include "ota.h"
#include "irqhandler.h"
#include "spislave.h"

View File

@ -52,7 +52,6 @@ public:
void addConfig(configData_t value);
void addStatus(uint16_t voltage, uint64_t uptime, float cputemp, uint32_t mem,
uint8_t reset0, uint32_t restarts);
void addAlarm(int8_t rssi, uint8_t message);
void addVoltage(uint16_t value);
void addGPS(gpsStatus_t value);
void addBME(bmeStatus_t value);

View File

@ -49,7 +49,7 @@ description = Paxcounter is a device for metering passenger flows in realtime. I
[common]
; for release_version use max. 10 chars total, use any decimal format like "a.b.c"
release_version = 2.5.0
release_version = 2.6.0
; DEBUG LEVEL: For production run set to 0, otherwise device will leak RAM while running!
; 0=None, 1=Error, 2=Warn, 3=Info, 4=Debug, 5=Verbose
debug_level = 3

View File

@ -62,11 +62,6 @@ function Decoder(bytes, port) {
return decode(bytes, [uint8], ['button']);
}
if (port === 6) {
// beacon proximity alarm
return decode(bytes, [int8, uint8], ['rssi', 'beacon']);
}
if (port === 7) {
// BME680 sensor data
return decode(bytes, [float, pressure, ufloat, ufloat], ['temperature', 'pressure', 'humidity', 'air']);
@ -248,7 +243,7 @@ var bitmap1 = function (byte) {
}
var i = bytesToInt(byte);
var bm = ('00000000' + Number(i).toString(2)).substr(-8).split('').map(Number).map(Boolean);
return ['adr', 'screensaver', 'screen', 'countermode', 'blescan', 'antenna', 'reserved', 'alarm']
return ['adr', 'screensaver', 'screen', 'countermode', 'blescan', 'antenna', 'reserved', 'reserved']
.reduce(function (obj, pos, index) {
obj[pos] = +bm[index];
return obj;
@ -262,7 +257,7 @@ var bitmap2 = function (byte) {
}
var i = bytesToInt(byte);
var bm = ('00000000' + Number(i).toString(2)).substr(-8).split('').map(Number).map(Boolean);
return ['battery', 'sensor3', 'sensor2', 'sensor1', 'gps', 'bme', 'alarm', 'counter']
return ['battery', 'sensor3', 'sensor2', 'sensor1', 'gps', 'bme', 'reserved', 'counter']
.reduce(function (obj, pos, index) {
obj[pos] = +bm[index];
return obj;

View File

@ -49,12 +49,6 @@ function Decoder(bytes, port) {
decoded.button = bytes[i++];
}
if (port === 6) {
var i = 0;
decoded.rssi = bytes[i++];
decoded.beacon = bytes[i++];
}
if (port === 7) {
var i = 0;
decoded.temperature = ((bytes[i++] << 8) | bytes[i++]);

View File

@ -70,11 +70,6 @@ function decodeUplink(input) {
data = decode(input.bytes, [uint8], ['button']);
}
if (input.fPort === 6) {
// beacon proximity alarm
data = decode(input.bytes, [int8, uint8], ['rssi', 'beacon']);
}
if (input.fPort === 7) {
// BME680 sensor data
data = decode(input.bytes, [float, pressure, ufloat, ufloat], ['temperature', 'pressure', 'humidity', 'air']);
@ -263,7 +258,7 @@ var bitmap1 = function (byte) {
}
var i = bytesToInt(byte);
var bm = ('00000000' + Number(i).toString(2)).substr(-8).split('').map(Number).map(Boolean);
return ['adr', 'screensaver', 'screen', 'countermode', 'blescan', 'antenna', 'reserved', 'alarm']
return ['adr', 'screensaver', 'screen', 'countermode', 'blescan', 'antenna', 'reserved', 'reserved']
.reduce(function (obj, pos, index) {
obj[pos] = +bm[index];
return obj;
@ -277,7 +272,7 @@ var bitmap2 = function (byte) {
}
var i = bytesToInt(byte);
var bm = ('00000000' + Number(i).toString(2)).substr(-8).split('').map(Number).map(Boolean);
return ['battery', 'sensor3', 'sensor2', 'sensor1', 'gps', 'bme', 'alarm', 'counter']
return ['battery', 'sensor3', 'sensor2', 'sensor1', 'gps', 'bme', 'reserved', 'counter']
.reduce(function (obj, pos, index) {
obj[pos] = +bm[index];
return obj;

View File

@ -56,12 +56,6 @@ function decodeUplink(input) {
data.button = input.bytes[i++];
}
if (input.fPort === 6) {
var i = 0;
data.rssi = input.bytes[i++];
data.beacon = input.bytes[i++];
}
if (input.fPort === 7) {
var i = 0;
data.temperature = ((input.bytes[i++] << 8) | input.bytes[i++]);

View File

@ -8,9 +8,9 @@ static const char TAG[] = __FILE__;
// default settings for device data to be sent
#define PAYLOADMASK \
((GPS_DATA | ALARM_DATA | MEMS_DATA | COUNT_DATA | SENSOR1_DATA | \
SENSOR2_DATA | SENSOR3_DATA) & \
(~BATT_DATA))
((GPS_DATA | MEMS_DATA | COUNT_DATA | SENSOR1_DATA | SENSOR2_DATA | \
SENSOR3_DATA) & \
(~BATT_DATA) & (~RESERVED_DATA))
// namespace for device runtime preferences
#define DEVCONFIG "paxcntcfg"
@ -54,7 +54,6 @@ static void defaultConfig(configData_t *myconfig) {
myconfig->wifiscan = WIFICOUNTER; // 0=disabled, 1=enabled
myconfig->wifiant = 0; // 0=internal, 1=external (for LoPy/LoPy4)
myconfig->rgblum = RGBLUMINOSITY; // RGB Led luminosity (0..100%)
myconfig->monitormode = 0; // 0=disabled, 1=enabled
myconfig->payloadmask = PAYLOADMASK; // payloads as defined in default
myconfig->enscount = COUNT_ENS; // 0=disabled, 1=enabled

View File

@ -20,7 +20,7 @@ User, long press -> send a button message
Reset -> reset device
*/
//#define HAS_DISPLAY 1
#define HAS_DISPLAY 1
#define MY_DISPLAY_SDA SDA
#define MY_DISPLAY_SCL SCL
#define MY_DISPLAY_RST NOT_A_PIN

View File

@ -76,12 +76,11 @@ void refreshTheMatrixDisplay(bool nextPage) {
case 0:
if (cfg.countermode == 1)
// update counter values from libpax
libpax_counter_count(&count_from_libpax);
// update counter values from libpax
libpax_counter_count(&count_from_libpax);
{ // cumulative counter mode -> display total number of pax
if (cfg.countermode == 1) {
// cumulative counter mode -> display total number of pax
if (ulLastNumMacs != count_from_libpax.pax) {
ulLastNumMacs = count_from_libpax.pax;
matrix.clear();

View File

@ -101,7 +101,7 @@
#define CONFIGPORT 3 // config query results
#define GPSPORT 4 // gps - NOTE: set to 1 to send combined GPS+COUNTERPORT payload
#define BUTTONPORT 5 // button pressed signal
#define BEACONPORT 6 // beacon alarms
#define RESERVEDPORT 6 // reserved (unused)
#define BMEPORT 7 // BME680 sensor
#define BATTPORT 8 // battery voltage
#define TIMEPORT 9 // time query and response

View File

@ -28,11 +28,6 @@ void PayloadConvert::addCount(uint16_t value, uint8_t snifftype) {
buffer[cursor++] = lowByte(value);
}
void PayloadConvert::addAlarm(int8_t rssi, uint8_t msg) {
buffer[cursor++] = rssi;
buffer[cursor++] = msg;
}
void PayloadConvert::addVoltage(uint16_t value) {
buffer[cursor++] = highByte(value);
buffer[cursor++] = lowByte(value);
@ -55,7 +50,7 @@ void PayloadConvert::addConfig(configData_t value) {
buffer[cursor++] = 0; // reserved
buffer[cursor++] = value.rgblum;
buffer[cursor++] = value.payloadmask;
buffer[cursor++] = value.monitormode;
buffer[cursor++] = 0; // reserved
memcpy(buffer + cursor, value.version, 10);
cursor += 10;
}
@ -168,11 +163,6 @@ void PayloadConvert::addCount(uint16_t value, uint8_t snifftype) {
writeUint16(value);
}
void PayloadConvert::addAlarm(int8_t rssi, uint8_t msg) {
writeUint8(rssi);
writeUint8(msg);
}
void PayloadConvert::addVoltage(uint16_t value) { writeUint16(value); }
void PayloadConvert::addConfig(configData_t value) {
@ -185,8 +175,7 @@ void PayloadConvert::addConfig(configData_t value) {
writeUint8(value.rgblum);
writeBitmap(value.adrmode ? true : false, value.screensaver ? true : false,
value.screenon ? true : false, value.countermode ? true : false,
value.blescan ? true : false, value.wifiant ? true : false, 0,
value.monitormode ? true : false);
value.blescan ? true : false, value.wifiant ? true : false, 0, 0);
writeUint8(value.payloadmask);
writeVersion(value.version);
}
@ -373,19 +362,6 @@ void PayloadConvert::addCount(uint16_t value, uint8_t snifftype) {
}
}
void PayloadConvert::addAlarm(int8_t rssi, uint8_t msg) {
#if (PAYLOAD_ENCODER == 3)
buffer[cursor++] = LPP_ALARM_CHANNEL;
#endif
buffer[cursor++] = LPP_PRESENCE;
buffer[cursor++] = msg;
#if (PAYLOAD_ENCODER == 3)
buffer[cursor++] = LPP_MSG_CHANNEL;
#endif
buffer[cursor++] = LPP_ANALOG_INPUT;
buffer[cursor++] = rssi;
}
void PayloadConvert::addVoltage(uint16_t value) {
uint16_t volt = value / 10;
#if (PAYLOAD_ENCODER == 3)

View File

@ -223,20 +223,6 @@ uint64_t macConvert(uint8_t *paddr) {
return (__builtin_bswap64(*mac) >> 16);
}
void set_beacon(uint8_t val[]) {
uint8_t id = val[0]; // use first parameter as beacon storage id
memmove(val, val + 1, 6); // strip off storage id
beacons[id] = macConvert(val); // store beacon MAC in array
ESP_LOGI(TAG, "Remote command: set beacon ID#%d", id);
// printKey("MAC", val, 6, false); // show beacon MAC
}
void set_monitor(uint8_t val[]) {
ESP_LOGI(TAG, "Remote command: set beacon monitor mode to %s",
val ? "on" : "off");
cfg.monitormode = val[0] ? 1 : 0;
}
void set_loradr(uint8_t val[]) {
#if (HAS_LORA)
if (validDR(val[0])) {
@ -436,8 +422,7 @@ static const cmd_t table[] = {
{0x09, set_reset, 1}, {0x0a, set_sendcycle, 1},
{0x0b, set_wifichancycle, 1}, {0x0c, set_blescantime, 1},
{0x0e, set_blescan, 1}, {0x0f, set_wifiant, 1},
{0x10, set_rgblum, 1}, {0x11, set_monitor, 1},
{0x12, set_beacon, 7}, {0x13, set_sensor, 2},
{0x10, set_rgblum, 1}, {0x13, set_sensor, 2},
{0x14, set_payloadmask, 1}, {0x15, set_bme, 1},
{0x16, set_batt, 1}, {0x17, set_wifiscan, 1},
{0x18, set_enscount, 1}, {0x19, set_sleepcycle, 2},

View File

@ -37,7 +37,7 @@ uint8_t sensor_mask(uint8_t sensor_no) {
case 6:
return (uint8_t)MEMS_DATA;
case 7:
return (uint8_t)ALARM_DATA;
return (uint8_t)RESERVED_DATA;
default:
return 0;
}