Browse Source

remove Serial.print

main
Hendrik Langer 5 years ago
parent
commit
7d7df04036
  1. 8
      src/network/XD0MQTT.cpp
  2. 8
      src/network/XD0OTA.cpp

8
src/network/XD0MQTT.cpp

@ -106,10 +106,10 @@ bool XD0MQTT::begin(void) {
mqtt_cfg.password = MQTT_PASSWORD; mqtt_cfg.password = MQTT_PASSWORD;
mqtt_cfg.user_context = (void*)this; mqtt_cfg.user_context = (void*)this;
ESP_LOGI(TAG, "[APP] Free memory: %d bytes", esp_get_free_heap_size()); ESP_LOGD(TAG, "[APP] Free memory: %d bytes", esp_get_free_heap_size());
Serial.printf("BROKER URI: %s\n", MQTT_BROKER_URI); ESP_LOGI(TAG, "BROKER URI: %s\n", MQTT_BROKER_URI);
Serial.printf("MQTT USERNAME: %s\n", MQTT_USERNAME); ESP_LOGI(TAG, "MQTT USERNAME: %s\n", MQTT_USERNAME);
Serial.printf("MQTT PASSWORD: %s\n", MQTT_PASSWORD); ESP_LOGI(TAG, "MQTT PASSWORD: %s\n", MQTT_PASSWORD);
client = esp_mqtt_client_init(&mqtt_cfg); client = esp_mqtt_client_init(&mqtt_cfg);
//esp_mqtt_client_register_event(client, ESP_EVENT_ANY_ID, mqtt_event_handler, client); //esp_mqtt_client_register_event(client, ESP_EVENT_ANY_ID, mqtt_event_handler, client);
esp_mqtt_client_start(client); esp_mqtt_client_start(client);

8
src/network/XD0OTA.cpp

@ -16,23 +16,21 @@ XD0OTA::XD0OTA(String deviceName) : deviceName{deviceName} {}
void XD0OTA::setClock() { void XD0OTA::setClock() {
configTime(0, 0, "de.pool.ntp.org", "time.nist.gov"); // UTC configTime(0, 0, "de.pool.ntp.org", "time.nist.gov"); // UTC
Serial.print(F("Waiting for NTP time sync: ")); ESP_LOGI(TAG, "Waiting for NTP time sync: ");
time_t now = time(nullptr); time_t now = time(nullptr);
int tries = 0; int tries = 0;
while (now < 8 * 3600 * 2) { while (now < 8 * 3600 * 2) {
yield(); yield();
delay(500); delay(500);
Serial.print(F(".")); ESP_LOGI(TAG, ".");
now = time(nullptr); now = time(nullptr);
tries++; tries++;
if (tries>15) return; if (tries>15) return;
} }
Serial.println(F(""));
struct tm timeinfo; struct tm timeinfo;
gmtime_r(&now, &timeinfo); gmtime_r(&now, &timeinfo);
Serial.print(F("Current time: ")); ESP_LOGI(TAG, "Current time: %s", asctime(&timeinfo));
Serial.print(asctime(&timeinfo));
// setenv("TZ", "CET-1CEST,M3.5.0/2,M10.5.0/3", 1); // setenv("TZ", "CET-1CEST,M3.5.0/2,M10.5.0/3", 1);
// tzset(); // tzset();

Loading…
Cancel
Save