From 26fef41f7302914d7e32d33c700183c46aca3500 Mon Sep 17 00:00:00 2001 From: Luc <8822552+luc-github@users.noreply.github.com> Date: Wed, 27 May 2020 11:23:56 +0200 Subject: [PATCH] Fix ESP400 out whith time zone Add external config file option for SSID/Password --- .gitignore | 1 + esp3d/configuration.h | 7 +++++++ esp3d/src/core/espcmd/ESP400.cpp | 2 +- esp3d/src/core/settings_esp3d.cpp | 2 +- esp3d/src/core/settings_esp3d.h | 2 +- 5 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index df289b05..a9e2a2a7 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ embedded/dist .vscode/c_cpp_properties.json .vscode/launch.json .vscode/arduino.json +esp3d/myconfig.h diff --git a/esp3d/configuration.h b/esp3d/configuration.h index a87996d0..1897226e 100644 --- a/esp3d/configuration.h +++ b/esp3d/configuration.h @@ -26,6 +26,13 @@ //Note: need both defined to enable it //#define STATION_WIFI_SSID "*********" //#define STATION_WIFI_PASSWORD "*********" +//you can also use a different config file for SSID/password +//this file is ignored by github +#if defined __has_include +# if __has_include ("myconfig.h") +# include "myconfig.h" +# endif +#endif //SERIAL_COMMAND_FEATURE: allow to send command by serial #define SERIAL_COMMAND_FEATURE diff --git a/esp3d/src/core/espcmd/ESP400.cpp b/esp3d/src/core/espcmd/ESP400.cpp index 29f40358..ab17867c 100644 --- a/esp3d/src/core/espcmd/ESP400.cpp +++ b/esp3d/src/core/espcmd/ESP400.cpp @@ -285,7 +285,7 @@ bool Commands::ESP400(const char* cmd_params, level_authenticate_type auth_type, output->print ((int8_t)Settings_ESP3D::read_byte(ESP_TIMEZONE)); output->print("\",\"H\":\"tzone\",\"O\":["); for (int8_t i = Settings_ESP3D::get_min_byte(ESP_TIMEZONE); i <= Settings_ESP3D::get_max_byte(ESP_TIMEZONE) ; i++) { - if (i > 1) { + if (i > Settings_ESP3D::get_min_byte(ESP_TIMEZONE)) { output->print (","); } output->printf("{\"%d\":\"%d\"}", i, i); diff --git a/esp3d/src/core/settings_esp3d.cpp b/esp3d/src/core/settings_esp3d.cpp index 8e3d7e04..40afd113 100644 --- a/esp3d/src/core/settings_esp3d.cpp +++ b/esp3d/src/core/settings_esp3d.cpp @@ -533,7 +533,7 @@ uint8_t Settings_ESP3D::get_max_byte(int pos) return res; } -uint8_t Settings_ESP3D::get_min_byte(int pos) +int8_t Settings_ESP3D::get_min_byte(int pos) { uint8_t res; switch(pos) { diff --git a/esp3d/src/core/settings_esp3d.h b/esp3d/src/core/settings_esp3d.h index 447cd5a7..6002e9e0 100644 --- a/esp3d/src/core/settings_esp3d.h +++ b/esp3d/src/core/settings_esp3d.h @@ -114,7 +114,7 @@ public: static uint32_t get_max_int32_value(int pos); static uint32_t get_min_int32_value(int pos); static uint8_t get_max_byte(int pos); - static uint8_t get_min_byte(int pos); + static int8_t get_min_byte(int pos); static uint8_t read_byte (int pos, bool * haserror = NULL); static uint32_t read_uint32(int pos, bool * haserror = NULL); static uint32_t read_IP(int pos, bool * haserror = NULL);