real use of the display
Some checks failed
Build / build (macos-12) (push) Waiting to run
Build / build (macos-14) (push) Waiting to run
Build / build (windows-2022) (push) Waiting to run
Build / build (ubuntu-22.04) (push) Failing after 15s
Documentation / build (push) Successful in 4s

This commit is contained in:
2024-04-23 23:38:12 -06:00
parent e1772508fe
commit 6d42a445de

View File

@ -70,6 +70,7 @@ int main(void)
printf("font width %d, font height %d\n", printf("font width %d, font height %d\n",
font_width, font_height); font_width, font_height);
} }
cfb_framebuffer_set_font(dev, 0);
printf("x_res %d, y_res %d, ppt %d, rows %d, cols %d\n", printf("x_res %d, y_res %d, ppt %d, rows %d, cols %d\n",
x_res, x_res,
@ -90,10 +91,10 @@ int main(void)
} }
while (1) while (1)
{
for (int i = 0; i < MIN(x_res, y_res); i++)
{ {
int ret; int ret;
char str_v[15] = {0};
char str_i[15] = {0};
ret = sensor_sample_fetch(ina); ret = sensor_sample_fetch(ina);
if (ret < 0) if (ret < 0)
@ -116,12 +117,18 @@ int main(void)
return 0; return 0;
} }
printf("voltage: %d.%06d\tcurrent: %d.%06d\n", voltage.val1, voltage.val2, current.val1, current.val2); sprintf(str_v, "V:%d.%06d", voltage.val1, voltage.val2);
sprintf(str_i, "I:%d.%06d", current.val1, current.val2);
printf("%s\t%s\n", str_v, str_i);
cfb_framebuffer_clear(dev, false); cfb_framebuffer_clear(dev, false);
if (cfb_print(dev, if (cfb_print(dev, str_v, 0, 0))
"0123456789mMgj!\"§$%&/()=", {
i, i)) printf("Failed to print a string\n");
continue;
}
if (cfb_print(dev, str_i, 0, 16))
{ {
printf("Failed to print a string\n"); printf("Failed to print a string\n");
continue; continue;
@ -132,7 +139,6 @@ int main(void)
k_sleep(K_MSEC(20)); k_sleep(K_MSEC(20));
#endif #endif
} }
}
int ret; int ret;
unsigned int period_ms = BLINK_PERIOD_MS_MAX; unsigned int period_ms = BLINK_PERIOD_MS_MAX;