123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- #include <AP_OSD/AP_OSD_Backend.h>
- #include <AP_HAL/Util.h>
- #include <ctype.h>
- extern const AP_HAL::HAL& hal;
- #define SYM_DIG_OFS_1 0x90
- #define SYM_DIG_OFS_2 0xA0
- void AP_OSD_Backend::write(uint8_t x, uint8_t y, bool blink, const char *fmt, ...)
- {
- if (blink && (blink_phase < 2)) {
- return;
- }
- char buff[32+1];
- va_list ap;
- va_start(ap, fmt);
- int res = hal.util->vsnprintf(buff, sizeof(buff), fmt, ap);
- res = MIN(res, int(sizeof(buff)));
- if (res > 0 && check_option(AP_OSD::OPTION_DECIMAL_PACK)) {
-
-
- char *p = strchr(&buff[1],'.');
- if (p && isdigit(p[1]) && isdigit(p[-1])) {
- p[-1] += SYM_DIG_OFS_1;
- p[1] += SYM_DIG_OFS_2;
- memmove(p, p+1, strlen(p+1)+1);
- res--;
- }
- }
- if (res < int(sizeof(buff))-1) {
- write(x, y, buff);
- }
- va_end(ap);
- }
|