File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed
Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -8847,11 +8847,19 @@ static void _webui_print_hex(const char* data, size_t len) {
88478847 }
88488848}
88498849static void _webui_print_ascii (const char * data , size_t len ) {
8850+ // This function is used to print the protocol binary packets. the packet
8851+ // may have ASCII and `0x00` inside text, as well as other non-ascii bytes
88508852 for (size_t i = 0 ; i < len ; i ++ ) {
8851- if ((unsigned char )* data == 0x00 )
8852- _webui_log_debug ("%c" , 0xCF );
8853- else
8854- _webui_log_debug ("%c" , (unsigned char )* data );
8853+ register unsigned char c = (unsigned char )* data ;
8854+ if (c == 0x00 ) {
8855+ _webui_log_debug ("%c" , 0xCF ); // Print `¤` | TODO: Maybe we can simply print a blank space?
8856+ } else {
8857+ if (c < 32 || c > 126 ) {
8858+ _webui_log_debug ("[0x%02X]" , c );
8859+ } else {
8860+ _webui_log_debug ("%c" , c );
8861+ }
8862+ }
88558863 data ++ ;
88568864 }
88578865}
You can’t perform that action at this time.
0 commit comments