mirror of https://github.com/arendst/Tasmota.git
Merge pull request #8967 from curzon01/development
Add script usage flags
This commit is contained in:
commit
493c8150ec
|
@ -422,7 +422,7 @@ struct {
|
||||||
uint8_t light_correction; // 49D
|
uint8_t light_correction; // 49D
|
||||||
uint8_t light_dimmer; // 49E
|
uint8_t light_dimmer; // 49E
|
||||||
uint8_t rule_enabled; // 49F
|
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_fade; // 4A1
|
||||||
uint8_t light_speed; // 4A2
|
uint8_t light_speed; // 4A2
|
||||||
uint8_t light_scheme; // 4A3
|
uint8_t light_scheme; // 4A3
|
||||||
|
|
|
@ -791,6 +791,11 @@ bool RulesProcess(void)
|
||||||
|
|
||||||
void RulesInit(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;
|
rules_flag.data = 0;
|
||||||
for (uint32_t i = 0; i < MAX_RULE_SETS; i++) {
|
for (uint32_t i = 0; i < MAX_RULE_SETS; i++) {
|
||||||
if (0 == GetRuleLen(i)) {
|
if (0 == GetRuleLen(i)) {
|
||||||
|
|
|
@ -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=(uint8_t*)Settings.script_pram[0];
|
||||||
glob_script_mem.script_pram_size=PMEM_SIZE;
|
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
|
#ifdef USE_SCRIPT_COMPRESSION
|
||||||
int32_t len_decompressed;
|
int32_t len_decompressed;
|
||||||
sprt=(char*)calloc(UNISHOXRSIZE+8,1);
|
sprt=(char*)calloc(UNISHOXRSIZE+8,1);
|
||||||
|
@ -6627,7 +6629,12 @@ bool Xdrv10(uint8_t function)
|
||||||
glob_script_mem.script_size=UNISHOXRSIZE;
|
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);
|
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;
|
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);
|
//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
|
#endif // USE_SCRIPT_COMPRESSION
|
||||||
|
|
||||||
#ifdef USE_BUTTON_EVENT
|
#ifdef USE_BUTTON_EVENT
|
||||||
|
|
Loading…
Reference in New Issue