Minor tweaks to V1.0
change AP name and MQTT default topic to avoid collisions
This commit is contained in:
parent
da827054a7
commit
6d878cc41b
@ -14,8 +14,8 @@ board = seeed_xiao_esp32c3
|
|||||||
monitor_speed = 115200
|
monitor_speed = 115200
|
||||||
framework = arduino
|
framework = arduino
|
||||||
board_build.partitions = min_spiffs.csv
|
board_build.partitions = min_spiffs.csv
|
||||||
upload_protocol = espota
|
;upload_protocol = espota
|
||||||
upload_port = TMP-EG-Bad.fritz.box
|
;upload_port = TMP-EG-Bad.fritz.box
|
||||||
lib_deps =
|
lib_deps =
|
||||||
moononournation/GFX Library for Arduino@^1.5.3
|
moononournation/GFX Library for Arduino@^1.5.3
|
||||||
lvgl/lvgl@^9.2.2
|
lvgl/lvgl@^9.2.2
|
||||||
|
|||||||
@ -49,7 +49,7 @@ void MQTT::begin(){
|
|||||||
psclient.setServer(Settings::prefs.mqtt_server,Settings::prefs.mqtt_port);
|
psclient.setServer(Settings::prefs.mqtt_server,Settings::prefs.mqtt_port);
|
||||||
WiFi.setHostname(custom_hostname.getValue()); //define hostname
|
WiFi.setHostname(custom_hostname.getValue()); //define hostname
|
||||||
wm.setConfigPortalBlocking(false);
|
wm.setConfigPortalBlocking(false);
|
||||||
if(wm.autoConnect("AutoConnectAP")){
|
if(wm.autoConnect("TempReglerAP")){
|
||||||
//if you get here you have connected to the WiFi
|
//if you get here you have connected to the WiFi
|
||||||
Serial.println("connected...yeey :)");
|
Serial.println("connected...yeey :)");
|
||||||
strcpy(glblData.myIP,WiFi.localIP().toString().c_str());
|
strcpy(glblData.myIP,WiFi.localIP().toString().c_str());
|
||||||
@ -119,7 +119,7 @@ void MQTT::saveConfigToFlash(void){
|
|||||||
strcpy(Settings::prefs.mqtt_topic,custom_mqtt_topic.getValue());
|
strcpy(Settings::prefs.mqtt_topic,custom_mqtt_topic.getValue());
|
||||||
strcpy(Settings::prefs.ntpServer,custom_ntpServer.getValue());
|
strcpy(Settings::prefs.ntpServer,custom_ntpServer.getValue());
|
||||||
Settings::prefs.defTemp = atof(custom_deftemp.getValue());
|
Settings::prefs.defTemp = atof(custom_deftemp.getValue());
|
||||||
if(custom_enbuff.getValue() != "0"){
|
if(custom_enbuff.getValue()[0] != '0'){
|
||||||
Settings::prefs.enBuff = true;
|
Settings::prefs.enBuff = true;
|
||||||
}else{
|
}else{
|
||||||
Settings::prefs.enBuff = false;
|
Settings::prefs.enBuff = false;
|
||||||
@ -133,6 +133,7 @@ void MQTT::reconnect(void) {
|
|||||||
// Attempt to connect
|
// Attempt to connect
|
||||||
if (psclient.connect(Settings::prefs.hostname)) {
|
if (psclient.connect(Settings::prefs.hostname)) {
|
||||||
Serial.println("connected");
|
Serial.println("connected");
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Serial.print("failed, rc=");
|
Serial.print("failed, rc=");
|
||||||
Serial.print(psclient.state());
|
Serial.print(psclient.state());
|
||||||
|
|||||||
@ -101,7 +101,6 @@ void measure(void){ //update temp every 30secs
|
|||||||
|
|
||||||
void setup(void)
|
void setup(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
DisplayInit();
|
DisplayInit();
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
lv_init();
|
lv_init();
|
||||||
@ -109,7 +108,6 @@ void setup(void)
|
|||||||
lv_log_register_print_cb(log_print);
|
lv_log_register_print_cb(log_print);
|
||||||
TouchInit();
|
TouchInit();
|
||||||
bme.begin();
|
bme.begin();
|
||||||
|
|
||||||
lv_display_t * disp = lv_display_create(SCREEN_WIDTH, SCREEN_HEIGHT);
|
lv_display_t * disp = lv_display_create(SCREEN_WIDTH, SCREEN_HEIGHT);
|
||||||
lv_display_set_buffers(disp,draw_buf, NULL, sizeof(draw_buf),LV_DISPLAY_RENDER_MODE_PARTIAL);
|
lv_display_set_buffers(disp,draw_buf, NULL, sizeof(draw_buf),LV_DISPLAY_RENDER_MODE_PARTIAL);
|
||||||
lv_display_set_rotation(disp, LV_DISPLAY_ROTATION_0);
|
lv_display_set_rotation(disp, LV_DISPLAY_ROTATION_0);
|
||||||
|
|||||||
@ -42,11 +42,14 @@ void Settings::loadSettings() {
|
|||||||
glblData.settemp = prefs.defTemp;
|
glblData.settemp = prefs.defTemp;
|
||||||
prefs.enBuff = preferences.getBool("enBuff", false);
|
prefs.enBuff = preferences.getBool("enBuff", false);
|
||||||
glblData.enBuff = prefs.enBuff;
|
glblData.enBuff = prefs.enBuff;
|
||||||
strncpy(prefs.hostname, preferences.getString("hostname", "TMP-EG-WoZi").c_str(), sizeof(prefs.hostname) - 1);
|
uint32_t mac = (uint32_t) ESP.getEfuseMac();
|
||||||
|
char tmp[20];
|
||||||
|
sprintf(tmp, "TMP-%08x", mac);
|
||||||
|
strncpy(prefs.hostname, preferences.getString("hostname", tmp).c_str(), sizeof(prefs.hostname) - 1);
|
||||||
prefs.hostname[sizeof(prefs.hostname) - 1] = '\0'; // Ensure null-termination
|
prefs.hostname[sizeof(prefs.hostname) - 1] = '\0'; // Ensure null-termination
|
||||||
strncpy(prefs.mqtt_server, preferences.getString("mqtt_server", "nas.local").c_str(), sizeof(prefs.mqtt_server) - 1);
|
strncpy(prefs.mqtt_server, preferences.getString("mqtt_server", "nas.local").c_str(), sizeof(prefs.mqtt_server) - 1);
|
||||||
prefs.mqtt_server[sizeof(prefs.mqtt_server) - 1] = '\0'; // Ensure null-termination
|
prefs.mqtt_server[sizeof(prefs.mqtt_server) - 1] = '\0'; // Ensure null-termination
|
||||||
strncpy(prefs.mqtt_topic, preferences.getString("mqtt_topic", "Raumtemp/EG/Wohnzimmer").c_str(), sizeof(prefs.mqtt_topic) - 1);
|
strncpy(prefs.mqtt_topic, preferences.getString("mqtt_topic", "Raumtemp/EG/Unkonfiguriert").c_str(), sizeof(prefs.mqtt_topic) - 1);
|
||||||
prefs.mqtt_topic[sizeof(prefs.mqtt_topic) - 1] = '\0'; // Ensure null-termination
|
prefs.mqtt_topic[sizeof(prefs.mqtt_topic) - 1] = '\0'; // Ensure null-termination
|
||||||
strncpy(prefs.ntpServer, preferences.getString("ntpServer", "nas.local").c_str(), sizeof(prefs.ntpServer) - 1);
|
strncpy(prefs.ntpServer, preferences.getString("ntpServer", "nas.local").c_str(), sizeof(prefs.ntpServer) - 1);
|
||||||
prefs.ntpServer[sizeof(prefs.ntpServer) - 1] = '\0'; // Ensure null-termination
|
prefs.ntpServer[sizeof(prefs.ntpServer) - 1] = '\0'; // Ensure null-termination
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user