diff --git a/src/main.cpp b/src/main.cpp index 3f03ef6..d50123b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -233,6 +233,7 @@ void sendESPNOW() { WiFi.forceSleepWake(); delay(1); // yield(); + digitalWrite(LED_BUILTIN, LOW); WiFi.persistent(false); // don't load and save credentials to flash WiFi.mode(WIFI_STA); if (esp_now_init()==0) { @@ -241,7 +242,8 @@ void sendESPNOW() { esp_now_add_peer(remoteMac, ESP_NOW_ROLE_SLAVE, WIFI_CHANNEL, NULL, 0); u8 bs[sizeof(sd)]; memcpy(bs, &sd, sizeof(sd)); - esp_now_send(NULL, bs, sizeof(sd)); // max ESP_NOW_MAX_DATA_LEN + for (int i=0; i<20; i++) + esp_now_send(NULL, bs, sizeof(sd)); // max ESP_NOW_MAX_DATA_LEN } else { Serial.println("error configuring ESP NOW"); @@ -253,6 +255,7 @@ void sendESPNOW() { WiFi.mode(WIFI_OFF); WiFi.forceSleepBegin(); delay(1); // yield(); + digitalWrite(LED_BUILTIN, HIGH); Serial.printf("sendESPNOW() took %d ms\n", millis()-espnowmillis); } @@ -264,6 +267,9 @@ void ICACHE_RAM_ATTR ISR_geiger_impulse() { void setup() { Serial.begin(115200); + pinMode(LED_BUILTIN, OUTPUT); + digitalWrite(LED_BUILTIN, HIGH); // turn OFF board led + sds.begin(SDS_TX, SDS_RX); sds.mode_mon_300(); @@ -276,6 +282,8 @@ void setup() { pinMode(GEIGER_PIN, INPUT); attachInterrupt(digitalPinToInterrupt(GEIGER_PIN), ISR_geiger_impulse, FALLING); + + Serial.println("ready."); Serial.flush(); } void loop() {