Run on MSC feature
This commit is contained in:
parent
361e299e0b
commit
1d0d1dbfc3
11
USBNova.ino
11
USBNova.ino
|
@ -81,7 +81,7 @@ void setup() {
|
|||
selector::changed();
|
||||
|
||||
// Start attack
|
||||
if (selector::mode() == ATTACK && !preferences::getRunOnIndicator()) {
|
||||
if (selector::mode() == ATTACK && !preferences::getRunOnIndicator() && !preferences::getRunOnMSC()) {
|
||||
delay(preferences::getInitialDelay()); // Wait to give computer time to init keyboard
|
||||
attack::start(); // Start keystroke injection attack
|
||||
led::setColor(preferences::getIdleColor()); // Set LED to green
|
||||
|
@ -94,15 +94,20 @@ void setup() {
|
|||
}
|
||||
|
||||
void loop() {
|
||||
taks:update();
|
||||
tasks::update();
|
||||
cli::update();
|
||||
|
||||
if(selector::read() != ATTACK) return;
|
||||
|
||||
// Only start the attack if run-on-indicator is disabled, or indicator actually changed
|
||||
if(preferences::getRunOnIndicator() && hid::indicatorChanged()) {
|
||||
if((preferences::getRunOnIndicator() && hid::indicatorChanged()) || (preferences::getRunOnMSC() && msc::changed())) {
|
||||
attack::start(); // Run script
|
||||
led::setColor(preferences::getIdleColor()); // Set LED to green
|
||||
// Don't run again
|
||||
while(true) {
|
||||
tasks::update();
|
||||
cli::update();
|
||||
}
|
||||
} else if (selector::changed()) {
|
||||
// ========== Setup Mode ========== //
|
||||
if (selector::mode() == SETUP) {
|
||||
|
|
|
@ -46,6 +46,7 @@ namespace preferences {
|
|||
|
||||
bool disable_capslock { true };
|
||||
bool run_on_indicator { false };
|
||||
bool run_on_msc { false };
|
||||
|
||||
int initial_delay { 1000 };
|
||||
|
||||
|
@ -87,7 +88,8 @@ namespace preferences {
|
|||
add_array(root, "idle_color", idle_color, 4);
|
||||
*/
|
||||
root["disable_capslock"] = disable_capslock;
|
||||
root["run_on_indicator"] = run_on_indicator;
|
||||
root["run_on_indicator"] = run_on_indicator;
|
||||
root["run_on_msc"] = run_on_msc;
|
||||
|
||||
root["initial_delay"] = initial_delay;
|
||||
}
|
||||
|
@ -138,6 +140,7 @@ namespace preferences {
|
|||
*/
|
||||
if (!config_doc.containsKey("disable_capslock")) config_doc["disable_capslock"] = disable_capslock;
|
||||
if (!config_doc.containsKey("run_on_indicator")) config_doc["run_on_indicator"] = run_on_indicator;
|
||||
if (!config_doc.containsKey("run_on_msc")) config_doc["run_on_msc"] = run_on_msc;
|
||||
|
||||
if (!config_doc.containsKey("initial_delay")) config_doc["initial_delay"] = initial_delay;
|
||||
|
||||
|
@ -170,6 +173,7 @@ namespace preferences {
|
|||
*/
|
||||
disable_capslock = config_doc["disable_capslock"].as<bool>();
|
||||
run_on_indicator = config_doc["run_on_indicator"].as<bool>();
|
||||
run_on_msc = config_doc["run_on_msc"].as<bool>();
|
||||
|
||||
initial_delay = config_doc["initial_delay"].as<int>();
|
||||
}
|
||||
|
@ -232,6 +236,7 @@ namespace preferences {
|
|||
*/
|
||||
disable_capslock = true;
|
||||
run_on_indicator = false;
|
||||
run_on_msc = false;
|
||||
|
||||
initial_delay = 1000;
|
||||
}
|
||||
|
@ -324,6 +329,10 @@ namespace preferences {
|
|||
bool getRunOnIndicator() {
|
||||
return run_on_indicator;
|
||||
}
|
||||
|
||||
bool getRunOnMSC() {
|
||||
return run_on_msc;
|
||||
}
|
||||
|
||||
int getInitialDelay() {
|
||||
return initial_delay;
|
||||
|
|
|
@ -35,6 +35,7 @@ namespace preferences {
|
|||
|
||||
bool getDisableCapslock();
|
||||
bool getRunOnIndicator();
|
||||
bool getRunOnMSC();
|
||||
|
||||
int getInitialDelay();
|
||||
}
|
Loading…
Reference in New Issue