Browse Source

fix startup code

main
Hendrik Langer 7 years ago
parent
commit
37e25c7c9f
  1. 12
      src/main.cpp

12
src/main.cpp

@ -77,8 +77,8 @@ void setup() {
boot_count++; boot_count++;
static wifi_country_t wifi_country = {.cc="EU", .schan=1, .nchan=13, .policy=WIFI_COUNTRY_POLICY_AUTO}; // static wifi_country_t wifi_country = {.cc="EU", .schan=1, .nchan=13, .policy=WIFI_COUNTRY_POLICY_AUTO};
esp_wifi_set_country(&wifi_country); // esp_wifi_set_country(&wifi_country);
//Initialize Basecamp //Initialize Basecamp
iot.begin(); iot.begin();
@ -126,8 +126,11 @@ void setup() {
strftime(strftime_buf, sizeof(strftime_buf), "%c", &timeinfo); strftime(strftime_buf, sizeof(strftime_buf), "%c", &timeinfo);
Serial.print("Current time: "); Serial.println(strftime_buf); Serial.print("Current time: "); Serial.println(strftime_buf);
bme280.begin();
bme280.printValues();
if (wakeup_reason == ESP_SLEEP_WAKEUP_TIMER) { if (wakeup_reason == ESP_SLEEP_WAKEUP_TIMER) {
for (int i=0; i<5 && iot.wifi.status() != WL_CONNECTED; i++) delay(500); for (int i=0; i<15 && iot.wifi.status() != WL_CONNECTED; i++) delay(500);
if (iot.wifi.status() == WL_CONNECTED) transmitStatus(); if (iot.wifi.status() == WL_CONNECTED) transmitStatus();
double seconds = difftime(now, mktime(&alarmTime)); double seconds = difftime(now, mktime(&alarmTime));
@ -146,9 +149,6 @@ void setup() {
menuChange = eMainScreen; menuChange = eMainScreen;
u8g2.setContrast(127); u8g2.setContrast(127);
bme280.begin();
bme280.printValues();
//Set up the Callbacks for the MQTT instance. Refer to the Async MQTT Client documentation //Set up the Callbacks for the MQTT instance. Refer to the Async MQTT Client documentation
// TODO: We should do this actually _before_ connecting the mqtt client... // TODO: We should do this actually _before_ connecting the mqtt client...
iot.mqtt.onConnect(onMqttConnect); iot.mqtt.onConnect(onMqttConnect);

Loading…
Cancel
Save