Bsongis/9x fixes (#4463)

[9x] Fixes + make firmware target added
This commit is contained in:
Bertrand Songis
2017-02-17 17:11:38 +01:00
committed by GitHub
parent 6106d1b228
commit 3e84e7930c
20 changed files with 209 additions and 187 deletions
+14 -13
View File
@@ -38,7 +38,7 @@
#define VBATTUNIT_X (VBATT_X-1)
#define VBATTUNIT_Y (3*FH)
#define REBOOT_X (20*FW-3)
#define BAR_HEIGHT (BOX_WIDTH-1)
#define BAR_HEIGHT (BOX_WIDTH-1l) // don't remove the l here to force 16bits maths on 9X
#define TRIM_LH_X (LCD_W*1/4+2)
#define TRIM_LV_X 3
#define TRIM_RV_X (LCD_W-4)
@@ -48,7 +48,7 @@
#define TRIM_RH_NEG (TRIM_RH_X+1*FW)
#define TRIM_RH_POS (TRIM_RH_X-4*FW)
#define TRIM_LEN 23
#define TRIM_LEN 23
void drawPotsBars()
{
@@ -162,25 +162,26 @@ void displayTrims(uint8_t phase)
}
}
void drawTimerWithMode(coord_t x, coord_t y, uint8_t index)
FORCEINLINE void drawTimerWithMode(coord_t x, coord_t y, uint8_t index)
{
// Main timer
if (g_model.timers[index].mode) {
const TimerData & timer = g_model.timers[index];
if (timer.mode) {
const TimerState & timerState = timersStates[index];
LcdFlags att = RIGHT | DBLSIZE | (timerState.val<0 ? BLINK|INVERS : 0);
const uint8_t negative = (timerState.val<0 ? BLINK | INVERS : 0);
LcdFlags att = RIGHT | DBLSIZE | negative;
drawTimer(x, y, timerState.val, att, att);
#if defined(CPUARM)
uint8_t xLabel = (timerState.val >= 0 ? x-49 : x-56);
uint8_t len = zlen(g_model.timers[index].name, LEN_TIMER_NAME);
uint8_t xLabel = (negative ? x-56 : x-49);
uint8_t len = zlen(timer.name, LEN_TIMER_NAME);
if (len > 0) {
lcdDrawSizedText(xLabel, y+FH, g_model.timers[index].name, len, RIGHT | ZCHAR);
lcdDrawSizedText(xLabel, y+FH, timer.name, len, RIGHT | ZCHAR);
}
else {
drawTimerMode(xLabel, y+FH, g_model.timers[index].mode, RIGHT);
drawTimerMode(xLabel, y+FH, timer.mode, RIGHT);
}
#else
uint8_t xLabel = (timerState.val >= 0 ? x-69 : x-76);
drawTimerMode(xLabel, y+FH, g_model.timers[index].mode);
uint8_t xLabel = (negative ? x-76 : x-69);
drawTimerMode(xLabel, y+FH, timer.mode);
#endif
}
}
@@ -495,7 +496,7 @@ void menuMainView(event_t event)
x0 = i<4 ? LCD_W/4+2 : LCD_W*3/4-2;
y0 = 38+(i%4)*5;
const uint16_t lim = (g_model.extendedLimits ? 512 * uint8_t(LIMIT_EXT_PERCENT / 100) : 512) * 2;
const uint16_t lim = (g_model.extendedLimits ? (512 * (long)LIMIT_EXT_PERCENT / 100) : 512) * 2;
int8_t len = (abs(val) * WBAR2 + lim/2) / lim;
if (len>WBAR2)