diff --git a/include/globals.h b/include/globals.h index 4e5202ac..225ebd93 100644 --- a/include/globals.h +++ b/include/globals.h @@ -127,7 +127,6 @@ extern std::array beacons; extern configData_t cfg; // current device configuration extern char clientId[20]; // unique clientID -extern char lmic_event_msg[LMIC_EVENTMSG_LEN]; // display buffer extern uint8_t batt_level; // display value extern uint16_t volatile libpax_macs_ble, libpax_macs_wifi; // libpax values extern uint8_t volatile channel; // wifi channel rotation counter diff --git a/include/lorawan.h b/include/lorawan.h index e2239739..fd300d9d 100644 --- a/include/lorawan.h +++ b/include/lorawan.h @@ -19,6 +19,7 @@ #endif extern TaskHandle_t lmicTask, lorasendTask; +extern char lmic_event_msg[LMIC_EVENTMSG_LEN]; // display buffer esp_err_t lmic_init(void); void lora_setupForNetwork(bool preJoin); diff --git a/include/main.h b/include/main.h index 6d2352b2..765dc7bd 100644 --- a/include/main.h +++ b/include/main.h @@ -20,5 +20,6 @@ #include "timekeeper.h" #include "corona.h" #include "boot.h" +#include "libpax_helpers.h" #endif \ No newline at end of file diff --git a/src/display.cpp b/src/display.cpp index 7c5b6d9a..2656246b 100644 --- a/src/display.cpp +++ b/src/display.cpp @@ -47,6 +47,8 @@ uint8_t displaybuf[MY_DISPLAY_WIDTH * MY_DISPLAY_HEIGHT / 8] = {0}; static uint8_t plotbuf[MY_DISPLAY_WIDTH * MY_DISPLAY_HEIGHT / 8] = {0}; static int dp_row = 0, dp_col = 0, dp_font = 0; +hw_timer_t *displayIRQ = NULL; + QRCode qrcode; #ifdef HAS_DISPLAY diff --git a/src/i2c.cpp b/src/i2c.cpp index f8f1bbdf..2d882043 100644 --- a/src/i2c.cpp +++ b/src/i2c.cpp @@ -5,6 +5,8 @@ // Local logging tag static const char TAG[] = __FILE__; +SemaphoreHandle_t I2Caccess; + void i2c_init(void) { Wire.begin(MY_DISPLAY_SDA, MY_DISPLAY_SCL, 100000); } void i2c_deinit(void) { Wire.~TwoWire(); } diff --git a/src/irqhandler.cpp b/src/irqhandler.cpp index 89bd4c23..2e97f360 100644 --- a/src/irqhandler.cpp +++ b/src/irqhandler.cpp @@ -3,6 +3,8 @@ // Local logging tag static const char TAG[] = __FILE__; +TaskHandle_t irqHandlerTask = NULL; + // irq handler task, handles all our application level interrupts void irqHandler(void *pvParameters) { diff --git a/src/ledmatrixdisplay.cpp b/src/ledmatrixdisplay.cpp index c727a766..a927cb35 100644 --- a/src/ledmatrixdisplay.cpp +++ b/src/ledmatrixdisplay.cpp @@ -14,6 +14,8 @@ static uint8_t displaybuf[LED_MATRIX_WIDTH * LED_MATRIX_HEIGHT / 8] = {0}; static unsigned long ulLastNumMacs = 0; static time_t ulLastTime = myTZ.toLocal(now()); +hw_timer_t *matrixDisplayIRQ = NULL; + LEDMatrix matrix(LED_MATRIX_LA_74138, LED_MATRIX_LB_74138, LED_MATRIX_LC_74138, LED_MATRIX_LD_74138, LED_MATRIX_EN_74138, LED_MATRIX_DATA_R1, LED_MATRIX_LATCHPIN, LED_MATRIX_CLOCKPIN); diff --git a/src/lorawan.cpp b/src/lorawan.cpp index b7a7fbdd..d01cfff2 100644 --- a/src/lorawan.cpp +++ b/src/lorawan.cpp @@ -21,6 +21,7 @@ RTC_DATA_ATTR lmic_t RTC_LMIC; static QueueHandle_t LoraSendQueue; TaskHandle_t lmicTask = NULL, lorasendTask = NULL; +char lmic_event_msg[LMIC_EVENTMSG_LEN]; // display buffer for LMIC event message class MyHalConfig_t : public Arduino_LMIC::HalConfiguration_t { diff --git a/src/main.cpp b/src/main.cpp index 6f0ee4ed..b20d5f34 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -85,31 +85,14 @@ triggers pps 1 sec impulse // Basic Config #include "main.h" -#include "libpax_helpers.h" - -configData_t cfg; // struct holds current device configuration -char lmic_event_msg[LMIC_EVENTMSG_LEN]; // display buffer for LMIC event message -uint8_t batt_level = 0; // display value -char clientId[20] = {0}; // unique ClientID - -hw_timer_t *ppsIRQ = NULL, *displayIRQ = NULL, *matrixDisplayIRQ = NULL; - -TaskHandle_t irqHandlerTask = NULL, ClockTask = NULL; -SemaphoreHandle_t I2Caccess; -bool volatile TimePulseTick = false; -timesource_t timeSource = _unsynced; - -// initialize payload encoder -PayloadConvert payload(PAYLOAD_BUFFER_SIZE); - -// set Time Zone for user setting from paxcounter.conf -TimeChangeRule myDST = DAYLIGHT_TIME; -TimeChangeRule mySTD = STANDARD_TIME; -Timezone myTZ(myDST, mySTD); // local Tag for logging static const char TAG[] = __FILE__; +configData_t cfg; // struct holds current device configuration +uint8_t batt_level = 0; // display value +char clientId[20] = {0}; // unique ClientID + void setup() { char features[100] = ""; diff --git a/src/payload.cpp b/src/payload.cpp index 2e89b1f4..740a250f 100644 --- a/src/payload.cpp +++ b/src/payload.cpp @@ -1,6 +1,9 @@ #include "globals.h" #include "payload.h" +// initialize payload encoder +PayloadConvert payload(PAYLOAD_BUFFER_SIZE); + PayloadConvert::PayloadConvert(uint8_t size) { buffer = (uint8_t *)malloc(size); cursor = 0; diff --git a/src/timekeeper.cpp b/src/timekeeper.cpp index d1da7744..9019fd3b 100644 --- a/src/timekeeper.cpp +++ b/src/timekeeper.cpp @@ -14,6 +14,17 @@ static const char TAG[] = __FILE__; // symbol to display current time source const char timeSetSymbols[] = {'G', 'R', 'L', 'S', '?'}; +// set Time Zone for user setting from paxcounter.conf +TimeChangeRule myDST = DAYLIGHT_TIME; +TimeChangeRule mySTD = STANDARD_TIME; +Timezone myTZ(myDST, mySTD); + +bool volatile TimePulseTick = false; +timesource_t timeSource = _unsynced; + +TaskHandle_t ClockTask = NULL; +hw_timer_t *ppsIRQ = NULL; + #ifdef HAS_IF482 #if (HAS_SDS011) #error cannot use IF482 together with SDS011 (both use UART#2)