diff --git a/src/display.cpp b/src/display.cpp index 319d77ba..2a7c9779 100644 --- a/src/display.cpp +++ b/src/display.cpp @@ -13,6 +13,8 @@ const char lora_datarate[] = {"1211100908077BFSNA"}; const char lora_datarate[] = {"100908078CNA121110090807"}; #endif +uint8_t DisplayState = 0; + // helper function, prints a hex key on display void DisplayKey(const uint8_t *key, uint8_t len, bool lsb) { const uint8_t *p; diff --git a/src/display.h b/src/display.h index 9fbd884a..a444de7b 100644 --- a/src/display.h +++ b/src/display.h @@ -3,6 +3,8 @@ #include +extern uint8_t DisplayState; + void init_display(const char *Productname, const char *Version); void refreshDisplay(void); void DisplayKey(const uint8_t *key, uint8_t len, bool lsb); diff --git a/src/globals.h b/src/globals.h index a904bdb8..0b08faec 100644 --- a/src/globals.h +++ b/src/globals.h @@ -5,7 +5,7 @@ #include // needed for ESP_LOGx on arduino framework -#include +#include // attn: increment version after modifications to configData_t truct! #define PROGVERSION "1.3.91" // use max 10 chars here! @@ -36,12 +36,12 @@ typedef struct { char version[10]; // Firmware version } configData_t; -extern configData_t cfg; -extern char display_line6[], display_line7[]; -extern int countermode, screensaver, adrmode, lorasf, txpower, rlim; -extern uint8_t channel, DisplayState; +// global variables +extern configData_t cfg; // current device configuration +extern char display_line6[], display_line7[]; // screen buffers +extern uint8_t channel; // wifi channel rotation counter extern uint16_t macs_total, macs_wifi, macs_ble; // MAC counters -extern std::set macs; +extern std::set macs; // temp storeage for sniffed MACs extern hw_timer_t *channelSwitch, *sendCycle; extern portMUX_TYPE timerMux; @@ -83,7 +83,6 @@ extern CayenneLPP payload; #error "No valid payload converter defined" #endif - void reset_counters(void); void blink_LED(uint16_t set_color, uint16_t set_blinkduration); void led_loop(void); diff --git a/src/gps.cpp b/src/gps.cpp index 98952f53..3aff1bb5 100644 --- a/src/gps.cpp +++ b/src/gps.cpp @@ -5,6 +5,9 @@ // Local logging tag static const char TAG[] = "main"; +TinyGPSPlus gps; +gpsStatus_t gps_status; + // read GPS data and cast to global struct void gps_read() { gps_status.latitude = (uint32_t)(gps.location.lat() * 1e6); diff --git a/src/main.cpp b/src/main.cpp index b0e97869..2d0074d9 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -27,20 +27,16 @@ licenses. Refer to LICENSE.txt file in repository for more details. #include "globals.h" #include "main.h" -// Initialize global variables configData_t cfg; // struct holds current device configuration + +// Initialize variables char display_line6[16], display_line7[16]; // display buffers -uint8_t DisplayState = 0, channel = 0; // globals for state machine +uint8_t channel = 0; // channel rotation counter uint16_t macs_total = 0, macs_wifi = 0, - macs_ble = 0; // MAC counters globals for display + macs_ble = 0; // MAC counters globals for display hw_timer_t *channelSwitch = NULL, *displaytimer = NULL, *sendCycle = NULL; // configure hardware timer for cyclic tasks -#ifdef HAS_GPS -gpsStatus_t gps_status; // struct for storing gps data -TinyGPSPlus gps; // create TinyGPS++ instance -#endif - // this variables will be changed in the ISR, and read in main loop static volatile int ButtonPressedIRQ = 0, ChannelTimerIRQ = 0, SendCycleTimerIRQ = 0, DisplayTimerIRQ = 0;