Add PRECONFIGURED_SCRIPT and START_SCRIPT_FROM_BOOT options

Change allows to define a PRECONFIGURED_SCRIPT in user_config_override.h
and to start a script from boot by defining START_SCRIPT_FROM_BOOT.
This commit is contained in:
Arnold 2021-09-16 23:44:54 +02:00 committed by GitHub
parent b5367f7743
commit 0de562567b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 0 deletions

View File

@ -8383,8 +8383,16 @@ bool Xdrv10(uint8_t function)
if (glob_script_mem.script_ram[0]!='>' && glob_script_mem.script_ram[1]!='D') {
// clr all
memset(glob_script_mem.script_ram, 0 ,glob_script_mem.script_size);
#ifdef PRECONFIGURED_SCRIPT
strcpy_P(glob_script_mem.script_ram, PSTR(PRECONFIGURED_SCRIPT));
#else
strcpy_P(glob_script_mem.script_ram, PSTR(">D\nscript error must start with >D"));
#endif
#ifdef START_SCRIPT_FROM_BOOT
bitWrite(Settings->rule_enabled, 0, 1);
#else
bitWrite(Settings->rule_enabled, 0, 0);
#endif
}
// assure permanent memory is 4 byte aligned