code sanitizations

This commit is contained in:
cyberman54 2018-05-27 17:42:18 +02:00
parent be883d577e
commit b9e3961609
7 changed files with 12 additions and 21 deletions

View File

@ -5,7 +5,7 @@
#include <Arduino.h> #include <Arduino.h>
// Local logging tag // Local logging tag
static const char *TAG = "antenna"; static const char* TAG = "wifi";
typedef enum { typedef enum {
ANTENNA_INT = 0, ANTENNA_INT = 0,

View File

@ -17,7 +17,7 @@ https://github.com/nkolban/esp32-snippets/tree/master/BLE/scanner
#define BT_BD_ADDR_HEX(addr) addr[0], addr[1], addr[2], addr[3], addr[4], addr[5] #define BT_BD_ADDR_HEX(addr) addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]
// local Tag for logging // local Tag for logging
static const char *TAG = "blescan"; static const char* TAG = "bluetooth";
// defined in macsniff.cpp // defined in macsniff.cpp
bool mac_add(uint8_t *paddr, int8_t rssi, bool sniff_type); bool mac_add(uint8_t *paddr, int8_t rssi, bool sniff_type);
@ -92,9 +92,8 @@ static const char *btsig_gap_type(uint32_t gap_type) {
IRAM_ATTR static void gap_callback_handler(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param_t *param) IRAM_ATTR static void gap_callback_handler(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param_t *param)
{ {
esp_ble_gap_cb_param_t *p = (esp_ble_gap_cb_param_t *)param; esp_ble_gap_cb_param_t *p = (esp_ble_gap_cb_param_t *)param;
esp_err_t status;
ESP_LOGD(TAG, "BT payload rcvd -> type: 0x%.2x -> %s", *p->scan_rst.ble_adv, btsig_gap_type(*p->scan_rst.ble_adv));
ESP_LOGD(tag, "BT payload rcvd -> type: 0x%.2x -> %s", *p->scan_rst.ble_adv, btsig_gap_type(*p->scan_rst.ble_adv));
switch (event) switch (event)
{ {

View File

@ -5,7 +5,7 @@
#include <nvs_flash.h> #include <nvs_flash.h>
// Local logging tag // Local logging tag
static const char *TAG = "configmanager"; static const char* TAG = "flash";
nvs_handle my_handle; nvs_handle my_handle;

View File

@ -11,7 +11,7 @@
#endif #endif
// Local logging Tag // Local logging Tag
static const char *TAG = "lorawan"; static const char* TAG = "lora";
// functions defined in rcommand.cpp // functions defined in rcommand.cpp
void rcommand(uint8_t cmd, uint8_t arg); void rcommand(uint8_t cmd, uint8_t arg);
@ -79,8 +79,6 @@ void get_hard_deveui(uint8_t *pdeveui) {
// Display a key // Display a key
void printKey(const char * name, const uint8_t * key, uint8_t len, bool lsb) { void printKey(const char * name, const uint8_t * key, uint8_t len, bool lsb) {
uint8_t start=lsb?len:0;
uint8_t end = lsb?0:len;
const uint8_t * p ; const uint8_t * p ;
char keystring[len+1] = "", keybyte[3]; char keystring[len+1] = "", keybyte[3];
for (uint8_t i=0; i<len ; i++) { for (uint8_t i=0; i<len ; i++) {
@ -170,7 +168,7 @@ void onEvent (ev_t ev) {
case EV_JOINED: case EV_JOINED:
strcpy_P(buff, PSTR("JOINED")); strcpy_P(buff, PSTR("JOINED"));
sprintf(display_lora, ""); // clear previous lmic status message from display sprintf(display_lora, " "); // clear previous lmic status message from display
// Disable link check validation (automatically enabled // Disable link check validation (automatically enabled
// during join, but not supported by TTN at this time). -> do we need this? // during join, but not supported by TTN at this time). -> do we need this?
@ -188,7 +186,7 @@ void onEvent (ev_t ev) {
case EV_TXCOMPLETE: case EV_TXCOMPLETE:
strcpy_P(buff, (LMIC.txrxFlags & TXRX_ACK) ? PSTR("RECEIVED ACK") : PSTR("TX COMPLETE")); strcpy_P(buff, (LMIC.txrxFlags & TXRX_ACK) ? PSTR("RECEIVED ACK") : PSTR("TX COMPLETE"));
sprintf(display_lora, ""); // clear previous lmic status message from display sprintf(display_lora, " "); // clear previous lmic status message from display
if (LMIC.dataLen) { if (LMIC.dataLen) {
ESP_LOGI(TAG, "Received %d bytes of payload, RSSI %d SNR %d", LMIC.dataLen, LMIC.rssi, (signed char)LMIC.snr / 4); ESP_LOGI(TAG, "Received %d bytes of payload, RSSI %d SNR %d", LMIC.dataLen, LMIC.rssi, (signed char)LMIC.snr / 4);

View File

@ -3,13 +3,11 @@
#include "globals.h" #include "globals.h"
#ifdef VENDORFILTER #ifdef VENDORFILTER
#include <array>
#include <algorithm>
#include "vendor_array.h" #include "vendor_array.h"
#endif #endif
// Local logging tag // Local logging tag
static const char *TAG = "macsniff"; static const char* TAG = "wifi";
static wifi_country_t wifi_country = {.cc=WIFI_MY_COUNTRY, .schan=WIFI_CHANNEL_MIN, .nchan=WIFI_CHANNEL_MAX, .policy=WIFI_COUNTRY_POLICY_MANUAL}; static wifi_country_t wifi_country = {.cc=WIFI_MY_COUNTRY, .schan=WIFI_CHANNEL_MIN, .nchan=WIFI_CHANNEL_MAX, .policy=WIFI_COUNTRY_POLICY_MANUAL};

View File

@ -61,9 +61,7 @@ std::set<uint16_t> macs; // associative container holds total of unique MAC adre
static volatile int ButtonPressed = 0, DisplayTimerIRQ = 0, ChannelTimerIRQ = 0; static volatile int ButtonPressed = 0, DisplayTimerIRQ = 0, ChannelTimerIRQ = 0;
// local Tag for logging // local Tag for logging
static const char *TAG = "paxcnt"; static const char* TAG = "main";
// Note: Log level control seems not working during runtime,
// so we need to switch loglevel by compiler build option in platformio.ini
#ifndef VERBOSE #ifndef VERBOSE
int redirect_log(const char * fmt, va_list args) { int redirect_log(const char * fmt, va_list args) {
@ -241,8 +239,6 @@ uint64_t uptime() {
// Print a key on display // Print a 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) {
uint8_t start=lsb?len:0;
uint8_t end = lsb?0:len;
const uint8_t * p ; const uint8_t * p ;
for (uint8_t i=0; i<len ; i++) { for (uint8_t i=0; i<len ; i++) {
p = lsb ? key+len-i-1 : key+i; p = lsb ? key+len-i-1 : key+i;
@ -413,7 +409,7 @@ uint64_t uptime() {
// small blink 10ms on each 1/2sec (not when joining) // small blink 10ms on each 1/2sec (not when joining)
LEDState = ((millis() % 500) < 20) ? LED_ON : LED_OFF; LEDState = ((millis() % 500) < 20) ? LED_ON : LED_OFF;
// This should not happen so indicate a problem // This should not happen so indicate a problem
} else if ( LMIC.opmode & (OP_TXDATA | OP_TXRXPEND | OP_JOINING | OP_REJOIN) == 0 ) { } else if ( LMIC.opmode & ((OP_TXDATA | OP_TXRXPEND | OP_JOINING | OP_REJOIN) == 0 ) ) {
LEDColor = COLOR_RED; LEDColor = COLOR_RED;
// heartbeat long blink 200ms on each 2 seconds // heartbeat long blink 200ms on each 2 seconds
LEDState = ((millis() % 2000) < 200) ? LED_ON : LED_OFF; LEDState = ((millis() % 2000) < 200) ? LED_ON : LED_OFF;

View File

@ -10,7 +10,7 @@
#include <hal/hal.h> #include <hal/hal.h>
// Local logging tag // Local logging tag
static const char *TAG = "rcommand"; static const char* TAG = "main";
// table of remote commands and assigned functions // table of remote commands and assigned functions
typedef struct { typedef struct {