Issue 183 fixed (JETI)
Issue 193 fixed (PWM Backlight) [stock] Rotary encoder bug fixes [stock / '128 / gruvin9x] Play Both function. Translations needed, who wants to add them in all language files? [stock] 40bytes flash saved
This commit is contained in:
+1
-1
@@ -414,7 +414,7 @@ void eeLoadModel(uint8_t id)
|
||||
// TODO pulses should be started after mixer calculations ...
|
||||
|
||||
#if defined(FRSKY)
|
||||
FRSKY_setModelAlarms();
|
||||
frskySendAlarms();
|
||||
#endif
|
||||
|
||||
#if defined(SDCARD)
|
||||
|
||||
+1
-1
@@ -913,7 +913,7 @@ void eeLoadModel(uint8_t id)
|
||||
// TODO pulses should be started after mixer calculations ...
|
||||
|
||||
#if defined(FRSKY)
|
||||
FRSKY_setModelAlarms();
|
||||
frskySendAlarms();
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM) && defined(SDCARD)
|
||||
|
||||
+14
-22
@@ -516,7 +516,7 @@ NOINLINE void processSerialData(uint8_t stat, uint8_t data)
|
||||
TrotCount = data;
|
||||
}
|
||||
if (privateDataPos == 2) { // rotary encoder switch
|
||||
TezRotary = data;
|
||||
RotEncoder = data;
|
||||
}
|
||||
#endif
|
||||
if (++privateDataPos == privateDataLen) {
|
||||
@@ -613,7 +613,7 @@ void frskyPushValue(uint8_t *&ptr, uint8_t value)
|
||||
}
|
||||
}
|
||||
|
||||
inline void FRSKY10mspoll(void)
|
||||
inline void frskySendNextAlarm(void)
|
||||
{
|
||||
#if defined(PCBSKY9X)
|
||||
if (txPdcPending())
|
||||
@@ -627,7 +627,7 @@ inline void FRSKY10mspoll(void)
|
||||
// Now send a packet
|
||||
frskyAlarmsSendState -= 1;
|
||||
uint8_t alarm = 1 - (frskyAlarmsSendState % 2);
|
||||
if (frskyAlarmsSendState < 4) {
|
||||
if (frskyAlarmsSendState < SEND_MODEL_ALARMS) {
|
||||
uint8_t channel = 1 - (frskyAlarmsSendState / 2);
|
||||
*ptr++ = (A22PKT + frskyAlarmsSendState); // fc - fb - fa - f9
|
||||
frskyPushValue(ptr, g_model.frsky.channels[channel].alarms_value[alarm]);
|
||||
@@ -672,7 +672,7 @@ void frskyPushValue(uint8_t *&ptr, uint8_t value)
|
||||
*ptr = BYTESTUFF;
|
||||
}
|
||||
|
||||
void FRSKY_setTxPacket(uint8_t type, uint8_t value, uint8_t p1, uint8_t p2)
|
||||
void frskySendPacket(uint8_t type, uint8_t value, uint8_t p1, uint8_t p2)
|
||||
{
|
||||
uint8_t *ptr = &frskyTxBuffer[0];
|
||||
|
||||
@@ -692,7 +692,7 @@ void FRSKY_setTxPacket(uint8_t type, uint8_t value, uint8_t p1, uint8_t p2)
|
||||
frskyTransmitBuffer();
|
||||
}
|
||||
|
||||
inline void FRSKY10mspoll(void)
|
||||
inline void frskySendNextAlarm(void)
|
||||
{
|
||||
if (frskyTxBufferCount)
|
||||
return; // we only have one buffer. If it's in use, then we can't send yet.
|
||||
@@ -700,27 +700,27 @@ inline void FRSKY10mspoll(void)
|
||||
// Now send a packet
|
||||
frskyAlarmsSendState -= 1;
|
||||
uint8_t alarm = 1 - (frskyAlarmsSendState % 2);
|
||||
if (frskyAlarmsSendState < 4) {
|
||||
if (frskyAlarmsSendState < SEND_MODEL_ALARMS) {
|
||||
uint8_t channel = 1 - (frskyAlarmsSendState / 2);
|
||||
FRSKY_setTxPacket(A22PKT + frskyAlarmsSendState, g_model.frsky.channels[channel].alarms_value[alarm], ALARM_GREATER(channel, alarm), ALARM_LEVEL(channel, alarm));
|
||||
frskySendPacket(A22PKT + frskyAlarmsSendState, g_model.frsky.channels[channel].alarms_value[alarm], ALARM_GREATER(channel, alarm), ALARM_LEVEL(channel, alarm));
|
||||
}
|
||||
else {
|
||||
FRSKY_setTxPacket(RSSI1PKT-alarm, getRssiAlarmValue(alarm), 0, (2+alarm+g_model.frsky.rssiAlarms[alarm].level) % 4);
|
||||
frskySendPacket(RSSI1PKT-alarm, getRssiAlarmValue(alarm), 0, (2+alarm+g_model.frsky.rssiAlarms[alarm].level) % 4);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
NOINLINE void check_frsky()
|
||||
NOINLINE void telemetryPoll10ms()
|
||||
{
|
||||
#if defined(PCBSKY9X)
|
||||
rxPdcUsart(processSerialData); // Receive serial data here
|
||||
#endif
|
||||
|
||||
// Attempt to transmit any waiting Fr-Sky alarm set packets every 50ms (subject to packet buffer availability)
|
||||
static uint8_t FrskyDelay = 5;
|
||||
if (frskyAlarmsSendState && (--FrskyDelay == 0)) {
|
||||
FrskyDelay = 5; // 50ms
|
||||
FRSKY10mspoll();
|
||||
static uint8_t frskyTxDelay = 5;
|
||||
if (frskyAlarmsSendState && (--frskyTxDelay == 0)) {
|
||||
frskyTxDelay = 5; // 50ms
|
||||
frskySendNextAlarm();
|
||||
}
|
||||
|
||||
#ifndef SIMU
|
||||
@@ -1273,15 +1273,7 @@ void menuTelemetryFrsky(uint8_t event)
|
||||
break;
|
||||
}
|
||||
|
||||
// The top black bar
|
||||
putsModelName(0, 0, g_model.name, g_eeGeneral.currModel, 0);
|
||||
uint8_t att = (g_vbat100mV < g_eeGeneral.vBatWarn ? BLINK : 0);
|
||||
putsVBat(14*FW,0,att);
|
||||
if (g_model.timers[0].mode) {
|
||||
att = (s_timerState[0]==TMR_BEEPING ? BLINK : 0);
|
||||
putsTime(17*FW, 0, s_timerVal[0], att, att);
|
||||
}
|
||||
lcd_invert_line(0);
|
||||
lcdDrawTelemetryTopBar();
|
||||
|
||||
if (frskyStreaming >= 0) {
|
||||
if (s_frsky_view < MAX_FRSKY_SCREENS) {
|
||||
|
||||
+5
-4
@@ -203,7 +203,8 @@ extern int8_t frskyStreaming; // >0 (true) == data is streaming in. 0 = nodata d
|
||||
extern uint8_t frskyUsrStreaming;
|
||||
#endif
|
||||
|
||||
#define SEND_MODEL_ALARMS 6
|
||||
#define SEND_RSSI_ALARMS 6
|
||||
#define SEND_MODEL_ALARMS 4
|
||||
extern uint8_t frskyAlarmsSendState;
|
||||
|
||||
extern FrskyData frskyData;
|
||||
@@ -212,11 +213,11 @@ extern uint8_t frskyTxBuffer[FRSKY_TX_PACKET_SIZE];
|
||||
extern uint8_t frskyTxBufferCount;
|
||||
|
||||
void FRSKY_Init(void);
|
||||
NOINLINE void check_frsky(void);
|
||||
NOINLINE void telemetryPoll10ms(void);
|
||||
|
||||
inline void FRSKY_setModelAlarms(void)
|
||||
inline void frskySendAlarms(void)
|
||||
{
|
||||
frskyAlarmsSendState = SEND_MODEL_ALARMS;
|
||||
frskyAlarmsSendState = SEND_RSSI_ALARMS;
|
||||
}
|
||||
|
||||
bool FRSKY_alarmRaised(uint8_t idx);
|
||||
|
||||
@@ -238,7 +238,7 @@ void menuGeneralSetup(uint8_t event)
|
||||
case ITEM_SETUP_BEEPER_MODE:
|
||||
g_eeGeneral.beeperMode = selectMenuItem(RADIO_SETUP_2ND_COLUMN, y, STR_MODE, STR_VBEEPMODE, g_eeGeneral.beeperMode, -2, 1, attr, event);
|
||||
#if defined(FRSKY)
|
||||
if (attr && checkIncDec_Ret) FRSKY_setModelAlarms();
|
||||
if (attr && checkIncDec_Ret) frskySendAlarms();
|
||||
#endif
|
||||
break;
|
||||
|
||||
|
||||
+102
-97
@@ -34,109 +34,133 @@
|
||||
|
||||
#include "open9x.h"
|
||||
|
||||
volatile uint16_t jeti_keys = JETI_KEY_NOCHANGE;
|
||||
uint8_t JetiBuffer[32]; // 32 characters
|
||||
volatile uint8_t JetiBufferReady;
|
||||
uint8_t jetiRxBuffer[32];
|
||||
uint8_t jetiReady;
|
||||
uint16_t jetiKeys;
|
||||
|
||||
void telemetryPoll10ms()
|
||||
{
|
||||
if (jetiReady) {
|
||||
jetiKeys = JETI_KEY_NOCHANGE;
|
||||
if (switchState((EnumKeys)(KEY_UP))) jetiKeys &= JETI_KEY_UP;
|
||||
if (switchState((EnumKeys)(KEY_DOWN))) jetiKeys &= JETI_KEY_DOWN;
|
||||
if (switchState((EnumKeys)(KEY_LEFT))) jetiKeys &= JETI_KEY_LEFT;
|
||||
if (switchState((EnumKeys)(KEY_RIGHT))) jetiKeys &= JETI_KEY_RIGHT;
|
||||
|
||||
jetiReady = 0; // invalidate buffer
|
||||
|
||||
JETI_EnableTXD();
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef SIMU
|
||||
ISR(USART0_UDRE_vect)
|
||||
{
|
||||
if (jetiKeys != 0xff) {
|
||||
UCSR0B &= ~(1 << TXB80);
|
||||
|
||||
if (jetiKeys & 0x0100)
|
||||
UCSR0B |= (1 << TXB80);
|
||||
|
||||
UDR0 = jetiKeys;
|
||||
|
||||
jetiKeys = 0xff;
|
||||
}
|
||||
else {
|
||||
JETI_DisableTXD();
|
||||
}
|
||||
}
|
||||
|
||||
ISR (USART0_RX_vect)
|
||||
{
|
||||
uint8_t stat;
|
||||
uint8_t rh;
|
||||
uint8_t rl;
|
||||
static uint8_t jbp;
|
||||
|
||||
stat = UCSR0A;
|
||||
rh = UCSR0B;
|
||||
rl = UDR0;
|
||||
uint8_t stat;
|
||||
uint8_t rh;
|
||||
uint8_t rl;
|
||||
static uint8_t jbp;
|
||||
|
||||
|
||||
if (stat & ((1 << FE0) | (1 << DOR0) | (1 << UPE0)))
|
||||
{ // discard buffer and start new on any error
|
||||
JetiBufferReady = 0;
|
||||
jbp = 0;
|
||||
}
|
||||
else if ((rh & (1 << RXB80)) == 0)
|
||||
{ // control
|
||||
if (rl == 0xfe)
|
||||
{ // start condition
|
||||
JetiBufferReady = 0;
|
||||
jbp = 0;
|
||||
}
|
||||
else if (rl == 0xff)
|
||||
{ // stop condition
|
||||
JetiBufferReady = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{ // data
|
||||
if (jbp < 32)
|
||||
{
|
||||
if(rl==0xDF)
|
||||
JetiBuffer[jbp++] = '@'; //@ => ° Issue 163
|
||||
else
|
||||
JetiBuffer[jbp++] = rl;
|
||||
}
|
||||
}
|
||||
stat = UCSR0A;
|
||||
rh = UCSR0B;
|
||||
rl = UDR0;
|
||||
|
||||
if (stat & ((1 << FE0) | (1 << DOR0) | (1 << UPE0))) {
|
||||
// discard buffer and start new on any error
|
||||
jetiReady = 0;
|
||||
jbp = 0;
|
||||
}
|
||||
else if ((rh & (1 << RXB80)) == 0) {
|
||||
// control
|
||||
if (rl == 0xfe) {
|
||||
// start condition
|
||||
jetiReady = 0;
|
||||
jbp = 0;
|
||||
}
|
||||
else if (rl == 0xff) {
|
||||
// stop condition
|
||||
jetiReady = 1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// data
|
||||
if (jbp < 32) {
|
||||
if (rl==0xDF)
|
||||
jetiRxBuffer[jbp++] = '@'; //@ => ° Issue 163
|
||||
else
|
||||
jetiRxBuffer[jbp++] = rl;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void JETI_Init (void)
|
||||
{
|
||||
|
||||
jeti_keys = JETI_KEY_NOCHANGE;
|
||||
|
||||
DDRE &= ~(1 << DDE0); // set RXD0 pin as input
|
||||
PORTE &= ~(1 << PORTE0); // disable pullup on RXD0 pin
|
||||
DDRE &= ~(1 << DDE0); // set RXD0 pin as input
|
||||
PORTE &= ~(1 << PORTE0); // disable pullup on RXD0 pin
|
||||
|
||||
#ifndef SIMU
|
||||
|
||||
#undef BAUD
|
||||
#define BAUD 9600
|
||||
#include <util/setbaud.h>
|
||||
UBRR0H = UBRRH_VALUE;
|
||||
UBRR0L = UBRRL_VALUE;
|
||||
UBRR0H = UBRRH_VALUE;
|
||||
UBRR0L = UBRRL_VALUE;
|
||||
|
||||
UCSR0A &= ~(1 << U2X0); // disable double speed operation
|
||||
UCSR0A &= ~(1 << U2X0); // disable double speed operation
|
||||
|
||||
// set 9O1
|
||||
UCSR0C = (1 << UPM01) | (1 << UPM00) | (1 << UCSZ01) | (1 << UCSZ00);
|
||||
UCSR0B = (1 << UCSZ02);
|
||||
// set 9O1
|
||||
UCSR0C = (1 << UPM01) | (1 << UPM00) | (1 << UCSZ01) | (1 << UCSZ00);
|
||||
UCSR0B = (1 << UCSZ02);
|
||||
|
||||
// flush receive buffer
|
||||
while ( UCSR0A & (1 << RXC0) ) UDR0;
|
||||
// flush receive buffer
|
||||
while ( UCSR0A & (1 << RXC0) ) UDR0;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
void JETI_EnableTXD (void)
|
||||
{
|
||||
UCSR0B |= (1 << TXEN0); // enable TX
|
||||
UCSR0B |= (1 << UDRIE0); // enable UDRE0 interrupt
|
||||
}
|
||||
|
||||
void JETI_DisableTXD (void)
|
||||
{
|
||||
UCSR0B &= ~(1 << TXEN0); // disable TX
|
||||
UCSR0B &= ~(1 << TXEN0); // disable TX
|
||||
UCSR0B &= ~(1 << UDRIE0); // disable UDRE0 interrupt
|
||||
}
|
||||
|
||||
|
||||
void JETI_EnableTXD (void)
|
||||
{
|
||||
UCSR0B |= (1 << TXEN0); // enable TX
|
||||
}
|
||||
|
||||
|
||||
void JETI_DisableRXD (void)
|
||||
{
|
||||
UCSR0B &= ~(1 << RXEN0); // disable RX
|
||||
UCSR0B &= ~(1 << RXCIE0); // disable Interrupt
|
||||
}
|
||||
|
||||
|
||||
void JETI_EnableRXD (void)
|
||||
{
|
||||
UCSR0B |= (1 << RXEN0); // enable RX
|
||||
UCSR0B |= (1 << RXCIE0); // enable Interrupt
|
||||
UCSR0B |= (1 << RXEN0); // enable RX
|
||||
UCSR0B |= (1 << RXCIE0); // enable Interrupt
|
||||
}
|
||||
|
||||
void JETI_DisableRXD (void)
|
||||
{
|
||||
UCSR0B &= ~(1 << RXEN0); // disable RX
|
||||
UCSR0B &= ~(1 << RXCIE0); // disable Interrupt
|
||||
}
|
||||
|
||||
#if 0
|
||||
void JETI_putw (uint16_t c)
|
||||
{
|
||||
loop_until_bit_is_set(UCSR0A, UDRE0);
|
||||
@@ -178,39 +202,20 @@ void JETI_put_stop (void)
|
||||
UCSR0B &= ~(1 << TXB80);
|
||||
UDR0 = 0xFF;
|
||||
}
|
||||
#endif
|
||||
|
||||
void menuTelemetryJeti(uint8_t event)
|
||||
{
|
||||
TITLE(PSTR("JETI"));
|
||||
lcdDrawTelemetryTopBar();
|
||||
|
||||
switch(event)
|
||||
{
|
||||
case EVT_KEY_FIRST(KEY_EXIT):
|
||||
JETI_DisableRXD();
|
||||
chainMenu(menuMainView);
|
||||
return;
|
||||
for (uint8_t i=0; i<16; i++) {
|
||||
lcd_putcAtt((i+2)*FW, 3*FH, jetiRxBuffer[i], BSS);
|
||||
lcd_putcAtt((i+2)*FW, 4*FH, jetiRxBuffer[i+16], BSS);
|
||||
}
|
||||
|
||||
for (uint8_t i = 0; i < 16; i++)
|
||||
{
|
||||
lcd_putcAtt((i+2)*FW, 3*FH, JetiBuffer[i], BSS);
|
||||
lcd_putcAtt((i+2)*FW, 4*FH, JetiBuffer[i+16], BSS);
|
||||
}
|
||||
|
||||
if (JetiBufferReady)
|
||||
{
|
||||
JETI_EnableTXD();
|
||||
if (switchState((EnumKeys)(KEY_UP))) jeti_keys &= JETI_KEY_UP;
|
||||
if (switchState((EnumKeys)(KEY_DOWN))) jeti_keys &= JETI_KEY_DOWN;
|
||||
if (switchState((EnumKeys)(KEY_LEFT))) jeti_keys &= JETI_KEY_LEFT;
|
||||
if (switchState((EnumKeys)(KEY_RIGHT))) jeti_keys &= JETI_KEY_RIGHT;
|
||||
|
||||
JetiBufferReady = 0; // invalidate buffer
|
||||
|
||||
JETI_putw((uint16_t) jeti_keys);
|
||||
_delay_ms (1);
|
||||
JETI_DisableTXD();
|
||||
|
||||
jeti_keys = JETI_KEY_NOCHANGE;
|
||||
if (event == EVT_KEY_FIRST(KEY_EXIT)) {
|
||||
JETI_DisableRXD();
|
||||
jetiReady = 0;
|
||||
chainMenu(menuMainView);
|
||||
}
|
||||
}
|
||||
|
||||
+4
-3
@@ -42,11 +42,12 @@
|
||||
#define JETI_KEY_NOCHANGE 0xf0
|
||||
|
||||
void JETI_Init(void);
|
||||
void JETI_DisableTXD (void);
|
||||
void JETI_EnableTXD (void);
|
||||
void JETI_DisableRXD (void);
|
||||
void JETI_EnableRXD (void);
|
||||
void JETI_DisableRXD (void);
|
||||
void JETI_EnableTXD (void);
|
||||
void JETI_DisableTXD (void);
|
||||
|
||||
void telemetryPoll10ms();
|
||||
void menuTelemetryJeti(uint8_t event);
|
||||
|
||||
#endif
|
||||
|
||||
+13
-1
@@ -659,12 +659,24 @@ void lcd_invert_line(int8_t y)
|
||||
#if defined(PCBX9D)
|
||||
*(p+3*DISPLAY_PLAN_SIZE) ^= 0xff;
|
||||
*(p+2*DISPLAY_PLAN_SIZE) ^= 0xff;
|
||||
*(p+DISPLAY_PLAN_SIZE) ^= 0xff;
|
||||
*(p+DISPLAY_PLAN_SIZE) ^= 0xff;
|
||||
#endif
|
||||
*p++ ^= 0xff;
|
||||
}
|
||||
}
|
||||
|
||||
void lcdDrawTelemetryTopBar()
|
||||
{
|
||||
putsModelName(0, 0, g_model.name, g_eeGeneral.currModel, 0);
|
||||
uint8_t att = (g_vbat100mV < g_eeGeneral.vBatWarn ? BLINK : 0);
|
||||
putsVBat(14*FW,0,att);
|
||||
if (g_model.timers[0].mode) {
|
||||
att = (s_timerState[0]==TMR_BEEPING ? BLINK : 0);
|
||||
putsTime(17*FW, 0, s_timerVal[0], att, att);
|
||||
}
|
||||
lcd_invert_line(0);
|
||||
}
|
||||
|
||||
void putsTime(xcoord_t x, uint8_t y, putstime_t tme, LcdFlags att, LcdFlags att2)
|
||||
{
|
||||
div_t qr;
|
||||
|
||||
@@ -215,6 +215,8 @@ extern void lcd_invert_line(int8_t y);
|
||||
#define lcd_status_line() lcd_invert_line(LCD_LINES-1)
|
||||
inline void lcd_square(xcoord_t x, uint8_t y, xcoord_t w, LcdFlags att=0) { lcd_rect(x, y, w, w, SOLID, att); }
|
||||
|
||||
void lcdDrawTelemetryTopBar();
|
||||
|
||||
#define DO_CROSS(xx,yy,ww) \
|
||||
lcd_vline(xx,yy-ww/2,ww); \
|
||||
lcd_hline(xx-ww/2,yy,ww);
|
||||
|
||||
+1
-1
@@ -605,7 +605,7 @@ void MAVLINK10mspoll(uint8_t count) {
|
||||
}
|
||||
}
|
||||
|
||||
void check_mavlink() {
|
||||
void telemetryPoll10ms() {
|
||||
uint16_t tmr10ms = get_tmr10ms();
|
||||
uint8_t count = tmr10ms & 0x0f; // 15*10ms
|
||||
if (!count) {
|
||||
|
||||
+1
-1
@@ -259,7 +259,7 @@ extern inline uint8_t MAVLINK_Action2CtrlMode(uint8_t action) {
|
||||
return action;
|
||||
}
|
||||
#endif
|
||||
void check_mavlink();
|
||||
void telemetryPoll10ms();
|
||||
void MAVLINK_Init(void);
|
||||
void menuTelemetryMavlink(uint8_t event);
|
||||
void MAVLINK10mspoll(uint16_t time);
|
||||
|
||||
+1
-9
@@ -221,14 +221,6 @@ void title(const pm_char * s)
|
||||
#define INC(val, min, max) if (val<max) {val++;} else {val=min;}
|
||||
#define DEC(val, min, max) if (val>min) {val--;} else {val=max;}
|
||||
|
||||
#if defined(PCBX9D)
|
||||
#define IS_ROTARY_SHORT(evt) (evt==EVT_KEY_BREAK(KEY_ENTER))
|
||||
#define SCROLL(min, val, max) ((val) > (max) ? ((min) + (val) - (max) - 1) : ((val) < (min) ? ((max) - (min) + (val) + 1) : (val)))
|
||||
#else
|
||||
#define IS_ROTARY_SHORT(evt) (evt==EVT_ROTARY_BREAK)
|
||||
#define SCROLL(min, val, max) limit(min, val, max)
|
||||
#endif
|
||||
|
||||
bool check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTabSize, const pm_uint8_t *horTab, uint8_t horTabMax, maxrow_t maxrow)
|
||||
{
|
||||
maxrow_t l_posVert = m_posVert;
|
||||
@@ -296,7 +288,7 @@ bool check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t
|
||||
int8_t cc = curr;
|
||||
|
||||
if (scrollLR) {
|
||||
cc = SCROLL((int8_t)0, (int8_t)(cc - scrollLR), (int8_t)(menuTabSize-1));
|
||||
cc = limit((int8_t)0, (int8_t)(cc - scrollLR), (int8_t)(menuTabSize-1));
|
||||
}
|
||||
|
||||
switch(event) {
|
||||
|
||||
+7
-2
@@ -3148,6 +3148,11 @@ void menuModelCustomFunctions(uint8_t event)
|
||||
val_max = NUM_XCHNPLAY-1;
|
||||
putsChnRaw(MODEL_CUSTOM_FUNC_3RD_COLUMN, y, val_displayed+1, attr);
|
||||
}
|
||||
else if (sd->func == FUNC_PLAY_BOTH) {
|
||||
lcd_outdezAtt(MODEL_CUSTOM_FUNC_3RD_COLUMN, y, val_displayed+PROMPT_CUSTOM_BASE, attr|LEFT);
|
||||
lcd_putcAtt(lcdLastPos, y, '/', attr);
|
||||
lcd_outdezAtt(lcdLastPos+FW, y, val_displayed+PROMPT_CUSTOM_BASE+1, attr|LEFT);
|
||||
}
|
||||
#endif
|
||||
#if defined(SDCARD)
|
||||
else if (sd->func == FUNC_LOGS) {
|
||||
@@ -3299,7 +3304,7 @@ void menuModelTelemetry(uint8_t event)
|
||||
case EVT_KEY_BREAK(KEY_RIGHT):
|
||||
#endif
|
||||
if (s_editMode>0 && sub<=ITEM_TELEMETRY_RSSI_ALARM2)
|
||||
FRSKY_setModelAlarms(); // update FrSky module when edit mode exited
|
||||
frskySendAlarms(); // update FrSky module when edit mode exited
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -3374,7 +3379,7 @@ void menuModelTelemetry(uint8_t event)
|
||||
t = ALARM_GREATER(ch, j);
|
||||
if (t != checkIncDecModel(event, t, 0, 1)) {
|
||||
channel.alarms_greater ^= (1 << j);
|
||||
FRSKY_setModelAlarms();
|
||||
frskySendAlarms();
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
|
||||
+5
-2
@@ -56,9 +56,9 @@
|
||||
#elif defined(PCBSKY9X)
|
||||
#define EEPROM_VER 213
|
||||
#elif defined(PCBGRUVIN9X)
|
||||
#define EEPROM_VER 212
|
||||
#define EEPROM_VER 213
|
||||
#else
|
||||
#define EEPROM_VER 212
|
||||
#define EEPROM_VER 213
|
||||
#endif
|
||||
|
||||
#ifndef PACK
|
||||
@@ -355,6 +355,9 @@ enum Functions {
|
||||
FUNC_RESET,
|
||||
FUNC_VARIO,
|
||||
FUNC_PLAY_TRACK,
|
||||
#if !defined(CPUARM)
|
||||
FUNC_PLAY_BOTH,
|
||||
#endif
|
||||
FUNC_PLAY_VALUE,
|
||||
#if !defined(PCBSTD)
|
||||
FUNC_LOGS,
|
||||
|
||||
+28
-15
@@ -284,13 +284,9 @@ void per10ms()
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(MAVLINK) && !defined(CPUARM)
|
||||
check_mavlink();
|
||||
#endif
|
||||
|
||||
#if defined(FRSKY) && !defined(CPUARM) && !(defined(PCBSTD) && (defined(AUDIO) || defined(VOICE)))
|
||||
#if (defined(FRSKY) || defined(MAVLINK) || defined(JETI)) && !defined(CPUARM) && !(defined(PCBSTD) && (defined(AUDIO) || defined(VOICE)))
|
||||
if (!IS_DSM2_SERIAL_PROTOCOL(s_current_protocol))
|
||||
check_frsky();
|
||||
telemetryPoll10ms();
|
||||
#endif
|
||||
|
||||
// These moved here from perOut() to improve beep trigger reliability.
|
||||
@@ -2063,8 +2059,7 @@ void evalFunctions()
|
||||
{
|
||||
MASK_FUNC_TYPE newActiveFunctions = 0;
|
||||
|
||||
#if defined(ROTARY_ENCODERS) && defined(GVARS) && !defined(PCBX9D)
|
||||
// TODO modify the PCBX9D ifdef
|
||||
#if defined(ROTARY_ENCODERS) && defined(GVARS)
|
||||
static rotenc_t rePreviousValues[ROTARY_ENCODERS];
|
||||
#endif
|
||||
|
||||
@@ -2226,6 +2221,14 @@ void evalFunctions()
|
||||
PLAY_VALUE(FSW_PARAM(sd), i+1);
|
||||
}
|
||||
}
|
||||
else if (sd->func == FUNC_PLAY_BOTH) {
|
||||
if (IS_PLAYING(i+1)) {
|
||||
switch_mask = 0;
|
||||
}
|
||||
else {
|
||||
PUSH_CUSTOM_PROMPT(FSW_PARAM(sd) + 1, i+1);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(DEBUG)
|
||||
@@ -2239,8 +2242,7 @@ void evalFunctions()
|
||||
if (FSW_PARAM(sd) >= MIXSRC_TrimRud-1 && FSW_PARAM(sd) <= MIXSRC_TrimAil-1) {
|
||||
trimGvar[FSW_PARAM(sd)-MIXSRC_TrimRud+1] = sd->func-FUNC_ADJUST_GV1;
|
||||
}
|
||||
#if defined(ROTARY_ENCODERS) && !defined(PCBX9D)
|
||||
// TODO modify these ifdef
|
||||
#if defined(ROTARY_ENCODERS)
|
||||
else if (FSW_PARAM(sd) >= MIXSRC_REa-1 && FSW_PARAM(sd) < MIXSRC_TrimRud-1) {
|
||||
int8_t scroll = rePreviousValues[FSW_PARAM(sd)-MIXSRC_REa+1] - (g_rotenc[FSW_PARAM(sd)-MIXSRC_REa+1] / ROTARY_ENCODER_GRANULARITY);
|
||||
if (scroll) {
|
||||
@@ -2279,18 +2281,29 @@ void evalFunctions()
|
||||
if (!COMPLEX_SWITCH && sd->func == FUNC_BACKGND_MUSIC) {
|
||||
STOP_PLAY(i+1);
|
||||
}
|
||||
#elif defined(VOICE)
|
||||
if (sd->func == FUNC_PLAY_BOTH && (!momentary || (activeFunctionSwitches & switch_mask))) {
|
||||
if (IS_PLAYING(i+1)) {
|
||||
switch_mask = 0;
|
||||
}
|
||||
else {
|
||||
PUSH_CUSTOM_PROMPT(FSW_PARAM(sd), i+1);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
activeFunctionSwitches &= (~switch_mask);
|
||||
if (COMPLEX_SWITCH)
|
||||
newActiveFunctions |= (activeFunctions & function_mask);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
activeFunctions = newActiveFunctions;
|
||||
|
||||
#if defined(ROTARY_ENCODERS) && defined(GVARS) && !defined(PCBX9D)
|
||||
// TODO review #ifdef PCBX9D
|
||||
#if defined(ROTARY_ENCODERS) && defined(GVARS)
|
||||
for (uint8_t i=0; i<ROTARY_ENCODERS; i++)
|
||||
rePreviousValues[i] = (g_rotenc[i] / ROTARY_ENCODER_GRANULARITY);
|
||||
#endif
|
||||
@@ -3014,7 +3027,7 @@ void perMain()
|
||||
checkBacklight();
|
||||
|
||||
#if defined(CPUARM) && defined(FRSKY)
|
||||
check_frsky();
|
||||
telemetryPoll10ms();
|
||||
#endif
|
||||
|
||||
lcd_clear();
|
||||
@@ -3153,10 +3166,10 @@ ISR(TIMER_10MS_VECT, ISR_NOBLOCK) // 10ms timer
|
||||
|
||||
static uint8_t cnt10ms = 77; // execute 10ms code once every 78 ISRs
|
||||
|
||||
#if defined(FRSKY)
|
||||
#if defined(FRSKY) || defined(MAVLINK) || defined(JETI)
|
||||
if (cnt10ms == 30) {
|
||||
if (!IS_DSM2_SERIAL_PROTOCOL(s_current_protocol))
|
||||
check_frsky();
|
||||
telemetryPoll10ms();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
+3
-3
@@ -798,10 +798,10 @@ int16_t getRotaryEncoder(uint8_t idx);
|
||||
void incRotaryEncoder(uint8_t idx, int8_t inc);
|
||||
#endif
|
||||
|
||||
#if defined(PCBSKY9X)
|
||||
#define ROTARY_ENCODER_GRANULARITY 2
|
||||
#else
|
||||
#if defined(PCBGRUVIN9X)
|
||||
#define ROTARY_ENCODER_GRANULARITY 1
|
||||
#else
|
||||
#define ROTARY_ENCODER_GRANULARITY 2
|
||||
#endif
|
||||
|
||||
#if defined(GVARS)
|
||||
|
||||
@@ -36,29 +36,26 @@
|
||||
|
||||
#if defined(ROTARY_ENCODER_NAVIGATION)
|
||||
|
||||
uint8_t RotEncoder ;
|
||||
|
||||
#if defined(TELEMETREZ)
|
||||
uint8_t TrotCount ; // TeZ version
|
||||
uint8_t LastTrotCount ; // TeZ version
|
||||
uint8_t TezRotary ;
|
||||
uint8_t RotEncoder ;
|
||||
#define ROTENC_DOWN() (RotEncoder != 0)
|
||||
#else
|
||||
uint8_t RotPosition ;
|
||||
int8_t LastRotaryValue ;
|
||||
int8_t Rotary_diff ;
|
||||
int8_t RotaryControl ;
|
||||
#endif
|
||||
|
||||
uint8_t RotEncoder ;
|
||||
#define ROTENC_DOWN() (RotEncoder & 0x20)
|
||||
#endif
|
||||
|
||||
void rotencPoll()
|
||||
{
|
||||
#if defined(TELEMETREZ)
|
||||
if (TrotCount != LastTrotCount ) {
|
||||
if (TrotCount != LastTrotCount) {
|
||||
g_rotenc[0] = LastTrotCount = TrotCount ;
|
||||
}
|
||||
if( TezRotary != 0)
|
||||
RotEncoder = 0x20; // switch is on
|
||||
#else
|
||||
// Rotary Encoder polling
|
||||
PORTA = 0 ; // No pullups
|
||||
@@ -144,7 +141,7 @@ FORCEINLINE
|
||||
#endif
|
||||
uint8_t keyDown()
|
||||
{
|
||||
return ((~PINB) & 0x7E) || ROTENC_DOWN();
|
||||
return ((~PINB) & 0x7E) | ROTENC_DOWN();
|
||||
}
|
||||
|
||||
bool switchState(EnumKeys enuk)
|
||||
@@ -268,7 +265,7 @@ void readKeysAndTrims()
|
||||
}
|
||||
|
||||
#if defined(ROTARY_ENCODER_NAVIGATION)
|
||||
keys[enuk].input(RotEncoder & 0x20, (EnumKeys)enuk); // Rotary Enc. Switch
|
||||
keys[enuk].input(ROTENC_DOWN(), (EnumKeys)enuk); // Rotary Enc. Switch
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -319,9 +316,9 @@ void fadeBacklight() //called from per10ms()
|
||||
{
|
||||
if (bl_target != bl_current) {
|
||||
if (bl_target > bl_current)
|
||||
OCR2 = pgm_read_word(&pwmtable[++bl_current]);
|
||||
OCR2 = pgm_read_byte(&pwmtable[++bl_current]);
|
||||
else
|
||||
OCR2 = pgm_read_word(&pwmtable[--bl_current]);
|
||||
OCR2 = pgm_read_byte(&pwmtable[--bl_current]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -121,9 +121,11 @@
|
||||
|
||||
#if defined(VOICE)
|
||||
#define TR_PLAY_TRACK "Play Track\0"
|
||||
#define TR_PLAY_BOTH "Play Both\0 "
|
||||
#define TR_PLAY_VALUE "Play Value\0"
|
||||
#else
|
||||
#define TR_PLAY_TRACK "[PlayTrack]"
|
||||
#define TR_PLAY_BOTH "[Play Both]" // TODO could be avoided
|
||||
#define TR_PLAY_VALUE "[PlayValue]"
|
||||
#endif
|
||||
|
||||
@@ -133,8 +135,8 @@
|
||||
#else
|
||||
#define TR_SDCLOGS "[SD Logs]\0 "
|
||||
#endif
|
||||
#define TR_FSW_VOLUME "Volume\0 "
|
||||
#define TR_FSW_BG_MUSIC "BgMusic\0 ""BgMusic ||\0"
|
||||
#define TR_FSW_VOLUME "Volume\0 "
|
||||
#define TR_FSW_BG_MUSIC "BgMusic\0 ""BgMusic ||\0"
|
||||
#elif defined(PCBGRUVIN9X)
|
||||
#if defined(SDCARD)
|
||||
#define TR_SDCLOGS "SD Logs\0 "
|
||||
@@ -161,7 +163,7 @@
|
||||
#define TR_FSW_TEST
|
||||
#endif
|
||||
|
||||
#define TR_VFSWFUNC "Safety\0 ""Trainer \0 ""Inst. Trim\0" TR_SOUND TR_HAPTIC "Reset\0 " TR_VVARIO TR_PLAY_TRACK TR_PLAY_VALUE TR_SDCLOGS TR_FSW_VOLUME "Backlight\0 " TR_FSW_BG_MUSIC TR_FSW_ADJUST_GVAR TR_FSW_TEST
|
||||
#define TR_VFSWFUNC "Safety\0 ""Trainer \0 ""Inst. Trim\0" TR_SOUND TR_HAPTIC "Reset\0 " TR_VVARIO TR_PLAY_TRACK TR_PLAY_BOTH TR_PLAY_VALUE TR_SDCLOGS TR_FSW_VOLUME "Backlight\0 " TR_FSW_BG_MUSIC TR_FSW_ADJUST_GVAR TR_FSW_TEST
|
||||
|
||||
#define LEN_VFSWRESET TR("\006","\012")
|
||||
#define TR_VFSWRESET "Timer 1 ""Timer 2 ""All ""Telemetry"
|
||||
|
||||
@@ -334,8 +334,8 @@
|
||||
#define TR_BEEPCOUNTDOWN INDENT"Cpt. \202 rebours"
|
||||
#define TR_BACKLIGHT_LABEL "R\200tro\200clairage"
|
||||
#define TR_BLDELAY INDENT"Dur\200e"
|
||||
#define TR_BLONBRIGHTNESS INDENT"ON Brightness"
|
||||
#define TR_BLOFFBRIGHTNESS INDENT"OFF Brightness"
|
||||
#define TR_BLONBRIGHTNESS INDENT"Luminosit\200 ON"
|
||||
#define TR_BLOFFBRIGHTNESS INDENT"Luminosit\200 OFF"
|
||||
#define TR_SPLASHSCREEN "Ecran d'accueil"
|
||||
#define TR_THROTTLEWARNING "Alerte Gaz"
|
||||
#define TR_SWITCHWARNING "Alerte Int"
|
||||
|
||||
Reference in New Issue
Block a user