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
@@ -410,12 +410,12 @@ void menuModelLogicalSwitches(event_t event)
}
else {
lcdDrawNumber(CSW_3RD_COLUMN, y, cs->v2, LEFT|attr2);
#if defined(GVARS)
#if defined(CPUARM) && defined(GVARS)
if (v1_val >= MIXSRC_GVAR1) {
v2_min = -1024; v2_max = +1024;
}
else
#endif // GVARS
#endif
{
v2_min = -LIMIT_EXT_PERCENT; v2_max = +LIMIT_EXT_PERCENT;
}
+6 -6
View File
@@ -76,15 +76,15 @@ enum MenuModelOutputsItems {
#endif
#define LIMITS_CURVE_POS 17*FW+1
#define LIMITS_MIN_MAX_OFFSET 1000
#define CONVERT_US_MIN_MAX(x) ((int16_t(x)*128)/25)
#define MIN_MAX_ATTR attr
#define LIMITS_MIN_MAX_OFFSET 100
#define CONVERT_US_MIN_MAX(x) ((int16_t(x)*128)/25)
#define MIN_MAX_ATTR attr
#if defined(PPM_UNIT_US)
#define SET_MIN_MAX(x, val) x = ((val)*250)/128
#define MIN_MAX_DISPLAY(x) CONVERT_US_MIN_MAX(x)
#define SET_MIN_MAX(x, val) x = ((val)*250)/128
#define MIN_MAX_DISPLAY(x) CONVERT_US_MIN_MAX(x)
#else
#define MIN_MAX_DISPLAY(x) ((int8_t)(x))
#define MIN_MAX_DISPLAY(x) ((int8_t)(x))
#endif
void menuModelLimits(event_t event)
+3 -3
View File
@@ -25,7 +25,7 @@ void menuRadioTrainer(event_t event)
uint8_t y;
bool slave = SLAVE_MODE();
MENU(STR_MENUTRAINER, menuTabGeneral, MENU_RADIO_TRAINER, (slave ? HEADER_LINE : HEADER_LINE+6), {HEADER_LINE_COLUMNS 2, 2, 2, 2, 0/*, 0*/});
MENU(STR_MENUTRAINER, menuTabGeneral, MENU_RADIO_TRAINER, (slave ? HEADER_LINE : HEADER_LINE+6), { HEADER_LINE_COLUMNS 2, 2, 2, 2, 0/*, 0*/ });
if (slave) {
lcdDrawText(7*FW, 4*FH, STR_SLAVE);
@@ -38,8 +38,8 @@ void menuRadioTrainer(event_t event)
y = MENU_HEADER_HEIGHT + 1 + FH;
for (uint8_t i=0; i<NUM_STICKS; i++) {
uint8_t chan = channel_order(i+1);
for (uint8_t i=HEADER_LINE; i<HEADER_LINE+NUM_STICKS; i++) {
uint8_t chan = channel_order(i+1-HEADER_LINE);
volatile TrainerMix * td = &g_eeGeneral.trainer.mix[chan-1];
drawSource(0, y, MIXSRC_Rud-1+chan, (menuVerticalPosition==i && CURSOR_ON_LINE()) ? INVERS : 0);
+1 -1
View File
@@ -101,7 +101,7 @@ void menuChannelsView(event_t event)
#endif
// Gauge
// uint16_t lim = (g_model.extendedLimits ? (512 * LIMIT_EXT_PERCENT / 100) : 512) * 2;
// uint16_t lim = (g_model.extendedLimits ? (512 * (long)LIMIT_EXT_PERCENT / 100) : 512) * 2;
//#ifdef MIXERS_MONITOR
// if (mixersView)
// lim = 512 * 2 * 2;
+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)