Better handling of keys in simu. Switches / THR warnings on simu now ok.
This commit is contained in:
+2
-1
@@ -345,7 +345,6 @@ extern const pm_char STR_MENUSTAT[];
|
|||||||
extern const pm_char STR_MENUDEBUG[];
|
extern const pm_char STR_MENUDEBUG[];
|
||||||
extern const pm_char STR_RXNUM[];
|
extern const pm_char STR_RXNUM[];
|
||||||
extern const pm_char STR_SYNCMENU[];
|
extern const pm_char STR_SYNCMENU[];
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(ROTARY_ENCODERS)
|
#if defined(ROTARY_ENCODERS)
|
||||||
extern const pm_char STR_BACK[];
|
extern const pm_char STR_BACK[];
|
||||||
@@ -403,3 +402,5 @@ extern const pm_char STR_EEPROMWARN[];
|
|||||||
extern const pm_char STR_THROTTLEWARN[];
|
extern const pm_char STR_THROTTLEWARN[];
|
||||||
extern const pm_char STR_ALARMSWARN[];
|
extern const pm_char STR_ALARMSWARN[];
|
||||||
extern const pm_char STR_SWITCHWARN[];
|
extern const pm_char STR_SWITCHWARN[];
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|||||||
@@ -178,6 +178,8 @@ void *main_thread(void *)
|
|||||||
checkAlarm();
|
checkAlarm();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
s_current_protocol = 0;
|
||||||
|
|
||||||
while (main_thread_running) {
|
while (main_thread_running) {
|
||||||
perMain();
|
perMain();
|
||||||
sleep(1/*ms*/);
|
sleep(1/*ms*/);
|
||||||
|
|||||||
+53
-42
@@ -237,44 +237,6 @@ long Open9xSim::onTimeout(FXObject*,FXSelector,void*)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
per10ms();
|
|
||||||
refreshDiplay();
|
|
||||||
getApp()->addTimeout(this,2,5);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Open9xSim::refreshDiplay()
|
|
||||||
{
|
|
||||||
if (lcd_refresh) {
|
|
||||||
lcd_refresh = false;
|
|
||||||
#if defined(PCBV4)
|
|
||||||
if(portc & 1<<OUT_C_LIGHT) bmf->setOffColor(FXRGB(150,200,152));
|
|
||||||
else bmf->setOffColor(FXRGB(200,200,200));
|
|
||||||
#else
|
|
||||||
if(portb & 1<<OUT_B_LIGHT) bmf->setOffColor(FXRGB(150,200,152));
|
|
||||||
else bmf->setOffColor(FXRGB(200,200,200));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
for(int x=0;x<W;x++){
|
|
||||||
for(int y=0;y<H;y++)
|
|
||||||
{
|
|
||||||
int o2 = x/4 + y*W*2*2/8;
|
|
||||||
if( lcd_buf[x+(y/8)*W] & (1<<(y%8))) {
|
|
||||||
buf2[o2] |= 3<<(x%4*2);
|
|
||||||
buf2[o2+W2/8] |= 3<<(x%4*2);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
buf2[o2] &= ~(3<<(x%4*2));
|
|
||||||
buf2[o2+W2/8] &= ~(3<<(x%4*2));
|
|
||||||
//buf2[x2/8+y2*W2/8] &= ~(3<<(x%8));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bmp->setData (buf2,0);
|
|
||||||
bmp->render();
|
|
||||||
bmf->setBitmap( bmp );
|
|
||||||
}
|
|
||||||
|
|
||||||
if(hasFocus()) {
|
if(hasFocus()) {
|
||||||
#ifdef REVB
|
#ifdef REVB
|
||||||
@@ -314,23 +276,31 @@ void Open9xSim::refreshDiplay()
|
|||||||
// PIOA->PIO_PDSR = 0xFFFFFFFF;
|
// PIOA->PIO_PDSR = 0xFFFFFFFF;
|
||||||
Temperature = 1000;
|
Temperature = 1000;
|
||||||
maxTemperature = 1500;
|
maxTemperature = 1500;
|
||||||
|
|
||||||
#elif defined(PCBV4)
|
#elif defined(PCBV4)
|
||||||
pinl &= ~ 0x3f;
|
uint8_t pin = (pinl & ~0x3f);
|
||||||
#else
|
#else
|
||||||
pinb &= ~ 0x7e;
|
uint8_t pin = (pinb & ~0x7e);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for(unsigned i=0; i<DIM(keys1);i+=5) {
|
for(unsigned i=0; i<DIM(keys1);i+=5) {
|
||||||
if (getApp()->getKeyState(keys1[i])) {
|
if (getApp()->getKeyState(keys1[i])) {
|
||||||
#if defined(PCBARM)
|
#if defined(PCBARM)
|
||||||
((Pio*)keys1[i+3])->PIO_PDSR &= ~(keys1[i+4]);
|
((Pio*)keys1[i+3])->PIO_PDSR &= ~(keys1[i+4]);
|
||||||
#elif defined(PCBV4)
|
#elif defined(PCBV4)
|
||||||
pinl |= (1<<keys1[i+2]);
|
pin |= (1<<keys1[i+2]);
|
||||||
#else
|
#else
|
||||||
pinb |= (1<<keys1[i+1]);
|
pin |= (1<<keys1[i+1]);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(PCBV4)
|
||||||
|
pinl = pin;
|
||||||
|
#else
|
||||||
|
pinb = pin;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
// gruvin: Can't use Function keys on the Mac -- too many other app conflicts.
|
// 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
|
// The ordering of these keys, Q/W,E/R,T/Y,U/I matches the on screen
|
||||||
@@ -433,6 +403,47 @@ void Open9xSim::refreshDiplay()
|
|||||||
case 2: setSwitch(DSW_ID2); break;
|
case 2: setSwitch(DSW_ID2); break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
per10ms();
|
||||||
|
refreshDiplay();
|
||||||
|
getApp()->addTimeout(this,2,5);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Open9xSim::refreshDiplay()
|
||||||
|
{
|
||||||
|
if (lcd_refresh) {
|
||||||
|
lcd_refresh = false;
|
||||||
|
#if defined(PCBV4)
|
||||||
|
if(portc & 1<<OUT_C_LIGHT) bmf->setOffColor(FXRGB(150,200,152));
|
||||||
|
else bmf->setOffColor(FXRGB(200,200,200));
|
||||||
|
#else
|
||||||
|
if(portb & 1<<OUT_B_LIGHT) bmf->setOffColor(FXRGB(150,200,152));
|
||||||
|
else bmf->setOffColor(FXRGB(200,200,200));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
for(int x=0;x<W;x++){
|
||||||
|
for(int y=0;y<H;y++)
|
||||||
|
{
|
||||||
|
int o2 = x/4 + y*W*2*2/8;
|
||||||
|
if( lcd_buf[x+(y/8)*W] & (1<<(y%8))) {
|
||||||
|
buf2[o2] |= 3<<(x%4*2);
|
||||||
|
buf2[o2+W2/8] |= 3<<(x%4*2);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
buf2[o2] &= ~(3<<(x%4*2));
|
||||||
|
buf2[o2+W2/8] &= ~(3<<(x%4*2));
|
||||||
|
//buf2[x2/8+y2*W2/8] &= ~(3<<(x%8));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bmp->setData (buf2,0);
|
||||||
|
bmp->render();
|
||||||
|
bmf->setBitmap( bmp );
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Open9xSim *th9xSim;
|
Open9xSim *th9xSim;
|
||||||
|
|||||||
Reference in New Issue
Block a user