feat: Improve defaults, range and wording of SD Log SF (#3058)
* fixes https://github.com/EdgeTX/edgetx/issues/2965 Changes: - the log period range is now 0.1s to 25.5s - upon creation of a new SD Logs SF the period is initialized to 1.0s - text "Value" is changed to "Period" to indicate parameter represents the log period ToDo: - translations for "Period" if desired rebase due to #2992 * changed Period to Interval Added translations for DA, DE, EN, IT, PL * added defaults for TR_INTERVAL to language files * fixed problem with too many leading zeros for intervals less than 1s. before: 00.5s after: 0.5s * added CZ translations for TR_PERIOD and TR_INTERVAL changed EN TR_FUNC from "Func" to "Function" * updated TR_FUNC for CZ, DA, IT, JP, PL updated TR_PERIOD and TR_INTERVAL for JP * added TR_PERIOD, TR_INTERVAL, TR_FUNC for SE * implemented TR_SF_SWITCH and logic to change between TR_SWITCH and TR_SF_SWITCH * 212x64 radios: single source for #define TR_LSW_HEADERS in language files deleted redundant defines * changed 128x64 and 212x64 SF SD Logs to same logic as colorlcd with - minimum log interval 0.1s - maximum log interval 25.5s - default log interval 1.0s TX12_Sim and X9D_Sim tested ok * migrated functional changes due to PR #2992 * missed updating TW language file * fix: Always `STR_SF_SWITCH` regardless of SF Co-authored-by: Peter Feerick <peter.feerick@gmail.com>
This commit is contained in:
@@ -32,6 +32,10 @@
|
||||
#endif
|
||||
|
||||
#if defined(SDCARD)
|
||||
#define SD_LOGS_PERIOD_MIN 1 // 0.1s fastest period
|
||||
#define SD_LOGS_PERIOD_MAX 255 // 25.5s slowest period
|
||||
#define SD_LOGS_PERIOD_DEFAULT 10 // 1s default period for newly created SF
|
||||
|
||||
void onCustomFunctionsFileSelectionMenu(const char * result)
|
||||
{
|
||||
int sub = menuVerticalPosition - HEADER_LINE;
|
||||
@@ -352,13 +356,15 @@ void menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF
|
||||
}
|
||||
#if defined(SDCARD)
|
||||
else if (func == FUNC_LOGS) {
|
||||
if (val_displayed) {
|
||||
lcdDrawNumber(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, val_displayed, attr|PREC1|LEFT);
|
||||
lcdDrawChar(lcdLastRightPos, y, 's');
|
||||
}
|
||||
else {
|
||||
lcdDrawMMM(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, attr);
|
||||
val_min = SD_LOGS_PERIOD_MIN;
|
||||
val_max = SD_LOGS_PERIOD_MAX;
|
||||
|
||||
if (!val_displayed) {
|
||||
val_displayed = CFN_PARAM(cfn) = SD_LOGS_PERIOD_DEFAULT;
|
||||
}
|
||||
|
||||
lcdDrawNumber(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, val_displayed, attr|PREC1|LEFT);
|
||||
lcdDrawChar(lcdLastRightPos, y, 's');
|
||||
}
|
||||
#endif
|
||||
#if defined(GVARS)
|
||||
|
||||
@@ -27,6 +27,10 @@
|
||||
#define MODEL_SPECIAL_FUNC_4TH_COLUMN (33*FW-3)
|
||||
#define MODEL_SPECIAL_FUNC_4TH_COLUMN_ONOFF (34*FW-3)
|
||||
|
||||
#define SD_LOGS_PERIOD_MIN 1 // 0.1s fastest period
|
||||
#define SD_LOGS_PERIOD_MAX 255 // 25.5s slowest period
|
||||
#define SD_LOGS_PERIOD_DEFAULT 10 // 1s default period for newly created SF
|
||||
|
||||
void onCustomFunctionsFileSelectionMenu(const char * result)
|
||||
{
|
||||
int sub = menuVerticalPosition;
|
||||
@@ -334,13 +338,15 @@ void menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF
|
||||
}
|
||||
}
|
||||
else if (func == FUNC_LOGS) {
|
||||
if (val_displayed) {
|
||||
lcdDrawNumber(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, val_displayed, attr|PREC1|LEFT);
|
||||
lcdDrawChar(lcdLastRightPos, y, 's');
|
||||
}
|
||||
else {
|
||||
lcdDrawMMM(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, attr);
|
||||
val_min = SD_LOGS_PERIOD_MIN;
|
||||
val_max = SD_LOGS_PERIOD_MAX;
|
||||
|
||||
if (!val_displayed) {
|
||||
val_displayed = CFN_PARAM(cfn) = SD_LOGS_PERIOD_DEFAULT;
|
||||
}
|
||||
|
||||
lcdDrawNumber(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, val_displayed, attr|PREC1|LEFT);
|
||||
lcdDrawChar(lcdLastRightPos, y, 's');
|
||||
}
|
||||
else if (func == FUNC_BACKLIGHT) {
|
||||
val_max = MIXSRC_LAST_CH;
|
||||
|
||||
@@ -52,6 +52,7 @@ class SpecialFunctionEditPage : public Page
|
||||
uint8_t index;
|
||||
FormWindow *specialFunctionOneWindow = nullptr;
|
||||
StaticText *headerSF = nullptr;
|
||||
StaticText *sfSwitchText = nullptr;
|
||||
bool active = false;
|
||||
|
||||
bool isActive() const
|
||||
@@ -234,10 +235,13 @@ class SpecialFunctionEditPage : public Page
|
||||
break;
|
||||
|
||||
case FUNC_LOGS: {
|
||||
auto edit = addNumberEdit(line, STR_VALUE, cfn, 0, 255);
|
||||
CFN_PARAM(cfn) = SD_LOGS_PERIOD_DEFAULT; // set default value
|
||||
|
||||
auto edit = addNumberEdit(line, STR_INTERVAL, cfn, SD_LOGS_PERIOD_MIN, SD_LOGS_PERIOD_MAX);
|
||||
edit->setDefault(SD_LOGS_PERIOD_DEFAULT); // set default period for DEF button
|
||||
edit->setDisplayHandler(
|
||||
[=](int32_t value) {
|
||||
return formatNumberAsString(CFN_PARAM(cfn), PREC1, sizeof(CFN_PARAM(cfn)), nullptr, "s");
|
||||
return formatNumberAsString(CFN_PARAM(cfn), PREC1, 0, nullptr, "s");
|
||||
});
|
||||
break;
|
||||
}
|
||||
@@ -360,7 +364,7 @@ class SpecialFunctionEditPage : public Page
|
||||
|
||||
// Switch
|
||||
auto line = window->newLine(&grid);
|
||||
new StaticText(line, rect_t{}, STR_SWITCH, 0, COLOR_THEME_PRIMARY1);
|
||||
sfSwitchText = new StaticText(line, rect_t{}, STR_SF_SWITCH, 0, COLOR_THEME_PRIMARY1);
|
||||
auto switchChoice =
|
||||
new SwitchChoice(line, rect_t{}, SWSRC_FIRST, SWSRC_LAST,
|
||||
GET_SET_DEFAULT(CFN_SWITCH(cfn)));
|
||||
|
||||
@@ -22,6 +22,10 @@
|
||||
#ifndef _SPECIAL_FUNCTIONS_H
|
||||
#define _SPECIAL_FUNCTIONS_H
|
||||
|
||||
#define SD_LOGS_PERIOD_MIN 1 // 0.1s fastest period
|
||||
#define SD_LOGS_PERIOD_MAX 255 // 25.5s slowest period
|
||||
#define SD_LOGS_PERIOD_DEFAULT 10 // 1s default period for newly created SF
|
||||
|
||||
#include "tabsgroup.h"
|
||||
|
||||
struct CustomFunctionData;
|
||||
|
||||
Reference in New Issue
Block a user