Merge pull request #8967 from curzon01/development

Add script usage flags
This commit is contained in:
Theo Arends 2020-07-23 13:56:53 +02:00 committed by GitHub
commit 493c8150ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 1 deletions

View File

@ -422,7 +422,7 @@ struct {
uint8_t light_correction; // 49D
uint8_t light_dimmer; // 49E
uint8_t rule_enabled; // 49F
uint8_t rule_once; // 4A0
uint8_t rule_once; // 4A0 bit 6+7 used by xdrv_10_scripter
uint8_t light_fade; // 4A1
uint8_t light_speed; // 4A2
uint8_t light_scheme; // 4A3

View File

@ -791,6 +791,11 @@ bool RulesProcess(void)
void RulesInit(void)
{
// indicates scripter not enabled
bitWrite(Settings.rule_once, 7, 0);
// and indicates scripter do not use compress
bitWrite(Settings.rule_once, 6, 0);
rules_flag.data = 0;
for (uint32_t i = 0; i < MAX_RULE_SETS; i++) {
if (0 == GetRuleLen(i)) {

View File

@ -6619,6 +6619,8 @@ bool Xdrv10(uint8_t function)
glob_script_mem.script_pram=(uint8_t*)Settings.script_pram[0];
glob_script_mem.script_pram_size=PMEM_SIZE;
// indicates scripter enabled (use rules[][] as single array)
bitWrite(Settings.rule_once, 7, 1);
#ifdef USE_SCRIPT_COMPRESSION
int32_t len_decompressed;
sprt=(char*)calloc(UNISHOXRSIZE+8,1);
@ -6627,7 +6629,12 @@ bool Xdrv10(uint8_t function)
glob_script_mem.script_size=UNISHOXRSIZE;
len_decompressed = SCRIPT_DECOMPRESS(Settings.rules[0], strlen(Settings.rules[0]), glob_script_mem.script_ram, glob_script_mem.script_size);
if (len_decompressed>0) glob_script_mem.script_ram[len_decompressed]=0;
// indicates scripter use compression
bitWrite(Settings.rule_once, 6, 1);
//AddLog_P2(LOG_LEVEL_INFO, PSTR("decompressed script len %d"),len_decompressed);
#else // USE_SCRIPT_COMPRESSION
// indicates scripter does not use compression
bitWrite(Settings.rule_once, 6, 0);
#endif // USE_SCRIPT_COMPRESSION
#ifdef USE_BUTTON_EVENT