Skip to content

Commit

Permalink
Remove blumy debug
Browse files Browse the repository at this point in the history
  • Loading branch information
Dennis960 committed Apr 14, 2024
1 parent 701f10f commit 58783f5
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 49 deletions.
2 changes: 0 additions & 2 deletions ESPlant-Firmware/main/defaults.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,3 @@
#define DEFAULT_SSID_MAX_LENGTH 33
#define DEFAULT_PASSWORD_MAX_LENGTH 65
#define DEFAULT_API_URL "http://esplant.hoppingadventure.com/api/v2/data"

// #define BLUMY_DEBUG
18 changes: 0 additions & 18 deletions ESPlant-Firmware/main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,6 @@ void sendSensorData(sensors_full_data_t *sensors_data, int8_t rssi)
char bearer[60];
sprintf(bearer, "Bearer %s", token);

#ifdef BLUMY_DEBUG
uint8_t debug_wdt_reached = 1;
plantstore_debugGetWdtReached(&debug_wdt_reached);
if (debug_wdt_reached)
{
rssi = 127; // debug value that is easy to spot
plantstore_debugSetWdtReached(0);
}
#endif

sprintf(data, "{\"light\":%2.2f,\"voltage\":%.2f,\"temperature\":%.2f,\"humidity\":%.2f,\"isUsbConnected\":%s,\"moisture\":%d,\"moistureStabilizationTime\":%lu,\"isMoistureMeasurementSuccessful\":%s,\"humidityRaw\":%lu,\"temperatureRaw\":%lu,\"rssi\":%d,\"duration\":%lld}",
sensors_data->light,
sensors_data->voltage,
Expand Down Expand Up @@ -118,14 +108,6 @@ void configuration_mode(bool isConfigured)
void watchdog_callback(void *arg)
{
ESP_LOGE("Watchdog", "Watchdog timeout reached, going to sleep");
#ifdef BLUMY_DEBUG
uint8_t debug_wdt_reached = 1;
plantstore_debugGetWdtReached(&debug_wdt_reached);
if (!debug_wdt_reached)
{
plantstore_debugSetWdtReached(1);
}
#endif
start_deep_sleep();
}

Expand Down
1 change: 1 addition & 0 deletions ESPlant-Firmware/main/plantfi.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ bool *_userConnectedToAp = NULL;
void plantfi_event_handler(void *arg, esp_event_base_t event_base,
int32_t event_id, void *event_data)
{
ESP_LOGI(PLANTFI_TAG, "Event dispatched from event loop base=%s, event_id=%ld", event_base, event_id);
if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_STA_DISCONNECTED)
{
if (plantfi_retry_num < plantfi_max_retry)
Expand Down
20 changes: 0 additions & 20 deletions ESPlant-Firmware/main/plantstore.c
Original file line number Diff line number Diff line change
Expand Up @@ -218,23 +218,3 @@ void plantstore_hardReset()
ESP_ERROR_CHECK(nvs_commit(nvs_handle));
nvs_close(nvs_handle);
}


#ifdef BLUMY_DEBUG
bool plantstore_debugGetWdtReached(uint8_t *reached)
{
nvs_handle_t nvs_handle = plantstore_openNvsReadOnly();
esp_err_t reached_err = nvs_get_u8(nvs_handle, DEBUG_WDT_REACHED_KEY, reached);
nvs_close(nvs_handle);

return reached_err == ESP_OK;
}

void plantstore_debugSetWdtReached(uint8_t reached)
{
nvs_handle_t nvs_handle = plantstore_openNvsReadWrite();
ESP_ERROR_CHECK(nvs_set_u8(nvs_handle, DEBUG_WDT_REACHED_KEY, reached));
ESP_ERROR_CHECK(nvs_commit(nvs_handle));
nvs_close(nvs_handle);
}
#endif
9 changes: 0 additions & 9 deletions ESPlant-Firmware/main/plantstore.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@
#define WATCHDOG_TIMEOUT_KEY "timeout_wdt"
#define FIRMWARE_UPDATE_URL_KEY "update_url"

#ifdef BLUMY_DEBUG
#define DEBUG_WDT_REACHED_KEY "debug_wdt"
#endif

bool plantstore_getWifiCredentials(char *ssid, char *password, size_t ssid_size, size_t password_size);
void plantstore_setWifiCredentials(char *ssid, char *password);
bool plantstore_getCloudConfigurationHttp(char *sensorId, char *url, char *auth, size_t sensorId_size, size_t url_size, size_t auth_size);
Expand All @@ -48,8 +44,3 @@ bool plantstore_getFirmwareUpdateUrl(char *url, size_t url_size);
*/
bool plantstore_isConfigured();
void plantstore_hardReset();

#ifdef BLUMY_DEBUG
bool plantstore_debugGetWdtReached(uint8_t *reached);
void plantstore_debugSetWdtReached(uint8_t reached);
#endif

0 comments on commit 58783f5

Please sign in to comment.