From 66faf5551308bb49d7283a9b3de4581ed51ebaee Mon Sep 17 00:00:00 2001 From: Torsten Stauder Date: Mon, 3 May 2021 00:55:24 +0200 Subject: [PATCH] Fixing compile-issues with FTP/MQTT --- src/Ftp.cpp | 11 ++++++++--- src/System.cpp | 18 +++++++++++++----- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/src/Ftp.cpp b/src/Ftp.cpp index 8d2f5d9..2d94087 100644 --- a/src/Ftp.cpp +++ b/src/Ftp.cpp @@ -68,9 +68,14 @@ void Ftp_Cyclic(void) { } void Ftp_EnableServer(void) { - if (Wlan_IsConnected() && !ftpEnableLastStatus && !ftpEnableCurrentStatus) { - ftpEnableLastStatus = true; - System_IndicateOk(); + #ifdef FTP_ENABLE + if (Wlan_IsConnected() && !ftpEnableLastStatus && !ftpEnableCurrentStatus) { + ftpEnableLastStatus = true; + #else + if (Wlan_IsConnected()) { + #endif + + System_IndicateOk(); } else { Log_Println((char *) FPSTR(unableToStartFtpServer), LOGLEVEL_ERROR); System_IndicateError(); diff --git a/src/System.cpp b/src/System.cpp index 4338f80..285c72b 100644 --- a/src/System.cpp +++ b/src/System.cpp @@ -74,7 +74,9 @@ bool System_SetSleepTimer(uint8_t minutes) { System_SleepTimerStartTimestamp = 0u; Led_ResetToInitialBrightness(); Log_Println((char *) FPSTR(modificatorSleepd), LOGLEVEL_NOTICE); - publishMqtt((char *) FPSTR(topicLedBrightnessState), Led_GetBrightness(), false); + #ifdef MQTT_ENABLE + publishMqtt((char *) FPSTR(topicLedBrightnessState), Led_GetBrightness(), false); + #endif } else { System_SleepTimer = minutes; System_SleepTimerStartTimestamp = millis(); @@ -82,8 +84,10 @@ bool System_SetSleepTimer(uint8_t minutes) { Led_ResetToNightBrightness(); Log_Println((char *) FPSTR(modificatorSleepTimer60), LOGLEVEL_NOTICE); - publishMqtt((char *) FPSTR(topicSleepTimerState), System_SleepTimer, false); - publishMqtt((char *) FPSTR(topicLedBrightnessState), Led_GetBrightness(), false); + #ifdef MQTT_ENABLE + publishMqtt((char *) FPSTR(topicSleepTimerState), System_SleepTimer, false); + publishMqtt((char *) FPSTR(topicLedBrightnessState), Led_GetBrightness(), false); + #endif } return sleepTimerEnabled; @@ -118,11 +122,15 @@ void System_ToggleLockControls(void) { if (System_LockControls) { Log_Println((char *) FPSTR(modificatorAllButtonsLocked), LOGLEVEL_NOTICE); - publishMqtt((char *) FPSTR(topicLockControlsState), "ON", false); + #ifdef MQTT_ENABLE + publishMqtt((char *) FPSTR(topicLockControlsState), "ON", false); + #endif System_IndicateOk(); } else { Log_Println((char *) FPSTR(modificatorAllButtonsUnlocked), LOGLEVEL_NOTICE); - publishMqtt((char *) FPSTR(topicLockControlsState), "OFF", false); + #ifdef MQTT_ENABLE + publishMqtt((char *) FPSTR(topicLockControlsState), "OFF", false); + #endif } }