I want to print my Mag
array. With the current API I can only print by row using ESP_LOGI
. So I have to fill a row string (char[]) and display in loop:
//char s[2 * (w - 2 * window - 1)];
char[200];
char s_tmp[4]; //one element of array string
for(int i=window; i<=w-window;++i){
memset(s, 0, sizeof(s));
memset(s_tmp, 0, sizeof(s_tmp)); // Fill with \0 for ESP_LOGI
for(int j=window; j<h-window;++j){
sprintf(s_tmp, "%u", Mag[i + j * w]);
strcat(s, s_tmp);
strcat(s, ".");
}
ESP_LOGI(TAG,"%s", s);
}
}
Output: Serial output read with VScode platformIO
Size = (h=28, w=28) window = 3
I (13793) camera_httpd: 0.0.0.2.1.1.1.0.0.1.0.2.1.0.0.0.1.0.2.0.0.1. m
I (13793) camera_httpd: 0.0.1.0.4.1.1.1.0.1.2.0.2.1.0.0.0.1.0.1.2.0.
I (13793) camera_httpd: 0.0.0.1.1.0.1.1.0.0.1.0.0.0.1.0.0.2.1.1.0.0. [0m
I (13803) camera_htt pd: 0.0.0.0.0.0.0.1.1.1.0.1.0.0.0.1.0.0.2.2.1.1.
I (13813) camera_httpd: 0.0.0.1.0.0.0.1.1.1.0.0.1.0.0.0.0.0.0.2.1.1.
I (13823) camera_httpd: 0.0.0.0.1.0.0.0.0.0.1.1.1. 1.0.0.0.0.1.0.2.2.
I (13823) camera_httpd: 0.0.0.0.2.1.0.0.0.0.0.0.1.0.0.0.1.0.0.1.0.2.
I (13833) camera_httpd: 1.0.0.0.1.0.1.0.0.0.0.0. 0.1.0.0.0.0.0.0.1.0.
I (13843) camera_httpd: 0.1.0.0.0.1.0.0.0.0.0.1.0.0.0.0.1.0.0.0.0.0.
I would like to know why it displays space. I am guessing those come from my memset(0). Is their any better way to do it?
It's related to platformIO extension VScode terminal which doesn't handle well special shell control characters for changing the color of the line.
Serial output read from PuTTY:
I (42273) camera_httpd: 0.0.0.0.2.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.
I (42273) camera_httpd: 0.0.0.0.0.1.0.0.1.0.0.0.0.0.0.0.0.0.0.0.1.1.
I (42283) camera_httpd: 0.0.0.0.1.0.1.1.0.1.0.0.1.0.0.0.0.0.0.0.0.1.
I (42293) camera_httpd: 0.0.0.0.4.1.1.1.1.1.1.0.1.0.0.0.0.0.0.1.0.0.
I (42293) camera_httpd: 0.0.0.1.0.1.1.1.1.1.1.1.1.0.0.0.0.0.0.0.0.1.
I (42303) camera_httpd: 0.0.0.0.1.1.1.1.1.1.1.1.1.1.0.1.0.0.1.0.0.1.
I (42313) camera_httpd: 0.0.0.0.3.1.1.1.1.1.1.0.1.1.0.0.0.0.1.0.1.0.
I (42323) camera_httpd: 0.0.0.1.0.1.1.1.1.1.1.1.1.0.1.0.0.0.0.0.1.0.
I (42323) camera_httpd: 0.0.0.0.1.0.1.1.1.1.1.1.1.0.0.1.0.0.0.1.0.1.
I (42333) camera_httpd: 0.5.1.1.3.1.0.1.1.1.1.1.1.1.1.0.0.0.0.0.0.0.
I (42343) camera_httpd: 0.0.0.1.1.0.1.0.0.1.1.0.1.0.0.0.0.0.0.0.0.0.