Checkboxes instead of OFF / ON

This commit is contained in:
bsongis
2012-05-21 20:09:58 +00:00
parent 3be919b20c
commit bc0958f436
10 changed files with 221 additions and 24 deletions
+7
View File
@@ -100,6 +100,9 @@ PXX = NO
# DSM2 (Spektrum) protocol
DSM2 = NO
#IR protocols (SILV / TRAC09 / PICZ / SWIFT)
IRPROTOS = NO
# SOMO-14D module (V4 board only)
SOMO = NO
@@ -406,6 +409,10 @@ ifeq ($(DSM2), PPM)
CPPDEFS += -DDSM2 -DDSM2_PPM
endif
ifeq ($(IRPROTOS), YES)
CPPDEFS += -DIRPROTOS
endif
#---------------- Compiler Options C++ ----------------
# -g*: generate debugging information
# -O*: optimization level
+1 -1
View File
@@ -1,4 +1,4 @@
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6f,0x00,0x00,0x07,0x00,0x07,0x00,0x14,0x7f,0x14,0x7f,0x14,0x08,0x7f,0x7f,0x7f,0x08,0x23,0x13,0x08,0x64,0x62,0x36,0x49,0x55,0x22,0x50,0x00,0x05,0x03,0x00,0x00,0x00,0x1c,0x22,0x41,0x00,0x00,0x41,0x22,0x1c,0x00,0x14,0x08,0x3e,0x08,0x14,0x08,0x08,0x3e,0x08,0x08,0x00,0x50,0x30,0x00,0x00,0x00,0x08,0x08,0x08,0x08,0x00,0x60,0x60,0x00,0x00,0x20,0x10,0x08,0x04,0x02,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6f,0x00,0x00,0x07,0x00,0x07,0x00,0x10,0x20,0x10,0x08,0x04,0x08,0x7f,0x7f,0x7f,0x08,0x23,0x13,0x08,0x64,0x62,0x36,0x49,0x55,0x22,0x50,0x00,0x05,0x03,0x00,0x00,0x00,0x1c,0x22,0x41,0x00,0x00,0x41,0x22,0x1c,0x00,0x14,0x08,0x3e,0x08,0x14,0x08,0x08,0x3e,0x08,0x08,0x00,0x50,0x30,0x00,0x00,0x00,0x08,0x08,0x08,0x08,0x00,0x60,0x60,0x00,0x00,0x20,0x10,0x08,0x04,0x02,
0x00,0x3e,0x41,0x41,0x3e,0x00,0x00,0x42,0x7f,0x40,0x00,0x62,0x51,0x49,0x46,0x00,0x41,0x49,0x49,0x36,0x00,0x18,0x14,0x12,0x7f,0x00,0x27,0x45,0x45,0x39,0x00,0x3e,0x49,0x49,0x32,0x00,0x01,0x79,0x05,0x03,0x00,0x36,0x49,0x49,0x36,0x00,0x06,0x49,0x29,0x1e,0x00,0x00,0x36,0x36,0x00,0x00,0x00,0x56,0x36,0x00,0x00,0x08,0x14,0x22,0x41,0x14,0x14,0x14,0x14,0x14,0x41,0x22,0x14,0x08,0x00,0x02,0x01,0x51,0x09,0x06,
0x06,0x09,0x09,0x06,0x00,0x7e,0x09,0x09,0x09,0x7e,0x7f,0x49,0x49,0x49,0x36,0x3e,0x41,0x41,0x41,0x22,0x7f,0x41,0x41,0x22,0x1c,0x7f,0x49,0x49,0x49,0x41,0x7f,0x09,0x09,0x09,0x01,0x3e,0x41,0x49,0x49,0x7a,0x7f,0x08,0x08,0x08,0x7f,0x00,0x41,0x7f,0x41,0x00,0x20,0x40,0x41,0x3f,0x01,0x7f,0x08,0x14,0x22,0x41,0x7f,0x40,0x40,0x40,0x40,0x7f,0x02,0x0c,0x02,0x7f,0x7f,0x04,0x08,0x10,0x7f,0x3e,0x41,0x41,0x41,0x3e,
0x7f,0x09,0x09,0x09,0x06,0x3e,0x41,0x51,0x21,0x5e,0x7f,0x09,0x19,0x29,0x46,0x26,0x49,0x49,0x49,0x32,0x01,0x01,0x7f,0x01,0x01,0x3f,0x40,0x40,0x40,0x3f,0x1f,0x20,0x40,0x20,0x1f,0x3f,0x40,0x30,0x40,0x3f,0x63,0x14,0x08,0x14,0x63,0x07,0x08,0x70,0x08,0x07,0x61,0x51,0x49,0x45,0x43,0x00,0x7f,0x41,0x41,0x00,0x02,0x04,0x08,0x10,0x20,0x00,0x41,0x41,0x7f,0x00,0x04,0x02,0x01,0x02,0x04,0x40,0x40,0x40,0x40,0x40,
+6 -6
View File
@@ -1,12 +1,12 @@
#define font_6x1_width 80
#define font_6x1_height 48
static unsigned char font_6x1_bits[] = {
0x00, 0x29, 0xe5, 0x86, 0x31, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x29,
0xe5, 0x66, 0x22, 0x84, 0x10, 0x02, 0x00, 0x80, 0x00, 0xa9, 0xef, 0x50,
0x11, 0x02, 0x55, 0x02, 0x00, 0x40, 0x00, 0x01, 0xf5, 0x89, 0x00, 0x02,
0xb9, 0x0f, 0x3c, 0x20, 0x00, 0x80, 0xef, 0x44, 0x05, 0x02, 0x55, 0x62,
0x00, 0x10, 0x00, 0x01, 0xe5, 0x72, 0x02, 0x84, 0x10, 0x42, 0x80, 0x09,
0x00, 0x01, 0xe5, 0xb0, 0x05, 0x48, 0x00, 0x20, 0x80, 0x01, 0x00, 0x00,
0x00, 0x29, 0xe0, 0x86, 0x31, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x29,
0xe0, 0x66, 0x22, 0x84, 0x10, 0x02, 0x00, 0x80, 0x00, 0x29, 0xe8, 0x50,
0x11, 0x02, 0x55, 0x02, 0x00, 0x40, 0x00, 0x01, 0xf4, 0x89, 0x00, 0x02,
0xb9, 0x0f, 0x3c, 0x20, 0x00, 0x80, 0xe2, 0x44, 0x05, 0x02, 0x55, 0x62,
0x00, 0x10, 0x00, 0x01, 0xe1, 0x72, 0x02, 0x84, 0x10, 0x42, 0x80, 0x09,
0x00, 0x01, 0xe0, 0xb0, 0x05, 0x48, 0x00, 0x20, 0x80, 0x01, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x31, 0x07, 0x3d,
0xf3, 0x8c, 0x01, 0x00, 0x41, 0x70, 0x92, 0x49, 0x88, 0x85, 0x84, 0x52,
0x32, 0x86, 0x80, 0x88, 0x12, 0x41, 0x48, 0x9d, 0x40, 0x52, 0x32, 0x46,
+2 -1
View File
@@ -82,7 +82,8 @@ NOINLINE int8_t selectMenuItem(uint8_t y, const pm_char *label, const pm_char *v
NOINLINE uint8_t onoffMenuItem(uint8_t value, uint8_t y, const pm_char *label, uint8_t attr, uint8_t event )
{
return selectMenuItem(y, label, STR_OFFON, value, 0, 1, attr, event);
menu_lcd_onoff(GENERAL_PARAM_OFS, y, value, attr);
return selectMenuItem(y, label, NULL, value, 0, 1, attr, event);
}
void displaySlider(uint8_t x, uint8_t y, uint8_t value, uint8_t attr)
+13 -2
View File
@@ -41,9 +41,20 @@ uint8_t s_noScroll;
int16_t g_chans512[NUM_CHNOUT]; // TODO not here!
void menu_lcd_onoff( uint8_t x,uint8_t y, uint8_t value, uint8_t mode )
void menu_lcd_onoff(uint8_t x,uint8_t y, uint8_t value, uint8_t attr)
{
lcd_putsiAtt(x, y, STR_OFFON, value, mode ? INVERS:0) ;
#if 0
/* ON / OFF version */
lcd_putsiAtt(x, y, STR_OFFON, value, attr ? INVERS:0) ;
#else
if (value) {
lcd_putc(x+1, y, '#');
}
if (attr)
lcd_filled_rect(x, y, 7, 7);
else
lcd_square(x, y, 7);
#endif
}
void DisplayScreenIndex(uint8_t index, uint8_t count, uint8_t attr)
+1 -1
View File
@@ -2205,7 +2205,7 @@ void menuProcFunctionSwitches(uint8_t event)
case 3:
if (sd->swtch && sd->func <= FUNC_SAFETY_CH16) {
menu_lcd_onoff(18*FW+2, y, (sd->param & 1), attr ) ;
menu_lcd_onoff(20*FW, y, (sd->param & 1), attr ) ;
if (active) sd->param = (sd->param & 0xfe) + checkIncDecModel(event,sd->param & 1, 0, 1);
}
else if (attr) {
+10
View File
@@ -521,8 +521,18 @@ enum Protocols {
PROTO_PPM,
PROTO_PPM16,
PROTO_PPMSIM,
#if defined(PXX) || defined(DSM2) || defined(IRPROTOS)
PROTO_PXX,
#endif
#if defined(DSM2) || defined(IRPROTOS)
PROTO_DSM2,
#endif
#if defined(IRPROTOS)
PROTO_SILV,
PROTO_TRAC09,
PROTO_PICZ,
// PROTO_SWIFT, // we will need 4 bytes for proto :(
#endif
PROTO_MAX
};
+172 -9
View File
@@ -88,7 +88,7 @@ void startPulses()
uint8_t pulses2MHz[PULSES_SIZE] = {0}; // TODO check this length, pulled from er9x, perhaps too big
uint8_t *pulses2MHzRPtr = pulses2MHz;
#if defined(DSM2) || defined(PXX)
#if defined(DSM2) || defined(PXX) || defined(IRPROTOS)
uint8_t *pulses2MHzWPtr = pulses2MHz;
#endif
@@ -164,14 +164,7 @@ ISR(TIMER1_COMPA_vect) //2MHz pulse generation
setupPulses();
// TODO test that it's optimized
if (1
#if defined(PXX)
&& g_model.protocol != PROTO_PXX
#endif
#if defined(DSM2_PPM)
&& g_model.protocol != PROTO_DSM2
#endif
) {
if (!IS_PXX_PROTOCOL(g_model.protocol) && !IS_DSM2_PROTOCOL(g_model.protocol)) {
// cli is not needed because for these 2 protocols interrupts are not enabled when entering here
@@ -535,6 +528,169 @@ void setupPulsesDsm2()
}
#endif
#if defined(IRPROTOS)
static void _send_u8(uint8_t u8)
{
#ifdef SIMU
*(pulses2MHzPtr)++=u8;
#else
asm volatile(
" st Z+,%A[u] \n\t"
: [p]"=z"(pulses2MHzWPtr)
: "%[p]"(pulses2MHzWPtr)
, [u]"r"(u8)
);
#endif
}
static void _send_u16(uint16_t u16)
{
#ifdef SIMU
*(*(uint16_t**)&pulses2MHzWPtr)++=u16;
#else
asm volatile(
" st Z+,%A[t0] \n\t"
" st Z+,%B[t0] \n\t"
: [p]"=z"(pulses2MHzWPtr)
: "%[p]"(pulses2MHzWPtr)
, [t0]"r"(u16)
);
#endif
}
static void _send_1(uint16_t t0)
{
// *(*(uint16_t**)&pulses2MHzPtr)++=t0;
_send_u16(t0);
*pulses2MHzWPtr++=CTRL_CNT;
//_send_u8(CTRL_CNT);
}
static void _send_rep1(uint16_t t0,uint8_t cnt)
{
// *(*(uint16_t**)&pulses2MHzPtr)++=t0;
_send_u16(t0);
_send_u8(CTRL_REP_1CMD);
_send_u8(cnt);
_send_u8(CTRL_CNT);
}
//picco z
//http://home.versanet.de/~b-konze/uni_fb/uni_fb.htm
// /home/husteret/txt/flieger/protokolle/m168fb_ufo_v08/picooz.c
//
// 1900 650 650 1226 650 1226 Stop
// ---- __ -- __ -- __----__----__ --__ ----____ --__
/*
chn:2 a=00 b=01 c=10
pow:4u msb first
trim:4s -2,0,1
direction:3s
-chk[0]
-chk[1]
0
-------
2-bit sum = 0
chk:2 = chn:2 + pow>>2:2 +pow:2 + trim>>2:2 +trim:2 dir + direction>>1:2 + direction<<1:2
*/
#define PICOOZ_RC_HIGH 93 //(1226/13)
#define PICOOZ_RC_LOW 49 //(650/13)
#define LEN_38KHZ (13*2) //= 38,46KHz
void picco_sendB1(bool bit)
{
if (bit) {
_send_rep1(LEN_38KHZ-1, PICOOZ_RC_HIGH); //ungerade anzahl 10101
_send_1 (1226*2 - 1); //lange 0
}
else {
_send_rep1(LEN_38KHZ-1, PICOOZ_RC_LOW); //ungerade anzahl 10101
_send_1 (650*2 - 1); //lange 0
}
}
void picco_sendBn(uint8_t bits, uint8_t n)
{
while (n--) picco_sendB1(bits & (1<<n));
}
#define BITS 10
#define BITS2 (BITS-1)
NOINLINE uint8_t reduce7u(int16_t v, uint8_t sfr)
{
v += (1<<BITS2);
if(v < 0) v=0;
if(v >= (1<<BITS)) v=(1<<BITS)-1;
return v>>sfr;
}
NOINLINE int8_t reduce7s(int16_t v, uint8_t sfr, uint8_t sf2, int8_t ofs2)
{
v += (1<<BITS2)+sf2;
if(v&(1<<BITS)) v = (1<<BITS)-1; //no overflow
int8_t i8 = (uint16_t)v>>sfr;
if(i8<=0) i8=1;
i8-=ofs2;
if(i8>=ofs2) i8=ofs2-1;//no overflow
return i8;
}
//these defines allow the compiler to preclculate constants
#define getChan7u(i,bitsRes) reduce7u(g_chans512[i],(BITS-bitsRes))
#define getChan7s(i,bitsRes) reduce7s(g_chans512[i],(BITS-bitsRes),1<<((BITS-bitsRes)-1),1<<(bitsRes-1))
static void setupPulsesPiccoZ(uint8_t chn)
{
// 1900 650 650 1226 650 0bit 1226 1bit Stop
// ---- __ -- __ -- __----__----__ --__ ----____ --__
static bool state = 0;
static uint8_t pow;
static int8_t trim;
static int8_t dir;
static uint8_t chk;
if (state == 0) {
_send_rep1(LEN_38KHZ-1, 147); // 1900/13 !! must be odd
_send_1 (650*2 - 1);//
picco_sendBn(0,2);
_send_rep1(LEN_38KHZ-1, PICOOZ_RC_HIGH);
_send_1 (650*2 - 1);//
_send_rep1(LEN_38KHZ-1, PICOOZ_RC_HIGH);
_send_1 (650*2 - 1);//
// chn:2 a=00 b=01 c=10
// pow:4u msb first
// trim:4s -2,0,1
// dir:3s
// -chk[0]
// -chk[1]
// 0
pow = getChan7u(2,4);
trim = getChan7s(1,4);
dir = getChan7s(0,3);
chk = - (chn+ (pow>>2) + pow + (trim>>2) + trim + (dir>>1) + (dir<<1));
}
else {
picco_sendBn(chn,2);
picco_sendBn(pow,4);
picco_sendBn(trim,4);
picco_sendBn(dir,3);
picco_sendB1(chk & (1<<0)); //lsb first, because we are here on a odd bit (dir is only 3 bits)
picco_sendB1(chk & (1<<1));
_send_rep1(LEN_38KHZ-1, PICOOZ_RC_LOW); //0-bit pulses
_send_1 (20000u*2 - 1); //20ms gap ?
}
state = !state;
}
#endif
void setupPulses()
{
if (s_current_protocol != g_model.protocol) {
@@ -670,6 +826,13 @@ void setupPulses()
break;
#endif
#ifdef IRPROTOS
case PROTO_PICZ:
setupPulsesPiccoZ(g_model.ppmNCH);
// TODO BSS stbyLevel = 0; //start with 1
break;
#endif
default:
// no sei here
setupPulsesPPM();
+8 -3
View File
@@ -6,7 +6,7 @@
#define TR_MMMINV "---""INV"
#define LEN_NCHANNELS "\004"
#define TR_NCHANNELS "4CH 6CH 8CH 10CH12CH14CH16CH"
#define TR_NCHANNELS "\0014CH\0016CH\0018CH10CH12CH14CH16CH"
#define LEN_VBEEPMODE "\005"
#define TR_VBEEPMODE "Quiet""Alarm""NoKey""All "
@@ -51,7 +51,12 @@
#else
#define TR_DSM2 "[DSM2]"
#endif
#define TR_VPROTOS "PPM\0 ""PPM16\0""PPMsim" TR_PXX TR_DSM2
#ifdef IRPROTOS
#define TR_IRPROTOS "SILV TRAC09PICZ SWIFT\0"
#else
#define TR_IRPROTOS
#endif
#define TR_VPROTOS "PPM\0 ""PPM16\0""PPMsim" TR_PXX TR_DSM2 TR_IRPROTOS
#define LEN_POSNEG "\003"
#define TR_POSNEG "POS""NEG"
@@ -336,7 +341,7 @@
#define TR_THROTTLENOTIDLE "Throttle not idle"
#define TR_RESETTHROTTLE "Reset throttle"
#define TR_ALARMSDISABLED "Alarms Disabled"
#define TR_SWITCHESNOTOFF "Switch on"
#define TR_SWITCHESNOTOFF "Switch inverted"
#define POS_SWITCH_WARN 7
#define TR_PLEASERESETTHEM "Please reset it"
#define TR_MESSAGE "\004MESSAGE"
+1 -1
View File
@@ -1 +1 @@
0x38,0x54,0x56,0x55,0x18,0x38,0x55,0x56,0x54,0x18,0x20,0x55,0x56,0x54,0x78,
0x38,0x54,0x56,0x55,0x18,0x38,0x55,0x56,0x54,0x18,0x20,0x55,0x56,0x54,0x78,