From 27fd2967532eebfdbd8323a9ef2bee19fc24ef93 Mon Sep 17 00:00:00 2001 From: cyberman54 Date: Tue, 16 Aug 2022 13:27:48 +0200 Subject: [PATCH] code sanitizations --- src/display.cpp | 3 --- src/main.cpp | 2 -- src/payload.cpp | 1 - src/reset.cpp | 7 +++---- src/sdcard.cpp | 7 +------ src/senddata.cpp | 2 -- 6 files changed, 4 insertions(+), 18 deletions(-) diff --git a/src/display.cpp b/src/display.cpp index 4b98b76a..2343430e 100644 --- a/src/display.cpp +++ b/src/display.cpp @@ -138,7 +138,6 @@ void dp_init(bool verbose) { #endif #endif // HAS_LORA - } // verbose dp_power(cfg.screenon); // set display off if disabled @@ -182,7 +181,6 @@ void dp_refresh(bool nextPage) { dp->setCursor(0, 0); switch (DisplayPage) { - // page 0: pax + parameters overview // page 1: pax + lorawan parameters // page 2: pax + GPS lat/lon @@ -398,7 +396,6 @@ void dp_refresh(bool nextPage) { DisplayPage++; break; #endif - } // switch (page) } // dp_refresh diff --git a/src/main.cpp b/src/main.cpp index 9577c062..1ddb86f0 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -84,7 +84,6 @@ static const char TAG[] = __FILE__; char clientId[20] = {0}; // unique ClientID void setup() { - char features[100] = ""; // disable brownout detection @@ -487,7 +486,6 @@ void setup() { RTC_runmode = RUNMODE_NORMAL; vTaskDelete(NULL); - } // setup() void loop() { vTaskDelete(NULL); } diff --git a/src/payload.cpp b/src/payload.cpp index 3e2854e3..bd9977c0 100644 --- a/src/payload.cpp +++ b/src/payload.cpp @@ -58,7 +58,6 @@ void PayloadConvert::addConfig(configData_t value) { void PayloadConvert::addStatus(uint16_t voltage, uint64_t uptime, float cputemp, uint32_t mem, uint8_t reset0, uint32_t restarts) { - buffer[cursor++] = highByte(voltage); buffer[cursor++] = lowByte(voltage); buffer[cursor++] = (byte)((uptime & 0xFF00000000000000) >> 56); diff --git a/src/reset.cpp b/src/reset.cpp index f62cb54b..b6d39984 100644 --- a/src/reset.cpp +++ b/src/reset.cpp @@ -39,7 +39,6 @@ void do_reset(bool warmstart) { } void do_after_reset(void) { - struct timeval sleep_stop_time; uint64_t sleep_time_ms; @@ -54,7 +53,6 @@ void do_after_reset(void) { #endif switch (rtc_get_reset_reason(0)) { - case POWERON_RESET: // 0x01 Vbat power on reset case RTCWDT_BROWN_OUT_RESET: // 0x0f Reset when the vdd voltage is not // stable @@ -102,7 +100,6 @@ void do_after_reset(void) { } void enter_deepsleep(const uint64_t wakeup_sec, gpio_num_t wakeup_gpio) { - ESP_LOGI(TAG, "Preparing to sleep..."); RTC_runmode = RUNMODE_SLEEP; @@ -205,4 +202,6 @@ void enter_deepsleep(const uint64_t wakeup_sec, gpio_num_t wakeup_gpio) { esp_deep_sleep_start(); } -unsigned long long uptime() { return (RTC_millis + esp_timer_get_time() / 1000); } \ No newline at end of file +unsigned long long uptime() { + return (RTC_millis + esp_timer_get_time() / 1000); +} \ No newline at end of file diff --git a/src/sdcard.cpp b/src/sdcard.cpp index 4794ce00..d4c23e46 100644 --- a/src/sdcard.cpp +++ b/src/sdcard.cpp @@ -67,7 +67,6 @@ int print_to_sd_card(const char *fmt, va_list args) { #endif bool openFile(FILE **fd, const char *filename) { - char _filename[50]; sprintf(_filename, "%s%s", MOUNT_POINT, filename); @@ -81,7 +80,6 @@ bool openFile(FILE **fd, const char *filename) { } // openfile bool sdcard_init(bool create) { - esp_err_t ret; // for usage of SD drivers on ESP32 platform see @@ -171,7 +169,6 @@ bool sdcard_init(bool create) { snprintf(bufferFilename, sizeof(bufferFilename), "/%s.csv", SDCARD_FILE_NAME); if (openFile(&data_file, bufferFilename)) { - fpos_t position; fgetpos(data_file, &position); @@ -207,7 +204,6 @@ bool sdcard_init(bool create) { #endif return useSDCard; - } // sdcard_init void sdcard_flush(void) { @@ -236,7 +232,6 @@ void sdcard_close(void) { void sdcardWriteData(uint16_t noWifi, uint16_t noBle, __attribute__((unused)) uint16_t voltage) { - if (!useSDCard) return; @@ -264,4 +259,4 @@ void sdcardWriteData(uint16_t noWifi, uint16_t noBle, fprintf(data_file, "\n"); } -#endif // (HAS_SDCARD) +#endif // (HAS_SDCARD) \ No newline at end of file diff --git a/src/senddata.cpp b/src/senddata.cpp index d55ee92c..518fd30f 100644 --- a/src/senddata.cpp +++ b/src/senddata.cpp @@ -25,7 +25,6 @@ void initSendDataTimer(uint8_t sendcycle) { // put data to send in RTos Queues used for transmit over channels Lora and SPI void SendPayload(uint8_t port) { - ESP_LOGD(TAG, "sending Payload for Port %d", port); MessageBuffer_t SendBuffer; // contains MessageSize, MessagePort, Message[] @@ -69,7 +68,6 @@ void SendPayload(uint8_t port) { #ifdef HAS_MQTT mqtt_enqueuedata(&SendBuffer); #endif - } // SendPayload // timer triggered function to prepare payload to send