[Taranis] SWR implemented with popup when SWR > 0x33 (Tx antenna problem)
[Taranis] RSSI/A1/A2 alarms [Taranis] Better code when no pulses sent (internal or external module). Thanks Mike! [Taranis] Correction on DEBUG serial code
This commit is contained in:
+49
-13
@@ -56,8 +56,10 @@ uint16_t Sine_values[] =
|
||||
const char * audioFilenames[] = {
|
||||
"inactiv",
|
||||
"lowbatt",
|
||||
#if defined(PCBSKY9X)
|
||||
"highmah",
|
||||
"hightemp",
|
||||
#endif
|
||||
"thralert",
|
||||
"swalert",
|
||||
"eebad",
|
||||
@@ -80,10 +82,18 @@ const char * audioFilenames[] = {
|
||||
"timerlt3",
|
||||
"timer10",
|
||||
"timer20",
|
||||
"timer30"
|
||||
"timer30",
|
||||
#if defined(PCBTARANIS)
|
||||
"a1_org",
|
||||
"a1_red",
|
||||
"a2_org",
|
||||
"a2_red",
|
||||
"rssi_org",
|
||||
"rssi_red",
|
||||
"swr_red",
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
uint32_t sdAvailableSystemAudioFiles = 0;
|
||||
uint8_t sdAvailablePhaseAudioFiles[MAX_PHASES] = { 0 };
|
||||
uint8_t sdAvailableMixerAudioFiles[MAX_MIXERS] = { 0 };
|
||||
@@ -740,6 +750,7 @@ void audioEvent(uint8_t e, uint8_t f)
|
||||
audioQueue.play(160, 40, 6, 2, -1);
|
||||
}
|
||||
break;
|
||||
#if defined(PCBSKY9X)
|
||||
case AU_TX_MAH_HIGH:
|
||||
if (!audioQueue.busy()) {
|
||||
// TODO Rob something better here?
|
||||
@@ -754,7 +765,7 @@ void audioEvent(uint8_t e, uint8_t f)
|
||||
audioQueue.play(160, 40, 6, 2, -1);
|
||||
}
|
||||
break;
|
||||
// error
|
||||
#endif
|
||||
#if defined(VOICE)
|
||||
case AU_THROTTLE_ALERT:
|
||||
case AU_SWITCH_ALERT:
|
||||
@@ -814,22 +825,47 @@ void audioEvent(uint8_t e, uint8_t f)
|
||||
case AU_MIX_WARNING_3:
|
||||
audioQueue.play(BEEP_DEFAULT_FREQ+112, 12, 8, PLAY_REPEAT(2));
|
||||
break;
|
||||
// time 30 seconds left
|
||||
case AU_TIMER_30:
|
||||
audioQueue.play(BEEP_DEFAULT_FREQ, 30, 6, PLAY_REPEAT(2)|PLAY_NOW);
|
||||
break;
|
||||
// time 20 seconds left
|
||||
case AU_TIMER_20:
|
||||
audioQueue.play(BEEP_DEFAULT_FREQ, 30, 6, PLAY_REPEAT(1)|PLAY_NOW);
|
||||
// time <3 seconds left
|
||||
case AU_TIMER_LT3:
|
||||
audioQueue.play(BEEP_DEFAULT_FREQ+10, 30, 6, PLAY_NOW);
|
||||
break;
|
||||
// time 10 seconds left
|
||||
case AU_TIMER_10:
|
||||
audioQueue.play(BEEP_DEFAULT_FREQ, 30, 6, PLAY_NOW);
|
||||
break;
|
||||
// time <3 seconds left
|
||||
case AU_TIMER_LT3:
|
||||
audioQueue.play(BEEP_DEFAULT_FREQ+10, 30, 6, PLAY_NOW);
|
||||
// time 20 seconds left
|
||||
case AU_TIMER_20:
|
||||
audioQueue.play(BEEP_DEFAULT_FREQ, 30, 6, PLAY_REPEAT(1)|PLAY_NOW);
|
||||
break;
|
||||
// time 30 seconds left
|
||||
case AU_TIMER_30:
|
||||
audioQueue.play(BEEP_DEFAULT_FREQ, 30, 6, PLAY_REPEAT(2)|PLAY_NOW);
|
||||
break;
|
||||
#if defined(PCBTARANIS)
|
||||
case AU_A1_ORANGE:
|
||||
audioQueue.play(BEEP_DEFAULT_FREQ+40, 30, 6, PLAY_NOW);
|
||||
break;
|
||||
case AU_A1_RED:
|
||||
audioQueue.play(BEEP_DEFAULT_FREQ+40, 30, 6, PLAY_REPEAT(1)|PLAY_NOW);
|
||||
break;
|
||||
case AU_A2_ORANGE:
|
||||
audioQueue.play(BEEP_DEFAULT_FREQ+80, 30, 6, PLAY_NOW);
|
||||
break;
|
||||
case AU_A2_RED:
|
||||
audioQueue.play(BEEP_DEFAULT_FREQ+80, 30, 6, PLAY_REPEAT(1)|PLAY_NOW);
|
||||
break;
|
||||
case AU_RSSI_ORANGE:
|
||||
audioQueue.play(BEEP_DEFAULT_FREQ+120, 30, 6, PLAY_NOW);
|
||||
break;
|
||||
case AU_RSSI_RED:
|
||||
audioQueue.play(BEEP_DEFAULT_FREQ+120, 30, 6, PLAY_REPEAT(1)|PLAY_NOW);
|
||||
break;
|
||||
case AU_SWR_RED:
|
||||
// siren
|
||||
audioQueue.play(20, 40, 10, 2, 1);
|
||||
audioQueue.pause(200);
|
||||
break;
|
||||
#endif
|
||||
case AU_FRSKY_BEEP1:
|
||||
audioQueue.play(BEEP_DEFAULT_FREQ, 15, 2);
|
||||
audioQueue.pause(200);
|
||||
|
||||
+14
-2
@@ -174,8 +174,10 @@ void audioStart();
|
||||
#define AUDIO_WARNING1() AUDIO_BUZZER(audioEvent(AU_WARNING1), beep(3))
|
||||
#define AUDIO_WARNING2() AUDIO_BUZZER(audioEvent(AU_WARNING2), beep(2))
|
||||
#define AUDIO_TX_BATTERY_LOW() AUDIO_BUZZER(audioEvent(AU_TX_BATTERY_LOW), beep(4))
|
||||
#define AUDIO_TX_MAH_HIGH() audioEvent(AU_TX_MAH_HIGH)
|
||||
#define AUDIO_TX_TEMP_HIGH() audioEvent(AU_TX_TEMP_HIGH)
|
||||
#if defined(PCBSKY9X)
|
||||
#define AUDIO_TX_MAH_HIGH() audioEvent(AU_TX_MAH_HIGH)
|
||||
#define AUDIO_TX_TEMP_HIGH() audioEvent(AU_TX_TEMP_HIGH)
|
||||
#endif
|
||||
#define AUDIO_ERROR() AUDIO_BUZZER(audioEvent(AU_ERROR), beep(4))
|
||||
#define AUDIO_TIMER_30() AUDIO_BUZZER(audioEvent(AU_TIMER_30), { beepAgain=2; beep(2); })
|
||||
#define AUDIO_TIMER_20() AUDIO_BUZZER(audioEvent(AU_TIMER_20), { beepAgain=1; beep(2); })
|
||||
@@ -192,6 +194,16 @@ void audioStart();
|
||||
#define AUDIO_PLAY(p) audioEvent(p)
|
||||
#define AUDIO_VARIO(f, t) audioQueue.play(f, t, 0, PLAY_BACKGROUND)
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
#define AUDIO_A1_ORANGE() audioEvent(AU_A1_ORANGE)
|
||||
#define AUDIO_A1_RED() audioEvent(AU_A1_RED)
|
||||
#define AUDIO_A2_ORANGE() audioEvent(AU_A2_ORANGE)
|
||||
#define AUDIO_A2_RED() audioEvent(AU_A2_RED)
|
||||
#define AUDIO_RSSI_ORANGE() audioEvent(AU_RSSI_ORANGE)
|
||||
#define AUDIO_RSSI_RED() audioEvent(AU_RSSI_RED)
|
||||
#define AUDIO_SWR_RED() audioEvent(AU_SWR_RED)
|
||||
#endif
|
||||
|
||||
#define AUDIO_HEARTBEAT()
|
||||
|
||||
#define SYSTEM_AUDIO_CATEGORY 0
|
||||
|
||||
+26
-14
@@ -4338,20 +4338,16 @@ enum menuModelTelemetryItems {
|
||||
ITEM_TELEMETRY_A1_LABEL,
|
||||
ITEM_TELEMETRY_A1_RANGE,
|
||||
ITEM_TELEMETRY_A1_OFFSET,
|
||||
#if !defined(PCBTARANIS)
|
||||
ITEM_TELEMETRY_A1_ALARM1,
|
||||
ITEM_TELEMETRY_A1_ALARM2,
|
||||
#endif
|
||||
ITEM_TELEMETRY_A2_LABEL,
|
||||
ITEM_TELEMETRY_A2_RANGE,
|
||||
ITEM_TELEMETRY_A2_OFFSET,
|
||||
#if !defined(PCBTARANIS)
|
||||
ITEM_TELEMETRY_A2_ALARM1,
|
||||
ITEM_TELEMETRY_A2_ALARM2,
|
||||
ITEM_TELEMETRY_RSSI_LABEL,
|
||||
ITEM_TELEMETRY_RSSI_ALARM1,
|
||||
ITEM_TELEMETRY_RSSI_ALARM2,
|
||||
#endif
|
||||
#if defined(FRSKY_HUB) || defined(WS_HOW_HIGH)
|
||||
ITEM_TELEMETRY_USR_LABEL,
|
||||
#if !defined(PCBTARANIS)
|
||||
@@ -4395,10 +4391,11 @@ enum menuModelTelemetryItems {
|
||||
#if defined(FRSKY)
|
||||
#if LCD_W >= 212
|
||||
#define TELEM_COL1 (1*FW)
|
||||
#define TELEM_COL2 (13*FW)
|
||||
#define TELEM_COL3 (25*FW)
|
||||
#define TELEM_COL2 (16*FW)
|
||||
#define TELEM_COL3 (28*FW)
|
||||
#define TELEM_BARS_COLMIN (3*FW+56)
|
||||
#define TELEM_BARS_COLMAX (20*FW-3)
|
||||
#define TELEM_SCRTYPE_COL (10*FW)
|
||||
#else
|
||||
#define TELEM_COL1 INDENT_WIDTH
|
||||
#if defined(TRANSLATIONS_FR) || defined(TRANSLATIONS_CZ)
|
||||
@@ -4408,11 +4405,12 @@ enum menuModelTelemetryItems {
|
||||
#endif
|
||||
#define TELEM_BARS_COLMIN (56-3*FW)
|
||||
#define TELEM_BARS_COLMAX (14*FW-3)
|
||||
#define TELEM_SCRTYPE_COL (10*FW)
|
||||
#endif
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
#define CHANNEL_ROWS (uint8_t)-1, 1, 0,
|
||||
#define RSSI_ROWS
|
||||
#define CHANNEL_ROWS (uint8_t)-1, 1, 0, 0, 0,
|
||||
#define RSSI_ROWS (uint8_t)-1, 0, 0,
|
||||
#else
|
||||
#define CHANNEL_ROWS (uint8_t)-1, 1, 0, 2, 2,
|
||||
#define RSSI_ROWS (uint8_t)-1, 1, 1,
|
||||
@@ -4424,17 +4422,17 @@ void menuModelTelemetry(uint8_t event)
|
||||
|
||||
uint8_t sub = m_posVert - 1;
|
||||
|
||||
#if !defined(PCBTARANIS)
|
||||
switch (event) {
|
||||
case EVT_KEY_BREAK(KEY_DOWN):
|
||||
case EVT_KEY_BREAK(KEY_UP):
|
||||
#if !defined(PCBTARANIS)
|
||||
case EVT_KEY_BREAK(KEY_LEFT):
|
||||
case EVT_KEY_BREAK(KEY_RIGHT):
|
||||
if (s_editMode>0 && sub<=ITEM_TELEMETRY_RSSI_ALARM2)
|
||||
frskySendAlarms(); // update FrSky module when edit mode exited
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
for (uint8_t i=0; i<LCD_LINES-1; i++) {
|
||||
uint8_t y = 1 + 1*FH + i*FH;
|
||||
@@ -4485,13 +4483,19 @@ void menuModelTelemetry(uint8_t event)
|
||||
if (attr) channel.offset = checkIncDec(event, channel.offset, -256, 256, EE_MODEL);
|
||||
break;
|
||||
|
||||
#if !defined(PCBTARANIS)
|
||||
case ITEM_TELEMETRY_A1_ALARM1:
|
||||
case ITEM_TELEMETRY_A1_ALARM2:
|
||||
case ITEM_TELEMETRY_A2_ALARM1:
|
||||
case ITEM_TELEMETRY_A2_ALARM2:
|
||||
{
|
||||
uint8_t j = ((k==ITEM_TELEMETRY_A1_ALARM1 || k==ITEM_TELEMETRY_A2_ALARM1) ? 0 : 1);
|
||||
#if defined(PCBTARANIS)
|
||||
lcd_putsLeft(y, (j==0 ? INDENT "Low Alarm" : INDENT "Critical Alarm"));
|
||||
putsTelemetryChannel(TELEM_COL2, y, dest, channel.alarms_value[j], LEFT|attr);
|
||||
if (attr && (s_editMode>0 || p1valdiff)) {
|
||||
channel.alarms_value[j] = checkIncDec(event, channel.alarms_value[j], 0, 255, EE_MODEL);
|
||||
}
|
||||
#else
|
||||
lcd_putsLeft(y, STR_ALARM);
|
||||
lcd_putsiAtt(TELEM_COL2, y, STR_VALARM, ALARM_LEVEL(ch, j), m_posHorz<=0 ? attr : 0);
|
||||
lcd_putsiAtt(TELEM_COL2+4*FW, y, STR_VALARMFN, ALARM_GREATER(ch, j), (m_posHorz<0 || m_posHorz==1) ? attr : 0);
|
||||
@@ -4516,6 +4520,7 @@ void menuModelTelemetry(uint8_t event)
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -4526,6 +4531,13 @@ void menuModelTelemetry(uint8_t event)
|
||||
case ITEM_TELEMETRY_RSSI_ALARM1:
|
||||
case ITEM_TELEMETRY_RSSI_ALARM2: {
|
||||
uint8_t j = k-ITEM_TELEMETRY_RSSI_ALARM1;
|
||||
#if defined(PCBTARANIS)
|
||||
lcd_putsLeft(y, (j==0 ? INDENT "Low Alarm" : INDENT "Critical Alarm"));
|
||||
lcd_outdezNAtt(TELEM_COL2, y, getRssiAlarmValue(j), LEFT|attr, 3);
|
||||
if (attr && (s_editMode>0 || p1valdiff)) {
|
||||
CHECK_INCDEC_MODELVAR(event, g_model.frsky.rssiAlarms[j].value, -30, 30);
|
||||
}
|
||||
#else
|
||||
lcd_putsLeft(y, STR_ALARM);
|
||||
lcd_putsiAtt(TELEM_COL2, y, STR_VALARM, ((2+j+g_model.frsky.rssiAlarms[j].level)%4), m_posHorz<=0 ? attr : 0);
|
||||
lcd_putc(TELEM_COL2+4*FW, y, '<');
|
||||
@@ -4541,9 +4553,9 @@ void menuModelTelemetry(uint8_t event)
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(FRSKY_HUB) || defined(WS_HOW_HIGH)
|
||||
case ITEM_TELEMETRY_USR_LABEL:
|
||||
@@ -4624,7 +4636,7 @@ void menuModelTelemetry(uint8_t event)
|
||||
uint8_t screenIndex = (k < ITEM_TELEMETRY_SCREEN_LABEL2 ? 0 : (k < ITEM_TELEMETRY_SCREEN_LABEL3 ? 1 : 2));
|
||||
bool screenType = IS_BARS_SCREEN(screenIndex);
|
||||
putsStrIdx(0*FW, y, STR_SCREEN, screenIndex+1);
|
||||
if (screenType != selectMenuItem(10*FW, y, PSTR(""), STR_VSCREEN, screenType, 0, 1, attr, event))
|
||||
if (screenType != selectMenuItem(TELEM_SCRTYPE_COL, y, PSTR(""), STR_VSCREEN, screenType, 0, 1, attr, event))
|
||||
g_model.frsky.screensType ^= (1 << screenIndex);
|
||||
break;
|
||||
}
|
||||
@@ -4633,7 +4645,7 @@ void menuModelTelemetry(uint8_t event)
|
||||
uint8_t screenIndex = (k < ITEM_TELEMETRY_SCREEN_LABEL2 ? 1 : 2);
|
||||
bool screenType = g_model.frsky.screensType & screenIndex;
|
||||
putsStrIdx(0*FW, y, STR_SCREEN, screenIndex);
|
||||
if (screenType != selectMenuItem(10*FW, y, PSTR(""), STR_VSCREEN, screenType, 0, 1, attr, event))
|
||||
if (screenType != selectMenuItem(TELEM_SCRTYPE_COL, y, PSTR(""), STR_VSCREEN, screenType, 0, 1, attr, event))
|
||||
g_model.frsky.screensType ^= screenIndex;
|
||||
break;
|
||||
}
|
||||
|
||||
+183
-188
@@ -54,7 +54,7 @@ static uint8_t s_frsky_view = e_frsky_custom_screen_1;
|
||||
#if LCD_W >= 212
|
||||
void displayRssiLine()
|
||||
{
|
||||
if (frskyStreaming > 0) {
|
||||
if (TELEMETRY_STREAMING()) {
|
||||
lcd_hline(0, 55, 212, 0); // separator
|
||||
uint8_t rssi = min((uint8_t)99, frskyData.rssi[1].value);
|
||||
lcd_putsLeft(7*FH+1, STR_TX); lcd_outdezNAtt(4*FW, 7*FH+1, rssi, LEADING0, 2);
|
||||
@@ -74,7 +74,7 @@ void displayRssiLine()
|
||||
#else
|
||||
void displayRssiLine()
|
||||
{
|
||||
if (frskyStreaming > 0) {
|
||||
if (TELEMETRY_STREAMING()) {
|
||||
lcd_hline(0, 55, 128, 0); // separator
|
||||
uint8_t rssi = min((uint8_t)99, frskyData.rssi[1].value);
|
||||
lcd_putsLeft(7*FH+1, STR_TX); lcd_outdezNAtt(4*FW, 7*FH+1, rssi, LEADING0, 2);
|
||||
@@ -97,7 +97,7 @@ void displayRssiLine()
|
||||
void displayGpsTime()
|
||||
{
|
||||
#define TIME_LINE (7*FH+1)
|
||||
uint8_t att = (frskyStreaming > 0 ? LEFT|LEADING0 : LEFT|LEADING0|BLINK);
|
||||
uint8_t att = (TELEMETRY_STREAMING() ? LEFT|LEADING0 : LEFT|LEADING0|BLINK);
|
||||
lcd_outdezNAtt(6*FW+5, TIME_LINE, frskyData.hub.hour, att, 2);
|
||||
lcd_putcAtt(8*FW+2, TIME_LINE, ':', att);
|
||||
lcd_outdezNAtt(9*FW+2, TIME_LINE, frskyData.hub.min, att, 2);
|
||||
@@ -193,203 +193,198 @@ void menuTelemetryFrsky(uint8_t event)
|
||||
|
||||
lcdDrawTelemetryTopBar();
|
||||
|
||||
if (frskyStreaming >= 0) {
|
||||
if (s_frsky_view < MAX_FRSKY_SCREENS) {
|
||||
FrSkyScreenData & screen = g_model.frsky.screens[s_frsky_view];
|
||||
if (g_model.frsky.screensType & (1<<s_frsky_view)) {
|
||||
// Custom Screen with gauges
|
||||
uint8_t barHeight = 5;
|
||||
for (int8_t i=3; i>=0; i--) {
|
||||
FrSkyBarData & bar = screen.bars[i];
|
||||
uint8_t source = bar.source;
|
||||
getvalue_t barMin = convertTelemValue(source, bar.barMin);
|
||||
getvalue_t barMax = convertTelemValue(source, 255-bar.barMax);
|
||||
if (source && barMax > barMin) {
|
||||
uint8_t y = barHeight+6+i*(barHeight+6);
|
||||
lcd_putsiAtt(0, y+barHeight-5, STR_VTELEMCHNS, source, 0);
|
||||
lcd_rect(25, y, 101, barHeight+2);
|
||||
getvalue_t value = getValue(MIXSRC_FIRST_TELEM+source-2);
|
||||
getvalue_t threshold = 0;
|
||||
uint8_t thresholdX = 0;
|
||||
if (source <= TELEM_TM2)
|
||||
threshold = 0;
|
||||
else if (source <= TELEM_RSSI_RX)
|
||||
threshold = getRssiAlarmValue(source-TELEM_RSSI_TX);
|
||||
else if (source <= TELEM_A2)
|
||||
threshold = g_model.frsky.channels[source-TELEM_A1].alarms_value[0];
|
||||
if (s_frsky_view < MAX_FRSKY_SCREENS) {
|
||||
FrSkyScreenData & screen = g_model.frsky.screens[s_frsky_view];
|
||||
if (g_model.frsky.screensType & (1<<s_frsky_view)) {
|
||||
// Custom Screen with gauges
|
||||
uint8_t barHeight = 5;
|
||||
for (int8_t i=3; i>=0; i--) {
|
||||
FrSkyBarData & bar = screen.bars[i];
|
||||
uint8_t source = bar.source;
|
||||
getvalue_t barMin = convertTelemValue(source, bar.barMin);
|
||||
getvalue_t barMax = convertTelemValue(source, 255-bar.barMax);
|
||||
if (source && barMax > barMin) {
|
||||
uint8_t y = barHeight+6+i*(barHeight+6);
|
||||
lcd_putsiAtt(0, y+barHeight-5, STR_VTELEMCHNS, source, 0);
|
||||
lcd_rect(25, y, 101, barHeight+2);
|
||||
getvalue_t value = getValue(MIXSRC_FIRST_TELEM+source-2);
|
||||
getvalue_t threshold = 0;
|
||||
uint8_t thresholdX = 0;
|
||||
if (source <= TELEM_TM2)
|
||||
threshold = 0;
|
||||
else if (source <= TELEM_RSSI_RX)
|
||||
threshold = getRssiAlarmValue(source-TELEM_RSSI_TX);
|
||||
else if (source <= TELEM_A2)
|
||||
threshold = g_model.frsky.channels[source-TELEM_A1].alarms_value[0];
|
||||
#if defined(FRSKY_HUB)
|
||||
else
|
||||
threshold = convertTelemValue(source, barsThresholds[source-TELEM_ALT]);
|
||||
else
|
||||
threshold = convertTelemValue(source, barsThresholds[source-TELEM_ALT]);
|
||||
#endif
|
||||
|
||||
if (threshold) {
|
||||
thresholdX = barCoord(threshold, barMin, barMax);
|
||||
if (thresholdX == 100)
|
||||
thresholdX = 0;
|
||||
}
|
||||
|
||||
uint8_t width = barCoord(value, barMin, barMax);
|
||||
|
||||
// reversed barshade for T1/T2
|
||||
uint8_t barShade = ((threshold > value) ? DOTTED : SOLID);
|
||||
if (source == TELEM_T1 || source == TELEM_T2)
|
||||
barShade = -barShade;
|
||||
|
||||
lcd_filled_rect(26, y+1, width, barHeight, barShade);
|
||||
|
||||
for (uint8_t j=50; j<125; j+=25)
|
||||
if (j>26+thresholdX || j>26+width) lcd_vline(j, y+1, barHeight);
|
||||
|
||||
if (thresholdX) {
|
||||
lcd_vlineStip(26+thresholdX, y-2, barHeight+3, DOTTED);
|
||||
lcd_hline(25+thresholdX, y-2, 3);
|
||||
}
|
||||
if (threshold) {
|
||||
thresholdX = barCoord(threshold, barMin, barMax);
|
||||
if (thresholdX == 100)
|
||||
thresholdX = 0;
|
||||
}
|
||||
else {
|
||||
barHeight += 2;
|
||||
|
||||
uint8_t width = barCoord(value, barMin, barMax);
|
||||
|
||||
// reversed barshade for T1/T2
|
||||
uint8_t barShade = ((threshold > value) ? DOTTED : SOLID);
|
||||
if (source == TELEM_T1 || source == TELEM_T2)
|
||||
barShade = -barShade;
|
||||
|
||||
lcd_filled_rect(26, y+1, width, barHeight, barShade);
|
||||
|
||||
for (uint8_t j=50; j<125; j+=25)
|
||||
if (j>26+thresholdX || j>26+width) lcd_vline(j, y+1, barHeight);
|
||||
|
||||
if (thresholdX) {
|
||||
lcd_vlineStip(26+thresholdX, y-2, barHeight+3, DOTTED);
|
||||
lcd_hline(25+thresholdX, y-2, 3);
|
||||
}
|
||||
}
|
||||
displayRssiLine();
|
||||
}
|
||||
else {
|
||||
// Custom Screen with numbers
|
||||
uint8_t fields_count = 0;
|
||||
for (uint8_t i=0; i<4; i++) {
|
||||
for (uint8_t j=0; j<NUM_LINE_ITEMS; j++) {
|
||||
uint8_t field = screen.lines[i].sources[j];
|
||||
if (i==3 && j==0) {
|
||||
#if LCD_W >= 212
|
||||
lcd_vline(69, 8, 48);
|
||||
lcd_vline(141, 8, 48);
|
||||
#else
|
||||
lcd_vline(63, 8, 48);
|
||||
#endif
|
||||
if (frskyStreaming > 0) {
|
||||
#if defined(FRSKY_HUB)
|
||||
if (field == TELEM_ACC) {
|
||||
lcd_putsLeft(7*FH+1, STR_ACCEL);
|
||||
lcd_outdezNAtt(4*FW, 7*FH+1, frskyData.hub.accelX, LEFT|PREC2);
|
||||
lcd_outdezNAtt(10*FW, 7*FH+1, frskyData.hub.accelY, LEFT|PREC2);
|
||||
lcd_outdezNAtt(16*FW, 7*FH+1, frskyData.hub.accelZ, LEFT|PREC2);
|
||||
break;
|
||||
}
|
||||
else if (field == TELEM_GPS_TIME) {
|
||||
displayGpsTime();
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
displayRssiLine();
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (field) {
|
||||
fields_count++;
|
||||
getvalue_t value = getValue(MIXSRC_FIRST_TELEM+field-2);
|
||||
uint8_t att = (i==3 ? NO_UNIT : DBLSIZE|NO_UNIT);
|
||||
#if LCD_W >= 212
|
||||
xcoord_t pos[] = {0, 71, 143, 214};
|
||||
#else
|
||||
xcoord_t pos[] = {0, 65, 130};
|
||||
#endif
|
||||
putsTelemetryChannel(pos[j+1]-2, 1+FH+2*FH*i, field-1, value, att);
|
||||
#if LCD_W < 212
|
||||
if (field >= TELEM_TM1 && field <= TELEM_TM2 && i!=3) {
|
||||
// there is not enough space on LCD for displaying "Tmr1" or "Tmr2", we write "T1" or "T2" instead
|
||||
field = field-TELEM_TM1+TELEM_T1;
|
||||
}
|
||||
#endif
|
||||
lcd_putsiAtt(pos[j], 1+FH+2*FH*i, STR_VTELEMCHNS, field, 0);
|
||||
}
|
||||
}
|
||||
else {
|
||||
barHeight += 2;
|
||||
}
|
||||
lcd_status_line();
|
||||
if (fields_count == 0)
|
||||
putEvent(event == EVT_KEY_BREAK(KEY_UP) ? event : EVT_KEY_BREAK(KEY_DOWN));
|
||||
}
|
||||
}
|
||||
else if (s_frsky_view == e_frsky_voltages) {
|
||||
// Volts / Amps / Watts / mAh
|
||||
uint8_t analog = 0;
|
||||
lcd_putsiAtt(0, 2*FH, STR_VOLTSRC, g_model.frsky.voltsSource+1, 0);
|
||||
switch(g_model.frsky.voltsSource) {
|
||||
case 0:
|
||||
case 1:
|
||||
displayVoltageScreenLine(2*FH, g_model.frsky.voltsSource);
|
||||
analog = 1+g_model.frsky.voltsSource;
|
||||
break;
|
||||
#if defined(FRSKY_HUB)
|
||||
case 2:
|
||||
putsTelemetryChannel(3*FW+6*FW+4, FH+1, TELEM_VFAS-1, frskyData.hub.vfas, DBLSIZE);
|
||||
break;
|
||||
case 3:
|
||||
putsTelemetryChannel(3*FW+6*FW+4, FH+1, TELEM_CELLS_SUM-1, frskyData.hub.cellsSum, DBLSIZE);
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (g_model.frsky.currentSource) {
|
||||
lcd_putsiAtt(0, 4*FH, STR_VOLTSRC, g_model.frsky.currentSource, 0);
|
||||
switch(g_model.frsky.currentSource) {
|
||||
case 1:
|
||||
case 2:
|
||||
displayVoltageScreenLine(4*FH, g_model.frsky.currentSource-1);
|
||||
break;
|
||||
#if defined(FRSKY_HUB)
|
||||
case 3:
|
||||
putsTelemetryChannel(3*FW+6*FW+4, 3*FH+1, TELEM_CURRENT-1, frskyData.hub.current, DBLSIZE);
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
putsTelemetryChannel(4, 5*FH+1, TELEM_POWER-1, frskyData.power, LEFT|DBLSIZE);
|
||||
putsTelemetryChannel(3*FW+4+4*FW+6*FW+FW, 5*FH+1, TELEM_CONSUMPTION-1, frskyData.currentConsumption, DBLSIZE);
|
||||
}
|
||||
else {
|
||||
displayVoltageScreenLine(analog > 0 ? 5*FH : 4*FH, analog ? 2-analog : 0);
|
||||
if (analog == 0) displayVoltageScreenLine(6*FH, 1);
|
||||
}
|
||||
|
||||
#if defined(FRSKY_HUB)
|
||||
// Cells voltage
|
||||
if (frskyData.hub.cellsCount > 0) {
|
||||
uint8_t y = 1*FH;
|
||||
for (uint8_t k=0; k<frskyData.hub.cellsCount && k<6; k++) {
|
||||
uint8_t attr = (barsThresholds[THLD_CELL] && frskyData.hub.cellVolts[k] < barsThresholds[THLD_CELL]) ? BLINK|PREC2 : PREC2;
|
||||
lcd_outdezNAtt(LCD_W, y, frskyData.hub.cellVolts[k] * 2, attr, 4);
|
||||
y += 1*FH;
|
||||
}
|
||||
lcd_vline(LCD_W-3*FW-2, 8, 47);
|
||||
}
|
||||
#endif
|
||||
|
||||
displayRssiLine();
|
||||
}
|
||||
else {
|
||||
// Custom Screen with numbers
|
||||
uint8_t fields_count = 0;
|
||||
for (uint8_t i=0; i<4; i++) {
|
||||
for (uint8_t j=0; j<NUM_LINE_ITEMS; j++) {
|
||||
uint8_t field = screen.lines[i].sources[j];
|
||||
if (i==3 && j==0) {
|
||||
#if LCD_W >= 212
|
||||
lcd_vline(69, 8, 48);
|
||||
lcd_vline(141, 8, 48);
|
||||
#else
|
||||
lcd_vline(63, 8, 48);
|
||||
#endif
|
||||
if (TELEMETRY_STREAMING()) {
|
||||
#if defined(FRSKY_HUB)
|
||||
else if (s_frsky_view == e_frsky_after_flight) {
|
||||
uint8_t line=1*FH+1;
|
||||
if (IS_USR_PROTO_FRSKY_HUB()) {
|
||||
// Latitude
|
||||
lcd_putsLeft(line, STR_LATITUDE);
|
||||
displayGpsCoord(line, frskyData.hub.gpsLatitudeNS, frskyData.hub.gpsLatitude_bp, frskyData.hub.gpsLatitude_ap);
|
||||
// Longitude
|
||||
line+=1*FH+1;
|
||||
lcd_putsLeft(line, STR_LONGITUDE);
|
||||
displayGpsCoord(line, frskyData.hub.gpsLongitudeEW, frskyData.hub.gpsLongitude_bp, frskyData.hub.gpsLongitude_ap);
|
||||
displayGpsTime();
|
||||
line+=1*FH+1;
|
||||
if (field == TELEM_ACC) {
|
||||
lcd_putsLeft(7*FH+1, STR_ACCEL);
|
||||
lcd_outdezNAtt(4*FW, 7*FH+1, frskyData.hub.accelX, LEFT|PREC2);
|
||||
lcd_outdezNAtt(10*FW, 7*FH+1, frskyData.hub.accelY, LEFT|PREC2);
|
||||
lcd_outdezNAtt(16*FW, 7*FH+1, frskyData.hub.accelZ, LEFT|PREC2);
|
||||
break;
|
||||
}
|
||||
else if (field == TELEM_GPS_TIME) {
|
||||
displayGpsTime();
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
displayRssiLine();
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (field) {
|
||||
fields_count++;
|
||||
getvalue_t value = getValue(MIXSRC_FIRST_TELEM+field-2);
|
||||
uint8_t att = (i==3 ? NO_UNIT : DBLSIZE|NO_UNIT);
|
||||
#if LCD_W >= 212
|
||||
xcoord_t pos[] = {0, 71, 143, 214};
|
||||
#else
|
||||
xcoord_t pos[] = {0, 65, 130};
|
||||
#endif
|
||||
putsTelemetryChannel(pos[j+1]-2, 1+FH+2*FH*i, field-1, value, att);
|
||||
#if LCD_W < 212
|
||||
if (field >= TELEM_TM1 && field <= TELEM_TM2 && i!=3) {
|
||||
// there is not enough space on LCD for displaying "Tmr1" or "Tmr2", we write "T1" or "T2" instead
|
||||
field = field-TELEM_TM1+TELEM_T1;
|
||||
}
|
||||
#endif
|
||||
lcd_putsiAtt(pos[j], 1+FH+2*FH*i, STR_VTELEMCHNS, field, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Rssi
|
||||
lcd_putsLeft(line, STR_MINRSSI);
|
||||
lcd_puts(10*FW, line, STR_TX);
|
||||
lcd_outdezNAtt(lcdLastPos, line, frskyData.rssi[1].min, LEFT|LEADING0, 2);
|
||||
lcd_puts(16*FW, line, STR_RX);
|
||||
lcd_outdezNAtt(lcdLastPos, line, frskyData.rssi[0].min, LEFT|LEADING0, 2);
|
||||
lcd_status_line();
|
||||
if (fields_count == 0)
|
||||
putEvent(event == EVT_KEY_BREAK(KEY_UP) ? event : EVT_KEY_BREAK(KEY_DOWN));
|
||||
}
|
||||
}
|
||||
else if (s_frsky_view == e_frsky_voltages) {
|
||||
// Volts / Amps / Watts / mAh
|
||||
uint8_t analog = 0;
|
||||
lcd_putsiAtt(0, 2*FH, STR_VOLTSRC, g_model.frsky.voltsSource+1, 0);
|
||||
switch(g_model.frsky.voltsSource) {
|
||||
case 0:
|
||||
case 1:
|
||||
displayVoltageScreenLine(2*FH, g_model.frsky.voltsSource);
|
||||
analog = 1+g_model.frsky.voltsSource;
|
||||
break;
|
||||
#if defined(FRSKY_HUB)
|
||||
case 2:
|
||||
putsTelemetryChannel(3*FW+6*FW+4, FH+1, TELEM_VFAS-1, frskyData.hub.vfas, DBLSIZE);
|
||||
break;
|
||||
case 3:
|
||||
putsTelemetryChannel(3*FW+6*FW+4, FH+1, TELEM_CELLS_SUM-1, frskyData.hub.cellsSum, DBLSIZE);
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (g_model.frsky.currentSource) {
|
||||
lcd_putsiAtt(0, 4*FH, STR_VOLTSRC, g_model.frsky.currentSource, 0);
|
||||
switch(g_model.frsky.currentSource) {
|
||||
case 1:
|
||||
case 2:
|
||||
displayVoltageScreenLine(4*FH, g_model.frsky.currentSource-1);
|
||||
break;
|
||||
#if defined(FRSKY_HUB)
|
||||
case 3:
|
||||
putsTelemetryChannel(3*FW+6*FW+4, 3*FH+1, TELEM_CURRENT-1, frskyData.hub.current, DBLSIZE);
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
putsTelemetryChannel(4, 5*FH+1, TELEM_POWER-1, frskyData.power, LEFT|DBLSIZE);
|
||||
putsTelemetryChannel(3*FW+4+4*FW+6*FW+FW, 5*FH+1, TELEM_CONSUMPTION-1, frskyData.currentConsumption, DBLSIZE);
|
||||
}
|
||||
else {
|
||||
displayVoltageScreenLine(analog > 0 ? 5*FH : 4*FH, analog ? 2-analog : 0);
|
||||
if (analog == 0) displayVoltageScreenLine(6*FH, 1);
|
||||
}
|
||||
|
||||
#if defined(FRSKY_HUB)
|
||||
// Cells voltage
|
||||
if (frskyData.hub.cellsCount > 0) {
|
||||
uint8_t y = 1*FH;
|
||||
for (uint8_t k=0; k<frskyData.hub.cellsCount && k<6; k++) {
|
||||
uint8_t attr = (barsThresholds[THLD_CELL] && frskyData.hub.cellVolts[k] < barsThresholds[THLD_CELL]) ? BLINK|PREC2 : PREC2;
|
||||
lcd_outdezNAtt(LCD_W, y, frskyData.hub.cellVolts[k] * 2, attr, 4);
|
||||
y += 1*FH;
|
||||
}
|
||||
lcd_vline(LCD_W-3*FW-2, 8, 47);
|
||||
}
|
||||
#endif
|
||||
|
||||
displayRssiLine();
|
||||
}
|
||||
#if defined(FRSKY_HUB)
|
||||
else if (s_frsky_view == e_frsky_after_flight) {
|
||||
uint8_t line=1*FH+1;
|
||||
if (IS_USR_PROTO_FRSKY_HUB()) {
|
||||
// Latitude
|
||||
lcd_putsLeft(line, STR_LATITUDE);
|
||||
displayGpsCoord(line, frskyData.hub.gpsLatitudeNS, frskyData.hub.gpsLatitude_bp, frskyData.hub.gpsLatitude_ap);
|
||||
// Longitude
|
||||
line+=1*FH+1;
|
||||
lcd_putsLeft(line, STR_LONGITUDE);
|
||||
displayGpsCoord(line, frskyData.hub.gpsLongitudeEW, frskyData.hub.gpsLongitude_bp, frskyData.hub.gpsLongitude_ap);
|
||||
displayGpsTime();
|
||||
line+=1*FH+1;
|
||||
}
|
||||
// Rssi
|
||||
lcd_putsLeft(line, STR_MINRSSI);
|
||||
lcd_puts(10*FW, line, STR_TX);
|
||||
lcd_outdezNAtt(lcdLastPos, line, frskyData.rssi[1].min, LEFT|LEADING0, 2);
|
||||
lcd_puts(16*FW, line, STR_RX);
|
||||
lcd_outdezNAtt(lcdLastPos, line, frskyData.rssi[0].min, LEFT|LEADING0, 2);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
lcd_putsAtt(22, 40, STR_NODATA, DBLSIZE);
|
||||
}
|
||||
}
|
||||
|
||||
+9
-2
@@ -105,7 +105,9 @@ const pm_char * openLogs()
|
||||
f_puts("Date,Time,", &g_oLogFile);
|
||||
#endif
|
||||
|
||||
#if defined(FRSKY)
|
||||
#if defined(FRSKY_SPORT)
|
||||
f_puts("SWR,RSSI,A1,A2,", &g_oLogFile);
|
||||
#elif defined(FRSKY)
|
||||
f_puts("Buffer,RX,TX,A1,A2,", &g_oLogFile);
|
||||
#endif
|
||||
|
||||
@@ -170,8 +172,13 @@ void writeLogs()
|
||||
f_printf(&g_oLogFile, "%4d-%02d-%02d,%02d:%02d:%02d,", utm.tm_year+1900, utm.tm_mon+1, utm.tm_mday, utm.tm_hour, utm.tm_min, utm.tm_sec);
|
||||
#endif
|
||||
|
||||
#if defined(FRSKY)
|
||||
#if defined(FRSKY_SPORT)
|
||||
f_printf(&g_oLogFile, "%d,%d,", frskyData.rssi[1].value, frskyData.rssi[0].value);
|
||||
#elif defined(FRSKY)
|
||||
f_printf(&g_oLogFile, "%d,%d,%d,", frskyStreaming, frskyData.rssi[0].value, frskyData.rssi[1].value);
|
||||
#endif
|
||||
|
||||
#if defined(FRSKY)
|
||||
for (uint8_t i=0; i<2; i++) {
|
||||
int16_t converted_value = applyChannelRatio(i, frskyData.analog[i].value);
|
||||
f_printf(&g_oLogFile, "%d.%02d,", converted_value/100, converted_value%100);
|
||||
|
||||
+4
-11
@@ -1025,13 +1025,8 @@ bool __getSwitch(int8_t swtch)
|
||||
#if defined(FRSKY)
|
||||
// Telemetry
|
||||
if (cs->v1 >= MIXSRC_FIRST_TELEM) {
|
||||
#if defined(PCBTARANIS)
|
||||
if (frskyData.rssi[0].value == 0 && cs->v1 >= MIXSRC_FIRST_TELEM+TELEM_TM2)
|
||||
if (!TELEMETRY_STREAMING() && cs->v1 >= MIXSRC_FIRST_TELEM+TELEM_TM2)
|
||||
return swtch > 0 ? false : true;
|
||||
#else
|
||||
if (frskyStreaming <= 0 && cs->v1 >= MIXSRC_FIRST_TELEM+TELEM_TM2)
|
||||
return swtch > 0 ? false : true;
|
||||
#endif
|
||||
|
||||
y = convertCswTelemValue(cs);
|
||||
|
||||
@@ -3671,12 +3666,12 @@ void perMain()
|
||||
counter = 10;
|
||||
#if defined(PCBTARANIS)
|
||||
int32_t instant_vbat = anaIn(TX_VOLTAGE);
|
||||
instant_vbat = ( instant_vbat + instant_vbat*(g_eeGeneral.vBatCalib)/128 ) * BATT_SCALE;
|
||||
instant_vbat = (instant_vbat + instant_vbat*(g_eeGeneral.vBatCalib)/128) * BATT_SCALE;
|
||||
instant_vbat >>= 11;
|
||||
instant_vbat += 2; // because of the diode
|
||||
#elif defined(PCBSKY9X)
|
||||
int32_t instant_vbat = anaIn(TX_VOLTAGE);
|
||||
instant_vbat = ( instant_vbat + instant_vbat*(g_eeGeneral.vBatCalib)/128 ) * 4191;
|
||||
instant_vbat = (instant_vbat + instant_vbat*(g_eeGeneral.vBatCalib)/128) * 4191;
|
||||
instant_vbat /= 55296;
|
||||
#elif defined(PCBGRUVIN9X)
|
||||
uint16_t instant_vbat = anaIn(TX_VOLTAGE);
|
||||
@@ -3718,12 +3713,10 @@ void perMain()
|
||||
if (g_vbat100mV <= g_eeGeneral.vBatWarn && g_vbat100mV>50) {
|
||||
AUDIO_TX_BATTERY_LOW();
|
||||
}
|
||||
#if defined(CPUARM)
|
||||
#if defined(PCBSKY9X)
|
||||
else if (g_eeGeneral.temperatureWarn && getTemperature() >= g_eeGeneral.temperatureWarn) {
|
||||
AUDIO_TX_TEMP_HIGH();
|
||||
}
|
||||
#endif
|
||||
#if defined(PCBSKY9X)
|
||||
else if (g_eeGeneral.mAhWarn && (g_eeGeneral.mAhUsed + Current_used * (488 + g_eeGeneral.currentCalib)/8192/36) / 500 >= g_eeGeneral.mAhWarn) {
|
||||
AUDIO_TX_MAH_HIGH();
|
||||
}
|
||||
|
||||
+10
-1
@@ -1190,7 +1190,7 @@ inline bool isFunctionActive(uint8_t func)
|
||||
enum AUDIO_SOUNDS {
|
||||
AU_INACTIVITY,
|
||||
AU_TX_BATTERY_LOW,
|
||||
#if defined(CPUARM)
|
||||
#if defined(PCBSKY9X)
|
||||
AU_TX_MAH_HIGH,
|
||||
AU_TX_TEMP_HIGH,
|
||||
#endif
|
||||
@@ -1221,6 +1221,15 @@ enum AUDIO_SOUNDS {
|
||||
AU_TIMER_10,
|
||||
AU_TIMER_20,
|
||||
AU_TIMER_30,
|
||||
#if defined(PCBTARANIS)
|
||||
AU_A1_ORANGE,
|
||||
AU_A1_RED,
|
||||
AU_A2_ORANGE,
|
||||
AU_A2_RED,
|
||||
AU_RSSI_ORANGE,
|
||||
AU_RSSI_RED,
|
||||
AU_SWR_RED,
|
||||
#endif
|
||||
AU_FRSKY_FIRST,
|
||||
AU_FRSKY_BEEP1 = AU_FRSKY_FIRST,
|
||||
AU_FRSKY_BEEP2,
|
||||
|
||||
@@ -76,59 +76,43 @@ void setupPulses(unsigned int port)
|
||||
|
||||
switch (s_current_protocol[port]) { // stop existing protocol hardware
|
||||
case PROTO_PXX:
|
||||
#if defined(PCBTARANIS)
|
||||
disable_pxx(port);
|
||||
#else
|
||||
disable_pxx();
|
||||
#endif
|
||||
break;
|
||||
#if defined(DSM2)
|
||||
case PROTO_DSM2_LP45:
|
||||
case PROTO_DSM2_DSM2:
|
||||
case PROTO_DSM2_DSMX:
|
||||
disable_ssc();
|
||||
disable_dsm2();
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
#if defined(PCBTARANIS)
|
||||
case PROTO_PPM:
|
||||
disable_ppm(port);
|
||||
#else
|
||||
disable_main_ppm();
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
disable_no_pulses(port);
|
||||
break;
|
||||
}
|
||||
|
||||
s_current_protocol[port] = required_protocol;
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
switch (required_protocol) {
|
||||
switch (required_protocol) { // Start new protocol hardware here
|
||||
case PROTO_PXX:
|
||||
init_pxx(port);
|
||||
break;
|
||||
case PROTO_PPM:
|
||||
init_ppm(port);
|
||||
break;
|
||||
}
|
||||
#elif defined(PCBSKY9X)
|
||||
switch (required_protocol) { // Start new protocol hardware here
|
||||
case PROTO_PXX:
|
||||
init_main_ppm(5000, 0); // Initial period 2.5 mS, output off
|
||||
init_ssc();
|
||||
break;
|
||||
#if defined(DSM2)
|
||||
case PROTO_DSM2_LP45:
|
||||
case PROTO_DSM2_DSM2:
|
||||
case PROTO_DSM2_DSMX:
|
||||
init_main_ppm(5000, 0); // Initial period 2.5 mS, output off
|
||||
init_ssc();
|
||||
init_dsm2(port);
|
||||
break;
|
||||
case PROTO_NONE:
|
||||
init_main_ppm(3000, 0); // Initial period 1.5 mS, output off
|
||||
#endif
|
||||
case PROTO_PPM:
|
||||
init_ppm(port);
|
||||
break;
|
||||
default:
|
||||
init_main_ppm(3000, 1); // Initial period 1.5 mS, output on
|
||||
init_no_pulses(port);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// Set up output data here
|
||||
@@ -143,12 +127,10 @@ void setupPulses(unsigned int port)
|
||||
setupPulsesDsm2(6);
|
||||
break;
|
||||
#endif
|
||||
#if defined(PCBTARANIS)
|
||||
case PROTO_PPM:
|
||||
#else
|
||||
default:
|
||||
#endif
|
||||
setupPulsesPPM(port); // Don't enable interrupts through here
|
||||
setupPulsesPPM(port);
|
||||
break ;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,12 +64,7 @@ inline void startPulses()
|
||||
|
||||
inline bool pulsesStarted() { return s_current_protocol[0] != 255; }
|
||||
inline void pausePulses() { s_pulses_paused = true; }
|
||||
inline void resumePulses() {
|
||||
s_pulses_paused = false;
|
||||
#if defined(PCBTARANIS)
|
||||
startPulses(); //TODO delete
|
||||
#endif
|
||||
}
|
||||
inline void resumePulses() { s_pulses_paused = false; }
|
||||
|
||||
#define SEND_FAILSAFE_NOW(idx) failsafeCounter[idx] = 1
|
||||
|
||||
|
||||
+1
-1
@@ -380,7 +380,7 @@ int main(int argc,char **argv)
|
||||
th9xSim->show(); // Otherwise the main window gets centred across my two monitors, split down the middle.
|
||||
#endif
|
||||
|
||||
#ifdef FRSKY
|
||||
#if defined(FRSKY) && !defined(FRSKY_SPORT)
|
||||
frskyStreaming = 1;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -758,8 +758,8 @@ void usbBootloader()
|
||||
PWM->PWM_DIS = PWM_DIS_CHID0 | PWM_DIS_CHID1 | PWM_DIS_CHID2 | PWM_DIS_CHID3 ; // Disable all
|
||||
NVIC_DisableIRQ(TC2_IRQn) ;
|
||||
|
||||
disable_main_ppm() ;
|
||||
disable_ppm2();
|
||||
disable_ppm(0);
|
||||
disable_ppm(1);
|
||||
|
||||
// PWM->PWM_IDR1 = PWM_IDR1_CHID3 ;
|
||||
// NVIC_DisableIRQ(PWM_IRQn) ;
|
||||
|
||||
@@ -162,13 +162,17 @@ extern uint32_t readKeys();
|
||||
#define DBLKEYS_PRESSED_LFT_DWN(i) ((in & (0x40 + 0x08)) == (0x40 + 0x08))
|
||||
|
||||
// Pulses driver
|
||||
#define init_no_pulses(port) init_main_ppm(3000, 0)
|
||||
#define disable_no_pulses(port) disable_ppm(0)
|
||||
void init_main_ppm(uint32_t period, uint32_t out_enable);
|
||||
void disable_main_ppm();
|
||||
void disable_ppm2();
|
||||
#define init_ppm(port) init_main_ppm(3000, 1)
|
||||
void disable_ppm(uint32_t port);
|
||||
void init_ssc();
|
||||
void disable_ssc();
|
||||
#define disable_pxx() disable_ssc()
|
||||
void setupPulsesPPM(unsigned int port);
|
||||
#define init_pxx(port) init_main_ppm(5000, 0); init_ssc()
|
||||
#define disable_pxx(port) disable_ssc()
|
||||
#define init_dsm2(port) init_main_ppm(5000, 0); init_ssc()
|
||||
#define disable_dsm2(port) disable_ssc()
|
||||
|
||||
// SD driver
|
||||
#if !defined(SIMU)
|
||||
|
||||
@@ -44,7 +44,7 @@ extern uint8_t Bit_pulses[64] ; // Likely more than we
|
||||
extern uint8_t Serial_byte_count ;
|
||||
|
||||
|
||||
void init_main_ppm( uint32_t period, uint32_t out_enable )
|
||||
void init_main_ppm(uint32_t period, uint32_t out_enable)
|
||||
{
|
||||
register Pio *pioptr ;
|
||||
register Pwm *pwmptr ;
|
||||
@@ -91,25 +91,22 @@ void init_main_ppm( uint32_t period, uint32_t out_enable )
|
||||
NVIC_EnableIRQ(PWM_IRQn) ;
|
||||
}
|
||||
|
||||
void disable_main_ppm()
|
||||
void disable_ppm(uint32_t port)
|
||||
{
|
||||
register Pio *pioptr ;
|
||||
|
||||
pioptr = PIOA ;
|
||||
pioptr->PIO_PER = PIO_PA17 ; // Assign A17 to PIO
|
||||
if (port == 0) {
|
||||
pioptr = PIOA ;
|
||||
pioptr->PIO_PER = PIO_PA17 ; // Assign A17 to PIO
|
||||
PWM->PWM_IDR1 = PWM_IDR1_CHID3 ;
|
||||
}
|
||||
else {
|
||||
pioptr = PIOC ;
|
||||
pioptr->PIO_PER = PIO_PC17 ; // Assign A17 to PIO
|
||||
|
||||
PWM->PWM_IDR1 = PWM_IDR1_CHID3 ;
|
||||
}
|
||||
|
||||
void disable_ppm2()
|
||||
{
|
||||
register Pio *pioptr ;
|
||||
|
||||
pioptr = PIOC ;
|
||||
pioptr->PIO_PER = PIO_PC17 ; // Assign A17 to PIO
|
||||
|
||||
PWM->PWM_IDR1 = PWM_IDR1_CHID1 ;
|
||||
NVIC_DisableIRQ(PWM_IRQn) ;
|
||||
PWM->PWM_IDR1 = PWM_IDR1_CHID1 ;
|
||||
NVIC_DisableIRQ(PWM_IRQn) ;
|
||||
}
|
||||
}
|
||||
|
||||
// Initialise the SSC to allow PXX output.
|
||||
|
||||
@@ -89,7 +89,7 @@ uint8_t usbPlugged(void);
|
||||
|
||||
void delaysInit();
|
||||
|
||||
#define DEBUG_UART_BAUDRATE 115200
|
||||
#define DEBUG_UART_BAUDRATE 9600
|
||||
#define SPORT_BAUDRATE 57600
|
||||
|
||||
void uartInit(uint32_t baudrate);
|
||||
|
||||
@@ -110,7 +110,6 @@ static void init_pa10_none()
|
||||
INTERNAL_RF_OFF();
|
||||
|
||||
// Timer1, channel 3
|
||||
|
||||
GPIO_InitTypeDef GPIO_InitStructure;
|
||||
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIO_INTPPM, ENABLE);
|
||||
|
||||
@@ -121,7 +120,7 @@ static void init_pa10_none()
|
||||
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
|
||||
GPIO_Init(GPIO_INTPPM, &GPIO_InitStructure);
|
||||
|
||||
GPIO_SetBits(GPIO_INTPPM,PIN_INTPPM_OUT) ; // Set high
|
||||
GPIO_SetBits(GPIO_INTPPM, PIN_INTPPM_OUT) ; // Set high
|
||||
|
||||
RCC->APB2ENR |= RCC_APB2ENR_TIM1EN ; // Enable clock
|
||||
|
||||
@@ -170,7 +169,7 @@ static void init_pa7_none()
|
||||
|
||||
RCC->APB2ENR |= RCC_APB2ENR_TIM8EN ; // Enable clock
|
||||
|
||||
TIM1->CR1 &= ~TIM_CR1_CEN ;
|
||||
TIM8->CR1 &= ~TIM_CR1_CEN ;
|
||||
TIM8->ARR = 36000 ; // 18mS
|
||||
TIM8->CCR2 = 32000 ; // Update time
|
||||
TIM8->PSC = (PERI2_FREQUENCY * TIMER_MULT_APB2) / 2000000 - 1 ; // 0.5uS from 30MHz
|
||||
@@ -326,12 +325,15 @@ extern "C" void TIM1_CC_IRQHandler()
|
||||
TIM1->CCR3 = pxxStream[INTERNAL_MODULE][0];
|
||||
TIM1->DIER |= TIM_DIER_CC2IE ; // Enable this interrupt
|
||||
}
|
||||
else {
|
||||
else if (s_current_protocol[INTERNAL_MODULE] == PROTO_PPM) {
|
||||
ppmStreamPtr[INTERNAL_MODULE] = ppmStream[INTERNAL_MODULE];
|
||||
TIM1->DIER |= TIM_DIER_UDE ;
|
||||
TIM1->SR &= ~TIM_SR_UIF ; // Clear this flag
|
||||
TIM1->DIER |= TIM_DIER_UIE ; // Enable this interrupt
|
||||
}
|
||||
else {
|
||||
TIM1->DIER |= TIM_DIER_CC2IE ; // Enable this interrupt
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" void TIM1_UP_TIM10_IRQHandler()
|
||||
|
||||
@@ -60,7 +60,7 @@ void uartInit(uint32_t baudrate)
|
||||
USART_InitStructure.USART_StopBits = USART_StopBits_1;
|
||||
USART_InitStructure.USART_Parity = USART_Parity_No;
|
||||
USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
|
||||
USART_InitStructure.USART_Mode = USART_Mode_Tx;
|
||||
USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;
|
||||
|
||||
USART_Init(UART3, &USART_InitStructure);
|
||||
USART_Cmd(UART3, ENABLE);
|
||||
|
||||
@@ -61,7 +61,7 @@ uint8_t frskyTxBuffer[FRSKY_TX_PACKET_SIZE]; // Ditto for transmit buffer
|
||||
#if !defined(CPUARM)
|
||||
uint8_t frskyTxBufferCount = 0;
|
||||
#endif
|
||||
int8_t frskyStreaming = -1;
|
||||
uint8_t frskyStreaming = 0;
|
||||
#if defined(WS_HOW_HIGH)
|
||||
uint8_t frskyUsrStreaming = 0;
|
||||
#endif
|
||||
|
||||
@@ -179,7 +179,8 @@ struct FrskyData {
|
||||
};
|
||||
|
||||
// Global Fr-Sky telemetry data variables
|
||||
extern int8_t frskyStreaming; // >0 (true) == data is streaming in. 0 = nodata detected for some time
|
||||
extern uint8_t frskyStreaming; // >0 (true) == data is streaming in. 0 = nodata detected for some time
|
||||
|
||||
#if defined(WS_HOW_HIGH)
|
||||
extern uint8_t frskyUsrStreaming;
|
||||
#endif
|
||||
@@ -213,5 +214,7 @@ void resetTelemetry();
|
||||
#define TELEMETRY_GPS_SPEED_BP frskyData.hub.gpsSpeed_bp
|
||||
#define TELEMETRY_GPS_SPEED_AP frskyData.hub.gpsSpeed_ap
|
||||
|
||||
#define TELEMETRY_STREAMING() (frskyStreaming > 0)
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -225,7 +225,14 @@
|
||||
#define TR_FUNCSOUNDS "Beep1 ""Beep2 ""Beep3 ""Warn1 ""Warn2 ""Cheep ""Ring ""SciFi ""Robot ""Chirp ""Tada ""Crickt""Siren ""AlmClk""Ratata""Tick "
|
||||
|
||||
#define LEN_VTELEMCHNS "\004"
|
||||
#define TR_VTELEMCHNS "---\0""Batt""Tmr1""Tmr2""Tx\0 ""Rx\0 ""A1\0 ""A2\0 ""Alt\0""Rpm\0""Fuel""T1\0 ""T2\0 ""Spd\0""Dist""GAlt""Cell""Cels""Vfas""Curr""Cnsp""Powr""AccX""AccY""AccZ""Hdg\0""VSpd""A1-\0""A2-\0""Alt-""Alt+""Rpm+""T1+\0""T2+\0""Spd+""Dst+""Cur+""Acc\0""Time"
|
||||
#if defined(PCBTARANIS)
|
||||
#define TR_RSSI_0 "SWR\0"
|
||||
#define TR_RSSI_1 "RSSI"
|
||||
#else
|
||||
#define TR_RSSI_0 "Tx\0 "
|
||||
#define TR_RSSI_1 "Rx\0 "
|
||||
#endif
|
||||
#define TR_VTELEMCHNS "---\0""Batt""Tmr1""Tmr2" TR_RSSI_0 TR_RSSI_1 "A1\0 ""A2\0 ""Alt\0""Rpm\0""Fuel""T1\0 ""T2\0 ""Spd\0""Dist""GAlt""Cell""Cels""Vfas""Curr""Cnsp""Powr""AccX""AccY""AccZ""Hdg\0""VSpd""A1-\0""A2-\0""Alt-""Alt+""Rpm+""T1+\0""T2+\0""Spd+""Dst+""Cur+""Acc\0""Time"
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define LEN_VTELEMUNIT_NORM "\003"
|
||||
|
||||
Reference in New Issue
Block a user