@@ -99,7 +99,7 @@ float readBoardTemperature() {
9999 * @return Formatted string with temperature reading and units
100100 */
101101std::string formatTemperatureMessage (const float temperature) {
102- const std::string prefix = " Temperature in The Factory: " ;
102+ const std::string prefix = " [INFO] Temperature in The Factory: " ;
103103 const std::string suffix = " °C.\n " ;
104104 const auto tempStr = std::to_string (lround (temperature));
105105 return prefix + tempStr + suffix;
@@ -113,15 +113,19 @@ std::string formatTemperatureMessage(const float temperature) {
113113void get_quote_of_the_day () {
114114 // Check if we're already connected first
115115 if (qotd_in_progress) {
116- DEBUGWIRE (" QOTD client already connected, skipping new connection\n " );
116+ DEBUGCORE (" [DEBUG] QOTD client already connected, skipping.\n " );
117+ auto notify = std::make_unique<std::string>(
118+ " [DEBUG] QOTD client already connected, skipping.\n " );
119+ serial_printer.print (std::move (notify));
117120 return ;
118121 }
119- DEBUGWIRE (
120- " Connecting to QOTD server for new quote\n " );
121122 qotd_in_progress = true ;
122123 if (!qotd_client.connect (qotd_ip_address, qotd_port)) {
123124 qotd_in_progress = false ;
124- DEBUGV (" Failed to connect to QOTD server.\n " );
125+ DEBUGCORE (" [ERROR] Failed to connect to QOTD server.\n " );
126+ auto notify = std::make_unique<std::string>(
127+ " [ERROR] Failed to connect to QOTD server.\n " );
128+ serial_printer.print (std::move (notify));
125129 }
126130}
127131
@@ -136,17 +140,24 @@ void get_echo() {
136140 if (!buffer_content.empty ()) {
137141 if (!echo_connected) {
138142 if (0 == echo_client.connect (echo_ip_address, echo_port)) {
139- DEBUGV (" Failed to connect to echo server..\n " );
143+ DEBUGCORE (" [ERROR] Failed to connect to echo server..\n " );
144+ auto notify = std::make_unique<std::string>(
145+ " [ERROR] Failed to connect to echo server..\n " );
146+ serial_printer.print (std::move (notify));
140147 return ;
141148 }
142149 echo_connected = true ;
143150 }
144- DEBUGWIRE ( " Sending quote to echo server (%d bytes) \n " , buffer_content. size ());
145- if (const size_t sent = echo_client.write (
151+
152+ if (const size_t error = echo_client.write (
146153 reinterpret_cast <const uint8_t *>(buffer_content.c_str ()),
147154 buffer_content.size ());
148- sent < buffer_content.size ()) {
149- DEBUGWIRE (" [ERROR] echo_client.write sent only %u/%u bytes\n " , sent, buffer_content.size ());
155+ error != PICO_OK) {
156+ DEBUGCORE (" [DEBUG] echo_client.write returned error %d\n " , error);
157+ auto notify = std::make_unique<std::string>(
158+ " [DEBUG][write] RESOURCE_IN_USE (" +
159+ std::to_string (error) + " )\n " );
160+ serial_printer.print (std::move (notify));
150161 }
151162 }
152163}
@@ -162,7 +173,7 @@ void print_heap_stats() {
162173
163174 // Format the string with stats using the same syntax as notify_connect
164175 auto heap_stats = std::make_unique<std::string>(
165- " Free: " + std::to_string (freeHeap) +
176+ " [INFO] Free: " + std::to_string (freeHeap) +
166177 " , Used: " + std::to_string (usedHeap) +
167178 " , Total: " + std::to_string (totalHeap) + " \n " );
168179
@@ -180,7 +191,7 @@ void print_stack_stats() {
180191
181192 // Format the string with stack for calling core stats
182193 auto stack_stats = std::make_unique<std::string>(
183- " Free Stack on core " + std::to_string (get_core_num ()) + " : " +
194+ " [INFO] Free Stack on core " + std::to_string (get_core_num ()) + " : " +
184195 std::to_string (free_stack) + " \n " );
185196 serial_printer.print (std::move (stack_stats));
186197}
@@ -199,6 +210,7 @@ void print_board_temperature() {
199210 * @brief Initializes the Wi-Fi connection and asynchronous context on Core 0.
200211 */
201212void setup () {
213+
202214 Serial1.begin (115200 );
203215 while (!Serial1) {
204216 tight_loop_contents ();
@@ -252,9 +264,9 @@ void setup() {
252264 qotd_closed_handler->initialisePerpetualBridge ();
253265 qotd_client.setOnClosedCallback (std::move (qotd_closed_handler));
254266
255- scheduler0.setEntry (qotd, 505 );
256- scheduler0.setEntry (echo, 101 );
257- scheduler0.setEntry (stack_0, 70707 );
267+ scheduler0.setEntry (qotd, 432 );
268+ scheduler0.setEntry (echo, 257 );
269+ scheduler0.setEntry (stack_0, 3030 );
258270
259271 pinMode (LED_BUILTIN, OUTPUT);
260272
@@ -274,9 +286,9 @@ void setup1() {
274286 panic_compact (" CTX init failed on Core 1\n " );
275287 }
276288
277- scheduler1.setEntry (stack_1, 909090 );
278- scheduler1.setEntry (heap, 808080 );
279- scheduler1.setEntry (board_temperature, 606060 );
289+ scheduler1.setEntry (stack_1, 80808 );
290+ scheduler1.setEntry (heap, 70707 );
291+ scheduler1.setEntry (board_temperature, 50505 );
280292 ctx1_ready = true ;
281293}
282294
0 commit comments