[X9D] Top bar
This commit is contained in:
@@ -231,7 +231,7 @@ void menuGeneralSetup(uint8_t event)
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if defined(BATTGRAPH)
|
||||
#if defined(BATTGRAPH) || defined(PCBX9D)
|
||||
case ITEM_SETUP_BATT_RANGE:
|
||||
lcd_putsLeft(y, PSTR("Battery Range"));
|
||||
lcd_putc(g_eeGeneral.vBatMin >= 10 ? RADIO_SETUP_2ND_COLUMN+2*FW+FWNUM-1 : RADIO_SETUP_2ND_COLUMN+2*FW+FWNUM-FW/2, y, '-');
|
||||
|
||||
+2
-2
@@ -1,2 +1,2 @@
|
||||
48,8,
|
||||
0x1d,0xe3,0xe3,0x1c,0x1c,0xdd,0xdd,0x3e,0xea,0x23,0x6b,0xb6,0xa1,0x9f,0xbf,0xc0,0xf9,0xef,0xff,0xe8,0xa1,0x9f,0xbf,0xc0,0xea,0x23,0x6b,0xb6,0x1c,0xdd,0xdd,0x3e,0x1d,0xe3,0xe3,0x1c,0x39,0xff,0xff,0x38,0x39,0xbb,0xbb,0x7c,0x7c,0x7d,0x7d,0xfe,0xfe,0xff,0xff,0xfe,0x29,0xd7,0xff,0x00,0x29,0xef,0xef,0x38,0xfe,0x93,0xff,0x92,0x7c,0x45,0x7d,0xc6,0x39,0xbb,0xbb,0x7c,0xff,0xff,0xff,0xff,0xff,0x7f,0x7f,0x7f,0xff,0x41,0x41,0x41,0xff,0x7d,0x7d,0x7d,0xff,0x7d,0x7d,0x7d,0xff,0x7d,0x7d,0x7d,0xfd,0x7b,0x7b,0x79,0xfb,0x47,0x47,0x43,0xff,0x7f,0x7f,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0x7f,0x7f,0xeb,0x6b,0x6b,0x6b,0xe3,0x7f,0x77,0x63,0xeb,0x5d,0x41,0x41,0xd5,0x55,0x55,0x55,0xeb,0x6b,0x6b,0x6b,0xff,0x7f,0x7f,0x7f,0xff,0x7f,0x7f,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0x7f,0x7f,0xfb,0x47,0x47,0x43,0xff,0x7b,0x7b,0x7b,0xdb,0x67,0x67,0x43,0xff,0x5f,0x5f,0x5f,0xff,0x59,0x59,0x59,0xdd,0x67,0x63,0x41,0xff,0x79,0x79,0x79,0xff,0xff,0xff,0xff,
|
||||
49,8,
|
||||
0x1d,0xe3,0xe3,0x1c,0x1c,0xdd,0xdd,0x3e,0xea,0x23,0x6b,0xb6,0xa1,0x9f,0xbf,0xc0,0xf9,0xef,0xff,0xe8,0xa1,0x9f,0xbf,0xc0,0xea,0x23,0x6b,0xb6,0x1c,0xdd,0xdd,0x3e,0x1d,0xe3,0xe3,0x1c,0x39,0xff,0xff,0x38,0x39,0xbb,0xbb,0x7c,0x7c,0x7d,0x7d,0xfe,0xfe,0xff,0xff,0xfe,0x29,0xd7,0xff,0x00,0x29,0xef,0xef,0x38,0xfe,0x93,0xff,0x92,0x7c,0x45,0x7d,0xc6,0x39,0xbb,0xbb,0x7c,0xff,0xff,0xff,0xff,0xff,0x7f,0x7f,0x7f,0xff,0x41,0x41,0x41,0xff,0x7d,0x7d,0x7d,0xff,0x7d,0x7d,0x7d,0xff,0x7d,0x7d,0x7d,0xff,0x7d,0x7d,0x7d,0xfd,0x7b,0x7b,0x79,0xfb,0x47,0x47,0x43,0xff,0x7f,0x7f,0x7f,0xff,0xff,0xff,0xff,0xff,0x7f,0x7f,0x7f,0xff,0x7f,0x7f,0x7f,0xe3,0x7f,0x77,0x63,0xdd,0x7f,0x63,0x41,0xdd,0x7f,0x41,0x41,0xdd,0x7f,0x63,0x41,0xe3,0x7f,0x77,0x63,0xff,0x7f,0x7f,0x7f,0xff,0x7f,0x7f,0x7f,0xff,0xff,0xff,0xff,0xff,0x7f,0x7f,0x7f,0xfb,0x47,0x47,0x43,0xff,0x7b,0x7b,0x7b,0xdb,0x67,0x67,0x43,0xff,0x5f,0x5f,0x5f,0xff,0x59,0x59,0x59,0xdd,0x67,0x63,0x41,0xff,0x79,0x79,0x79,0xff,0x7f,0x7f,0x7f,0xff,0xff,0xff,0xff,
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 742 B After Width: | Height: | Size: 731 B |
+10
-22
@@ -82,22 +82,6 @@ void lcd_img(xcoord_t x, uint8_t y, const pm_uchar * img, uint8_t idx, LcdFlags
|
||||
|
||||
uint8_t lcdLastPos;
|
||||
|
||||
#if defined(PCBX9D)
|
||||
#define LCD_BYTE_FILTER(p, keep, add) \
|
||||
do { \
|
||||
if (!(flags & GREY(1))) \
|
||||
*(p) = ((*(p)) & (keep)) | (add); \
|
||||
if (!(flags & GREY(2))) \
|
||||
*(p+DISPLAY_PLAN_SIZE) = ((*(p+DISPLAY_PLAN_SIZE)) & (keep)) | (add); \
|
||||
if (!(flags & GREY(4))) \
|
||||
*(p+2*DISPLAY_PLAN_SIZE) = ((*(p+2*DISPLAY_PLAN_SIZE)) & (keep)) | (add); \
|
||||
if (!(flags & GREY(8))) \
|
||||
*(p+3*DISPLAY_PLAN_SIZE) = ((*(p+3*DISPLAY_PLAN_SIZE)) & (keep)) | (add); \
|
||||
} while (0)
|
||||
#else
|
||||
#define LCD_BYTE_FILTER(p, keep, add) *(p) = (*(p) & (keep)) | (add)
|
||||
#endif
|
||||
|
||||
void lcd_putcAtt(xcoord_t x, uint8_t y, const unsigned char c, LcdFlags flags)
|
||||
{
|
||||
uint8_t *p = &displayBuf[ y / 8 * LCD_W + x ];
|
||||
@@ -161,7 +145,7 @@ void lcd_putcAtt(xcoord_t x, uint8_t y, const unsigned char c, LcdFlags flags)
|
||||
b1 = ~b1;
|
||||
b2 = ~b2;
|
||||
}
|
||||
uint8_t ym8 = (y % 8);
|
||||
uint8_t ym8 = (y & 0x07);
|
||||
if (&p[LCD_W+1] < DISPLAY_END) {
|
||||
LCD_BYTE_FILTER(p, ~(0xff << ym8), b1 << ym8);
|
||||
uint8_t *r = p + LCD_W;
|
||||
@@ -181,7 +165,7 @@ void lcd_putcAtt(xcoord_t x, uint8_t y, const unsigned char c, LcdFlags flags)
|
||||
}
|
||||
else if (flags & SMLSIZE) {
|
||||
q = &font_4x6[((uint16_t)c-0x20)*5+4];
|
||||
uint8_t ym8 = (y % 8);
|
||||
uint8_t ym8 = (y & 0x07);
|
||||
p += 4;
|
||||
for (int8_t i=4; i>=0; i--) {
|
||||
uint8_t b = pgm_read_byte(q--);
|
||||
@@ -199,7 +183,7 @@ void lcd_putcAtt(xcoord_t x, uint8_t y, const unsigned char c, LcdFlags flags)
|
||||
}
|
||||
else if (flags & TINSIZE) {
|
||||
q = &font_3x5[((uint16_t)c-0x2D)*3+2];
|
||||
uint8_t ym8 = (y % 8);
|
||||
uint8_t ym8 = (y & 0x07);
|
||||
p += 3;
|
||||
for (int8_t i=3; i>=0; i--) {
|
||||
uint8_t b = (i!=3 ? pgm_read_byte(q--) : 0);
|
||||
@@ -224,7 +208,7 @@ void lcd_putcAtt(xcoord_t x, uint8_t y, const unsigned char c, LcdFlags flags)
|
||||
condense=1;
|
||||
}
|
||||
|
||||
uint8_t ym8 = (y % 8);
|
||||
uint8_t ym8 = (y & 0x07);
|
||||
p += 5;
|
||||
for (int8_t i=5; i>=0; i--) {
|
||||
uint8_t b = (i!=5 ? pgm_read_byte(q--) : 0);
|
||||
@@ -482,6 +466,10 @@ void lcd_mask(uint8_t *p, uint8_t mask, LcdFlags att)
|
||||
{
|
||||
ASSERT_IN_DISPLAY(p);
|
||||
|
||||
if ((att&FILL_WHITE) && ((*p&mask) || (*(p+DISPLAY_PLAN_SIZE)&mask) || (*(p+2*DISPLAY_PLAN_SIZE)&mask) || (*(p+3*DISPLAY_PLAN_SIZE)&mask))) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(att & GREY(1))) {
|
||||
if (att & FORCE)
|
||||
*p |= mask;
|
||||
@@ -579,7 +567,7 @@ void lcd_vlineStip(xcoord_t x, int8_t y, int8_t h, uint8_t pat)
|
||||
pat = ~pat;
|
||||
|
||||
uint8_t *p = &displayBuf[ y / 8 * LCD_W + x ];
|
||||
y = y % 8;
|
||||
y = (y & 0x07);
|
||||
if (y) {
|
||||
ASSERT_IN_DISPLAY(p);
|
||||
*p ^= ~(BITMASK(y)-1) & pat;
|
||||
@@ -612,7 +600,7 @@ void lcd_vlineStip(xcoord_t x, int8_t y, int8_t h, uint8_t pat, LcdFlags att)
|
||||
pat = ~pat;
|
||||
|
||||
uint8_t *p = &displayBuf[ y / 8 * LCD_W + x ];
|
||||
y = y % 8;
|
||||
y = (y & 0x07);
|
||||
if (y) {
|
||||
ASSERT_IN_DISPLAY(p);
|
||||
uint8_t msk = ~(BITMASK(y)-1);
|
||||
|
||||
@@ -107,6 +107,9 @@
|
||||
#define FORCE 0x02
|
||||
#define ERASE 0x04
|
||||
#define ROUND 0x08
|
||||
#if defined(PCBX9D)
|
||||
#define FILL_WHITE 0x10
|
||||
#endif
|
||||
|
||||
/* switches flags */
|
||||
#define SWCONDENSED 0x20 /* means that THRm will be displayed as THR */
|
||||
@@ -115,17 +118,18 @@
|
||||
#define NO_UNIT 0x40
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define MIDSIZE 0x0100
|
||||
#define SMLSIZE 0x0200
|
||||
#define TINSIZE 0x0400
|
||||
#define MIDSIZE 0x0100
|
||||
#define SMLSIZE 0x0200
|
||||
#define TINSIZE 0x0400
|
||||
#else
|
||||
#define MIDSIZE DBLSIZE
|
||||
#define SMLSIZE 0x00
|
||||
#define TINSIZE 0x00
|
||||
#define MIDSIZE DBLSIZE
|
||||
#define SMLSIZE 0x00
|
||||
#define TINSIZE 0x00
|
||||
#endif
|
||||
|
||||
#if defined(PCBX9D)
|
||||
#define GREY(x) ((x) * 0x1000)
|
||||
#define GREY_DEFAULT GREY(8)
|
||||
#define GREY_MASK(x) ((x) & 0xF000)
|
||||
#endif
|
||||
|
||||
@@ -234,7 +238,8 @@ void lcdDrawTelemetryTopBar();
|
||||
lcd_vline(x+5, y+8, 2);
|
||||
|
||||
extern void lcd_img(xcoord_t x, uint8_t y, const pm_uchar * img, uint8_t idx, LcdFlags att=0);
|
||||
extern void lcd_bmp(xcoord_t x, uint8_t y, const pm_uchar * img);
|
||||
extern void lcd_bmp(xcoord_t x, uint8_t y, const pm_uchar * img, uint8_t offset=0, uint8_t width=0);
|
||||
#define LCD_ICON(x, y, icon) lcd_bmp(x, y, icons, icon)
|
||||
extern void lcdSetRefVolt(unsigned char val);
|
||||
extern void lcdInit();
|
||||
extern void lcd_clear();
|
||||
@@ -253,5 +258,23 @@ extern bool lcd_refresh;
|
||||
extern uint8_t lcd_buf[DISPLAY_BUF_SIZE];
|
||||
#endif
|
||||
|
||||
#define LCD_BYTE_FILTER_PLAN(p, keep, add) *(p) = (*(p) & (keep)) | (add)
|
||||
|
||||
#if defined(PCBX9D)
|
||||
#define LCD_BYTE_FILTER(p, keep, add) \
|
||||
do { \
|
||||
if (!(flags & GREY(1))) \
|
||||
LCD_BYTE_FILTER_PLAN(p, keep, add); \
|
||||
if (!(flags & GREY(2))) \
|
||||
LCD_BYTE_FILTER_PLAN((p+DISPLAY_PLAN_SIZE), keep, add); \
|
||||
if (!(flags & GREY(4))) \
|
||||
LCD_BYTE_FILTER_PLAN((p+2*DISPLAY_PLAN_SIZE), keep, add); \
|
||||
if (!(flags & GREY(8))) \
|
||||
LCD_BYTE_FILTER_PLAN((p+3*DISPLAY_PLAN_SIZE), keep, add); \
|
||||
} while (0)
|
||||
#else
|
||||
#define LCD_BYTE_FILTER(p, keep, add) LCD_BYTE_FILTER_PLAN(p, keep, add)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/*eof*/
|
||||
|
||||
+94
-12
@@ -43,7 +43,8 @@
|
||||
#define LBOX_CENTERY (LCD_H-BOX_WIDTH/2-10)
|
||||
#define RBOX_CENTERX (LCD_W-LBOX_CENTERX)
|
||||
#define RBOX_CENTERY LBOX_CENTERY
|
||||
#define MODELNAME_X (13)
|
||||
#define MODELNAME_X (15)
|
||||
#define MODELNAME_Y (10)
|
||||
#define VBATT_X (MODELNAME_X+26)
|
||||
#define VBATT_Y (FH+3)
|
||||
#define VBATTUNIT_X (VBATT_X-2)
|
||||
@@ -54,8 +55,8 @@
|
||||
#define PHASE_Y (3*FH)
|
||||
#define PHASE_FLAGS (0)
|
||||
#define TIMERS_X 144
|
||||
#define TIMER1_Y 0
|
||||
#define TIMER2_Y VBATT_Y
|
||||
#define TIMER1_Y 20
|
||||
#define TIMER2_Y 45
|
||||
#define TIMERS_R 192
|
||||
#define REBOOT_X (LCD_W-FW)
|
||||
#define VSWITCH_X(i) (((i>=NUM_CSW*3/4) ? BITMAP_X+28 : ((i>=NUM_CSW/2) ? BITMAP_X+25 : ((i>=NUM_CSW/4) ? 21 : 18))) + 3*i)
|
||||
@@ -73,6 +74,7 @@
|
||||
#define RBOX_CENTERX (3*LCD_W/4 - 10)
|
||||
#define RBOX_CENTERY LBOX_CENTERY
|
||||
#define MODELNAME_X (2*FW-2)
|
||||
#define MODELNAME_Y (0)
|
||||
#define PHASE_X (6*FW)
|
||||
#define PHASE_Y (2*FH)
|
||||
#define PHASE_FLAGS 0
|
||||
@@ -98,6 +100,16 @@
|
||||
const pm_uchar x9d_logo[] PROGMEM = {
|
||||
#include "x9d_logo.lbm"
|
||||
};
|
||||
|
||||
const pm_uchar icons[] PROGMEM = {
|
||||
#include "icons.lbm"
|
||||
};
|
||||
|
||||
#define ICON_RSSI 0, 9
|
||||
#define ICON_SPEAKER 9, 9
|
||||
#define ICON_SD 18, 11
|
||||
#define ICON_LOGS 28, 11
|
||||
#define ICON_TRAINER 38, 11
|
||||
#endif
|
||||
|
||||
void drawPotsBars()
|
||||
@@ -173,7 +185,7 @@ void displayTrims(uint8_t phase)
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(PCBX9D) || defined(PCBACT)
|
||||
#if defined(PCBX9D)
|
||||
void displaySliders()
|
||||
{
|
||||
for (uint8_t i=NUM_STICKS; i<NUM_STICKS+NUM_POTS; i++) {
|
||||
@@ -187,6 +199,70 @@ void displaySliders()
|
||||
lcd_vline(x+2, y, 2);
|
||||
}
|
||||
}
|
||||
|
||||
#define BAR_X 15
|
||||
#define BAR_Y 1
|
||||
#define BAR_BATT_X BAR_X+19
|
||||
#define BAR_RSSI_X BAR_X+42
|
||||
#define BAR_SD_X BAR_X+100
|
||||
#define BAR_LOGS_X BAR_X+112
|
||||
#define BAR_TRN_X BAR_X+124
|
||||
#define BAR_VOLUME_X BAR_X+140
|
||||
#define BAR_TIME_X BAR_X+165
|
||||
|
||||
void displayTopBarGauge(xcoord_t x, uint8_t count, bool blinking=false)
|
||||
{
|
||||
if (!blinking || BLINK_ON_PHASE)
|
||||
lcd_filled_rect(x+1, BAR_Y+2, 11, 5, SOLID, ERASE);
|
||||
count = min((uint8_t)10, count);
|
||||
for (uint8_t i=0; i<count; i+=2)
|
||||
lcd_vline(x+2+i, BAR_Y+3, 3);
|
||||
}
|
||||
|
||||
void displayTopBar()
|
||||
{
|
||||
/* Tx voltage */
|
||||
putsVBat(BAR_BATT_X, BAR_Y+1, 0);
|
||||
lcd_rect(VBATT_X, BAR_Y+1, 13, 7);
|
||||
lcd_vline(VBATT_X+13, BAR_Y+2, 5);
|
||||
|
||||
/* RSSI */
|
||||
LCD_ICON(BAR_RSSI_X, BAR_Y, ICON_RSSI);
|
||||
lcd_rect(BAR_RSSI_X+10, BAR_Y+1, 13, 7);
|
||||
|
||||
/* SD icon */
|
||||
LCD_ICON(BAR_SD_X, BAR_Y, ICON_SD);
|
||||
lcd_hline(BAR_SD_X, BAR_Y+8, 11);
|
||||
|
||||
/* Logs icon */
|
||||
LCD_ICON(BAR_LOGS_X, BAR_Y, ICON_LOGS);
|
||||
lcd_hline(BAR_LOGS_X, BAR_Y+8, 11);
|
||||
|
||||
/* Trainer icon */
|
||||
LCD_ICON(BAR_TRN_X, BAR_Y, ICON_TRAINER);
|
||||
lcd_hline(BAR_TRN_X, BAR_Y+8, 11);
|
||||
|
||||
/* Audio volume */
|
||||
LCD_ICON(BAR_VOLUME_X, BAR_Y, ICON_SPEAKER);
|
||||
|
||||
/* RTC time */
|
||||
struct gtm t;
|
||||
gettime(&t);
|
||||
lcd_putcAtt(BAR_TIME_X-1, BAR_Y+1, ':', BLINK);
|
||||
lcd_outdezNAtt(BAR_TIME_X+1, BAR_Y+1, t.tm_hour, LEADING0, 2);
|
||||
lcd_outdezNAtt(BAR_TIME_X+3*FWNUM-1, BAR_Y+1, t.tm_min, LEADING0, 2);
|
||||
|
||||
/* The background */
|
||||
lcd_filled_rect(BAR_X, BAR_Y, 182, 9, SOLID, FILL_WHITE|GREY_DEFAULT);
|
||||
|
||||
/* The inside of the Batt gauge */
|
||||
uint8_t count = 10 * (g_vbat100mV - g_eeGeneral.vBatMin - 90) / (30 + g_eeGeneral.vBatMax - g_eeGeneral.vBatMin);
|
||||
displayTopBarGauge(VBATT_X, count, g_vbat100mV <= g_eeGeneral.vBatWarn);
|
||||
|
||||
/* The inside of the RSSI gauge */
|
||||
count = min(frskyData.rssi[0].value, frskyData.rssi[1].value) / 10;
|
||||
displayTopBarGauge(BAR_RSSI_X+10, count, (frskyData.rssi[0].value < getRssiAlarmValue(0)) || (frskyData.rssi[1].value < getRssiAlarmValue(1)));
|
||||
}
|
||||
#endif
|
||||
|
||||
#if LCD_W >= 212
|
||||
@@ -195,7 +271,7 @@ void displayTimers()
|
||||
// Main timer
|
||||
if (g_model.timers[0].mode) {
|
||||
putsTime(TIMERS_X, TIMER1_Y, s_timerVal[0], MIDSIZE|LEFT, MIDSIZE|LEFT);
|
||||
putsTmrMode(TIMERS_X-16, TIMER1_Y+5, g_model.timers[0].mode, SWCONDENSED|SMLSIZE);
|
||||
putsTmrMode(TIMERS_X, TIMER1_Y-6, g_model.timers[0].mode, SWCONDENSED|SMLSIZE);
|
||||
if (g_model.timers[0].persistent) lcd_putcAtt(TIMERS_R, TIMER1_Y+1, 'P', SMLSIZE);
|
||||
if (s_timerVal[0] < 0) lcd_hline(TIMERS_X-6, TIMER1_Y+2, 4);
|
||||
}
|
||||
@@ -203,7 +279,7 @@ void displayTimers()
|
||||
// Second timer
|
||||
if (g_model.timers[1].mode) {
|
||||
putsTime(TIMERS_X, TIMER2_Y, s_timerVal[1], MIDSIZE|LEFT, MIDSIZE|LEFT);
|
||||
putsTmrMode(TIMERS_X-16, TIMER2_Y+5, g_model.timers[1].mode, SWCONDENSED|SMLSIZE);
|
||||
putsTmrMode(TIMERS_X, TIMER2_Y-6, g_model.timers[1].mode, SWCONDENSED|SMLSIZE);
|
||||
if (g_model.timers[1].persistent) lcd_putcAtt(TIMERS_R, TIMER2_Y+1, 'P', SMLSIZE);
|
||||
if (s_timerVal[1] < 0) lcd_hline(TIMERS_X-6, TIMER2_Y+2, 4);
|
||||
}
|
||||
@@ -443,28 +519,31 @@ void menuMainView(uint8_t event)
|
||||
lcd_putsnAtt(PHASE_X, PHASE_Y, g_model.phaseData[phase].name, sizeof(g_model.phaseData[phase].name), ZCHAR|PHASE_FLAGS);
|
||||
|
||||
// Model Name
|
||||
putsModelName(MODELNAME_X, 0*FH, g_model.name, g_eeGeneral.currModel, BIGSIZE);
|
||||
putsModelName(MODELNAME_X, MODELNAME_Y, g_model.name, g_eeGeneral.currModel, BIGSIZE);
|
||||
|
||||
#if !defined(PCBX9D)
|
||||
// Main Voltage (or alarm if any)
|
||||
displayVoltageOrAlarm();
|
||||
|
||||
// Timers
|
||||
displayTimers();
|
||||
#endif
|
||||
|
||||
// Trims sliders
|
||||
displayTrims(phase);
|
||||
}
|
||||
|
||||
#if defined(PCBX9D) || defined(PCBACT)
|
||||
#if defined(PCBX9D)
|
||||
// Top bar
|
||||
displayTopBar();
|
||||
|
||||
// Sliders (Pots / Sliders)
|
||||
displaySliders();
|
||||
|
||||
#if defined(PCBX9D)
|
||||
if (modelBitmapLoaded == NULL)
|
||||
lcd_bmp(BITMAP_X, BITMAP_Y, modelBitmap);
|
||||
else
|
||||
lcd_bmp(BITMAP_X, BITMAP_Y, x9d_logo);
|
||||
#endif
|
||||
|
||||
// Switches
|
||||
for (uint8_t i=0; i<8; i++) {
|
||||
@@ -489,10 +568,13 @@ void menuMainView(uint8_t event)
|
||||
break;
|
||||
}
|
||||
}
|
||||
putsSwitches((g_eeGeneral.view == VIEW_SWITCHES) ? (i<4 ? 3*FW+2 : 8*FW-1) : (i<4 ? 8*FW+3 : 24*FW+1), (i%4)*FH+3*FH, sw, 0);
|
||||
putsSwitches((g_eeGeneral.view == VIEW_INPUTS) ? (i<4 ? 8*FW+3 : 24*FW+1) : (i<4 ? 3*FW+2 : 8*FW-1), (i%4)*FH+3*FH, sw, 0);
|
||||
}
|
||||
|
||||
if (g_eeGeneral.view == VIEW_INPUTS) {
|
||||
if (g_eeGeneral.view == VIEW_TIMERS) {
|
||||
displayTimers();
|
||||
}
|
||||
else if (g_eeGeneral.view == VIEW_INPUTS) {
|
||||
// Sticks
|
||||
doMainScreenGraphics();
|
||||
}
|
||||
|
||||
+1
-1
@@ -68,7 +68,7 @@
|
||||
#define IF_CPUARM(x)
|
||||
#endif
|
||||
|
||||
#if defined(BATTGRAPH)
|
||||
#if defined(BATTGRAPH) || defined(PCBX9D)
|
||||
#define IF_BATTGRAPH(x) x,
|
||||
#else
|
||||
#define IF_BATTGRAPH(x)
|
||||
|
||||
+23
-22
@@ -46,7 +46,7 @@ uint16_t dummyport16;
|
||||
const char *eepromFile = NULL;
|
||||
FILE *fp = NULL;
|
||||
|
||||
#if defined(PCBX9D) || defined(PCBACT)
|
||||
#if defined(PCBX9D)
|
||||
uint32_t Peri1_frequency ;
|
||||
uint32_t Peri2_frequency ;
|
||||
GPIO_TypeDef gpioa;
|
||||
@@ -77,12 +77,18 @@ extern const char* eeprom_buffer_data;
|
||||
uint8_t eeprom[EESIZE];
|
||||
sem_t *eeprom_write_sem;
|
||||
|
||||
|
||||
#if defined(CPUARM)
|
||||
#if defined(PCBX9D)
|
||||
#define SWITCH_CASE(swtch, pin, mask) \
|
||||
case swtch: \
|
||||
if (state) pin &= ~(mask); else pin |= (mask); \
|
||||
break;
|
||||
#else
|
||||
#define SWITCH_CASE(swtch, pin, mask) \
|
||||
case swtch: \
|
||||
if (state) pin |= (mask); else pin &= ~(mask); \
|
||||
break;
|
||||
#endif
|
||||
#define SWITCH_3_CASE(swtch, pin1, pin2, mask1, mask2) \
|
||||
case swtch: \
|
||||
if (state < 0) pin1 &= ~(mask1); else pin1 |= (mask1); \
|
||||
@@ -115,11 +121,7 @@ void simuSetKey(uint8_t key, bool state)
|
||||
switch (key) {
|
||||
KEY_CASE(KEY_MENU, GPIO_BUTTON_MENU, PIN_BUTTON_MENU)
|
||||
KEY_CASE(KEY_EXIT, GPIO_BUTTON_EXIT, PIN_BUTTON_EXIT)
|
||||
#if defined(PCBACT)
|
||||
KEY_CASE(KEY_CLR, GPIO_BUTTON_CLR, PIN_BUTTON_CLR)
|
||||
KEY_CASE(KEY_PAGE, GPIO_BUTTON_PAGE, PIN_BUTTON_PAGE)
|
||||
KEY_CASE(BTN_REa, GPIO_BUTTON_ENTER, PIN_BUTTON_ENTER)
|
||||
#elif defined(PCBX9D)
|
||||
#if defined(PCBX9D)
|
||||
KEY_CASE(KEY_ENTER, GPIO_BUTTON_ENTER, PIN_BUTTON_ENTER)
|
||||
KEY_CASE(KEY_PAGE, GPIO_BUTTON_PAGE, PIN_BUTTON_PAGE)
|
||||
KEY_CASE(KEY_MINUS, GPIO_BUTTON_MINUS, PIN_BUTTON_MINUS)
|
||||
@@ -160,16 +162,15 @@ void simuSetSwitch(uint8_t swtch, int8_t state)
|
||||
{
|
||||
// printf("swtch=%d state=%d\n", swtch, state); fflush(stdout);
|
||||
switch (swtch) {
|
||||
#if defined(PCBACT)
|
||||
#elif defined(PCBX9D)
|
||||
SWITCH_3_CASE(0, GPIOB->IDR, GPIOE->IDR, PIN_SW_A_H, PIN_SW_A_L)
|
||||
SWITCH_3_CASE(1, GPIOB->IDR, GPIOB->IDR, PIN_SW_B_H, PIN_SW_B_L)
|
||||
SWITCH_3_CASE(2, GPIOB->IDR, GPIOE->IDR, PIN_SW_C_H, PIN_SW_C_L)
|
||||
SWITCH_3_CASE(3, GPIOE->IDR, GPIOE->IDR, PIN_SW_D_H, PIN_SW_D_L)
|
||||
SWITCH_3_CASE(4, GPIOB->IDR, GPIOB->IDR, PIN_SW_E_H, PIN_SW_E_L)
|
||||
SWITCH_CASE(5, GPIOE->IDR, PIN_SW_F)
|
||||
SWITCH_3_CASE(6, GPIOA->IDR, GPIOB->IDR, PIN_SW_G_H, PIN_SW_G_L)
|
||||
SWITCH_CASE(7, GPIOE->IDR, PIN_SW_H)
|
||||
#if defined(PCBX9D)
|
||||
SWITCH_3_CASE(0, GPIO_PIN_SW_A_L, GPIO_PIN_SW_A_H, PIN_SW_A_L, PIN_SW_A_H)
|
||||
SWITCH_3_CASE(1, GPIO_PIN_SW_B_L, GPIO_PIN_SW_B_H, PIN_SW_B_L, PIN_SW_B_H)
|
||||
SWITCH_3_CASE(2, GPIO_PIN_SW_C_L, GPIO_PIN_SW_C_H, PIN_SW_C_L, PIN_SW_C_H)
|
||||
SWITCH_3_CASE(3, GPIO_PIN_SW_D_L, GPIO_PIN_SW_D_H, PIN_SW_D_L, PIN_SW_D_H)
|
||||
SWITCH_3_CASE(4, GPIO_PIN_SW_E_H, GPIO_PIN_SW_E_L, PIN_SW_E_H, PIN_SW_E_L)
|
||||
SWITCH_CASE(5, GPIO_PIN_SW_F, PIN_SW_F)
|
||||
SWITCH_3_CASE(6, GPIO_PIN_SW_G_L, GPIO_PIN_SW_G_H, PIN_SW_G_L, PIN_SW_G_H)
|
||||
SWITCH_CASE(7, GPIO_PIN_SW_H, PIN_SW_H)
|
||||
#elif defined(PCBSKY9X)
|
||||
SWITCH_CASE(0, PIOC->PIO_PDSR, 1<<20)
|
||||
SWITCH_CASE(1, PIOA->PIO_PDSR, 1<<15)
|
||||
@@ -211,7 +212,7 @@ uint16_t getTmr16KHz()
|
||||
return get_tmr10ms() * 160;
|
||||
}
|
||||
|
||||
#if !defined(PCBX9D) && !defined(PCBACT)
|
||||
#if !defined(PCBX9D)
|
||||
bool eeprom_thread_running = true;
|
||||
void *eeprom_write_function(void *)
|
||||
{
|
||||
@@ -342,7 +343,7 @@ void StartEepromThread(const char *filename)
|
||||
sem_init(eeprom_write_sem, 0, 0);
|
||||
#endif
|
||||
|
||||
#if !defined(PCBX9D) && !defined(PCBACT)
|
||||
#if !defined(PCBX9D)
|
||||
eeprom_thread_running = true;
|
||||
assert(!pthread_create(&eeprom_thread_pid, NULL, &eeprom_write_function, NULL));
|
||||
#endif
|
||||
@@ -350,14 +351,14 @@ void StartEepromThread(const char *filename)
|
||||
|
||||
void StopEepromThread()
|
||||
{
|
||||
#if !defined(PCBX9D) && !defined(PCBACT)
|
||||
#if !defined(PCBX9D)
|
||||
eeprom_thread_running = false;
|
||||
sem_post(eeprom_write_sem);
|
||||
pthread_join(eeprom_thread_pid, NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(PCBX9D) || defined(PCBACT)
|
||||
#if defined(PCBX9D)
|
||||
void eeprom_read_block (void *pointer_ram, uint16_t pointer_eeprom, size_t size)
|
||||
#else
|
||||
void eeprom_read_block (void *pointer_ram, const void *pointer_eeprom, size_t size)
|
||||
@@ -375,7 +376,7 @@ void eeprom_read_block (void *pointer_ram, const void *pointer_eeprom, size_t si
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(PCBX9D) || defined(PCBACT)
|
||||
#if defined(PCBX9D)
|
||||
void eeWriteBlockCmp(const void *pointer_ram, uint16_t pointer_eeprom, size_t size)
|
||||
{
|
||||
assert(size);
|
||||
|
||||
+8
-25
@@ -236,13 +236,7 @@ long Open9xSim::onTimeout(FXObject*,FXSelector,void*)
|
||||
|
||||
if(hasFocus()) {
|
||||
static int keys1[]={
|
||||
#if defined(PCBACT)
|
||||
KEY_Page_Up, KEY_MENU,
|
||||
KEY_BackSpace, KEY_EXIT,
|
||||
KEY_Page_Down, KEY_PAGE,
|
||||
KEY_Clear, KEY_CLR,
|
||||
KEY_Return, BTN_REa,
|
||||
#elif defined(PCBX9D)
|
||||
#if defined(PCBX9D)
|
||||
KEY_Page_Up, KEY_MENU,
|
||||
KEY_Page_Down, KEY_PAGE,
|
||||
KEY_Return, KEY_ENTER,
|
||||
@@ -276,22 +270,6 @@ long Open9xSim::onTimeout(FXObject*,FXSelector,void*)
|
||||
simuSetKey(keys1[i+1], getApp()->getKeyState(keys1[i]));
|
||||
}
|
||||
|
||||
#if defined(PCBACT)
|
||||
static bool rotencState = false;
|
||||
if (rotencState) {
|
||||
if (!getApp()->getKeyState(KEY_Right) && !getApp()->getKeyState(KEY_Left))
|
||||
rotencState = false;
|
||||
}
|
||||
else if (getApp()->getKeyState(KEY_Right)) {
|
||||
g_rotenc[0] -= 1;
|
||||
rotencState = true;
|
||||
}
|
||||
else if (getApp()->getKeyState(KEY_Left)) {
|
||||
g_rotenc[0] += 1;
|
||||
rotencState = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
// gruvin: Can't use Function keys on the Mac -- too many other app conflicts.
|
||||
// The ordering of these keys, Q/W,E/R,T/Y,U/I matches the on screen
|
||||
@@ -335,7 +313,7 @@ long Open9xSim::onTimeout(FXObject*,FXSelector,void*)
|
||||
} \
|
||||
simuSetSwitch(swtch, state_##swtch-states);
|
||||
|
||||
#if defined(PCBX9D) || defined(PCBACT)
|
||||
#if defined(PCBX9D)
|
||||
SWITCH_KEY(A, 0, 3);
|
||||
SWITCH_KEY(B, 1, 3);
|
||||
SWITCH_KEY(C, 2, 3);
|
||||
@@ -361,7 +339,7 @@ long Open9xSim::onTimeout(FXObject*,FXSelector,void*)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if defined(PCBX9D) || defined(PCBACT)
|
||||
#if defined(PCBX9D)
|
||||
#define BL_COLOR FXRGB(47,123,227)
|
||||
#else
|
||||
#define BL_COLOR FXRGB(150,200,152)
|
||||
@@ -463,6 +441,11 @@ int main(int argc,char **argv)
|
||||
StartEepromThread(argc >= 2 ? argv[1] : "eeprom.bin");
|
||||
StartMainThread();
|
||||
|
||||
#if defined(PCBX9D)
|
||||
simuSetSwitch(0, 0);
|
||||
simuSetSwitch(1, 0);
|
||||
#endif
|
||||
|
||||
return application.run();
|
||||
}
|
||||
|
||||
|
||||
@@ -53,6 +53,8 @@
|
||||
#define PIN_SW_F GPIO_Pin_14 //PE.14
|
||||
#endif
|
||||
|
||||
#define GPIO_PIN_SW_E_L GPIOB->IDR
|
||||
#define GPIO_PIN_SW_E_H GPIOB->IDR
|
||||
#define PIN_SW_E_L GPIO_Pin_3 //PB.03
|
||||
#define PIN_SW_E_H GPIO_Pin_4 //PB.04
|
||||
|
||||
|
||||
@@ -119,7 +119,6 @@ void readKeysAndTrims()
|
||||
|
||||
bool switchState(EnumKeys enuk)
|
||||
{
|
||||
register uint32_t b = GPIOB->IDR;
|
||||
register uint32_t xxx = 0;
|
||||
|
||||
if (enuk < (int) DIM(keys)) return keys[enuk].state() ? 1 : 0;
|
||||
@@ -178,13 +177,13 @@ bool switchState(EnumKeys enuk)
|
||||
break;
|
||||
|
||||
case SW_SE0:
|
||||
xxx = (~b & PIN_SW_E_H) && (b & PIN_SW_E_L);
|
||||
xxx = (~GPIO_PIN_SW_E_H & PIN_SW_E_H) && (GPIO_PIN_SW_E_L & PIN_SW_E_L);
|
||||
break;
|
||||
case SW_SE1:
|
||||
xxx = (b & PIN_SW_E_H) && (b & PIN_SW_E_L);
|
||||
xxx = (GPIO_PIN_SW_E_H & PIN_SW_E_H) && (GPIO_PIN_SW_E_L & PIN_SW_E_L);
|
||||
break;
|
||||
case SW_SE2:
|
||||
xxx = (b & PIN_SW_E_H) && (~b & PIN_SW_E_L);
|
||||
xxx = (GPIO_PIN_SW_E_H & PIN_SW_E_H) && (~GPIO_PIN_SW_E_L & PIN_SW_E_L);
|
||||
break;
|
||||
|
||||
case SW_SF0:
|
||||
|
||||
Reference in New Issue
Block a user