Minor tweaks to V1.0

change AP name and MQTT default topic to avoid collisions
This commit is contained in:
Moirtz Wagner 2025-10-16 19:54:37 +02:00
parent da827054a7
commit 6d878cc41b
4 changed files with 10 additions and 8 deletions

View File

@ -14,8 +14,8 @@ board = seeed_xiao_esp32c3
monitor_speed = 115200
framework = arduino
board_build.partitions = min_spiffs.csv
upload_protocol = espota
upload_port = TMP-EG-Bad.fritz.box
;upload_protocol = espota
;upload_port = TMP-EG-Bad.fritz.box
lib_deps =
moononournation/GFX Library for Arduino@^1.5.3
lvgl/lvgl@^9.2.2

View File

@ -49,7 +49,7 @@ void MQTT::begin(){
psclient.setServer(Settings::prefs.mqtt_server,Settings::prefs.mqtt_port);
WiFi.setHostname(custom_hostname.getValue()); //define hostname
wm.setConfigPortalBlocking(false);
if(wm.autoConnect("AutoConnectAP")){
if(wm.autoConnect("TempReglerAP")){
//if you get here you have connected to the WiFi
Serial.println("connected...yeey :)");
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.ntpServer,custom_ntpServer.getValue());
Settings::prefs.defTemp = atof(custom_deftemp.getValue());
if(custom_enbuff.getValue() != "0"){
if(custom_enbuff.getValue()[0] != '0'){
Settings::prefs.enBuff = true;
}else{
Settings::prefs.enBuff = false;
@ -133,6 +133,7 @@ void MQTT::reconnect(void) {
// Attempt to connect
if (psclient.connect(Settings::prefs.hostname)) {
Serial.println("connected");
} else {
Serial.print("failed, rc=");
Serial.print(psclient.state());

View File

@ -101,7 +101,6 @@ void measure(void){ //update temp every 30secs
void setup(void)
{
DisplayInit();
Serial.begin(115200);
lv_init();
@ -109,7 +108,6 @@ void setup(void)
lv_log_register_print_cb(log_print);
TouchInit();
bme.begin();
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_rotation(disp, LV_DISPLAY_ROTATION_0);

View File

@ -42,11 +42,14 @@ void Settings::loadSettings() {
glblData.settemp = prefs.defTemp;
prefs.enBuff = preferences.getBool("enBuff", false);
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
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
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
strncpy(prefs.ntpServer, preferences.getString("ntpServer", "nas.local").c_str(), sizeof(prefs.ntpServer) - 1);
prefs.ntpServer[sizeof(prefs.ntpServer) - 1] = '\0'; // Ensure null-termination