commit
79a6146d44
@ -1,7 +1,7 @@
|
|||||||
#ifndef _BUTTON_H
|
#ifndef _BUTTON_H
|
||||||
#define _BUTTON_H
|
#define _BUTTON_H
|
||||||
|
|
||||||
#include <SimpleButton.h>
|
#include <OneButton.h>
|
||||||
#include "irqhandler.h"
|
#include "irqhandler.h"
|
||||||
#include "senddata.h"
|
#include "senddata.h"
|
||||||
#include "display.h"
|
#include "display.h"
|
||||||
@ -11,7 +11,13 @@
|
|||||||
#define BUTTON_ACTIVEHIGH 0
|
#define BUTTON_ACTIVEHIGH 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void button_init(int pin);
|
#ifndef BUTTON_PULLUP
|
||||||
void readButton();
|
#define BUTTON_PULLUP 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extern TaskHandle_t buttonLoopTask;
|
||||||
|
|
||||||
|
void button_init(void);
|
||||||
|
void IRAM_ATTR readButton(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
@ -13,6 +13,7 @@
|
|||||||
#include "reset.h"
|
#include "reset.h"
|
||||||
#include "led.h"
|
#include "led.h"
|
||||||
#include "power.h"
|
#include "power.h"
|
||||||
|
#include "button.h"
|
||||||
|
|
||||||
extern Ticker cyclicTimer;
|
extern Ticker cyclicTimer;
|
||||||
|
|
||||||
|
@ -36,12 +36,4 @@ void IRAM_ATTR DisplayIRQ();
|
|||||||
void IRAM_ATTR MatrixDisplayIRQ();
|
void IRAM_ATTR MatrixDisplayIRQ();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAS_BUTTON
|
|
||||||
void IRAM_ATTR ButtonIRQ();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAS_PMU
|
|
||||||
void IRAM_ATTR PMUIRQ();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
@ -23,5 +23,6 @@
|
|||||||
#include "boot.h"
|
#include "boot.h"
|
||||||
#include "power.h"
|
#include "power.h"
|
||||||
#include "antenna.h"
|
#include "antenna.h"
|
||||||
|
#include "button.h"
|
||||||
|
|
||||||
#endif
|
#endif
|
@ -100,6 +100,5 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
extern PayloadConvert payload;
|
extern PayloadConvert payload;
|
||||||
extern int8_t batt_level;
|
|
||||||
|
|
||||||
#endif // _PAYLOAD_H_
|
#endif // _PAYLOAD_H_
|
||||||
|
@ -53,11 +53,13 @@ typedef uint8_t (*mapFn_t)(uint16_t, uint16_t, uint16_t);
|
|||||||
uint16_t read_voltage(void);
|
uint16_t read_voltage(void);
|
||||||
void calibrate_voltage(void);
|
void calibrate_voltage(void);
|
||||||
bool batt_sufficient(void);
|
bool batt_sufficient(void);
|
||||||
|
extern int8_t batt_level;
|
||||||
|
|
||||||
#ifdef HAS_PMU
|
#ifdef HAS_PMU
|
||||||
#include <XPowersLib.h>
|
#include <XPowersLib.h>
|
||||||
extern XPowersPMU pmu;
|
extern XPowersPMU pmu;
|
||||||
enum pmu_power_t { pmu_power_on, pmu_power_off, pmu_power_sleep };
|
enum pmu_power_t { pmu_power_on, pmu_power_off, pmu_power_sleep };
|
||||||
|
void IRAM_ATTR PMUIRQ();
|
||||||
void AXP192_powerevent_IRQ(void);
|
void AXP192_powerevent_IRQ(void);
|
||||||
void AXP192_power(pmu_power_t powerlevel);
|
void AXP192_power(pmu_power_t powerlevel);
|
||||||
void AXP192_init(void);
|
void AXP192_init(void);
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
#include "timesync.h"
|
#include "timesync.h"
|
||||||
#include "power.h"
|
#include "power.h"
|
||||||
#include "antenna.h"
|
#include "antenna.h"
|
||||||
|
#include "payload.h"
|
||||||
|
|
||||||
// maximum number of elements in rcommand interpreter queue
|
// maximum number of elements in rcommand interpreter queue
|
||||||
#define RCMD_QUEUE_SIZE 5
|
#define RCMD_QUEUE_SIZE 5
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
#include "lorawan.h"
|
#include "lorawan.h"
|
||||||
#include "display.h"
|
#include "display.h"
|
||||||
#include "sdcard.h"
|
#include "sdcard.h"
|
||||||
|
#include "payload.h"
|
||||||
|
|
||||||
void SendPayload(uint8_t port);
|
void SendPayload(uint8_t port);
|
||||||
void sendData(void);
|
void sendData(void);
|
||||||
|
@ -46,7 +46,7 @@ description = Paxcounter is a device for metering passenger flows in realtime. I
|
|||||||
|
|
||||||
[common]
|
[common]
|
||||||
; for release_version use max. 10 chars total, use any decimal format like "a.b.c"
|
; for release_version use max. 10 chars total, use any decimal format like "a.b.c"
|
||||||
release_version = 3.4.0
|
release_version = 3.4.1
|
||||||
; DEBUG LEVEL: For production run set to 0, otherwise device will leak RAM while running!
|
; 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
|
; 0=None, 1=Error, 2=Warn, 3=Info, 4=Debug, 5=Verbose
|
||||||
debug_level = 3
|
debug_level = 3
|
||||||
@ -81,7 +81,7 @@ lib_deps_basic =
|
|||||||
https://github.com/SukkoPera/Arduino-Rokkit-Hash.git
|
https://github.com/SukkoPera/Arduino-Rokkit-Hash.git
|
||||||
bblanchon/ArduinoJson @ ^6
|
bblanchon/ArduinoJson @ ^6
|
||||||
makuna/RTC @ ^2.3.5
|
makuna/RTC @ ^2.3.5
|
||||||
spacehuhn/SimpleButton
|
mathertel/OneButton @ ^2.0.3
|
||||||
lewisxhe/XPowersLib @ ^0.1.4
|
lewisxhe/XPowersLib @ ^0.1.4
|
||||||
256dpi/MQTT @ ^2.5.0
|
256dpi/MQTT @ ^2.5.0
|
||||||
lib_deps_all =
|
lib_deps_all =
|
||||||
|
@ -10,7 +10,7 @@ description = Paxcounter is a device for metering passenger flows in realtime. I
|
|||||||
|
|
||||||
[common]
|
[common]
|
||||||
; for release_version use max. 10 chars total, use any decimal format like "a.b.c"
|
; for release_version use max. 10 chars total, use any decimal format like "a.b.c"
|
||||||
release_version = 3.4.0
|
release_version = 3.4.1
|
||||||
; DEBUG LEVEL: For production run set to 0, otherwise device will leak RAM while running!
|
; 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
|
; 0=None, 1=Error, 2=Warn, 3=Info, 4=Debug, 5=Verbose
|
||||||
debug_level = 3
|
debug_level = 3
|
||||||
@ -29,7 +29,7 @@ lib_deps_all =
|
|||||||
https://github.com/cyberman54/libpax.git
|
https://github.com/cyberman54/libpax.git
|
||||||
https://github.com/SukkoPera/Arduino-Rokkit-Hash.git
|
https://github.com/SukkoPera/Arduino-Rokkit-Hash.git
|
||||||
bblanchon/ArduinoJson @ ^6
|
bblanchon/ArduinoJson @ ^6
|
||||||
spacehuhn/SimpleButton
|
mathertel/OneButton @ ^2.0.3
|
||||||
256dpi/MQTT @ ^2.5.0
|
256dpi/MQTT @ ^2.5.0
|
||||||
ricmoo/QRCode @ ^0.0.1
|
ricmoo/QRCode @ ^0.0.1
|
||||||
build_flags_basic =
|
build_flags_basic =
|
||||||
|
@ -3,42 +3,49 @@
|
|||||||
#include "globals.h"
|
#include "globals.h"
|
||||||
#include "button.h"
|
#include "button.h"
|
||||||
|
|
||||||
using namespace simplebutton;
|
|
||||||
|
|
||||||
// Local logging tag
|
// Local logging tag
|
||||||
static const char TAG[] = __FILE__;
|
static const char TAG[] = __FILE__;
|
||||||
|
|
||||||
static Button *b = NULL;
|
OneButton button(HAS_BUTTON, !BUTTON_ACTIVEHIGH, !!BUTTON_PULLUP);
|
||||||
|
TaskHandle_t buttonLoopTask;
|
||||||
|
|
||||||
void button_init(int pin) {
|
void IRAM_ATTR readButton(void) { button.tick(); }
|
||||||
#ifdef BUTTON_PULLUP
|
|
||||||
b = new ButtonPullup(pin);
|
|
||||||
#else
|
|
||||||
b = new Button(pin, !BUTTON_ACTIVEHIGH);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// attach events to the button
|
void singleClick(void) {
|
||||||
|
|
||||||
b->setOnDoubleClicked([]() {});
|
|
||||||
|
|
||||||
b->setOnClicked([]() {
|
|
||||||
#ifdef HAS_DISPLAY
|
#ifdef HAS_DISPLAY
|
||||||
dp_refresh(true); // switch to next display page
|
dp_refresh(true); // switch to next display page
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAS_MATRIX_DISPLAY
|
#ifdef HAS_MATRIX_DISPLAY
|
||||||
refreshTheMatrixDisplay(true); // switch to next display page
|
refreshTheMatrixDisplay(true); // switch to next display page
|
||||||
#endif
|
#endif
|
||||||
});
|
|
||||||
|
|
||||||
b->setOnHolding([]() {
|
|
||||||
payload.reset();
|
|
||||||
payload.addButton(0x01);
|
|
||||||
SendPayload(BUTTONPORT);
|
|
||||||
});
|
|
||||||
|
|
||||||
// attach interrupt to the button
|
|
||||||
attachInterrupt(digitalPinToInterrupt(pin), ButtonIRQ, CHANGE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void readButton() { b->update(); }
|
void longPressStart(void) {
|
||||||
|
payload.reset();
|
||||||
|
payload.addButton(0x01);
|
||||||
|
SendPayload(BUTTONPORT);
|
||||||
|
}
|
||||||
|
|
||||||
|
void buttonLoop(void *parameter) {
|
||||||
|
while (1) {
|
||||||
|
doIRQ(BUTTON_IRQ);
|
||||||
|
delay(20);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void button_init(void) {
|
||||||
|
ESP_LOGI(TAG, "Starting button Controller...");
|
||||||
|
xTaskCreatePinnedToCore(buttonLoop, // task function
|
||||||
|
"buttonloop", // name of task
|
||||||
|
2048, // stack size of task
|
||||||
|
(void *)1, // parameter of the task
|
||||||
|
2, // priority of the task
|
||||||
|
&buttonLoopTask, // task handle
|
||||||
|
1); // CPU core
|
||||||
|
|
||||||
|
button.setPressTicks(1000);
|
||||||
|
button.attachClick(singleClick);
|
||||||
|
button.attachLongPressStart(longPressStart);
|
||||||
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
@ -71,6 +71,13 @@ void doHousekeeping() {
|
|||||||
eTaskGetState(ledLoopTask));
|
eTaskGetState(ledLoopTask));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAS_BUTTON
|
||||||
|
if (buttonLoopTask != NULL)
|
||||||
|
ESP_LOGD(TAG, "Buttonloop %d bytes left | Taskstate = %d",
|
||||||
|
uxTaskGetStackHighWaterMark(buttonLoopTask),
|
||||||
|
eTaskGetState(buttonLoopTask));
|
||||||
|
#endif
|
||||||
|
|
||||||
// read battery voltage into global variable
|
// read battery voltage into global variable
|
||||||
#if (defined BAT_MEASURE_ADC || defined HAS_PMU || defined HAS_IP5306)
|
#if (defined BAT_MEASURE_ADC || defined HAS_PMU || defined HAS_IP5306)
|
||||||
batt_level = read_battlevel();
|
batt_level = read_battlevel();
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
|
|
||||||
#define CFG_sx1276_radio 1
|
#define CFG_sx1276_radio 1
|
||||||
#define HAS_LED NOT_A_PIN // LoPy4 has no on board mono LED, we use on board RGB LED
|
#define HAS_LED NOT_A_PIN // LoPy4 has no on board mono LED, we use on board RGB LED
|
||||||
#define RGB_LED_COUNT 1 // we have 1 LEDs
|
|
||||||
#define RGB_LED_COUNT 1 // we have 1 LED
|
#define RGB_LED_COUNT 1 // we have 1 LED
|
||||||
#define HAS_RGB_LED FastLED.addLeds<WS2812, GPIO_NUM_0, GRB>(leds, RGB_LED_COUNT);
|
#define HAS_RGB_LED FastLED.addLeds<WS2812, GPIO_NUM_0, GRB>(leds, RGB_LED_COUNT);
|
||||||
#define BOARD_HAS_PSRAM // use extra 4MB extern RAM
|
#define BOARD_HAS_PSRAM // use extra 4MB extern RAM
|
||||||
|
@ -13,10 +13,10 @@ void irqHandler(void *pvParameters) {
|
|||||||
|
|
||||||
// task remains in blocked state until it is notified by an irq
|
// task remains in blocked state until it is notified by an irq
|
||||||
for (;;) {
|
for (;;) {
|
||||||
xTaskNotifyWait(0x00, // Don't clear any bits on entry
|
xTaskNotifyWait(0x00, // Don't clear any bits on entry
|
||||||
ULONG_MAX, // Clear all bits on exit
|
ULONG_MAX, // Clear all bits on exit
|
||||||
&irqSource, // Receives the notification value
|
&irqSource, // Receives the notification value
|
||||||
portMAX_DELAY); // wait forever
|
portMAX_DELAY); // wait forever
|
||||||
|
|
||||||
if (irqSource & UNMASK_IRQ) // interrupt handler to be enabled?
|
if (irqSource & UNMASK_IRQ) // interrupt handler to be enabled?
|
||||||
irqSource &= ~MASK_IRQ; // then clear irq mask flag
|
irqSource &= ~MASK_IRQ; // then clear irq mask flag
|
||||||
@ -102,14 +102,6 @@ void IRAM_ATTR DisplayIRQ() { doIRQ(DISPLAY_IRQ); }
|
|||||||
void IRAM_ATTR MatrixDisplayIRQ() { doIRQ(MATRIX_DISPLAY_IRQ); }
|
void IRAM_ATTR MatrixDisplayIRQ() { doIRQ(MATRIX_DISPLAY_IRQ); }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAS_BUTTON
|
|
||||||
void IRAM_ATTR ButtonIRQ() { doIRQ(BUTTON_IRQ); }
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAS_PMU
|
|
||||||
void IRAM_ATTR PMUIRQ() { doIRQ(PMU_IRQ); }
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void mask_user_IRQ() { xTaskNotify(irqHandlerTask, MASK_IRQ, eSetBits); }
|
void mask_user_IRQ() { xTaskNotify(irqHandlerTask, MASK_IRQ, eSetBits); }
|
||||||
|
|
||||||
void unmask_user_IRQ() { xTaskNotify(irqHandlerTask, UNMASK_IRQ, eSetBits); }
|
void unmask_user_IRQ() { xTaskNotify(irqHandlerTask, UNMASK_IRQ, eSetBits); }
|
@ -28,6 +28,7 @@ licenses. Refer to LICENSE.txt file in repository for more details.
|
|||||||
Task Core Prio Purpose
|
Task Core Prio Purpose
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
ledloop* 1 1 blinks LEDs
|
ledloop* 1 1 blinks LEDs
|
||||||
|
buttonloop* 1 2 reads button
|
||||||
spiloop# 0 2 reads/writes data on spi interface
|
spiloop# 0 2 reads/writes data on spi interface
|
||||||
lmictask* 1 2 MCCI LMiC LORAWAN stack
|
lmictask* 1 2 MCCI LMiC LORAWAN stack
|
||||||
clockloop# 1 6 generates realtime telegrams for external clock
|
clockloop# 1 6 generates realtime telegrams for external clock
|
||||||
@ -468,7 +469,7 @@ void setup() {
|
|||||||
#else
|
#else
|
||||||
strcat_P(features, "PD");
|
strcat_P(features, "PD");
|
||||||
#endif // BUTTON_PULLUP
|
#endif // BUTTON_PULLUP
|
||||||
button_init(HAS_BUTTON);
|
button_init();
|
||||||
#endif // HAS_BUTTON
|
#endif // HAS_BUTTON
|
||||||
|
|
||||||
// only if we have a timesource we do timesync
|
// only if we have a timesource we do timesync
|
||||||
|
@ -25,6 +25,8 @@ static const adc_unit_t unit = ADC_UNIT_1;
|
|||||||
#ifdef HAS_PMU
|
#ifdef HAS_PMU
|
||||||
XPowersPMU pmu;
|
XPowersPMU pmu;
|
||||||
|
|
||||||
|
void IRAM_ATTR PMUIRQ() { doIRQ(PMU_IRQ); }
|
||||||
|
|
||||||
void AXP192_powerevent_IRQ(void) {
|
void AXP192_powerevent_IRQ(void) {
|
||||||
pmu.getIrqStatus();
|
pmu.getIrqStatus();
|
||||||
|
|
||||||
|
133
src/senddata.cpp
133
src/senddata.cpp
@ -96,9 +96,8 @@ void sendData() {
|
|||||||
|
|
||||||
#if !(PAYLOAD_OPENSENSEBOX)
|
#if !(PAYLOAD_OPENSENSEBOX)
|
||||||
payload.addCount(count.wifi_count, MAC_SNIFF_WIFI);
|
payload.addCount(count.wifi_count, MAC_SNIFF_WIFI);
|
||||||
if (cfg.blescan) {
|
if (cfg.blescan)
|
||||||
payload.addCount(count.ble_count, MAC_SNIFF_BLE);
|
payload.addCount(count.ble_count, MAC_SNIFF_BLE);
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (HAS_GPS)
|
#if (HAS_GPS)
|
||||||
@ -114,116 +113,116 @@ void sendData() {
|
|||||||
|
|
||||||
#if (PAYLOAD_OPENSENSEBOX)
|
#if (PAYLOAD_OPENSENSEBOX)
|
||||||
payload.addCount(count.wifi_count, MAC_SNIFF_WIFI);
|
payload.addCount(count.wifi_count, MAC_SNIFF_WIFI);
|
||||||
if (cfg.blescan) {
|
if (cfg.blescan)
|
||||||
payload.addCount(count.ble_count, MAC_SNIFF_BLE);
|
payload.addCount(count.ble_count, MAC_SNIFF_BLE);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (HAS_SDS011)
|
#if (HAS_SDS011)
|
||||||
sds011_store(&sds_status);
|
sds011_store(&sds_status);
|
||||||
payload.addSDS(sds_status);
|
payload.addSDS(sds_status);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAS_DISPLAY
|
#ifdef HAS_DISPLAY
|
||||||
dp_plotCurve(count.pax, true);
|
dp_plotCurve(count.pax, true);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (HAS_SDCARD)
|
#if (HAS_SDCARD)
|
||||||
sdcardWriteData(count.wifi_count, count.ble_count
|
sdcardWriteData(count.wifi_count, count.ble_count
|
||||||
#if (defined BAT_MEASURE_ADC || defined HAS_PMU)
|
#if (defined BAT_MEASURE_ADC || defined HAS_PMU)
|
||||||
,
|
,
|
||||||
read_voltage()
|
read_voltage()
|
||||||
#endif
|
#endif
|
||||||
);
|
);
|
||||||
#endif // HAS_SDCARD
|
#endif // HAS_SDCARD
|
||||||
|
|
||||||
SendPayload(COUNTERPORT);
|
SendPayload(COUNTERPORT);
|
||||||
break; // case COUNTDATA
|
break; // case COUNTDATA
|
||||||
|
|
||||||
#endif // ((WIFICOUNTER) || (BLECOUNTER))
|
#endif // ((WIFICOUNTER) || (BLECOUNTER))
|
||||||
|
|
||||||
#if (HAS_BME)
|
#if (HAS_BME)
|
||||||
case MEMS_DATA:
|
case MEMS_DATA:
|
||||||
payload.reset();
|
payload.reset();
|
||||||
payload.addBME(bme_status);
|
payload.addBME(bme_status);
|
||||||
SendPayload(BMEPORT);
|
SendPayload(BMEPORT);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (HAS_GPS)
|
#if (HAS_GPS)
|
||||||
case GPS_DATA:
|
case GPS_DATA:
|
||||||
if (GPSPORT != COUNTERPORT) {
|
if (GPSPORT != COUNTERPORT) {
|
||||||
// send GPS position only if we have a fix
|
// send GPS position only if we have a fix
|
||||||
if (gps_hasfix()) {
|
if (gps_hasfix()) {
|
||||||
gps_storelocation(&gps_status);
|
gps_storelocation(&gps_status);
|
||||||
payload.reset();
|
payload.reset();
|
||||||
payload.addGPS(gps_status);
|
payload.addGPS(gps_status);
|
||||||
SendPayload(GPSPORT);
|
SendPayload(GPSPORT);
|
||||||
} else
|
} else
|
||||||
ESP_LOGD(TAG, "No valid GPS position");
|
ESP_LOGD(TAG, "No valid GPS position");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (HAS_SENSORS)
|
#if (HAS_SENSORS)
|
||||||
#if (HAS_SENSOR_1)
|
#if (HAS_SENSOR_1)
|
||||||
case SENSOR1_DATA:
|
case SENSOR1_DATA:
|
||||||
payload.reset();
|
payload.reset();
|
||||||
payload.addSensor(sensor_read(1));
|
payload.addSensor(sensor_read(1));
|
||||||
SendPayload(SENSOR1PORT);
|
SendPayload(SENSOR1PORT);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#if (HAS_SENSOR_2)
|
#if (HAS_SENSOR_2)
|
||||||
case SENSOR2_DATA:
|
case SENSOR2_DATA:
|
||||||
payload.reset();
|
payload.reset();
|
||||||
payload.addSensor(sensor_read(2));
|
payload.addSensor(sensor_read(2));
|
||||||
SendPayload(SENSOR2PORT);
|
SendPayload(SENSOR2PORT);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#if (HAS_SENSOR_3)
|
#if (HAS_SENSOR_3)
|
||||||
case SENSOR3_DATA:
|
case SENSOR3_DATA:
|
||||||
payload.reset();
|
payload.reset();
|
||||||
payload.addSensor(sensor_read(3));
|
payload.addSensor(sensor_read(3));
|
||||||
SendPayload(SENSOR3PORT);
|
SendPayload(SENSOR3PORT);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (defined BAT_MEASURE_ADC || defined HAS_PMU)
|
#if (defined BAT_MEASURE_ADC || defined HAS_PMU)
|
||||||
case BATT_DATA:
|
case BATT_DATA:
|
||||||
payload.reset();
|
payload.reset();
|
||||||
payload.addVoltage(read_voltage());
|
payload.addVoltage(read_voltage());
|
||||||
SendPayload(BATTPORT);
|
SendPayload(BATTPORT);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
} // switch
|
} // switch
|
||||||
bitmask &= ~mask;
|
bitmask &= ~mask;
|
||||||
mask <<= 1;
|
mask <<= 1;
|
||||||
} // while (bitmask)
|
} // while (bitmask)
|
||||||
} // sendData()
|
} // sendData()
|
||||||
|
|
||||||
void flushQueues(void) {
|
void flushQueues(void) {
|
||||||
rcmd_queuereset();
|
rcmd_queuereset();
|
||||||
#if (HAS_LORA)
|
#if (HAS_LORA)
|
||||||
lora_queuereset();
|
lora_queuereset();
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAS_SPI
|
#ifdef HAS_SPI
|
||||||
spi_queuereset();
|
spi_queuereset();
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAS_MQTT
|
#ifdef HAS_MQTT
|
||||||
mqtt_queuereset();
|
mqtt_queuereset();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool allQueuesEmtpy(void) {
|
bool allQueuesEmtpy(void) {
|
||||||
uint32_t rc = rcmd_queuewaiting();
|
uint32_t rc = rcmd_queuewaiting();
|
||||||
#if (HAS_LORA)
|
#if (HAS_LORA)
|
||||||
rc += lora_queuewaiting();
|
rc += lora_queuewaiting();
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAS_SPI
|
#ifdef HAS_SPI
|
||||||
rc += spi_queuewaiting();
|
rc += spi_queuewaiting();
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAS_MQTT
|
#ifdef HAS_MQTT
|
||||||
rc += mqtt_queuewaiting();
|
rc += mqtt_queuewaiting();
|
||||||
#endif
|
#endif
|
||||||
return (rc == 0) ? true : false;
|
return (rc == 0) ? true : false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user