code sanitizations

This commit is contained in:
Klaus K Wilting 2018-07-15 23:40:42 +02:00
parent 77815cf18b
commit c1f51ee21e
6 changed files with 11 additions and 12 deletions

View File

@ -6,6 +6,13 @@
HAS_DISPLAY u8x8(OLED_RST, OLED_SCL, OLED_SDA); HAS_DISPLAY u8x8(OLED_RST, OLED_SCL, OLED_SDA);
// helper string for converting LoRa spread factor values
#if defined(CFG_eu868)
const char lora_datarate[] = {"1211100908077BFSNA"};
#elif defined(CFG_us915)
const char lora_datarate[] = {"100908078CNA121110090807"};
#endif
// 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

@ -17,17 +17,10 @@ extern char display_line6[], display_line7[];
extern int countermode, screensaver, adrmode, lorasf, txpower, rlim; extern int countermode, screensaver, adrmode, lorasf, txpower, rlim;
extern uint8_t channel, DisplayState; extern uint8_t channel, DisplayState;
extern uint16_t macs_total, macs_wifi, macs_ble; // MAC counters extern uint16_t macs_total, macs_wifi, macs_ble; // MAC counters
extern uint64_t uptimecounter;
extern std::set<uint16_t> macs; extern std::set<uint16_t> macs;
extern hw_timer_t *channelSwitch, *sendCycle; extern hw_timer_t *channelSwitch, *sendCycle;
extern portMUX_TYPE timerMux; extern portMUX_TYPE timerMux;
#if defined(CFG_eu868)
const char lora_datarate[] = {"1211100908077BFSNA"};
#elif defined(CFG_us915)
const char lora_datarate[] = {"100908078CNA121110090807"};
#endif
#ifdef HAS_GPS #ifdef HAS_GPS
extern gpsStatus_t gps_status; // struct for storing gps data extern gpsStatus_t gps_status; // struct for storing gps data
extern TinyGPSPlus gps; // Make TinyGPS++ instance globally availabe extern TinyGPSPlus gps; // Make TinyGPS++ instance globally availabe

View File

@ -4,6 +4,7 @@
// ESP32 Functions // ESP32 Functions
#include <esp_wifi.h> #include <esp_wifi.h>
// Hash function for scrambling MAC addresses
#include "hash.h" #include "hash.h"
#define MAC_SNIFF_WIFI 0 #define MAC_SNIFF_WIFI 0

View File

@ -32,7 +32,6 @@ char display_line6[16], display_line7[16]; // display buffers
uint8_t DisplayState = 0, channel = 0; // globals for state machine uint8_t DisplayState = 0, channel = 0; // globals for state machine
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
uint64_t uptimecounter = 0; // timer global for uptime counter
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
@ -438,8 +437,6 @@ void loop() {
// state machine for uptime, display, LED, button, lowmemory, senddata // state machine for uptime, display, LED, button, lowmemory, senddata
uptimecounter = uptime() / 1000; // counts uptime in seconds (64bit)
#if (HAS_LED != NOT_A_PIN) || defined(HAS_RGB_LED) #if (HAS_LED != NOT_A_PIN) || defined(HAS_RGB_LED)
led_loop(); led_loop();
#endif #endif

View File

@ -73,4 +73,5 @@ extern TinyGPSPlus gps; // Make TinyGPS++ instance globally availabe
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);
uint64_t uptime();

View File

@ -284,7 +284,7 @@ void get_status(uint8_t val) {
uint16_t voltage = 0; uint16_t voltage = 0;
#endif #endif
payload.reset(); payload.reset();
payload.addStatus(voltage, uptimecounter, temperatureRead()); payload.addStatus(voltage, uptime() / 1000, temperatureRead());
senddata(STATUSPORT); senddata(STATUSPORT);
}; };