void drawStick(coord_t centrex, int16_t xval, int16_t yval) { #define BOX_CENTERY (LCD_H-BOX_WIDTH/2-10) #define MARKER_WIDTH 5 lcd_square(centrex-BOX_WIDTH/2, BOX_CENTERY-BOX_WIDTH/2, BOX_WIDTH); lcd_vline(centrex, BOX_CENTERY-1, 3); lcd_hline(centrex-1, BOX_CENTERY, 3); lcd_square(centrex + (xval/((2*RESX)/(BOX_WIDTH-MARKER_WIDTH))) - MARKER_WIDTH/2, BOX_CENTERY - (yval/((2*RESX)/(BOX_WIDTH-MARKER_WIDTH))) - MARKER_WIDTH/2, MARKER_WIDTH, ROUND); #undef BOX_CENTERY #undef MARKER_WIDTH }
void menu_lcd_onoff(coord_t x, coord_t y, uint8_t value, LcdFlags attr) { if (value) lcd_putc(x+1, y, '#'); if (attr) drawFilledRect(x, y, 7, 7); else lcd_square(x, y, 7); }
void menu_lcd_onoff(uint8_t x, uint8_t y, uint8_t value, LcdFlags attr) { #if defined(GRAPHICS) if (value) lcd_putc(x+1, y, '#'); if (attr) lcd_filled_rect(x, y, 7, 7); else lcd_square(x, y, 7); #else /* ON / OFF version */ lcd_putsiAtt(x, y, STR_OFFON, value, attr ? INVERS:0) ; #endif }
void displayTrims(uint8_t phase) { for (uint8_t i=0; i<4; i++) { static coord_t x[4] = {TRIM_LH_X, TRIM_LV_X, TRIM_RV_X, TRIM_RH_X}; static uint8_t vert[4] = {0,1,1,0}; coord_t xm, ym; uint8_t stickIndex = CONVERT_MODE(i); xm = x[stickIndex]; uint8_t att = ROUND; int16_t val = getTrimValue(phase, i); #if !defined(CPUM64) || !defined(FRSKY) int16_t dir = val; bool exttrim = false; if (val < TRIM_MIN || val > TRIM_MAX) { exttrim = true; } #endif if (val < -(TRIM_LEN+1)*4) { val = -(TRIM_LEN+1); } else if (val > (TRIM_LEN+1)*4) { val = TRIM_LEN+1; } else { val /= 4; } if (vert[i]) { ym = 31; lcd_vline(xm, ym-TRIM_LEN, TRIM_LEN*2); if (i!=2 || !g_model.thrTrim) { lcd_vline(xm-1, ym-1, 3); lcd_vline(xm+1, ym-1, 3); } ym -= val; #if !defined(CPUM64) || !defined(FRSKY) drawFilledRect(xm-3, ym-3, 7, 7, SOLID, att|ERASE); if (dir >= 0) { lcd_hline(xm-1, ym-1, 3); } if (dir <= 0) { lcd_hline(xm-1, ym+1, 3); } if (exttrim) { lcd_hline(xm-1, ym, 3); } #endif #if defined(CPUARM) if (g_model.displayTrims != DISPLAY_TRIMS_NEVER && dir != 0) { if (g_model.displayTrims == DISPLAY_TRIMS_ALWAYS || (trimsDisplayTimer > 0 && (trimsDisplayMask & (1<<i)))) { lcd_outdezAtt(dir>0 ? 22 : 54, xm-2, -abs(dir/5), TINSIZE|VERTICAL); } } #endif } else { ym = 60; lcd_hline(xm-TRIM_LEN, ym, TRIM_LEN*2); lcd_hline(xm-1, ym-1, 3); lcd_hline(xm-1, ym+1, 3); xm += val; #if !defined(CPUM64) || !defined(FRSKY) drawFilledRect(xm-3, ym-3, 7, 7, SOLID, att|ERASE); if (dir >= 0) { lcd_vline(xm+1, ym-1, 3); } if (dir <= 0) { lcd_vline(xm-1, ym-1, 3); } if (exttrim) { lcd_vline(xm, ym-1, 3); } #endif #if defined(CPUARM) if (g_model.displayTrims != DISPLAY_TRIMS_NEVER && dir != 0) { if (g_model.displayTrims == DISPLAY_TRIMS_ALWAYS || (trimsDisplayTimer > 0 && (trimsDisplayMask & (1<<i)))) { lcd_outdezAtt((stickIndex==0 ? TRIM_LH_X : TRIM_RH_X)+(dir>0 ? -11 : 20), ym-2, -abs(dir/5), TINSIZE); } } #endif } lcd_square(xm-3, ym-3, 7, att); } }