feat: special function to push customisable switches (#5497)
Co-authored-by: philmoz <phil.a.mitchell@gmail.com> Co-authored-by: elecpower <elecpower@users.noreply.github.com>
This commit is contained in:
co-authored by
philmoz
elecpower
parent
40449bf730
commit
d417228677
@@ -1626,7 +1626,18 @@ static void r_customFn(void* user, uint8_t* data, uint32_t bitoffs,
|
||||
case FUNC_LOGS: // 10th of seconds
|
||||
CFN_PARAM(cfn) = yaml_str2uint(val, l_sep);
|
||||
break;
|
||||
#if defined(FUNCTION_SWITCHES)
|
||||
case FUNC_PUSH_CUST_SWITCH:
|
||||
CFN_CS_INDEX(cfn) = yaml_str2uint_ref(val, val_len); // SW index
|
||||
|
||||
// ","
|
||||
if (!val_len || val[0] != ',') return;
|
||||
val++; val_len--;
|
||||
l_sep = find_sep(val, val_len);
|
||||
|
||||
CFN_PARAM(cfn) = yaml_str2int(val, l_sep); // Duration, 10th of seconds
|
||||
break;
|
||||
#endif
|
||||
case FUNC_ADJUST_GVAR: {
|
||||
|
||||
CFN_GVAR_INDEX(cfn) = yaml_str2int_ref(val, l_sep);
|
||||
@@ -1819,6 +1830,17 @@ static bool w_customFn(void* user, uint8_t* data, uint32_t bitoffs,
|
||||
#if defined(COLORLCD)
|
||||
case FUNC_SET_SCREEN:
|
||||
#endif
|
||||
|
||||
#if defined(FUNCTION_SWITCHES)
|
||||
case FUNC_PUSH_CUST_SWITCH:
|
||||
str = yaml_unsigned2str(CFN_CS_INDEX(cfn)); // SW index
|
||||
if (!wf(opaque, str, strlen(str))) return false;
|
||||
if (!wf(opaque,",",1)) return false;
|
||||
str = yaml_signed2str(CFN_PARAM(cfn)); // Duration
|
||||
if (!wf(opaque, str, strlen(str))) return false;
|
||||
break;
|
||||
#endif
|
||||
|
||||
case FUNC_HAPTIC:
|
||||
case FUNC_LOGS: // 10th of seconds
|
||||
str = yaml_unsigned2str(CFN_PARAM(cfn));
|
||||
|
||||
Reference in New Issue
Block a user