Try to fix memory leak

This commit is contained in:
Just Call Me Koko
2023-07-14 08:29:24 -04:00
parent ec0cc676ed
commit f854a30ed6
5 changed files with 83 additions and 8 deletions

View File

@@ -275,7 +275,7 @@ void CommandLine::runCommand(String input) {
int hex_arg = this->argSearch(&cmd_args, "-s");
int pat_arg = this->argSearch(&cmd_args, "-p");
#ifdef PIN
if (hex_arg != 0) {
if (hex_arg != -1) {
String hexstring = cmd_args.get(hex_arg + 1);
int number = (int)strtol(&hexstring[1], NULL, 16);
int r = number >> 16;
@@ -287,6 +287,13 @@ void CommandLine::runCommand(String input) {
led_obj.setColor(r, g, b);
led_obj.setMode(MODE_CUSTOM);
}
else if (pat_arg != -1) {
String pat_name = cmd_args.get(pat_arg + 1);
pat_name.toLowerCase();
if (pat_name == "rainbow") {
led_obj.setMode(MODE_RAINBOW);
}
}
#else
Serial.println("This hardware does not support neopixel");
#endif