File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
examples/SendReceiveClient Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change 2929#define SEND_PERIOD 300
3030
3131uint32_t next_send_time = 0 ;
32+ bool not_yet_connected = true ;
33+
34+ // This callback function will be called whenever the radio connects to a node
35+ void connected_callback (mt_node_t *node, mt_nr_progress_t progress) {
36+ if (not_yet_connected)
37+ Serial.println (" Connected to Meshtastic device!" );
38+ not_yet_connected = false ;
39+ }
3240
3341// This callback function will be called whenever the radio receives a text message
3442void text_message_callback (uint32_t from, const char * text) {
@@ -68,6 +76,9 @@ void setup() {
6876
6977 randomSeed (micros ());
7078
79+ // Initial connection to the Meshtastic device
80+ mt_request_node_report (connected_callback);
81+
7182 // Register a callback function to be called whenever a text message is received
7283 set_text_message_callback (text_message_callback);
7384}
You can’t perform that action at this time.
0 commit comments