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"};
#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;

View File

@ -3,6 +3,8 @@
#include <U8x8lib.h>
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);

View File

@ -5,7 +5,7 @@
#include <Arduino.h>
// needed for ESP_LOGx on arduino framework
#include <esp32-hal-log.h>
#include <esp32-hal-log.h>
// 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<uint16_t> macs;
extern std::set<uint16_t> 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);

View File

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

View File

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