code sanitization (decentralized several vars)

This commit is contained in:
cyberman54 2021-03-31 19:02:01 +02:00
parent 03796c39af
commit e439d932b9
11 changed files with 29 additions and 22 deletions

View File

@ -127,7 +127,6 @@ extern std::array<uint64_t, 0xff> 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

View File

@ -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);

View File

@ -20,5 +20,6 @@
#include "timekeeper.h"
#include "corona.h"
#include "boot.h"
#include "libpax_helpers.h"
#endif

View File

@ -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

View File

@ -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(); }

View File

@ -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) {

View File

@ -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);

View File

@ -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 {

View File

@ -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] = "";

View File

@ -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;

View File

@ -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)