mirror of
https://github.com/opentx/opentx.git
synced 2025-07-18 05:45:21 +03:00
Default options for widgets / layouts / themes now OK on VC++
This commit is contained in:
parent
62df9831d8
commit
c521fce20b
8 changed files with 27 additions and 19 deletions
|
@ -25,7 +25,7 @@ const uint8_t LBM_TOPMENU_MASK_OPENTX[] = {
|
|||
};
|
||||
|
||||
const ZoneOption OPTIONS_THEME_DEFAULT[] = {
|
||||
{ "Background color", ZoneOption::Color, OPTION_DEFAULT_VALUE({ .unsignedValue = WHITE }) },
|
||||
{ "Background color", ZoneOption::Color, OPTION_DEFAULT_VALUE_UNSIGNED(WHITE) },
|
||||
{ NULL, ZoneOption::Bool }
|
||||
};
|
||||
|
||||
|
|
|
@ -34,16 +34,22 @@ struct Zone
|
|||
#define LEN_ZONE_OPTION_STRING 8
|
||||
union ZoneOptionValue
|
||||
{
|
||||
bool boolValue;
|
||||
uint32_t unsignedValue;
|
||||
int32_t signedValue;
|
||||
bool boolValue;
|
||||
char stringValue[LEN_ZONE_OPTION_STRING];
|
||||
};
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#define OPTION_DEFAULT_VALUE(...)
|
||||
#define OPTION_DEFAULT_VALUE_UNSIGNED(x) { uint32_t(x) }
|
||||
#define OPTION_DEFAULT_VALUE_SIGNED(x) { uint32_t(x) }
|
||||
#define OPTION_DEFAULT_VALUE_BOOL(x) { uint32_t(x) }
|
||||
#define OPTION_DEFAULT_VALUE_STRING(...) { *((ZoneOptionValue *)(const char []) __VA_ARGS__) }
|
||||
#else
|
||||
#define OPTION_DEFAULT_VALUE(...) __VA_ARGS__
|
||||
#define OPTION_DEFAULT_VALUE_UNSIGNED(x) { .unsignedValue = (x) }
|
||||
#define OPTION_DEFAULT_VALUE_SIGNED(x) { .signedValue = (x) }
|
||||
#define OPTION_DEFAULT_VALUE_BOOL(x) { .boolValue = (x) }
|
||||
#define OPTION_DEFAULT_VALUE_STRING(...) { .stringValue = __VA_ARGS__}
|
||||
#endif
|
||||
|
||||
struct ZoneOption
|
||||
|
|
|
@ -34,10 +34,10 @@ class GaugeWidget: public Widget
|
|||
};
|
||||
|
||||
const ZoneOption GaugeWidget::options[] = {
|
||||
{ "Source", ZoneOption::Source, OPTION_DEFAULT_VALUE({ .unsignedValue = 1 }) },
|
||||
{ "Min", ZoneOption::Integer, OPTION_DEFAULT_VALUE({ .signedValue = -RESX }) },
|
||||
{ "Max", ZoneOption::Integer, OPTION_DEFAULT_VALUE({ .signedValue = RESX }) },
|
||||
{ "Color", ZoneOption::Color, OPTION_DEFAULT_VALUE({ .unsignedValue = RED }) },
|
||||
{ "Source", ZoneOption::Source, OPTION_DEFAULT_VALUE_UNSIGNED(1) },
|
||||
{ "Min", ZoneOption::Integer, OPTION_DEFAULT_VALUE_SIGNED(-RESX) },
|
||||
{ "Max", ZoneOption::Integer, OPTION_DEFAULT_VALUE_SIGNED(RESX) },
|
||||
{ "Color", ZoneOption::Color, OPTION_DEFAULT_VALUE_UNSIGNED(RED) },
|
||||
{ NULL, ZoneOption::Bool }
|
||||
};
|
||||
|
||||
|
|
|
@ -34,9 +34,9 @@ class OutputsWidget: public Widget
|
|||
};
|
||||
|
||||
const ZoneOption OutputsWidget::options[] = {
|
||||
{ "Min", ZoneOption::Integer, OPTION_DEFAULT_VALUE({ .unsignedValue = 0 }) },
|
||||
{ "Max", ZoneOption::Integer, OPTION_DEFAULT_VALUE({ .unsignedValue = 7 }) },
|
||||
{ "Color", ZoneOption::Color, OPTION_DEFAULT_VALUE({ .unsignedValue = RED }) },
|
||||
{ "Min", ZoneOption::Integer, OPTION_DEFAULT_VALUE_UNSIGNED(0) },
|
||||
{ "Max", ZoneOption::Integer, OPTION_DEFAULT_VALUE_UNSIGNED(7) },
|
||||
{ "Color", ZoneOption::Color, OPTION_DEFAULT_VALUE_UNSIGNED(RED) },
|
||||
{ NULL, ZoneOption::Bool }
|
||||
};
|
||||
|
||||
|
|
|
@ -34,9 +34,9 @@ class TextWidget: public Widget
|
|||
};
|
||||
|
||||
const ZoneOption TextWidget::options[] = {
|
||||
{ "Text", ZoneOption::String, OPTION_DEFAULT_VALUE({ .stringValue = { '\015', '\347', '\0', '\14', '\377', '\376', '\373', '\364' } }) },
|
||||
{ "Color", ZoneOption::Color, OPTION_DEFAULT_VALUE({ .unsignedValue = RED }) },
|
||||
{ "Size", ZoneOption::TextSize, OPTION_DEFAULT_VALUE({ .unsignedValue = 0 }) },
|
||||
{ "Text", ZoneOption::String, OPTION_DEFAULT_VALUE_STRING({ '\015', '\347', '\0', '\14', '\377', '\376', '\373', '\364' }) },
|
||||
{ "Color", ZoneOption::Color, OPTION_DEFAULT_VALUE_UNSIGNED(RED) },
|
||||
{ "Size", ZoneOption::TextSize, OPTION_DEFAULT_VALUE_UNSIGNED(0) },
|
||||
{ NULL, ZoneOption::Bool }
|
||||
};
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ class TimerWidget: public Widget
|
|||
};
|
||||
|
||||
const ZoneOption TimerWidget::options[] = {
|
||||
{ "Timer source", ZoneOption::Timer, OPTION_DEFAULT_VALUE({ .unsignedValue = 0 }) },
|
||||
{ "Timer source", ZoneOption::Timer, OPTION_DEFAULT_VALUE_UNSIGNED(0) },
|
||||
{ NULL, ZoneOption::Bool }
|
||||
};
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ class ValueWidget: public Widget
|
|||
};
|
||||
|
||||
const ZoneOption ValueWidget::options[] = {
|
||||
{ "Source", ZoneOption::Source, OPTION_DEFAULT_VALUE({ .unsignedValue = MIXSRC_Rud }) },
|
||||
{ "Source", ZoneOption::Source, OPTION_DEFAULT_VALUE_UNSIGNED(MIXSRC_Rud) },
|
||||
{ NULL, ZoneOption::Bool }
|
||||
};
|
||||
|
||||
|
|
|
@ -1043,7 +1043,10 @@ void checkModelIdUnique(uint8_t index, uint8_t module);
|
|||
|
||||
inline int divRoundClosest(const int n, const int d)
|
||||
{
|
||||
return ((n < 0) ^ (d < 0)) ? ((n - d/2)/d) : ((n + d/2)/d);
|
||||
if (d == 0)
|
||||
return 0;
|
||||
else
|
||||
return ((n < 0) ^ (d < 0)) ? ((n - d/2)/d) : ((n + d/2)/d);
|
||||
}
|
||||
|
||||
#define calc100to256_16Bits(x) calc100to256(x)
|
||||
|
@ -1352,7 +1355,6 @@ uint16_t crc16(uint8_t * buf, uint32_t len);
|
|||
#define PLAY_BACKGROUND 0x20
|
||||
#define PLAY_INCREMENT(x) ((uint8_t)(((uint8_t)x) << 6)) /* -1, 0, 1, 2 */
|
||||
|
||||
/* make sure the defines below always go in numeric order */
|
||||
enum AUDIO_SOUNDS {
|
||||
AU_TADA,
|
||||
#if defined(CPUARM)
|
||||
|
@ -1362,7 +1364,6 @@ enum AUDIO_SOUNDS {
|
|||
AU_THROTTLE_ALERT,
|
||||
AU_SWITCH_ALERT,
|
||||
AU_BAD_RADIODATA,
|
||||
AU_STORAGE_FORMAT,
|
||||
#endif
|
||||
AU_TX_BATTERY_LOW,
|
||||
AU_INACTIVITY,
|
||||
|
@ -1382,6 +1383,7 @@ enum AUDIO_SOUNDS {
|
|||
AU_TELEMETRY_BACK,
|
||||
AU_TRAINER_LOST,
|
||||
AU_TRAINER_BACK,
|
||||
AU_SENSOR_LOST,
|
||||
#endif
|
||||
#if defined(PCBSKY9X)
|
||||
AU_TX_MAH_HIGH,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue