get tcp working

This commit is contained in:
Travis Shears 2025-12-21 20:44:11 +01:00
parent f107bfb55b
commit 65ad286add
Signed by: travisshears
GPG key ID: CB9BF1910F3F7469
2 changed files with 23 additions and 28 deletions

14
node1.c
View file

@ -145,13 +145,13 @@ static bool cb_30(__unused struct repeating_timer *t) {
current_bem280_reading.humidity);
printf("Sending data to backend server...\n");
printf("MSG: %s", msg);
// bool success = tcp_client_send_message(&tcp_config, msg);
// if (success) {
// printf("✓ Data sent successfully\n");
// comms_led_blink();
// } else {
// printf("✗ Failed to send data\n");
// }
bool success = tcp_client_send_message(&tcp_config, msg);
if (success) {
printf("✓ Data sent successfully\n");
comms_led_blink();
} else {
printf("✗ Failed to send data\n");
}
} else {
printf("WiFi not connected, skipping send\n");
}

View file

@ -232,13 +232,8 @@ bool tcp_client_send_message(tcp_client_config *config, const char *message) {
state->success = false;
break;
}
#if PICO_CYW43_ARCH_POLL
cyw43_arch_poll();
cyw43_arch_wait_for_work_until(make_timeout_time_ms(100));
#else
sleep_ms(100);
#endif
}
bool success = state->success;