code sanitizations

This commit is contained in:
Klaus K Wilting 2018-07-19 21:53:56 +02:00
parent c3a1e4f4ec
commit ed18316616
5 changed files with 17 additions and 15 deletions

View File

@ -13,6 +13,8 @@ const char lora_datarate[] = {"1211100908077BFSNA"};
const char lora_datarate[] = {"100908078CNA121110090807"}; const char lora_datarate[] = {"100908078CNA121110090807"};
#endif #endif
uint8_t DisplayState = 0;
// helper function, prints a hex key on display // helper function, prints a hex key on display
void DisplayKey(const uint8_t *key, uint8_t len, bool lsb) { void DisplayKey(const uint8_t *key, uint8_t len, bool lsb) {
const uint8_t *p; const uint8_t *p;

View File

@ -3,6 +3,8 @@
#include <U8x8lib.h> #include <U8x8lib.h>
extern uint8_t DisplayState;
void init_display(const char *Productname, const char *Version); void init_display(const char *Productname, const char *Version);
void refreshDisplay(void); void refreshDisplay(void);
void DisplayKey(const uint8_t *key, uint8_t len, bool lsb); void DisplayKey(const uint8_t *key, uint8_t len, bool lsb);

View File

@ -36,12 +36,12 @@ typedef struct {
char version[10]; // Firmware version char version[10]; // Firmware version
} configData_t; } configData_t;
extern configData_t cfg; // global variables
extern char display_line6[], display_line7[]; extern configData_t cfg; // current device configuration
extern int countermode, screensaver, adrmode, lorasf, txpower, rlim; extern char display_line6[], display_line7[]; // screen buffers
extern uint8_t channel, DisplayState; extern uint8_t channel; // wifi channel rotation counter
extern uint16_t macs_total, macs_wifi, macs_ble; // MAC counters extern uint16_t macs_total, macs_wifi, macs_ble; // MAC counters
extern std::set<uint16_t> macs; extern std::set<uint16_t> macs; // temp storeage for sniffed MACs
extern hw_timer_t *channelSwitch, *sendCycle; extern hw_timer_t *channelSwitch, *sendCycle;
extern portMUX_TYPE timerMux; extern portMUX_TYPE timerMux;
@ -83,7 +83,6 @@ extern CayenneLPP payload;
#error "No valid payload converter defined" #error "No valid payload converter defined"
#endif #endif
void reset_counters(void); void reset_counters(void);
void blink_LED(uint16_t set_color, uint16_t set_blinkduration); void blink_LED(uint16_t set_color, uint16_t set_blinkduration);
void led_loop(void); void led_loop(void);

View File

@ -5,6 +5,9 @@
// Local logging tag // Local logging tag
static const char TAG[] = "main"; static const char TAG[] = "main";
TinyGPSPlus gps;
gpsStatus_t gps_status;
// read GPS data and cast to global struct // read GPS data and cast to global struct
void gps_read() { void gps_read() {
gps_status.latitude = (uint32_t)(gps.location.lat() * 1e6); gps_status.latitude = (uint32_t)(gps.location.lat() * 1e6);

View File

@ -27,20 +27,16 @@ licenses. Refer to LICENSE.txt file in repository for more details.
#include "globals.h" #include "globals.h"
#include "main.h" #include "main.h"
// Initialize global variables
configData_t cfg; // struct holds current device configuration configData_t cfg; // struct holds current device configuration
// Initialize variables
char display_line6[16], display_line7[16]; // display buffers 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, 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, hw_timer_t *channelSwitch = NULL, *displaytimer = NULL,
*sendCycle = NULL; // configure hardware timer for cyclic tasks *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 // this variables will be changed in the ISR, and read in main loop
static volatile int ButtonPressedIRQ = 0, ChannelTimerIRQ = 0, static volatile int ButtonPressedIRQ = 0, ChannelTimerIRQ = 0,
SendCycleTimerIRQ = 0, DisplayTimerIRQ = 0; SendCycleTimerIRQ = 0, DisplayTimerIRQ = 0;