JS: Improve and fix subghz module

- Fix some memory leaks
- Check for setup() being called
- Add end(), can setup() again to check for external module
- Add support for custom modulation presets
- Improve error handling
- Deinit correctly at exit
- Fix RAW files
- Fix repeat behavior, can specify with transmitFile(path, repeat)
This commit is contained in:
Willy-JL
2024-07-06 03:13:18 +02:00
parent 0f4f844ff1
commit 49a63bf10b
3 changed files with 240 additions and 86 deletions

View File

@@ -29,9 +29,17 @@ changeFrequency(433920000);
printRXline();
delay(1000);
let result = subghz.transmitFile("/ext/subghz/0.sub");
print(result ? "Send success" : "Send failed");
print("Sending 0.sub")
subghz.transmitFile("/ext/subghz/0.sub");
// Can also specify repeat count: subghz.transmitFile(path, repeat)
// If not provided, defaults to 1 repeat for RAW and 10 repeats for parsed
// These 10 repeats by default are to simulate holding the button on remote
print("Send success");
delay(1000);
changeFrequency(315000000);
printRXline();
printRXline();
// Optional, done automatically at script end
subghz.end()
// But can be used to setup again, which will retry to detect external modules