From d353a2f0f2fca7747bf611c005b86a3ff257d480 Mon Sep 17 00:00:00 2001 From: Dooho Yi Date: Tue, 22 Jun 2021 20:06:54 +0900 Subject: [PATCH] postman now collects also 'Hello' msg. (WIP) --- postman/src/main.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/postman/src/main.cpp b/postman/src/main.cpp index b2854cd..809dd36 100644 --- a/postman/src/main.cpp +++ b/postman/src/main.cpp @@ -205,6 +205,34 @@ void collect_post() { } } } + // + else if (type == '{') { + //expecting a Hello message. + uint8_t frm_size = sizeof(Hello) + 2; + // + if (Serial.available() >= frm_size) { + // + uint8_t frm[frm_size]; + // + Serial.readBytes(frm, frm_size); + char first = frm[0]; + char last = frm[frm_size - 1]; + if (first == '{' && last == '}') { + // + //good. ==> ok, post it. + // + //pseudo-broadcast using peer-list! + // + esp_now_send(NULL, frm, frm_size); + // + MONITORING_SERIAL.write(frm, frm_size); + MONITORING_SERIAL.print(" ==(esp_now_send/0)==> "); + // + } else { + insync = false; //error! + } + } + } } } }