feat: Add 'repeat' option to 'Lua Script' special function (#3338)

* Add support for the '1x' repeat option for 'Play Script' special functions.

* Add Companion and B&W radio support.

* Fix B&W radio logic and layout.

* Add translation hooks.
This commit is contained in:
philmoz
2023-04-10 11:00:50 +10:00
committed by GitHub
parent 6138f29da6
commit 227780d784
11 changed files with 123 additions and 52 deletions
@@ -1477,7 +1477,12 @@ static void r_customFn(void* user, uint8_t* data, uint32_t bitoffs,
}
}
} else if (HAS_REPEAT_PARAM(func)) {
if (val_len == 2
if (func == FUNC_PLAY_SCRIPT) {
if (val_len == 2 && val[0] == '1' && val[1] == 'x')
CFN_PLAY_REPEAT(cfn) = 1;
else
CFN_PLAY_REPEAT(cfn) = 0;
} else if (val_len == 2
&& val[0] == '1'
&& val[1] == 'x') {
CFN_PLAY_REPEAT(cfn) = 0;
@@ -1629,7 +1634,9 @@ static bool w_customFn(void* user, uint8_t* data, uint32_t bitoffs,
// ","
if (!wf(opaque,",",1)) return false;
}
if (CFN_PLAY_REPEAT(cfn) == 0) {
if (func == FUNC_PLAY_SCRIPT) {
if (!wf(opaque,(CFN_PLAY_REPEAT(cfn) == 0) ? "On" : "1x",2)) return false;
} else if (CFN_PLAY_REPEAT(cfn) == 0) {
// "1x"
if (!wf(opaque,"1x",2)) return false;
} else if (CFN_PLAY_REPEAT(cfn) == CFN_PLAY_REPEAT_NOSTART) {