[stock] around 200bytes flash saving
[all] WSHH used for vario - not tested at all [all] correction for d>=ofs used with timers [sky9x/gruvin9x] SD needs 2/3 files opened in the same time [sky9x] low speed SD when high speed not allowed
This commit is contained in:
+5
-1
@@ -197,8 +197,12 @@ extern "C" {
|
||||
/ ff_req_grant, ff_rel_grant, ff_del_syncobj and ff_cre_syncobj
|
||||
/ function must be added to the project. */
|
||||
|
||||
#if defined(PCBARM)
|
||||
#define _FS_SHARE 3 /* 0:Disable or >=1:Enable */
|
||||
#else
|
||||
#define _FS_SHARE 2 /* 0:Disable or >=1:Enable */
|
||||
#endif
|
||||
|
||||
#define _FS_SHARE 0 /* 0:Disable or >=1:Enable */
|
||||
/* To enable file shareing feature, set _FS_SHARE to 1 or greater. The value
|
||||
defines how many files can be opened simultaneously. */
|
||||
|
||||
|
||||
+24
-3
@@ -86,6 +86,8 @@ uint32_t Sd_rca ;
|
||||
uint32_t Cmd_8_resp ;
|
||||
uint32_t Cmd_A41_resp ;
|
||||
uint8_t cardType;
|
||||
const uint8_t SpeedTable[] = { 1, 10, 12, 13, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 70, 80 } ;
|
||||
uint32_t sdSpeedAllowed ;
|
||||
|
||||
/*-----------------------------------------------------------------------*/
|
||||
/* Lock / unlock functions */
|
||||
@@ -144,7 +146,8 @@ uint32_t sdSetSpeed(uint32_t mciSpeed )
|
||||
|
||||
/* Actual MCI speed */
|
||||
mciSpeed = Master_frequency / 2 / (clkdiv + 1);
|
||||
/* Modify MR */HSMCI->HSMCI_MR = mciMr | clkdiv;
|
||||
/* Modify MR */
|
||||
HSMCI->HSMCI_MR = mciMr | clkdiv;
|
||||
|
||||
return mciSpeed;
|
||||
}
|
||||
@@ -363,6 +366,24 @@ const char * sdCmd9()
|
||||
Card_CSD[1] = phsmci->HSMCI_RSPR[1] ;
|
||||
Card_CSD[2] = phsmci->HSMCI_RSPR[2] ;
|
||||
Card_CSD[3] = phsmci->HSMCI_RSPR[3] ;
|
||||
|
||||
// Calc transmission speed
|
||||
uint32_t i = Card_CSD[0] & 0x0000007F ;
|
||||
uint32_t j ;
|
||||
j = i >> 3 ;
|
||||
j = SpeedTable[j] ;
|
||||
j *= 10000 ;
|
||||
i &= 7 ;
|
||||
if ( i-- )
|
||||
j *= 10 ;
|
||||
if ( i-- )
|
||||
j *= 10 ;
|
||||
if ( i )
|
||||
j *= 10 ;
|
||||
if ( j > 9000000 )
|
||||
j = 9000000 ;
|
||||
sdSpeedAllowed = j ;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -452,8 +473,8 @@ const char * sdAcmd6()
|
||||
if (result)
|
||||
return result;
|
||||
|
||||
sdSetBusWidth( HSMCI_SDCR_SDCBUS_4 ) ;
|
||||
sdSetSpeed(9000000);
|
||||
sdSetBusWidth(HSMCI_SDCR_SDCBUS_4);
|
||||
sdSetSpeed(sdSpeedAllowed);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
+5
-2
@@ -270,7 +270,7 @@ void parseTelemHubByte(uint8_t byte)
|
||||
// First received barometer altitude => Altitude offset
|
||||
if (!frskyData.hub.baroAltitudeOffset)
|
||||
frskyData.hub.baroAltitudeOffset = -frskyData.hub.baroAltitude_bp;
|
||||
if (g_model.frsky.varioSource == VARIO_SOURCE_BARO_V1) {
|
||||
if (g_model.frsky.usrProto == USR_PROTO_FRSKY_HUB && g_model.frsky.varioSource == VARIO_SOURCE_DATA) {
|
||||
evalVario(frskyData.hub.baroAltitude_bp, 0);
|
||||
}
|
||||
frskyData.hub.baroAltitude_bp += frskyData.hub.baroAltitudeOffset;
|
||||
@@ -278,7 +278,7 @@ void parseTelemHubByte(uint8_t byte)
|
||||
break;
|
||||
|
||||
case offsetof(FrskyHubData, baroAltitude_ap):
|
||||
if (g_model.frsky.varioSource == VARIO_SOURCE_BARO_V2) {
|
||||
if (g_model.frsky.usrProto == USR_PROTO_HALCYON && g_model.frsky.varioSource == VARIO_SOURCE_DATA) {
|
||||
evalVario(frskyData.hub.baroAltitude_bp-frskyData.hub.baroAltitudeOffset, frskyData.hub.baroAltitude_ap);
|
||||
}
|
||||
break;
|
||||
@@ -347,6 +347,9 @@ void parseTelemWSHowHighByte(uint8_t byte)
|
||||
if (frskyUsrStreaming < (FRSKY_TIMEOUT10ms*3 - 10)) {
|
||||
((uint8_t*)&frskyData.hub)[offsetof(FrskyHubData, baroAltitude_bp)] = byte;
|
||||
checkMinMaxAltitude();
|
||||
if (g_model.frsky.varioSource == VARIO_SOURCE_DATA) {
|
||||
evalVario(frskyData.hub.baroAltitude_bp, 0);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// At least 100mS passed since last data received
|
||||
|
||||
+10
-21
@@ -234,7 +234,7 @@ bool check(uint8_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTa
|
||||
int8_t maxcol = MAXCOL(m_posVert);
|
||||
|
||||
#if defined(ROTARY_ENCODERS)
|
||||
if (!(s_warning || s_sdcard_error || s_menu_count))
|
||||
if (!(s_warning || s_menu_count))
|
||||
check_rotary_encoder();
|
||||
if (m_posVert < 0 && (event==EVT_KEY_FIRST(BTN_REa) || event==EVT_KEY_FIRST(BTN_REb) || event==EVT_KEY_FIRST(KEY_MENU))) {
|
||||
popMenu();
|
||||
@@ -526,12 +526,13 @@ void pushMenu(MenuFuncP newMenu)
|
||||
(*newMenu)(EVT_ENTRY);
|
||||
}
|
||||
|
||||
const pm_char * s_global_warning = 0;
|
||||
const pm_char * s_warning = 0;
|
||||
const pm_char * s_warning_info;
|
||||
uint8_t s_warning_info_len;
|
||||
// uint8_t s_warning_info_att not needed now
|
||||
uint8_t s_confirmation = 0;
|
||||
uint8_t s_warning_type;
|
||||
uint8_t s_warning_result = 0;
|
||||
const pm_char * s_global_warning = 0;
|
||||
|
||||
void displayBox()
|
||||
{
|
||||
@@ -551,33 +552,21 @@ void displayPopup(const pm_char * pstr)
|
||||
|
||||
void displayWarning(uint8_t event)
|
||||
{
|
||||
if (s_warning) {
|
||||
displayBox();
|
||||
lcd_puts(16, 5*FH, STR_EXIT);
|
||||
switch(event) {
|
||||
case EVT_KEY_FIRST(KEY_EXIT):
|
||||
killEvents(event);
|
||||
s_warning = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void displayConfirmation(uint8_t event)
|
||||
{
|
||||
s_confirmation = false;
|
||||
s_warning_result = false;
|
||||
displayBox();
|
||||
if (s_warning_info)
|
||||
lcd_putsnAtt(16, 4*FH, s_warning_info, s_warning_info_len, ZCHAR);
|
||||
lcd_puts(16, 5*FH, STR_POPUPS);
|
||||
|
||||
lcd_puts(16, 5*FH, s_warning_type == WARNING_TYPE_CONFIRM ? STR_POPUPS : STR_EXIT);
|
||||
switch(event) {
|
||||
case EVT_KEY_FIRST(KEY_MENU):
|
||||
s_confirmation = true;
|
||||
if (s_warning_type == WARNING_TYPE_ASTERISK)
|
||||
break;
|
||||
s_warning_result = true;
|
||||
// no break
|
||||
case EVT_KEY_FIRST(KEY_EXIT):
|
||||
killEvents(event);
|
||||
s_warning = 0;
|
||||
s_warning_type = WARNING_TYPE_ASTERISK;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
+8
-5
@@ -207,16 +207,20 @@ int8_t selectMenuItem(uint8_t x, uint8_t y, const pm_char *label, const pm_char
|
||||
uint8_t onoffMenuItem(uint8_t value, uint8_t x, uint8_t y, const pm_char *label, uint8_t attr, uint8_t event );
|
||||
int8_t switchMenuItem(uint8_t x, uint8_t y, int8_t value, uint8_t attr, uint8_t event);
|
||||
|
||||
extern const pm_char * s_global_warning;
|
||||
#define WARNING_TYPE_ASTERISK 0
|
||||
#define WARNING_TYPE_CONFIRM 1
|
||||
|
||||
extern const pm_char * s_warning;
|
||||
extern const pm_char * s_warning_info;
|
||||
extern uint8_t s_warning_info_len;
|
||||
extern uint8_t s_confirmation;
|
||||
extern uint8_t s_warning_result;
|
||||
extern uint8_t s_warning_type;
|
||||
|
||||
extern const pm_char * s_global_warning;
|
||||
|
||||
void displayBox();
|
||||
void displayPopup(const pm_char * pstr);
|
||||
void displayWarning(uint8_t event);
|
||||
void displayConfirmation(uint8_t event);
|
||||
|
||||
#if defined(SDCARD)
|
||||
#define MENU_MAX_LINES 4
|
||||
@@ -233,14 +237,13 @@ extern uint8_t s_menu_flags;
|
||||
extern uint8_t s_menu_offset;
|
||||
extern bool s_menu_more;
|
||||
const char * displayMenu(uint8_t event);
|
||||
extern const pm_char * s_sdcard_error;
|
||||
|
||||
#define STATUS_LINE_LENGTH 22
|
||||
extern char statusLineMsg[STATUS_LINE_LENGTH];
|
||||
void showStatusLine();
|
||||
void drawStatusLine();
|
||||
#else
|
||||
#define s_menu_count 0
|
||||
#define s_sdcard_error 0
|
||||
#define drawStatusLine()
|
||||
#endif
|
||||
|
||||
|
||||
+35
-65
@@ -127,9 +127,6 @@ inline uint8_t eeFindEmptyModel(uint8_t id, bool down)
|
||||
}
|
||||
|
||||
#if defined(SDCARD)
|
||||
// TODO to be elsewhere if common to many menus
|
||||
const pm_char * s_sdcard_error = NULL;
|
||||
|
||||
bool listSdFiles(const char *path, const char *extension)
|
||||
{
|
||||
FILINFO fno;
|
||||
@@ -199,25 +196,23 @@ void menuProcModelSelect(uint8_t event)
|
||||
#define refresh event
|
||||
#endif
|
||||
|
||||
if (s_confirmation) {
|
||||
if (s_warning_result) {
|
||||
eeDeleteModel(m_posVert); // delete file
|
||||
s_confirmation = 0;
|
||||
s_warning_result = 0;
|
||||
s_copyMode = 0;
|
||||
event = EVT_ENTRY_UP;
|
||||
}
|
||||
|
||||
#if defined(SDCARD)
|
||||
uint8_t _event = event;
|
||||
if (s_warning || s_sdcard_error || s_menu_count) {
|
||||
_event = 0;
|
||||
if (s_menu_count) {
|
||||
event = 0;
|
||||
}
|
||||
#else
|
||||
uint8_t _event = s_warning ? 0 : event;
|
||||
#endif
|
||||
uint8_t _event_ = (IS_RE_NAVIGATION_EVT(_event) ? 0 : _event);
|
||||
uint8_t _event_ = (IS_RE_NAVIGATION_EVT(event) ? 0 : event);
|
||||
|
||||
if (s_copyMode || !eeModelExists(g_eeGeneral.currModel)) {
|
||||
if ((_event & 0x1f) == KEY_EXIT)
|
||||
if ((event & 0x1f) == KEY_EXIT)
|
||||
_event_ -= KEY_EXIT;
|
||||
}
|
||||
|
||||
@@ -250,7 +245,7 @@ void menuProcModelSelect(uint8_t event)
|
||||
}
|
||||
#endif
|
||||
|
||||
switch(_event)
|
||||
switch(event)
|
||||
{
|
||||
case EVT_ENTRY:
|
||||
m_posVert = sub = g_eeGeneral.currModel;
|
||||
@@ -261,7 +256,8 @@ void menuProcModelSelect(uint8_t event)
|
||||
case EVT_KEY_LONG(KEY_EXIT):
|
||||
if (s_copyMode && s_copyTgtOfs == 0 && g_eeGeneral.currModel != sub && eeModelExists(sub)) {
|
||||
s_warning = STR_DELETEMODEL;
|
||||
killEvents(_event);
|
||||
s_warning_type = WARNING_TYPE_CONFIRM;
|
||||
killEvents(event);
|
||||
break;
|
||||
}
|
||||
// no break
|
||||
@@ -269,18 +265,18 @@ void menuProcModelSelect(uint8_t event)
|
||||
if (s_copyMode) {
|
||||
sub = m_posVert = (s_copyMode == MOVE_MODE || s_copySrcRow<0) ? (MAX_MODELS+sub+s_copyTgtOfs) % MAX_MODELS : s_copySrcRow;
|
||||
s_copyMode = 0;
|
||||
killEvents(_event);
|
||||
killEvents(event);
|
||||
}
|
||||
break;
|
||||
#if defined(ROTARY_ENCODERS)
|
||||
case EVT_KEY_BREAK(BTN_REa):
|
||||
case EVT_KEY_BREAK(BTN_REb):
|
||||
if (navigationRotaryEncoder(_event))
|
||||
if (navigationRotaryEncoder(event))
|
||||
s_editMode = (s_editMode == 0 && sub == g_eeGeneral.currModel) ? -1 : 0;
|
||||
break;
|
||||
case EVT_KEY_LONG(BTN_REa):
|
||||
case EVT_KEY_LONG(BTN_REb):
|
||||
if (!navigationRotaryEncoder(_event))
|
||||
if (!navigationRotaryEncoder(event))
|
||||
break;
|
||||
#endif
|
||||
case EVT_KEY_LONG(KEY_MENU):
|
||||
@@ -316,7 +312,7 @@ void menuProcModelSelect(uint8_t event)
|
||||
s_copyMode = 0;
|
||||
event = EVT_ENTRY_UP;
|
||||
}
|
||||
else if (_event == EVT_KEY_LONG(KEY_MENU) || IS_RE_NAVIGATION_EVT_TYPE(_event, EVT_KEY_LONG)) {
|
||||
else if (event == EVT_KEY_LONG(KEY_MENU) || IS_RE_NAVIGATION_EVT_TYPE(event, EVT_KEY_LONG)) {
|
||||
s_copyMode = 0;
|
||||
killEvents(event);
|
||||
#if defined(SDCARD)
|
||||
@@ -356,7 +352,7 @@ void menuProcModelSelect(uint8_t event)
|
||||
case EVT_KEY_FIRST(KEY_LEFT):
|
||||
case EVT_KEY_FIRST(KEY_RIGHT):
|
||||
if (sub == g_eeGeneral.currModel) {
|
||||
chainMenu(_event == EVT_KEY_FIRST(KEY_RIGHT) ? menuProcModel : menuTabModel[DIM(menuTabModel)-1]);
|
||||
chainMenu(event == EVT_KEY_FIRST(KEY_RIGHT) ? menuProcModel : menuTabModel[DIM(menuTabModel)-1]);
|
||||
return;
|
||||
}
|
||||
AUDIO_WARNING2();
|
||||
@@ -364,14 +360,14 @@ void menuProcModelSelect(uint8_t event)
|
||||
case EVT_KEY_FIRST(KEY_UP):
|
||||
case EVT_KEY_FIRST(KEY_DOWN):
|
||||
if (s_copyMode) {
|
||||
int8_t next_ofs = (_event == EVT_KEY_FIRST(KEY_UP) ? s_copyTgtOfs+1 : s_copyTgtOfs-1);
|
||||
int8_t next_ofs = (event == EVT_KEY_FIRST(KEY_UP) ? s_copyTgtOfs+1 : s_copyTgtOfs-1);
|
||||
if (next_ofs == MAX_MODELS || next_ofs == -MAX_MODELS)
|
||||
next_ofs = 0;
|
||||
|
||||
if (s_copySrcRow < 0 && s_copyMode==COPY_MODE) {
|
||||
s_copySrcRow = oldSub;
|
||||
// find a hole (in the first empty slot above / below)
|
||||
m_posVert = eeFindEmptyModel(s_copySrcRow, _event==EVT_KEY_FIRST(KEY_DOWN));
|
||||
m_posVert = eeFindEmptyModel(s_copySrcRow, event==EVT_KEY_FIRST(KEY_DOWN));
|
||||
if ((uint8_t)m_posVert == 0xff) {
|
||||
// no free room for duplicating the model
|
||||
AUDIO_ERROR();
|
||||
@@ -382,7 +378,7 @@ void menuProcModelSelect(uint8_t event)
|
||||
sub = m_posVert;
|
||||
}
|
||||
s_copyTgtOfs = next_ofs;
|
||||
killEvents(_event);
|
||||
killEvents(event);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -449,22 +445,14 @@ void menuProcModelSelect(uint8_t event)
|
||||
s_warning_info = name;
|
||||
#endif
|
||||
s_warning_info_len = sizeof(g_model.name);
|
||||
displayConfirmation(event);
|
||||
displayWarning(event);
|
||||
}
|
||||
|
||||
#if defined(SDCARD)
|
||||
REFRESH(false);
|
||||
if (s_sdcard_error) {
|
||||
s_warning = s_sdcard_error;
|
||||
displayWarning(event);
|
||||
if (s_warning)
|
||||
s_warning = NULL;
|
||||
else
|
||||
s_sdcard_error = NULL;
|
||||
}
|
||||
|
||||
if (s_menu_count) {
|
||||
const char * result = displayMenu(event);
|
||||
const char * result = displayMenu(_event);
|
||||
if (result) {
|
||||
REFRESH(true);
|
||||
if (result == STR_SELECT_MODEL || result == STR_CREATE_MODEL) {
|
||||
@@ -479,21 +467,22 @@ void menuProcModelSelect(uint8_t event)
|
||||
}
|
||||
else if (result == STR_BACKUP_MODEL) {
|
||||
eeCheck(true); // force writing of current model data before this is changed
|
||||
s_sdcard_error = eeBackupModel(sub);
|
||||
s_warning = eeBackupModel(sub);
|
||||
}
|
||||
else if (result == STR_RESTORE_MODEL || result == STR_UPDATE_LIST) {
|
||||
if (!listSdFiles(MODELS_PATH, MODELS_EXT)) {
|
||||
s_sdcard_error = STR_NO_MODELS_ON_SD;
|
||||
s_warning = STR_NO_MODELS_ON_SD;
|
||||
s_menu_flags = 0;
|
||||
}
|
||||
}
|
||||
else if (result == STR_DELETE_MODEL) {
|
||||
s_warning = STR_DELETEMODEL;
|
||||
s_warning_type = WARNING_TYPE_CONFIRM;
|
||||
}
|
||||
else {
|
||||
// The user choosed a file on SD to restore
|
||||
s_sdcard_error = eeRestoreModel(sub, (char *)result);
|
||||
if (!s_sdcard_error && g_eeGeneral.currModel == sub)
|
||||
s_warning = eeRestoreModel(sub, (char *)result);
|
||||
if (!s_warning && g_eeGeneral.currModel == sub)
|
||||
eeLoadModel(sub);
|
||||
}
|
||||
}
|
||||
@@ -1776,9 +1765,8 @@ static uint8_t s_copySrcCh;
|
||||
#define EXPO_LINE_SELECT_POS 18
|
||||
#endif
|
||||
|
||||
void menuProcExpoMix(uint8_t expo, uint8_t _event_)
|
||||
void menuProcExpoMix(uint8_t expo, uint8_t _event)
|
||||
{
|
||||
uint8_t _event = (s_warning ? 0 : _event_);
|
||||
uint8_t event = _event;
|
||||
uint8_t key = (event & 0x1f);
|
||||
|
||||
@@ -2043,7 +2031,6 @@ void menuProcExpoMix(uint8_t expo, uint8_t _event_)
|
||||
}
|
||||
s_maxLines = cur;
|
||||
if (sub >= s_maxLines-1) m_posVert = s_maxLines-1;
|
||||
displayWarning(_event_);
|
||||
}
|
||||
|
||||
void menuProcExposAll(uint8_t event)
|
||||
@@ -2104,10 +2091,8 @@ enum LimitsItems {
|
||||
#endif
|
||||
|
||||
|
||||
void menuProcLimits(uint8_t _event)
|
||||
void menuProcLimits(uint8_t event)
|
||||
{
|
||||
uint8_t event = (s_warning ? 0 : _event);
|
||||
|
||||
MENU(STR_MENULIMITS, menuTabModel, e_Limits, 1+NUM_CHNOUT+1, {0, ITEM_LIMITS_MAXROW, ITEM_LIMITS_MAXROW, ITEM_LIMITS_MAXROW, ITEM_LIMITS_MAXROW, ITEM_LIMITS_MAXROW, ITEM_LIMITS_MAXROW, ITEM_LIMITS_MAXROW, ITEM_LIMITS_MAXROW, ITEM_LIMITS_MAXROW, ITEM_LIMITS_MAXROW, ITEM_LIMITS_MAXROW, ITEM_LIMITS_MAXROW, ITEM_LIMITS_MAXROW, ITEM_LIMITS_MAXROW, ITEM_LIMITS_MAXROW, ITEM_LIMITS_MAXROW, 0});
|
||||
|
||||
uint8_t sub = m_posVert - 1;
|
||||
@@ -2121,10 +2106,10 @@ void menuProcLimits(uint8_t _event)
|
||||
#endif
|
||||
}
|
||||
|
||||
if (s_confirmation) {
|
||||
if (s_warning_result) {
|
||||
LimitData *ld = limitaddress(sub);
|
||||
ld->revert = !ld->revert;
|
||||
s_confirmation = 0;
|
||||
s_warning_result = 0;
|
||||
AUDIO_WARNING2();
|
||||
}
|
||||
|
||||
@@ -2238,8 +2223,8 @@ void menuProcLimits(uint8_t _event)
|
||||
bool revert_new = checkIncDecModel(event, ld->revert, 0, 1);
|
||||
if (checkIncDec_Ret && thrOutput(k)) {
|
||||
s_warning = STR_INVERT_THR;
|
||||
s_warning_type = WARNING_TYPE_CONFIRM;
|
||||
killEvents(event);
|
||||
_event = 0;
|
||||
}
|
||||
else
|
||||
ld->revert = revert_new;
|
||||
@@ -2261,14 +2246,9 @@ void menuProcLimits(uint8_t _event)
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (s_warning) {
|
||||
displayConfirmation(_event);
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(CURVES)
|
||||
@@ -2578,7 +2558,7 @@ void menuProcFunctionSwitches(uint8_t event)
|
||||
{
|
||||
#if defined(PCBARM) && defined(SDCARD)
|
||||
uint8_t _event = event;
|
||||
if (s_warning || s_menu_count) {
|
||||
if (s_menu_count) {
|
||||
event = 0;
|
||||
}
|
||||
#endif
|
||||
@@ -2737,10 +2717,6 @@ void menuProcFunctionSwitches(uint8_t event)
|
||||
}
|
||||
|
||||
#if defined(PCBARM) && defined(SDCARD)
|
||||
if (s_warning) {
|
||||
displayConfirmation(_event);
|
||||
}
|
||||
|
||||
if (s_menu_count) {
|
||||
const char * result = displayMenu(_event);
|
||||
if (result) {
|
||||
@@ -2977,7 +2953,7 @@ void menuProcTelemetry(uint8_t event)
|
||||
case ITEM_TELEMETRY_VARIO_SOURCE:
|
||||
lcd_puts(4, y, STR_SOURCE);
|
||||
lcd_putsiAtt(TELEM_COL2, y, STR_VARIOSRC, g_model.frsky.varioSource, attr);
|
||||
if (attr) CHECK_INCDEC_MODELVAR(event, g_model.frsky.varioSource, VARIO_SOURCE_FIRST, VARIO_SOURCE_LAST-1);
|
||||
if (attr) CHECK_INCDEC_MODELVAR(event, g_model.frsky.varioSource, VARIO_SOURCE_FIRST, VARIO_SOURCE_LAST);
|
||||
break;
|
||||
|
||||
case ITEM_TELEMETRY_VARIO_SPEED:
|
||||
@@ -3075,18 +3051,16 @@ void menuProcTelemetry(uint8_t event)
|
||||
#endif
|
||||
|
||||
#ifdef TEMPLATES
|
||||
void menuProcTemplates(uint8_t _event)
|
||||
void menuProcTemplates(uint8_t event)
|
||||
{
|
||||
uint8_t event = (s_warning ? 0 : _event);
|
||||
|
||||
SIMPLE_MENU(STR_MENUTEMPLATES, menuTabModel, e_Templates, 1+TMPL_COUNT);
|
||||
|
||||
uint8_t sub = m_posVert - 1;
|
||||
|
||||
if (s_confirmation) {
|
||||
if (s_warning_result) {
|
||||
if (sub<TMPL_COUNT)
|
||||
applyTemplate(sub);
|
||||
s_confirmation = 0;
|
||||
s_warning_result = 0;
|
||||
AUDIO_WARNING2();
|
||||
}
|
||||
|
||||
@@ -3095,9 +3069,9 @@ void menuProcTemplates(uint8_t _event)
|
||||
case EVT_KEY_FIRST(KEY_MENU):
|
||||
if (sub!=255) {
|
||||
s_warning = STR_VTEMPLATES+1 + (sub * LEN2_VTEMPLATES);
|
||||
s_warning_type = WARNING_TYPE_CONFIRM;
|
||||
}
|
||||
killEvents(event);
|
||||
_event = 0;
|
||||
s_editMode = 0;
|
||||
break;
|
||||
}
|
||||
@@ -3110,10 +3084,6 @@ void menuProcTemplates(uint8_t _event)
|
||||
lcd_putsiAtt(4*FW, y, STR_VTEMPLATES, k, (sub==k ? INVERS : 0));
|
||||
y+=FH;
|
||||
}
|
||||
|
||||
if (s_warning) {
|
||||
displayConfirmation(_event);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
+5
-5
@@ -464,11 +464,10 @@ enum TelemetrySource {
|
||||
|
||||
enum VarioSource {
|
||||
VARIO_SOURCE_FIRST = 0,
|
||||
VARIO_SOURCE_BARO_V1 = 0,
|
||||
VARIO_SOURCE_BARO_V2,
|
||||
VARIO_SOURCE_DATA = VARIO_SOURCE_FIRST,
|
||||
VARIO_SOURCE_A1,
|
||||
VARIO_SOURCE_A2,
|
||||
VARIO_SOURCE_LAST
|
||||
VARIO_SOURCE_LAST = VARIO_SOURCE_A2,
|
||||
};
|
||||
|
||||
#if defined(PCBARM)
|
||||
@@ -488,7 +487,8 @@ PACK(typedef struct t_FrSkyBarData {
|
||||
enum FrskyUsrProtocols {
|
||||
USR_PROTO_NONE,
|
||||
USR_PROTO_FRSKY_HUB,
|
||||
USR_PROTO_WS_HOW_HIGH
|
||||
USR_PROTO_WS_HOW_HIGH,
|
||||
USR_PROTO_HALCYON,
|
||||
};
|
||||
|
||||
enum FrskySource {
|
||||
@@ -517,7 +517,7 @@ PACK(typedef struct t_FrSkyData {
|
||||
#else
|
||||
PACK(typedef struct t_FrSkyData {
|
||||
FrSkyChannelData channels[2];
|
||||
uint8_t usrProto:2; // Protocol in FrSky user data, 0=None, 1=FrSky hub, 2=WS HowHigh
|
||||
uint8_t usrProto:2; // Protocol in FrSky user data, 0=None, 1=FrSky hub, 2=WS HowHigh, 3=Halcyon
|
||||
uint8_t blades:2; // How many blades for RPMs, 0=2 blades, 1=3 blades
|
||||
uint8_t spare1:4;
|
||||
uint8_t voltsSource:3;
|
||||
|
||||
+25
-6
@@ -697,11 +697,17 @@ bool __getSwitch(int8_t swtch)
|
||||
y = cs->v2;
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
else {
|
||||
y = calc100toRESX(cs->v2);
|
||||
}
|
||||
#else
|
||||
if (cs->v1 > CSW_CHOUT_BASE+NUM_CHNOUT) {
|
||||
y = cs->v2; // it's a timer
|
||||
}
|
||||
else {
|
||||
y = calc100toRESX(cs->v2);
|
||||
}
|
||||
#endif
|
||||
|
||||
switch (cs->func) {
|
||||
case CS_VPOS:
|
||||
@@ -718,11 +724,14 @@ bool __getSwitch(int8_t swtch)
|
||||
break;
|
||||
default:
|
||||
{
|
||||
if (csLastValue[cs_idx] == -32668)
|
||||
csLastValue[cs_idx] = x;
|
||||
int16_t diff = x - csLastValue[cs_idx];
|
||||
if (cs->func == CS_DIFFEGREATER)
|
||||
result = (y >= 0 ? (diff >= y) : (diff <= y));
|
||||
else
|
||||
result = (abs(diff) >= y);
|
||||
printf("x=%d last=%d y=%d diff=%d result=%d\n", x, csLastValue[cs_idx], y, diff, result); fflush(stdout);
|
||||
if (result)
|
||||
csLastValue[cs_idx] = x;
|
||||
break;
|
||||
@@ -1555,6 +1564,8 @@ void resetAll()
|
||||
#ifdef FRSKY
|
||||
resetTelemetry();
|
||||
#endif
|
||||
for (uint8_t i=0; i<NUM_CSW; i++)
|
||||
csLastValue[i] = -32668;
|
||||
}
|
||||
|
||||
static uint8_t lastSwPos[2] = {0, 0};
|
||||
@@ -1930,6 +1941,7 @@ void evalFunctions()
|
||||
|
||||
if ((!momentary) || (~activeFunctionSwitches & switch_mask)) {
|
||||
if (sd->func == FUNC_PLAY_SOUND) {
|
||||
printf("BEEP\n"); fflush(stdout);
|
||||
AUDIO_PLAY(AU_FRSKY_FIRST+FSW_PARAM(sd));
|
||||
}
|
||||
|
||||
@@ -2705,7 +2717,9 @@ void perMain()
|
||||
check_frsky();
|
||||
#endif
|
||||
|
||||
g_menuStack[g_menuStackPtr](evt);
|
||||
const char *warn = s_warning;
|
||||
g_menuStack[g_menuStackPtr](warn ? 0 : evt);
|
||||
if (warn) displayWarning(evt);
|
||||
drawStatusLine();
|
||||
refreshDisplay();
|
||||
|
||||
@@ -3547,12 +3561,17 @@ int main(void)
|
||||
hapticOff();
|
||||
#endif
|
||||
|
||||
BACKLIGHT_ON;
|
||||
g_eeGeneral.optrexDisplay = 1;
|
||||
lcd_clear();
|
||||
refreshDisplay();
|
||||
|
||||
g_eeGeneral.optrexDisplay = 0;
|
||||
g_eeGeneral.backlightBright = 0;
|
||||
g_eeGeneral.contrast = 25;
|
||||
|
||||
lcd_clear();
|
||||
BACKLIGHT_ON;
|
||||
|
||||
lcd_clear();
|
||||
lcd_putcAtt( 48, 24, 'U', DBLSIZE ) ;
|
||||
lcd_putcAtt( 60, 24, 'S', DBLSIZE ) ;
|
||||
lcd_putcAtt( 72, 24, 'B', DBLSIZE ) ;
|
||||
|
||||
+6
-12
@@ -158,20 +158,14 @@
|
||||
#define LEN_VALARMFN "\001"
|
||||
#define TR_VALARMFN "<>"
|
||||
|
||||
#define LEN_VTELPROTO "\004"
|
||||
#if defined(WS_HOW_HIGH)
|
||||
#define TR_VTELPROTO "----Hub WSHH"
|
||||
#elif defined(FRSKY_HUB)
|
||||
#define TR_VTELPROTO "----Hub "
|
||||
#else
|
||||
#define TR_VTELPROTO ""
|
||||
#endif
|
||||
#define LEN_VTELPROTO "\007"
|
||||
#define TR_VTELPROTO "---\0 ""Hub\0 ""WSHHigh""Halcyon"
|
||||
|
||||
#define LEN_VOLTSRC "\003"
|
||||
#define TR_VOLTSRC "---""A1\0""A2\0""FAS""Cel"
|
||||
#define LEN_VOLTSRC "\003"
|
||||
#define TR_VOLTSRC "---""A1\0""A2\0""FAS""Cel"
|
||||
|
||||
#define LEN_VARIOSRC "\007"
|
||||
#define TR_VARIOSRC "FrSky\0 ""Halcyon""A1\0 ""A2\0"
|
||||
#define LEN_VARIOSRC "\004"
|
||||
#define TR_VARIOSRC "Data""A1\0 ""A2\0"
|
||||
|
||||
#define LEN_GPSFORMAT "\004"
|
||||
#define TR_GPSFORMAT "HMS NMEA"
|
||||
|
||||
+6
-12
@@ -158,20 +158,14 @@
|
||||
#define LEN_VALARMFN "\001"
|
||||
#define TR_VALARMFN "<>"
|
||||
|
||||
#define LEN_VTELPROTO "\004"
|
||||
#if defined(WS_HOW_HIGH)
|
||||
#define TR_VTELPROTO "NoneHub WSHH"
|
||||
#elif defined(FRSKY_HUB)
|
||||
#define TR_VTELPROTO "NoneHub "
|
||||
#else
|
||||
#define TR_VTELPROTO ""
|
||||
#endif
|
||||
#define LEN_VTELPROTO "\007"
|
||||
#define TR_VTELPROTO "---\0 ""Hub\0 ""WSHHigh""Halcyon"
|
||||
|
||||
#define LEN_VOLTSRC "\003"
|
||||
#define TR_VOLTSRC "---""A1\0""A2\0""FAS""Cel"
|
||||
#define LEN_VOLTSRC "\003"
|
||||
#define TR_VOLTSRC "---""A1\0""A2\0""FAS""Cel"
|
||||
|
||||
#define LEN_VARIOSRC "\007"
|
||||
#define TR_VARIOSRC "FrSky\0 ""Halcyon""A1\0 ""A2\0"
|
||||
#define LEN_VARIOSRC "\004"
|
||||
#define TR_VARIOSRC "Data""A1\0 ""A2\0"
|
||||
|
||||
#define LEN_GPSFORMAT "\004"
|
||||
#define TR_GPSFORMAT "HMS NMEA"
|
||||
|
||||
+4
-10
@@ -159,20 +159,14 @@
|
||||
#define LEN_VALARMFN "\001"
|
||||
#define TR_VALARMFN "<>"
|
||||
|
||||
#define LEN_VTELPROTO "\004"
|
||||
#if defined(WS_HOW_HIGH)
|
||||
#define TR_VTELPROTO "NoneHub WSHH"
|
||||
#elif defined(FRSKY_HUB)
|
||||
#define TR_VTELPROTO "NoneHub "
|
||||
#else
|
||||
#define TR_VTELPROTO ""
|
||||
#endif
|
||||
#define LEN_VTELPROTO "\007"
|
||||
#define TR_VTELPROTO "None\0 ""Hub\0 ""WSHHigh""Halcyon"
|
||||
|
||||
#define LEN_VOLTSRC "\003"
|
||||
#define TR_VOLTSRC "---""A1\0""A2\0""FAS""Cel"
|
||||
|
||||
#define LEN_VARIOSRC "\007"
|
||||
#define TR_VARIOSRC "FrSky\0 ""Halcyon""A1\0 ""A2\0"
|
||||
#define LEN_VARIOSRC "\004"
|
||||
#define TR_VARIOSRC "Data""A1\0 ""A2\0"
|
||||
|
||||
#define LEN_GPSFORMAT "\004"
|
||||
#define TR_GPSFORMAT "HMS NMEA"
|
||||
|
||||
+6
-12
@@ -153,20 +153,14 @@
|
||||
#define LEN_VALARMFN "\001"
|
||||
#define TR_VALARMFN "<>"
|
||||
|
||||
#define LEN_VTELPROTO "\004"
|
||||
#if defined(WS_HOW_HIGH)
|
||||
#define TR_VTELPROTO "Non Hub WSHH"
|
||||
#elif defined(FRSKY_HUB)
|
||||
#define TR_VTELPROTO "Non Hub "
|
||||
#else
|
||||
#define TR_VTELPROTO ""
|
||||
#endif
|
||||
#define LEN_VTELPROTO "\007"
|
||||
#define TR_VTELPROTO "---\0 ""Hub\0 ""WSHHigh""Halcyon"
|
||||
|
||||
#define LEN_VOLTSRC "\003"
|
||||
#define TR_VOLTSRC "---""A1\0""A2\0""FAS""Cel"
|
||||
#define LEN_VOLTSRC "\003"
|
||||
#define TR_VOLTSRC "---""A1\0""A2\0""FAS""Cel"
|
||||
|
||||
#define LEN_VARIOSRC "\007"
|
||||
#define TR_VARIOSRC "FrSky\0 ""Halcyon""A1\0 ""A2\0"
|
||||
#define LEN_VARIOSRC "\004"
|
||||
#define TR_VARIOSRC "Data""A1\0 ""A2\0"
|
||||
|
||||
#define LEN_GPSFORMAT "\004"
|
||||
#define TR_GPSFORMAT "HMS NMEA"
|
||||
|
||||
+6
-12
@@ -158,20 +158,14 @@
|
||||
#define LEN_VALARMFN "\001"
|
||||
#define TR_VALARMFN "<>"
|
||||
|
||||
#define LEN_VTELPROTO "\004"
|
||||
#if defined(WS_HOW_HIGH)
|
||||
#define TR_VTELPROTO "NoneHub WSHH"
|
||||
#elif defined(FRSKY_HUB)
|
||||
#define TR_VTELPROTO "NoneHub "
|
||||
#else
|
||||
#define TR_VTELPROTO ""
|
||||
#endif
|
||||
#define LEN_VTELPROTO "\007"
|
||||
#define TR_VTELPROTO "---\0 ""Hub\0 ""WSHHigh""Halcyon"
|
||||
|
||||
#define LEN_VOLTSRC "\003"
|
||||
#define TR_VOLTSRC "---""A1\0""A2\0""FAS""Cel"
|
||||
#define LEN_VOLTSRC "\003"
|
||||
#define TR_VOLTSRC "---""A1\0""A2\0""FAS""Cel"
|
||||
|
||||
#define LEN_VARIOSRC "\007"
|
||||
#define TR_VARIOSRC "FrSky\0 ""Halcyon""A1\0 ""A2\0"
|
||||
#define LEN_VARIOSRC "\004"
|
||||
#define TR_VARIOSRC "Data""A1\0 ""A2\0"
|
||||
|
||||
#define LEN_GPSFORMAT "\004"
|
||||
#define TR_GPSFORMAT "HMS NMEA"
|
||||
|
||||
+6
-12
@@ -153,20 +153,14 @@
|
||||
#define LEN_VALARMFN "\001"
|
||||
#define TR_VALARMFN "<>"
|
||||
|
||||
#define LEN_VTELPROTO "\004"
|
||||
#if defined(WS_HOW_HIGH)
|
||||
#define TR_VTELPROTO "--- Hub WSHH"
|
||||
#elif defined(FRSKY_HUB)
|
||||
#define TR_VTELPROTO "--- Hub "
|
||||
#else
|
||||
#define TR_VTELPROTO ""
|
||||
#endif
|
||||
#define LEN_VTELPROTO "\007"
|
||||
#define TR_VTELPROTO "---\0 ""Hub\0 ""WSHHigh""Halcyon"
|
||||
|
||||
#define LEN_VOLTSRC "\003"
|
||||
#define TR_VOLTSRC "---""A1\0""A2\0""FAS""Cel"
|
||||
#define LEN_VOLTSRC "\003"
|
||||
#define TR_VOLTSRC "---""A1\0""A2\0""FAS""Cel"
|
||||
|
||||
#define LEN_VARIOSRC "\007"
|
||||
#define TR_VARIOSRC "FrSky\0 ""Halcyon""A1\0 ""A2\0"
|
||||
#define LEN_VARIOSRC "\004"
|
||||
#define TR_VARIOSRC "Data""A1\0 ""A2\0"
|
||||
|
||||
#define LEN_GPSFORMAT "\004"
|
||||
#define TR_GPSFORMAT "HMS NMEA"
|
||||
|
||||
Reference in New Issue
Block a user