Merge pull request #258 from bennydiamond/newline-on-uip-serial-print

Automatically print newline on serial interface
This commit is contained in:
logicog
2026-08-22 19:14:45 +02:00
committed by GitHub
4 changed files with 13 additions and 6 deletions
+1
View File
@@ -125,6 +125,7 @@ extern __xdata struct uip_eth_addr uip_ethaddr;
// Headers for calls in the common code area (HOME/BANK0)
void print_string_no_syslog(__code char *p);
void print_string_newline_no_syslog(__code char *p);
void print_string(__code char *p);
void print_string_x(__xdata char *p);
void print_long(uint32_t a);
+6
View File
@@ -289,6 +289,12 @@ void print_string_no_syslog(__code char *p)
write_char_no_syslog(*p++);
}
void print_string_newline_no_syslog(__code char *p)
{
write_char_no_syslog('\n');
print_string_no_syslog(p);
}
void print_string_x(__xdata char *p)
{
while (*p)
+5 -5
View File
@@ -30,16 +30,16 @@ void syslog_start(void) __banked
uip_ipaddr(server_ip, state.server_ip[0], state.server_ip[1], state.server_ip[2], state.server_ip[3]);
state.syslog_conn = uip_udp_new(&server_ip, HTONS(514));
if (state.syslog_conn == 0) {
print_string_no_syslog("Failed to create a new UDP client\n");
print_string_newline_no_syslog("Failed to create a new UDP client");
return;
}
print_string_no_syslog("Started syslog to IP ");
print_string_newline_no_syslog("Started syslog to IP ");
itoa(state.server_ip[0]); write_char('.'); itoa(state.server_ip[1]); write_char('.');
itoa(state.server_ip[2]); write_char('.'); itoa(state.server_ip[3]); write_char('\n');
state.enabled = 1;
}
else {
print_string_no_syslog("Syslog is already running\n");
print_string_newline_no_syslog("Syslog is already running");
}
}
@@ -49,9 +49,9 @@ void syslog_stop(void) __banked
if (state.syslog_conn != 0) {
uip_udp_remove(state.syslog_conn);
state.syslog_conn = 0;
print_string_no_syslog("Stopped syslog\n");
print_string_newline_no_syslog("Stopped syslog");
} else {
print_string_no_syslog("Syslog is not running\n");
print_string_newline_no_syslog("Syslog is not running");
}
}
+1 -1
View File
@@ -234,7 +234,7 @@ __xdata struct uip_stats uip_stat;
#endif /* UIP_STATISTICS == 1 */
#if UIP_LOGGING == 1
#define UIP_LOG(m) print_string_no_syslog(m);
#define UIP_LOG(m) print_string_newline_no_syslog(m);
#else
#define UIP_LOG(m)
#endif /* UIP_LOGGING == 1 */