diff --git a/config.cpp b/config.cpp index 13815a4..f81b20d 100644 --- a/config.cpp +++ b/config.cpp @@ -109,6 +109,12 @@ bool readConfig (bool clear_on_error) return false; } + // Check the config for new elements Compteur + if (config.compteur_modele[0] == '\0') + strcpy_P(config.compteur_modele, CFG_COMPTEUR_DEFAULT_MODELE); + if (config.compteur_tic[0] == '\0') + strcpy_P(config.compteur_tic, CFG_COMPTEUR_DEFAULT_TIC); + return true ; } @@ -187,6 +193,11 @@ void showConfig() if (config.config & CFG_LCD) DebugF(" LCD"); _wdt_feed(); + DebuglnF("\r\n===== Compteur"); + DebugF("Modèle :"); Debugln(config.compteur_modele); + DebugF("TIC :"); Debugln(config.compteur_tic); + _wdt_feed(); + DebuglnF("\r\n===== Emoncms"); DebugF("host :"); Debugln(config.emoncms.host); DebugF("port :"); Debugln(config.emoncms.port); @@ -232,6 +243,10 @@ void resetConfig(void) config.ota_port = DEFAULT_OTA_PORT ; // Add other init default config here + + // Compteur + strcpy_P(config.compteur_modele, CFG_COMPTEUR_DEFAULT_MODELE); + strcpy_P(config.compteur_tic, CFG_COMPTEUR_DEFAULT_TIC); // Emoncms strcpy_P(config.emoncms.host, CFG_EMON_DEFAULT_HOST); diff --git a/config.h b/config.h index 95d6301..4a0f96d 100644 --- a/config.h +++ b/config.h @@ -29,6 +29,11 @@ #define CFG_PSK_SIZE 64 #define CFG_HOSTNAME_SIZE 16 +#define CFG_COMPTEUR_MODELE_SIZE 12 +#define CFG_COMPTEUR_TIC_SIZE 10 +#define CFG_COMPTEUR_DEFAULT_MODELE "electronique" +#define CFG_COMPTEUR_DEFAULT_TIC "historique" + #define CFG_EMON_HOST_SIZE 32 #define CFG_EMON_APIKEY_SIZE 32 #define CFG_EMON_URL_SIZE 32 @@ -72,6 +77,9 @@ #define CFG_FORM_OTA_AUTH FPSTR("ota_auth") #define CFG_FORM_OTA_PORT FPSTR("ota_port") +#define CFG_FORM_COMPTEUR_MODELE FPSTR("compteur_modele") +#define CFG_FORM_COMPTEUR_TIC FPSTR("compteur_tic") + #define CFG_FORM_EMON_HOST FPSTR("emon_host") #define CFG_FORM_EMON_PORT FPSTR("emon_port") #define CFG_FORM_EMON_URL FPSTR("emon_url") @@ -127,19 +135,21 @@ typedef struct // 1024 bytes total including CRC typedef struct { - char ssid[CFG_SSID_SIZE+1]; // SSID - char psk[CFG_PSK_SIZE+1]; // Pre shared key - char host[CFG_HOSTNAME_SIZE+1]; // Hostname - char ap_psk[CFG_PSK_SIZE+1]; // Access Point Pre shared key - char ota_auth[CFG_PSK_SIZE+1]; // OTA Authentication password - uint32_t config; // Bit field register - uint16_t ota_port; // OTA port - uint8_t led_bright; // RGB Led brightness 0-255 - uint16_t oled_type; // Display OLED type (1306 or 1106) - uint8_t filler[128]; // in case adding data in config avoiding loosing current conf by bad crc - _emoncms emoncms; // Emoncms configuration - _jeedom jeedom; // jeedom configuration - uint8_t filler1[256]; // Another filler in case we need more + char ssid[CFG_SSID_SIZE+1]; // SSID + char psk[CFG_PSK_SIZE+1]; // Pre shared key + char host[CFG_HOSTNAME_SIZE+1]; // Hostname + char ap_psk[CFG_PSK_SIZE+1]; // Access Point Pre shared key + char ota_auth[CFG_PSK_SIZE+1]; // OTA Authentication password + uint32_t config; // Bit field register + uint16_t ota_port; // OTA port + uint8_t led_bright; // RGB Led brightness 0-255 + uint16_t oled_type; // Display OLED type (1306 or 1106) + char compteur_modele[CFG_COMPTEUR_MODELE_SIZE+1]; // Modele de compteur + char compteur_tic[CFG_COMPTEUR_TIC_SIZE+1]; // TIC mode + uint8_t filler[104]; // in case adding data in config avoiding loosing current conf by bad crc + _emoncms emoncms; // Emoncms configuration + _jeedom jeedom; // jeedom configuration + uint8_t filler1[256]; // Another filler in case we need more uint16_t crc; } _Config; diff --git a/data/css/remora.css.gz b/data/css/remora.css.gz index d3fec39..b63b370 100644 Binary files a/data/css/remora.css.gz and b/data/css/remora.css.gz differ diff --git a/data/index.htm.gz b/data/index.htm.gz index cb76c0d..81895d8 100644 Binary files a/data/index.htm.gz and b/data/index.htm.gz differ diff --git a/data/js/remora.js.gz b/data/js/remora.js.gz index a21cf40..38df9e2 100644 Binary files a/data/js/remora.js.gz and b/data/js/remora.js.gz differ diff --git a/remora_soft.ino b/remora_soft.ino index 577f5b9..bbdea95 100644 --- a/remora_soft.ino +++ b/remora_soft.ino @@ -467,10 +467,6 @@ void mysetup() #elif defined (ESP8266) - #ifdef MOD_TELEINFO - // Init de la téléinformation - Serial.begin(1200, SERIAL_7E1); - #endif // Clear our global flags config.config = 0; @@ -523,6 +519,18 @@ void mysetup() rgb_brightness = config.led_bright; DebugF("RGB Brightness: "); Debugln(rgb_brightness); + // Init de la téléinformation + #ifdef MOD_TELEINFO + if (strcmp(config.compteur_tic, "standard") == 0) { + Debugln("TIC standard : Serial 9600 bps"); + Serial.begin(9600, SERIAL_7E1); + } + else { + Debugln("Tic historique : Serial 1200 bps"); + Serial.begin(1200, SERIAL_7E1); + } + #endif + // Connection au Wifi ou Vérification WifiHandleConn(true); diff --git a/tinfo.cpp b/tinfo.cpp index 1884c4e..b4ff5aa 100644 --- a/tinfo.cpp +++ b/tinfo.cpp @@ -234,7 +234,14 @@ bool tinfo_setup(bool wait_data) Debugflush(); #ifdef SPARK - Serial1.begin(1200); // Port série RX/TX on serial1 for Spark + if (strcmp(config.compteur_modele, "linky") && strcmp(config.compteur_tic, "standard")) { + Debugln("TIC standard : Serial 9600 bps"); + Serial1.begin(9600); // Port série RX/TX on serial1 for Spark + } + else{ + Debugln("TIC historique : Serial 1200 bps"); + Serial1.begin(1200); // Port série RX/TX on serial1 for Spark + } #endif // reset du timeout de detection de la teleinfo diff --git a/webdev/index.htm b/webdev/index.htm index 1f7c121..cd683c1 100644 --- a/webdev/index.htm +++ b/webdev/index.htm @@ -459,6 +459,26 @@

+
+ +
+ +
+
+ +
+ +
+ +
+
+