Improved mixer source (de-)serialization
This commit is contained in:
+11
-2
@@ -257,7 +257,7 @@ PACK(struct SwashRingData {
|
||||
#if MAX_SCRIPTS > 0
|
||||
union ScriptDataInput {
|
||||
int16_t value;
|
||||
source_t source;
|
||||
source_t source CUST(r_mixSrcRaw,w_mixSrcRaw);
|
||||
} FUNC(select_script_input);
|
||||
|
||||
PACK(struct ScriptData {
|
||||
@@ -288,14 +288,23 @@ typedef int16_t ls_telemetry_value_t;
|
||||
|
||||
#if !defined(COLORLCD)
|
||||
PACK(struct FrSkyBarData {
|
||||
source_t source;
|
||||
source_t source CUST(r_mixSrcRaw,w_mixSrcRaw);
|
||||
ls_telemetry_value_t barMin; // minimum for bar display
|
||||
ls_telemetry_value_t barMax; // ditto for max display (would usually = ratio)
|
||||
});
|
||||
|
||||
#if defined(YAML_GENERATOR)
|
||||
PACK(struct LineDataSource {
|
||||
source_t val CUST(r_mixSrcRaw,w_mixSrcRaw);
|
||||
});
|
||||
PACK(struct FrSkyLineData {
|
||||
LineDataSource sources[NUM_LINE_ITEMS];
|
||||
});
|
||||
#else
|
||||
PACK(struct FrSkyLineData {
|
||||
source_t sources[NUM_LINE_ITEMS];
|
||||
});
|
||||
#endif
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
PACK(struct TelemetryScriptData {
|
||||
|
||||
+1
-1
@@ -634,7 +634,7 @@ int main(int argc, char ** argv)
|
||||
startEepromThread(argc >= 2 ? argv[1] : "eeprom.bin");
|
||||
#endif
|
||||
startAudioThread();
|
||||
simuStart(false, argc >= 3 ? argv[2] : 0, argc >= 4 ? argv[3] : 0);
|
||||
simuStart(true/*false*/, argc >= 3 ? argv[2] : 0, argc >= 4 ? argv[3] : 0);
|
||||
|
||||
return application.run();
|
||||
}
|
||||
|
||||
@@ -49,6 +49,17 @@ extern const struct YamlIdStr enum_MixSources[];
|
||||
|
||||
#define r_mixSrcRaw nullptr
|
||||
|
||||
static constexpr char closing_parenthesis[] = ")";
|
||||
|
||||
static bool output_source_1_param(const char* src_prefix, size_t src_len, uint32_t n,
|
||||
yaml_writer_func wf, void* opaque)
|
||||
{
|
||||
if (!wf(opaque, src_prefix, src_len)) return false;
|
||||
const char* str = yaml_unsigned2str(n);
|
||||
if (!wf(opaque, str, strlen(str))) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool w_mixSrcRaw(const YamlNode* node, uint32_t val, yaml_writer_func wf, void* opaque)
|
||||
{
|
||||
const char* str = nullptr;
|
||||
@@ -61,6 +72,69 @@ static bool w_mixSrcRaw(const YamlNode* node, uint32_t val, yaml_writer_func wf,
|
||||
|
||||
str = yaml_unsigned2str(val - MIXSRC_FIRST_INPUT);
|
||||
}
|
||||
#if defined(LUA_INPUTS)
|
||||
else if (val >= MIXSRC_FIRST_LUA
|
||||
&& val <= MIXSRC_LAST_LUA) {
|
||||
|
||||
if (!wf(opaque, "lua(", 4)) return false;
|
||||
|
||||
val -= MIXSRC_FIRST_LUA;
|
||||
uint32_t script = val / MAX_SCRIPT_OUTPUTS;
|
||||
|
||||
if (!output_source_1_param("lua(", 4, script, wf, opaque)) return false;
|
||||
if (!wf(opaque, ",", 1)) return false;
|
||||
|
||||
val = val % MAX_SCRIPT_OUTPUTS;
|
||||
str = yaml_unsigned2str(val);
|
||||
|
||||
if (!wf(opaque, str, strlen(str))) return false;
|
||||
str = closing_parenthesis;
|
||||
}
|
||||
#endif
|
||||
else if (val >= MIXSRC_FIRST_LOGICAL_SWITCH
|
||||
&& val <= MIXSRC_LAST_LOGICAL_SWITCH) {
|
||||
|
||||
val -= MIXSRC_FIRST_LOGICAL_SWITCH;
|
||||
if (!output_source_1_param("ls(", 3, val, wf, opaque)) return false;
|
||||
str = closing_parenthesis;
|
||||
}
|
||||
else if (val >= MIXSRC_FIRST_TRAINER
|
||||
&& val <= MIXSRC_LAST_TRAINER) {
|
||||
|
||||
val -= MIXSRC_FIRST_TRAINER;
|
||||
if (!output_source_1_param("tr(", 3, val, wf, opaque)) return false;
|
||||
str = closing_parenthesis;
|
||||
}
|
||||
else if (val >= MIXSRC_FIRST_CH
|
||||
&& val <= MIXSRC_LAST_CH) {
|
||||
|
||||
val -= MIXSRC_FIRST_CH;
|
||||
if (!output_source_1_param("ch(", 3, val, wf, opaque)) return false;
|
||||
str = closing_parenthesis;
|
||||
}
|
||||
else if (val >= MIXSRC_FIRST_GVAR
|
||||
&& val <= MIXSRC_LAST_GVAR) {
|
||||
|
||||
val -= MIXSRC_FIRST_GVAR;
|
||||
if (!output_source_1_param("gv(", 3, val, wf, opaque)) return false;
|
||||
str = closing_parenthesis;
|
||||
}
|
||||
else if (val >= MIXSRC_FIRST_TELEM
|
||||
&& val <= MIXSRC_LAST_TELEM) {
|
||||
|
||||
val -= MIXSRC_FIRST_TELEM;
|
||||
uint8_t sign = val % 3;
|
||||
val = val / 3;
|
||||
if (!wf(opaque, "tele(", 5)) return false;
|
||||
if (sign == 1) {
|
||||
if (!wf(opaque, "-", 1)) return false;
|
||||
} else if (sign == 2) {
|
||||
if (!wf(opaque, "+", 1)) return false;
|
||||
}
|
||||
str = yaml_unsigned2str(val);
|
||||
if (!wf(opaque, str, strlen(str))) return false;
|
||||
str = closing_parenthesis;
|
||||
}
|
||||
else {
|
||||
str = yaml_output_enum(val, enum_MixSources);
|
||||
}
|
||||
|
||||
@@ -666,7 +666,7 @@ static const struct YamlNode struct_TrainerModuleData[] = {
|
||||
};
|
||||
static const struct YamlNode union_ScriptDataInput_elmts[] = {
|
||||
YAML_SIGNED( "value", 16 ),
|
||||
YAML_UNSIGNED( "source", 8 ),
|
||||
YAML_UNSIGNED_CUST( "source", 8, r_mixSrcRaw, w_mixSrcRaw ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode union_ScriptDataInput[] = {
|
||||
|
||||
@@ -636,7 +636,7 @@ static const struct YamlNode struct_TrainerModuleData[] = {
|
||||
};
|
||||
static const struct YamlNode union_ScriptDataInput_elmts[] = {
|
||||
YAML_SIGNED( "value", 16 ),
|
||||
YAML_UNSIGNED( "source", 16 ),
|
||||
YAML_UNSIGNED_CUST( "source", 16, r_mixSrcRaw, w_mixSrcRaw ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode union_ScriptDataInput[] = {
|
||||
@@ -723,19 +723,19 @@ static const struct YamlNode struct_TelemetrySensor[] = {
|
||||
};
|
||||
static const struct YamlNode struct_FrSkyBarData[] = {
|
||||
YAML_IDX,
|
||||
YAML_UNSIGNED( "source", 16 ),
|
||||
YAML_UNSIGNED_CUST( "source", 16, r_mixSrcRaw, w_mixSrcRaw ),
|
||||
YAML_SIGNED( "barMin", 16 ),
|
||||
YAML_SIGNED( "barMax", 16 ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_unsigned_16[] = {
|
||||
static const struct YamlNode struct_LineDataSource[] = {
|
||||
YAML_IDX,
|
||||
YAML_UNSIGNED( "val", 16 ),
|
||||
YAML_UNSIGNED_CUST( "val", 16, r_mixSrcRaw, w_mixSrcRaw ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_FrSkyLineData[] = {
|
||||
YAML_IDX,
|
||||
YAML_ARRAY("sources", 16, 2, struct_unsigned_16, NULL),
|
||||
YAML_ARRAY("sources", 16, 2, struct_LineDataSource, NULL),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_TelemetryScriptData[] = {
|
||||
|
||||
@@ -636,7 +636,7 @@ static const struct YamlNode struct_TrainerModuleData[] = {
|
||||
};
|
||||
static const struct YamlNode union_ScriptDataInput_elmts[] = {
|
||||
YAML_SIGNED( "value", 16 ),
|
||||
YAML_UNSIGNED( "source", 16 ),
|
||||
YAML_UNSIGNED_CUST( "source", 16, r_mixSrcRaw, w_mixSrcRaw ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode union_ScriptDataInput[] = {
|
||||
@@ -723,19 +723,19 @@ static const struct YamlNode struct_TelemetrySensor[] = {
|
||||
};
|
||||
static const struct YamlNode struct_FrSkyBarData[] = {
|
||||
YAML_IDX,
|
||||
YAML_UNSIGNED( "source", 16 ),
|
||||
YAML_UNSIGNED_CUST( "source", 16, r_mixSrcRaw, w_mixSrcRaw ),
|
||||
YAML_SIGNED( "barMin", 16 ),
|
||||
YAML_SIGNED( "barMax", 16 ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_unsigned_16[] = {
|
||||
static const struct YamlNode struct_LineDataSource[] = {
|
||||
YAML_IDX,
|
||||
YAML_UNSIGNED( "val", 16 ),
|
||||
YAML_UNSIGNED_CUST( "val", 16, r_mixSrcRaw, w_mixSrcRaw ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_FrSkyLineData[] = {
|
||||
YAML_IDX,
|
||||
YAML_ARRAY("sources", 16, 2, struct_unsigned_16, NULL),
|
||||
YAML_ARRAY("sources", 16, 2, struct_LineDataSource, NULL),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_TelemetryScriptData[] = {
|
||||
|
||||
@@ -636,7 +636,7 @@ static const struct YamlNode struct_TrainerModuleData[] = {
|
||||
};
|
||||
static const struct YamlNode union_ScriptDataInput_elmts[] = {
|
||||
YAML_SIGNED( "value", 16 ),
|
||||
YAML_UNSIGNED( "source", 16 ),
|
||||
YAML_UNSIGNED_CUST( "source", 16, r_mixSrcRaw, w_mixSrcRaw ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode union_ScriptDataInput[] = {
|
||||
@@ -723,19 +723,19 @@ static const struct YamlNode struct_TelemetrySensor[] = {
|
||||
};
|
||||
static const struct YamlNode struct_FrSkyBarData[] = {
|
||||
YAML_IDX,
|
||||
YAML_UNSIGNED( "source", 16 ),
|
||||
YAML_UNSIGNED_CUST( "source", 16, r_mixSrcRaw, w_mixSrcRaw ),
|
||||
YAML_SIGNED( "barMin", 16 ),
|
||||
YAML_SIGNED( "barMax", 16 ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_unsigned_16[] = {
|
||||
static const struct YamlNode struct_LineDataSource[] = {
|
||||
YAML_IDX,
|
||||
YAML_UNSIGNED( "val", 16 ),
|
||||
YAML_UNSIGNED_CUST( "val", 16, r_mixSrcRaw, w_mixSrcRaw ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_FrSkyLineData[] = {
|
||||
YAML_IDX,
|
||||
YAML_ARRAY("sources", 16, 2, struct_unsigned_16, NULL),
|
||||
YAML_ARRAY("sources", 16, 2, struct_LineDataSource, NULL),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_TelemetryScriptData[] = {
|
||||
|
||||
@@ -636,7 +636,7 @@ static const struct YamlNode struct_TrainerModuleData[] = {
|
||||
};
|
||||
static const struct YamlNode union_ScriptDataInput_elmts[] = {
|
||||
YAML_SIGNED( "value", 16 ),
|
||||
YAML_UNSIGNED( "source", 16 ),
|
||||
YAML_UNSIGNED_CUST( "source", 16, r_mixSrcRaw, w_mixSrcRaw ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode union_ScriptDataInput[] = {
|
||||
@@ -723,19 +723,19 @@ static const struct YamlNode struct_TelemetrySensor[] = {
|
||||
};
|
||||
static const struct YamlNode struct_FrSkyBarData[] = {
|
||||
YAML_IDX,
|
||||
YAML_UNSIGNED( "source", 16 ),
|
||||
YAML_UNSIGNED_CUST( "source", 16, r_mixSrcRaw, w_mixSrcRaw ),
|
||||
YAML_SIGNED( "barMin", 16 ),
|
||||
YAML_SIGNED( "barMax", 16 ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_unsigned_16[] = {
|
||||
static const struct YamlNode struct_LineDataSource[] = {
|
||||
YAML_IDX,
|
||||
YAML_UNSIGNED( "val", 16 ),
|
||||
YAML_UNSIGNED_CUST( "val", 16, r_mixSrcRaw, w_mixSrcRaw ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_FrSkyLineData[] = {
|
||||
YAML_IDX,
|
||||
YAML_ARRAY("sources", 16, 2, struct_unsigned_16, NULL),
|
||||
YAML_ARRAY("sources", 16, 2, struct_LineDataSource, NULL),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_TelemetryScriptData[] = {
|
||||
|
||||
@@ -683,7 +683,7 @@ static const struct YamlNode struct_TrainerModuleData[] = {
|
||||
};
|
||||
static const struct YamlNode union_ScriptDataInput_elmts[] = {
|
||||
YAML_SIGNED( "value", 16 ),
|
||||
YAML_UNSIGNED( "source", 16 ),
|
||||
YAML_UNSIGNED_CUST( "source", 16, r_mixSrcRaw, w_mixSrcRaw ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode union_ScriptDataInput[] = {
|
||||
|
||||
@@ -683,7 +683,7 @@ static const struct YamlNode struct_TrainerModuleData[] = {
|
||||
};
|
||||
static const struct YamlNode union_ScriptDataInput_elmts[] = {
|
||||
YAML_SIGNED( "value", 16 ),
|
||||
YAML_UNSIGNED( "source", 16 ),
|
||||
YAML_UNSIGNED_CUST( "source", 16, r_mixSrcRaw, w_mixSrcRaw ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode union_ScriptDataInput[] = {
|
||||
|
||||
@@ -636,7 +636,7 @@ static const struct YamlNode struct_TrainerModuleData[] = {
|
||||
};
|
||||
static const struct YamlNode union_ScriptDataInput_elmts[] = {
|
||||
YAML_SIGNED( "value", 16 ),
|
||||
YAML_UNSIGNED( "source", 16 ),
|
||||
YAML_UNSIGNED_CUST( "source", 16, r_mixSrcRaw, w_mixSrcRaw ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode union_ScriptDataInput[] = {
|
||||
@@ -723,19 +723,19 @@ static const struct YamlNode struct_TelemetrySensor[] = {
|
||||
};
|
||||
static const struct YamlNode struct_FrSkyBarData[] = {
|
||||
YAML_IDX,
|
||||
YAML_UNSIGNED( "source", 16 ),
|
||||
YAML_UNSIGNED_CUST( "source", 16, r_mixSrcRaw, w_mixSrcRaw ),
|
||||
YAML_SIGNED( "barMin", 16 ),
|
||||
YAML_SIGNED( "barMax", 16 ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_unsigned_16[] = {
|
||||
static const struct YamlNode struct_LineDataSource[] = {
|
||||
YAML_IDX,
|
||||
YAML_UNSIGNED( "val", 16 ),
|
||||
YAML_UNSIGNED_CUST( "val", 16, r_mixSrcRaw, w_mixSrcRaw ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_FrSkyLineData[] = {
|
||||
YAML_IDX,
|
||||
YAML_ARRAY("sources", 16, 2, struct_unsigned_16, NULL),
|
||||
YAML_ARRAY("sources", 16, 2, struct_LineDataSource, NULL),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_TelemetryScriptData[] = {
|
||||
|
||||
@@ -644,7 +644,7 @@ static const struct YamlNode struct_TrainerModuleData[] = {
|
||||
};
|
||||
static const struct YamlNode union_ScriptDataInput_elmts[] = {
|
||||
YAML_SIGNED( "value", 16 ),
|
||||
YAML_UNSIGNED( "source", 16 ),
|
||||
YAML_UNSIGNED_CUST( "source", 16, r_mixSrcRaw, w_mixSrcRaw ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode union_ScriptDataInput[] = {
|
||||
@@ -736,19 +736,19 @@ static const struct YamlNode struct_TelemetrySensor[] = {
|
||||
};
|
||||
static const struct YamlNode struct_FrSkyBarData[] = {
|
||||
YAML_IDX,
|
||||
YAML_UNSIGNED( "source", 16 ),
|
||||
YAML_UNSIGNED_CUST( "source", 16, r_mixSrcRaw, w_mixSrcRaw ),
|
||||
YAML_SIGNED( "barMin", 16 ),
|
||||
YAML_SIGNED( "barMax", 16 ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_unsigned_16[] = {
|
||||
static const struct YamlNode struct_LineDataSource[] = {
|
||||
YAML_IDX,
|
||||
YAML_UNSIGNED( "val", 16 ),
|
||||
YAML_UNSIGNED_CUST( "val", 16, r_mixSrcRaw, w_mixSrcRaw ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_FrSkyLineData[] = {
|
||||
YAML_IDX,
|
||||
YAML_ARRAY("sources", 16, 3, struct_unsigned_16, NULL),
|
||||
YAML_ARRAY("sources", 16, 3, struct_LineDataSource, NULL),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_TelemetryScriptData[] = {
|
||||
|
||||
@@ -683,7 +683,7 @@ static const struct YamlNode struct_TrainerModuleData[] = {
|
||||
};
|
||||
static const struct YamlNode union_ScriptDataInput_elmts[] = {
|
||||
YAML_SIGNED( "value", 16 ),
|
||||
YAML_UNSIGNED( "source", 16 ),
|
||||
YAML_UNSIGNED_CUST( "source", 16, r_mixSrcRaw, w_mixSrcRaw ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode union_ScriptDataInput[] = {
|
||||
@@ -775,19 +775,19 @@ static const struct YamlNode struct_TelemetrySensor[] = {
|
||||
};
|
||||
static const struct YamlNode struct_FrSkyBarData[] = {
|
||||
YAML_IDX,
|
||||
YAML_UNSIGNED( "source", 16 ),
|
||||
YAML_UNSIGNED_CUST( "source", 16, r_mixSrcRaw, w_mixSrcRaw ),
|
||||
YAML_SIGNED( "barMin", 16 ),
|
||||
YAML_SIGNED( "barMax", 16 ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_unsigned_16[] = {
|
||||
static const struct YamlNode struct_LineDataSource[] = {
|
||||
YAML_IDX,
|
||||
YAML_UNSIGNED( "val", 16 ),
|
||||
YAML_UNSIGNED_CUST( "val", 16, r_mixSrcRaw, w_mixSrcRaw ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_FrSkyLineData[] = {
|
||||
YAML_IDX,
|
||||
YAML_ARRAY("sources", 16, 3, struct_unsigned_16, NULL),
|
||||
YAML_ARRAY("sources", 16, 3, struct_LineDataSource, NULL),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_TelemetryScriptData[] = {
|
||||
|
||||
@@ -621,7 +621,7 @@ static const struct YamlNode struct_TrainerModuleData[] = {
|
||||
};
|
||||
static const struct YamlNode union_ScriptDataInput_elmts[] = {
|
||||
YAML_SIGNED( "value", 16 ),
|
||||
YAML_UNSIGNED( "source", 16 ),
|
||||
YAML_UNSIGNED_CUST( "source", 16, r_mixSrcRaw, w_mixSrcRaw ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode union_ScriptDataInput[] = {
|
||||
@@ -708,19 +708,19 @@ static const struct YamlNode struct_TelemetrySensor[] = {
|
||||
};
|
||||
static const struct YamlNode struct_FrSkyBarData[] = {
|
||||
YAML_IDX,
|
||||
YAML_UNSIGNED( "source", 16 ),
|
||||
YAML_UNSIGNED_CUST( "source", 16, r_mixSrcRaw, w_mixSrcRaw ),
|
||||
YAML_SIGNED( "barMin", 16 ),
|
||||
YAML_SIGNED( "barMax", 16 ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_unsigned_16[] = {
|
||||
static const struct YamlNode struct_LineDataSource[] = {
|
||||
YAML_IDX,
|
||||
YAML_UNSIGNED( "val", 16 ),
|
||||
YAML_UNSIGNED_CUST( "val", 16, r_mixSrcRaw, w_mixSrcRaw ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_FrSkyLineData[] = {
|
||||
YAML_IDX,
|
||||
YAML_ARRAY("sources", 16, 2, struct_unsigned_16, NULL),
|
||||
YAML_ARRAY("sources", 16, 2, struct_LineDataSource, NULL),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_TelemetryScriptData[] = {
|
||||
|
||||
@@ -631,7 +631,7 @@ static const struct YamlNode struct_TrainerModuleData[] = {
|
||||
};
|
||||
static const struct YamlNode union_ScriptDataInput_elmts[] = {
|
||||
YAML_SIGNED( "value", 16 ),
|
||||
YAML_UNSIGNED( "source", 16 ),
|
||||
YAML_UNSIGNED_CUST( "source", 16, r_mixSrcRaw, w_mixSrcRaw ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode union_ScriptDataInput[] = {
|
||||
@@ -718,19 +718,19 @@ static const struct YamlNode struct_TelemetrySensor[] = {
|
||||
};
|
||||
static const struct YamlNode struct_FrSkyBarData[] = {
|
||||
YAML_IDX,
|
||||
YAML_UNSIGNED( "source", 16 ),
|
||||
YAML_UNSIGNED_CUST( "source", 16, r_mixSrcRaw, w_mixSrcRaw ),
|
||||
YAML_SIGNED( "barMin", 16 ),
|
||||
YAML_SIGNED( "barMax", 16 ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_unsigned_16[] = {
|
||||
static const struct YamlNode struct_LineDataSource[] = {
|
||||
YAML_IDX,
|
||||
YAML_UNSIGNED( "val", 16 ),
|
||||
YAML_UNSIGNED_CUST( "val", 16, r_mixSrcRaw, w_mixSrcRaw ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_FrSkyLineData[] = {
|
||||
YAML_IDX,
|
||||
YAML_ARRAY("sources", 16, 2, struct_unsigned_16, NULL),
|
||||
YAML_ARRAY("sources", 16, 2, struct_LineDataSource, NULL),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_TelemetryScriptData[] = {
|
||||
|
||||
@@ -628,7 +628,7 @@ static const struct YamlNode struct_TrainerModuleData[] = {
|
||||
};
|
||||
static const struct YamlNode union_ScriptDataInput_elmts[] = {
|
||||
YAML_SIGNED( "value", 16 ),
|
||||
YAML_UNSIGNED( "source", 16 ),
|
||||
YAML_UNSIGNED_CUST( "source", 16, r_mixSrcRaw, w_mixSrcRaw ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode union_ScriptDataInput[] = {
|
||||
@@ -715,19 +715,19 @@ static const struct YamlNode struct_TelemetrySensor[] = {
|
||||
};
|
||||
static const struct YamlNode struct_FrSkyBarData[] = {
|
||||
YAML_IDX,
|
||||
YAML_UNSIGNED( "source", 16 ),
|
||||
YAML_UNSIGNED_CUST( "source", 16, r_mixSrcRaw, w_mixSrcRaw ),
|
||||
YAML_SIGNED( "barMin", 16 ),
|
||||
YAML_SIGNED( "barMax", 16 ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_unsigned_16[] = {
|
||||
static const struct YamlNode struct_LineDataSource[] = {
|
||||
YAML_IDX,
|
||||
YAML_UNSIGNED( "val", 16 ),
|
||||
YAML_UNSIGNED_CUST( "val", 16, r_mixSrcRaw, w_mixSrcRaw ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_FrSkyLineData[] = {
|
||||
YAML_IDX,
|
||||
YAML_ARRAY("sources", 16, 2, struct_unsigned_16, NULL),
|
||||
YAML_ARRAY("sources", 16, 2, struct_LineDataSource, NULL),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_TelemetryScriptData[] = {
|
||||
|
||||
@@ -632,7 +632,7 @@ static const struct YamlNode struct_TrainerModuleData[] = {
|
||||
};
|
||||
static const struct YamlNode union_ScriptDataInput_elmts[] = {
|
||||
YAML_SIGNED( "value", 16 ),
|
||||
YAML_UNSIGNED( "source", 16 ),
|
||||
YAML_UNSIGNED_CUST( "source", 16, r_mixSrcRaw, w_mixSrcRaw ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode union_ScriptDataInput[] = {
|
||||
@@ -719,19 +719,19 @@ static const struct YamlNode struct_TelemetrySensor[] = {
|
||||
};
|
||||
static const struct YamlNode struct_FrSkyBarData[] = {
|
||||
YAML_IDX,
|
||||
YAML_UNSIGNED( "source", 16 ),
|
||||
YAML_UNSIGNED_CUST( "source", 16, r_mixSrcRaw, w_mixSrcRaw ),
|
||||
YAML_SIGNED( "barMin", 16 ),
|
||||
YAML_SIGNED( "barMax", 16 ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_unsigned_16[] = {
|
||||
static const struct YamlNode struct_LineDataSource[] = {
|
||||
YAML_IDX,
|
||||
YAML_UNSIGNED( "val", 16 ),
|
||||
YAML_UNSIGNED_CUST( "val", 16, r_mixSrcRaw, w_mixSrcRaw ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_FrSkyLineData[] = {
|
||||
YAML_IDX,
|
||||
YAML_ARRAY("sources", 16, 2, struct_unsigned_16, NULL),
|
||||
YAML_ARRAY("sources", 16, 2, struct_LineDataSource, NULL),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_TelemetryScriptData[] = {
|
||||
|
||||
@@ -93,35 +93,51 @@ bool yaml_is_zero(uint8_t* data, uint32_t bitoffs, uint32_t bits)
|
||||
return !yaml_get_bits(data + (bitoffs>>3UL), bitoffs & 0x7, bits);
|
||||
}
|
||||
|
||||
int32_t yaml_str2int(const char* val, uint8_t val_len)
|
||||
int32_t yaml_str2int_ref(const char*& val, uint8_t& val_len)
|
||||
{
|
||||
bool neg = false;
|
||||
int i_val = 0;
|
||||
|
||||
for(uint8_t i=0; i < val_len; i++) {
|
||||
if (val[i] == '-')
|
||||
neg = true;
|
||||
else if (val[i] >= '0' && val[i] <= '9') {
|
||||
i_val = i_val * 10 + (val[i] - '0');
|
||||
}
|
||||
|
||||
while (val_len > 0) {
|
||||
if (*val == '-') {
|
||||
neg = true;
|
||||
} else if (*val >= '0' && *val <= '9') {
|
||||
i_val = i_val * 10 + (*val - '0');
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
val++; val_len--;
|
||||
}
|
||||
|
||||
return neg ? -i_val : i_val;
|
||||
}
|
||||
|
||||
uint32_t yaml_str2uint(const char* val, uint8_t val_len)
|
||||
int32_t yaml_str2int(const char* val, uint8_t val_len)
|
||||
{
|
||||
return yaml_str2int_ref(val, val_len);
|
||||
}
|
||||
|
||||
uint32_t yaml_str2uint_ref(const char* val, uint8_t val_len)
|
||||
{
|
||||
uint32_t i_val = 0;
|
||||
|
||||
for(uint8_t i=0; i < val_len; i++) {
|
||||
if (val[i] >= '0' && val[i] <= '9') {
|
||||
i_val = i_val * 10 + (val[i] - '0');
|
||||
while(val_len > 0) {
|
||||
if (*val >= '0' && *val <= '9') {
|
||||
i_val = i_val * 10 + (*val - '0');
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
val++; val_len--;
|
||||
}
|
||||
|
||||
return i_val;
|
||||
}
|
||||
|
||||
uint32_t yaml_str2uint(const char* val, uint8_t val_len)
|
||||
{
|
||||
return yaml_str2uint_ref(val, val_len);
|
||||
}
|
||||
|
||||
static char int2str_buffer[MAX_STR] = {0};
|
||||
static const char _int2str_lookup[] = { '0', '1', '2', '3', '4', '5', '6' , '7', '8', '9' };
|
||||
|
||||
|
||||
@@ -30,6 +30,9 @@ uint32_t yaml_get_bits(uint8_t* src, uint32_t bit_ofs, uint32_t bits);
|
||||
// assumes bits is a multiple of 8
|
||||
bool yaml_is_zero(uint8_t* data, uint32_t bitoffs, uint32_t bits);
|
||||
|
||||
int32_t yaml_str2int_ref(const char*& val, uint8_t& val_len);
|
||||
uint32_t yaml_str2uint_ref(const char* val, uint8_t val_len);
|
||||
|
||||
int32_t yaml_str2int(const char* val, uint8_t val_len);
|
||||
uint32_t yaml_str2uint(const char* val, uint8_t val_len);
|
||||
|
||||
|
||||
@@ -70,15 +70,108 @@ static bool in_write_weight(const YamlNode* node, uint32_t val, yaml_writer_func
|
||||
|
||||
extern const struct YamlIdStr enum_MixSources[];
|
||||
|
||||
// TODO sources: parse/output
|
||||
// - lua(script#,n): LUA mix outputs
|
||||
// - ls(n): logical switches
|
||||
// - tr(n): trainer input
|
||||
// - ch(n): channels
|
||||
// - gv(n): gvars
|
||||
// - tele(n): telemetry
|
||||
//
|
||||
static uint32_t r_mixSrcRaw(const YamlNode* node, const char* val, uint8_t val_len)
|
||||
{
|
||||
if (val_len > 0 && val[0] == 'I') {
|
||||
return yaml_str2uint(val+1, val_len-1) + MIXSRC_FIRST_INPUT;
|
||||
} else if (val_len > 4 &&
|
||||
val[0] == 'l' &&
|
||||
val[1] == 'u' &&
|
||||
val[2] == 'a' &&
|
||||
val[3] == '(') {
|
||||
|
||||
// parse int and ignore ','
|
||||
val += 4; val_len -= 4;
|
||||
uint8_t script = yaml_str2uint(val, val_len);
|
||||
|
||||
if (!val_len) return MIXSRC_NONE;
|
||||
val++; val_len--;
|
||||
|
||||
// parse int and ignore closing ')'
|
||||
return yaml_str2uint(val, val_len) + MIXSRC_FIRST_LUA +
|
||||
script * MAX_SCRIPT_OUTPUTS;
|
||||
|
||||
} else if (val_len > 3 &&
|
||||
val[0] == 'l' &&
|
||||
val[1] == 's' &&
|
||||
val[2] == '(') {
|
||||
|
||||
val += 3; val_len -= 3;
|
||||
// parse int and ignore closing ')'
|
||||
return yaml_str2uint(val, val_len) + MIXSRC_FIRST_LOGICAL_SWITCH;
|
||||
|
||||
} else if (val_len > 3 &&
|
||||
val[0] == 't' &&
|
||||
val[1] == 'r' &&
|
||||
val[2] == '(') {
|
||||
|
||||
val += 3; val_len -= 3;
|
||||
// parse int and ignore closing ')'
|
||||
return yaml_str2uint(val, val_len) + MIXSRC_FIRST_TRAINER;
|
||||
|
||||
} else if (val_len > 3 &&
|
||||
val[0] == 'c' &&
|
||||
val[1] == 'h' &&
|
||||
val[2] == '(') {
|
||||
|
||||
val += 3; val_len -= 3;
|
||||
// parse int and ignore closing ')'
|
||||
return yaml_str2uint_ref(val, val_len) + MIXSRC_FIRST_CH;
|
||||
|
||||
} else if (val_len > 3 &&
|
||||
val[0] == 'g' &&
|
||||
val[1] == 'v' &&
|
||||
val[2] == '(') {
|
||||
|
||||
val += 3; val_len -= 3;
|
||||
// parse int and ignore closing ')'
|
||||
return yaml_str2uint_ref(val, val_len) + MIXSRC_FIRST_GVAR;
|
||||
|
||||
} else if (val_len > 5 &&
|
||||
val[0] == 't' &&
|
||||
val[1] == 'e' &&
|
||||
val[2] == 'l' &&
|
||||
val[3] == 'e' &&
|
||||
val[4] == '(') {
|
||||
|
||||
val += 5; val_len -= 5;
|
||||
|
||||
// parse sign
|
||||
uint8_t sign = 0;
|
||||
if (*val == '-') {
|
||||
sign = 1;
|
||||
val++; val_len--;
|
||||
} else if (*val == '+') {
|
||||
sign = 2;
|
||||
val++; val_len--;
|
||||
}
|
||||
|
||||
// parse int and ignore closing ')'
|
||||
return yaml_str2uint_ref(val, val_len) * 3 + sign + MIXSRC_FIRST_TELEM;
|
||||
}
|
||||
|
||||
return yaml_parse_enum(enum_MixSources, val, val_len);
|
||||
}
|
||||
|
||||
static constexpr char closing_parenthesis[] = ")";
|
||||
|
||||
static bool output_source_1_param(const char* src_prefix, size_t src_len, uint32_t n,
|
||||
yaml_writer_func wf, void* opaque)
|
||||
{
|
||||
if (!wf(opaque, src_prefix, src_len)) return false;
|
||||
const char* str = yaml_unsigned2str(n);
|
||||
if (!wf(opaque, str, strlen(str))) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool w_mixSrcRaw(const YamlNode* node, uint32_t val, yaml_writer_func wf, void* opaque)
|
||||
{
|
||||
const char* str = nullptr;
|
||||
@@ -91,6 +184,69 @@ static bool w_mixSrcRaw(const YamlNode* node, uint32_t val, yaml_writer_func wf,
|
||||
|
||||
str = yaml_unsigned2str(val - MIXSRC_FIRST_INPUT);
|
||||
}
|
||||
#if defined(LUA_INPUTS)
|
||||
else if (val >= MIXSRC_FIRST_LUA
|
||||
&& val <= MIXSRC_LAST_LUA) {
|
||||
|
||||
if (!wf(opaque, "lua(", 4)) return false;
|
||||
|
||||
val -= MIXSRC_FIRST_LUA;
|
||||
uint32_t script = val / MAX_SCRIPT_OUTPUTS;
|
||||
|
||||
if (!output_source_1_param("lua(", 4, script, wf, opaque)) return false;
|
||||
if (!wf(opaque, ",", 1)) return false;
|
||||
|
||||
val = val % MAX_SCRIPT_OUTPUTS;
|
||||
str = yaml_unsigned2str(val);
|
||||
|
||||
if (!wf(opaque, str, strlen(str))) return false;
|
||||
str = closing_parenthesis;
|
||||
}
|
||||
#endif
|
||||
else if (val >= MIXSRC_FIRST_LOGICAL_SWITCH
|
||||
&& val <= MIXSRC_LAST_LOGICAL_SWITCH) {
|
||||
|
||||
val -= MIXSRC_FIRST_LOGICAL_SWITCH;
|
||||
if (!output_source_1_param("ls(", 3, val, wf, opaque)) return false;
|
||||
str = closing_parenthesis;
|
||||
}
|
||||
else if (val >= MIXSRC_FIRST_TRAINER
|
||||
&& val <= MIXSRC_LAST_TRAINER) {
|
||||
|
||||
val -= MIXSRC_FIRST_TRAINER;
|
||||
if (!output_source_1_param("tr(", 3, val, wf, opaque)) return false;
|
||||
str = closing_parenthesis;
|
||||
}
|
||||
else if (val >= MIXSRC_FIRST_CH
|
||||
&& val <= MIXSRC_LAST_CH) {
|
||||
|
||||
val -= MIXSRC_FIRST_CH;
|
||||
if (!output_source_1_param("ch(", 3, val, wf, opaque)) return false;
|
||||
str = closing_parenthesis;
|
||||
}
|
||||
else if (val >= MIXSRC_FIRST_GVAR
|
||||
&& val <= MIXSRC_LAST_GVAR) {
|
||||
|
||||
val -= MIXSRC_FIRST_GVAR;
|
||||
if (!output_source_1_param("gv(", 3, val, wf, opaque)) return false;
|
||||
str = closing_parenthesis;
|
||||
}
|
||||
else if (val >= MIXSRC_FIRST_TELEM
|
||||
&& val <= MIXSRC_LAST_TELEM) {
|
||||
|
||||
val -= MIXSRC_FIRST_TELEM;
|
||||
uint8_t sign = val % 3;
|
||||
val = val / 3;
|
||||
if (!wf(opaque, "tele(", 5)) return false;
|
||||
if (sign == 1) {
|
||||
if (!wf(opaque, "-", 1)) return false;
|
||||
} else if (sign == 2) {
|
||||
if (!wf(opaque, "+", 1)) return false;
|
||||
}
|
||||
str = yaml_unsigned2str(val);
|
||||
if (!wf(opaque, str, strlen(str))) return false;
|
||||
str = closing_parenthesis;
|
||||
}
|
||||
else {
|
||||
str = yaml_output_enum(val, enum_MixSources);
|
||||
}
|
||||
|
||||
@@ -666,7 +666,7 @@ static const struct YamlNode struct_TrainerModuleData[] = {
|
||||
};
|
||||
static const struct YamlNode union_ScriptDataInput_elmts[] = {
|
||||
YAML_SIGNED( "value", 16 ),
|
||||
YAML_UNSIGNED( "source", 8 ),
|
||||
YAML_UNSIGNED_CUST( "source", 8, r_mixSrcRaw, w_mixSrcRaw ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode union_ScriptDataInput[] = {
|
||||
|
||||
@@ -636,7 +636,7 @@ static const struct YamlNode struct_TrainerModuleData[] = {
|
||||
};
|
||||
static const struct YamlNode union_ScriptDataInput_elmts[] = {
|
||||
YAML_SIGNED( "value", 16 ),
|
||||
YAML_UNSIGNED( "source", 16 ),
|
||||
YAML_UNSIGNED_CUST( "source", 16, r_mixSrcRaw, w_mixSrcRaw ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode union_ScriptDataInput[] = {
|
||||
@@ -723,19 +723,19 @@ static const struct YamlNode struct_TelemetrySensor[] = {
|
||||
};
|
||||
static const struct YamlNode struct_FrSkyBarData[] = {
|
||||
YAML_IDX,
|
||||
YAML_UNSIGNED( "source", 16 ),
|
||||
YAML_UNSIGNED_CUST( "source", 16, r_mixSrcRaw, w_mixSrcRaw ),
|
||||
YAML_SIGNED( "barMin", 16 ),
|
||||
YAML_SIGNED( "barMax", 16 ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_unsigned_16[] = {
|
||||
static const struct YamlNode struct_LineDataSource[] = {
|
||||
YAML_IDX,
|
||||
YAML_UNSIGNED( "val", 16 ),
|
||||
YAML_UNSIGNED_CUST( "val", 16, r_mixSrcRaw, w_mixSrcRaw ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_FrSkyLineData[] = {
|
||||
YAML_IDX,
|
||||
YAML_ARRAY("sources", 16, 2, struct_unsigned_16, NULL),
|
||||
YAML_ARRAY("sources", 16, 2, struct_LineDataSource, NULL),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_TelemetryScriptData[] = {
|
||||
|
||||
@@ -636,7 +636,7 @@ static const struct YamlNode struct_TrainerModuleData[] = {
|
||||
};
|
||||
static const struct YamlNode union_ScriptDataInput_elmts[] = {
|
||||
YAML_SIGNED( "value", 16 ),
|
||||
YAML_UNSIGNED( "source", 16 ),
|
||||
YAML_UNSIGNED_CUST( "source", 16, r_mixSrcRaw, w_mixSrcRaw ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode union_ScriptDataInput[] = {
|
||||
@@ -723,19 +723,19 @@ static const struct YamlNode struct_TelemetrySensor[] = {
|
||||
};
|
||||
static const struct YamlNode struct_FrSkyBarData[] = {
|
||||
YAML_IDX,
|
||||
YAML_UNSIGNED( "source", 16 ),
|
||||
YAML_UNSIGNED_CUST( "source", 16, r_mixSrcRaw, w_mixSrcRaw ),
|
||||
YAML_SIGNED( "barMin", 16 ),
|
||||
YAML_SIGNED( "barMax", 16 ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_unsigned_16[] = {
|
||||
static const struct YamlNode struct_LineDataSource[] = {
|
||||
YAML_IDX,
|
||||
YAML_UNSIGNED( "val", 16 ),
|
||||
YAML_UNSIGNED_CUST( "val", 16, r_mixSrcRaw, w_mixSrcRaw ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_FrSkyLineData[] = {
|
||||
YAML_IDX,
|
||||
YAML_ARRAY("sources", 16, 2, struct_unsigned_16, NULL),
|
||||
YAML_ARRAY("sources", 16, 2, struct_LineDataSource, NULL),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_TelemetryScriptData[] = {
|
||||
|
||||
@@ -636,7 +636,7 @@ static const struct YamlNode struct_TrainerModuleData[] = {
|
||||
};
|
||||
static const struct YamlNode union_ScriptDataInput_elmts[] = {
|
||||
YAML_SIGNED( "value", 16 ),
|
||||
YAML_UNSIGNED( "source", 16 ),
|
||||
YAML_UNSIGNED_CUST( "source", 16, r_mixSrcRaw, w_mixSrcRaw ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode union_ScriptDataInput[] = {
|
||||
@@ -723,19 +723,19 @@ static const struct YamlNode struct_TelemetrySensor[] = {
|
||||
};
|
||||
static const struct YamlNode struct_FrSkyBarData[] = {
|
||||
YAML_IDX,
|
||||
YAML_UNSIGNED( "source", 16 ),
|
||||
YAML_UNSIGNED_CUST( "source", 16, r_mixSrcRaw, w_mixSrcRaw ),
|
||||
YAML_SIGNED( "barMin", 16 ),
|
||||
YAML_SIGNED( "barMax", 16 ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_unsigned_16[] = {
|
||||
static const struct YamlNode struct_LineDataSource[] = {
|
||||
YAML_IDX,
|
||||
YAML_UNSIGNED( "val", 16 ),
|
||||
YAML_UNSIGNED_CUST( "val", 16, r_mixSrcRaw, w_mixSrcRaw ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_FrSkyLineData[] = {
|
||||
YAML_IDX,
|
||||
YAML_ARRAY("sources", 16, 2, struct_unsigned_16, NULL),
|
||||
YAML_ARRAY("sources", 16, 2, struct_LineDataSource, NULL),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_TelemetryScriptData[] = {
|
||||
|
||||
@@ -636,7 +636,7 @@ static const struct YamlNode struct_TrainerModuleData[] = {
|
||||
};
|
||||
static const struct YamlNode union_ScriptDataInput_elmts[] = {
|
||||
YAML_SIGNED( "value", 16 ),
|
||||
YAML_UNSIGNED( "source", 16 ),
|
||||
YAML_UNSIGNED_CUST( "source", 16, r_mixSrcRaw, w_mixSrcRaw ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode union_ScriptDataInput[] = {
|
||||
@@ -723,19 +723,19 @@ static const struct YamlNode struct_TelemetrySensor[] = {
|
||||
};
|
||||
static const struct YamlNode struct_FrSkyBarData[] = {
|
||||
YAML_IDX,
|
||||
YAML_UNSIGNED( "source", 16 ),
|
||||
YAML_UNSIGNED_CUST( "source", 16, r_mixSrcRaw, w_mixSrcRaw ),
|
||||
YAML_SIGNED( "barMin", 16 ),
|
||||
YAML_SIGNED( "barMax", 16 ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_unsigned_16[] = {
|
||||
static const struct YamlNode struct_LineDataSource[] = {
|
||||
YAML_IDX,
|
||||
YAML_UNSIGNED( "val", 16 ),
|
||||
YAML_UNSIGNED_CUST( "val", 16, r_mixSrcRaw, w_mixSrcRaw ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_FrSkyLineData[] = {
|
||||
YAML_IDX,
|
||||
YAML_ARRAY("sources", 16, 2, struct_unsigned_16, NULL),
|
||||
YAML_ARRAY("sources", 16, 2, struct_LineDataSource, NULL),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_TelemetryScriptData[] = {
|
||||
|
||||
@@ -683,7 +683,7 @@ static const struct YamlNode struct_TrainerModuleData[] = {
|
||||
};
|
||||
static const struct YamlNode union_ScriptDataInput_elmts[] = {
|
||||
YAML_SIGNED( "value", 16 ),
|
||||
YAML_UNSIGNED( "source", 16 ),
|
||||
YAML_UNSIGNED_CUST( "source", 16, r_mixSrcRaw, w_mixSrcRaw ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode union_ScriptDataInput[] = {
|
||||
|
||||
@@ -683,7 +683,7 @@ static const struct YamlNode struct_TrainerModuleData[] = {
|
||||
};
|
||||
static const struct YamlNode union_ScriptDataInput_elmts[] = {
|
||||
YAML_SIGNED( "value", 16 ),
|
||||
YAML_UNSIGNED( "source", 16 ),
|
||||
YAML_UNSIGNED_CUST( "source", 16, r_mixSrcRaw, w_mixSrcRaw ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode union_ScriptDataInput[] = {
|
||||
|
||||
@@ -636,7 +636,7 @@ static const struct YamlNode struct_TrainerModuleData[] = {
|
||||
};
|
||||
static const struct YamlNode union_ScriptDataInput_elmts[] = {
|
||||
YAML_SIGNED( "value", 16 ),
|
||||
YAML_UNSIGNED( "source", 16 ),
|
||||
YAML_UNSIGNED_CUST( "source", 16, r_mixSrcRaw, w_mixSrcRaw ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode union_ScriptDataInput[] = {
|
||||
@@ -723,19 +723,19 @@ static const struct YamlNode struct_TelemetrySensor[] = {
|
||||
};
|
||||
static const struct YamlNode struct_FrSkyBarData[] = {
|
||||
YAML_IDX,
|
||||
YAML_UNSIGNED( "source", 16 ),
|
||||
YAML_UNSIGNED_CUST( "source", 16, r_mixSrcRaw, w_mixSrcRaw ),
|
||||
YAML_SIGNED( "barMin", 16 ),
|
||||
YAML_SIGNED( "barMax", 16 ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_unsigned_16[] = {
|
||||
static const struct YamlNode struct_LineDataSource[] = {
|
||||
YAML_IDX,
|
||||
YAML_UNSIGNED( "val", 16 ),
|
||||
YAML_UNSIGNED_CUST( "val", 16, r_mixSrcRaw, w_mixSrcRaw ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_FrSkyLineData[] = {
|
||||
YAML_IDX,
|
||||
YAML_ARRAY("sources", 16, 2, struct_unsigned_16, NULL),
|
||||
YAML_ARRAY("sources", 16, 2, struct_LineDataSource, NULL),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_TelemetryScriptData[] = {
|
||||
|
||||
@@ -644,7 +644,7 @@ static const struct YamlNode struct_TrainerModuleData[] = {
|
||||
};
|
||||
static const struct YamlNode union_ScriptDataInput_elmts[] = {
|
||||
YAML_SIGNED( "value", 16 ),
|
||||
YAML_UNSIGNED( "source", 16 ),
|
||||
YAML_UNSIGNED_CUST( "source", 16, r_mixSrcRaw, w_mixSrcRaw ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode union_ScriptDataInput[] = {
|
||||
@@ -736,19 +736,19 @@ static const struct YamlNode struct_TelemetrySensor[] = {
|
||||
};
|
||||
static const struct YamlNode struct_FrSkyBarData[] = {
|
||||
YAML_IDX,
|
||||
YAML_UNSIGNED( "source", 16 ),
|
||||
YAML_UNSIGNED_CUST( "source", 16, r_mixSrcRaw, w_mixSrcRaw ),
|
||||
YAML_SIGNED( "barMin", 16 ),
|
||||
YAML_SIGNED( "barMax", 16 ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_unsigned_16[] = {
|
||||
static const struct YamlNode struct_LineDataSource[] = {
|
||||
YAML_IDX,
|
||||
YAML_UNSIGNED( "val", 16 ),
|
||||
YAML_UNSIGNED_CUST( "val", 16, r_mixSrcRaw, w_mixSrcRaw ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_FrSkyLineData[] = {
|
||||
YAML_IDX,
|
||||
YAML_ARRAY("sources", 16, 3, struct_unsigned_16, NULL),
|
||||
YAML_ARRAY("sources", 16, 3, struct_LineDataSource, NULL),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_TelemetryScriptData[] = {
|
||||
|
||||
@@ -683,7 +683,7 @@ static const struct YamlNode struct_TrainerModuleData[] = {
|
||||
};
|
||||
static const struct YamlNode union_ScriptDataInput_elmts[] = {
|
||||
YAML_SIGNED( "value", 16 ),
|
||||
YAML_UNSIGNED( "source", 16 ),
|
||||
YAML_UNSIGNED_CUST( "source", 16, r_mixSrcRaw, w_mixSrcRaw ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode union_ScriptDataInput[] = {
|
||||
@@ -775,19 +775,19 @@ static const struct YamlNode struct_TelemetrySensor[] = {
|
||||
};
|
||||
static const struct YamlNode struct_FrSkyBarData[] = {
|
||||
YAML_IDX,
|
||||
YAML_UNSIGNED( "source", 16 ),
|
||||
YAML_UNSIGNED_CUST( "source", 16, r_mixSrcRaw, w_mixSrcRaw ),
|
||||
YAML_SIGNED( "barMin", 16 ),
|
||||
YAML_SIGNED( "barMax", 16 ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_unsigned_16[] = {
|
||||
static const struct YamlNode struct_LineDataSource[] = {
|
||||
YAML_IDX,
|
||||
YAML_UNSIGNED( "val", 16 ),
|
||||
YAML_UNSIGNED_CUST( "val", 16, r_mixSrcRaw, w_mixSrcRaw ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_FrSkyLineData[] = {
|
||||
YAML_IDX,
|
||||
YAML_ARRAY("sources", 16, 3, struct_unsigned_16, NULL),
|
||||
YAML_ARRAY("sources", 16, 3, struct_LineDataSource, NULL),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_TelemetryScriptData[] = {
|
||||
|
||||
@@ -621,7 +621,7 @@ static const struct YamlNode struct_TrainerModuleData[] = {
|
||||
};
|
||||
static const struct YamlNode union_ScriptDataInput_elmts[] = {
|
||||
YAML_SIGNED( "value", 16 ),
|
||||
YAML_UNSIGNED( "source", 16 ),
|
||||
YAML_UNSIGNED_CUST( "source", 16, r_mixSrcRaw, w_mixSrcRaw ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode union_ScriptDataInput[] = {
|
||||
@@ -708,19 +708,19 @@ static const struct YamlNode struct_TelemetrySensor[] = {
|
||||
};
|
||||
static const struct YamlNode struct_FrSkyBarData[] = {
|
||||
YAML_IDX,
|
||||
YAML_UNSIGNED( "source", 16 ),
|
||||
YAML_UNSIGNED_CUST( "source", 16, r_mixSrcRaw, w_mixSrcRaw ),
|
||||
YAML_SIGNED( "barMin", 16 ),
|
||||
YAML_SIGNED( "barMax", 16 ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_unsigned_16[] = {
|
||||
static const struct YamlNode struct_LineDataSource[] = {
|
||||
YAML_IDX,
|
||||
YAML_UNSIGNED( "val", 16 ),
|
||||
YAML_UNSIGNED_CUST( "val", 16, r_mixSrcRaw, w_mixSrcRaw ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_FrSkyLineData[] = {
|
||||
YAML_IDX,
|
||||
YAML_ARRAY("sources", 16, 2, struct_unsigned_16, NULL),
|
||||
YAML_ARRAY("sources", 16, 2, struct_LineDataSource, NULL),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_TelemetryScriptData[] = {
|
||||
|
||||
@@ -631,7 +631,7 @@ static const struct YamlNode struct_TrainerModuleData[] = {
|
||||
};
|
||||
static const struct YamlNode union_ScriptDataInput_elmts[] = {
|
||||
YAML_SIGNED( "value", 16 ),
|
||||
YAML_UNSIGNED( "source", 16 ),
|
||||
YAML_UNSIGNED_CUST( "source", 16, r_mixSrcRaw, w_mixSrcRaw ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode union_ScriptDataInput[] = {
|
||||
@@ -718,19 +718,19 @@ static const struct YamlNode struct_TelemetrySensor[] = {
|
||||
};
|
||||
static const struct YamlNode struct_FrSkyBarData[] = {
|
||||
YAML_IDX,
|
||||
YAML_UNSIGNED( "source", 16 ),
|
||||
YAML_UNSIGNED_CUST( "source", 16, r_mixSrcRaw, w_mixSrcRaw ),
|
||||
YAML_SIGNED( "barMin", 16 ),
|
||||
YAML_SIGNED( "barMax", 16 ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_unsigned_16[] = {
|
||||
static const struct YamlNode struct_LineDataSource[] = {
|
||||
YAML_IDX,
|
||||
YAML_UNSIGNED( "val", 16 ),
|
||||
YAML_UNSIGNED_CUST( "val", 16, r_mixSrcRaw, w_mixSrcRaw ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_FrSkyLineData[] = {
|
||||
YAML_IDX,
|
||||
YAML_ARRAY("sources", 16, 2, struct_unsigned_16, NULL),
|
||||
YAML_ARRAY("sources", 16, 2, struct_LineDataSource, NULL),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_TelemetryScriptData[] = {
|
||||
|
||||
@@ -628,7 +628,7 @@ static const struct YamlNode struct_TrainerModuleData[] = {
|
||||
};
|
||||
static const struct YamlNode union_ScriptDataInput_elmts[] = {
|
||||
YAML_SIGNED( "value", 16 ),
|
||||
YAML_UNSIGNED( "source", 16 ),
|
||||
YAML_UNSIGNED_CUST( "source", 16, r_mixSrcRaw, w_mixSrcRaw ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode union_ScriptDataInput[] = {
|
||||
@@ -715,19 +715,19 @@ static const struct YamlNode struct_TelemetrySensor[] = {
|
||||
};
|
||||
static const struct YamlNode struct_FrSkyBarData[] = {
|
||||
YAML_IDX,
|
||||
YAML_UNSIGNED( "source", 16 ),
|
||||
YAML_UNSIGNED_CUST( "source", 16, r_mixSrcRaw, w_mixSrcRaw ),
|
||||
YAML_SIGNED( "barMin", 16 ),
|
||||
YAML_SIGNED( "barMax", 16 ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_unsigned_16[] = {
|
||||
static const struct YamlNode struct_LineDataSource[] = {
|
||||
YAML_IDX,
|
||||
YAML_UNSIGNED( "val", 16 ),
|
||||
YAML_UNSIGNED_CUST( "val", 16, r_mixSrcRaw, w_mixSrcRaw ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_FrSkyLineData[] = {
|
||||
YAML_IDX,
|
||||
YAML_ARRAY("sources", 16, 2, struct_unsigned_16, NULL),
|
||||
YAML_ARRAY("sources", 16, 2, struct_LineDataSource, NULL),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_TelemetryScriptData[] = {
|
||||
|
||||
@@ -632,7 +632,7 @@ static const struct YamlNode struct_TrainerModuleData[] = {
|
||||
};
|
||||
static const struct YamlNode union_ScriptDataInput_elmts[] = {
|
||||
YAML_SIGNED( "value", 16 ),
|
||||
YAML_UNSIGNED( "source", 16 ),
|
||||
YAML_UNSIGNED_CUST( "source", 16, r_mixSrcRaw, w_mixSrcRaw ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode union_ScriptDataInput[] = {
|
||||
@@ -719,19 +719,19 @@ static const struct YamlNode struct_TelemetrySensor[] = {
|
||||
};
|
||||
static const struct YamlNode struct_FrSkyBarData[] = {
|
||||
YAML_IDX,
|
||||
YAML_UNSIGNED( "source", 16 ),
|
||||
YAML_UNSIGNED_CUST( "source", 16, r_mixSrcRaw, w_mixSrcRaw ),
|
||||
YAML_SIGNED( "barMin", 16 ),
|
||||
YAML_SIGNED( "barMax", 16 ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_unsigned_16[] = {
|
||||
static const struct YamlNode struct_LineDataSource[] = {
|
||||
YAML_IDX,
|
||||
YAML_UNSIGNED( "val", 16 ),
|
||||
YAML_UNSIGNED_CUST( "val", 16, r_mixSrcRaw, w_mixSrcRaw ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_FrSkyLineData[] = {
|
||||
YAML_IDX,
|
||||
YAML_ARRAY("sources", 16, 2, struct_unsigned_16, NULL),
|
||||
YAML_ARRAY("sources", 16, 2, struct_LineDataSource, NULL),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_TelemetryScriptData[] = {
|
||||
|
||||
@@ -510,6 +510,11 @@ bool YamlTreeWalker::generate(yaml_writer_func wf, void* opaque)
|
||||
if (!toParent())
|
||||
return true;
|
||||
|
||||
if (getNode()->type == YDT_UNION) {
|
||||
if (!toParent()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
toNextAttr();
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user