Improved LED and Wristband Highlight LED support

This commit is contained in:
Stefan Kremser
2018-10-11 16:49:39 +02:00
parent 3230750a26
commit 8b39d2b520
7 changed files with 1590 additions and 1585 deletions

View File

@@ -688,7 +688,7 @@ void CLI::runCommand(String input) {
// ===== STOP ===== //
// stop [<mode>]
else if (eqlsCMD(0, CLI_STOP)) {
led->setMode(led->LED_MODE::IDLE, true);
led.setMode(led.LED_MODE::IDLE, true);
if ((list->size() >= 2) && !(eqlsCMD(1, CLI_ALL))) {
for (int i = 1; i < list->size(); i++) {
@@ -964,9 +964,9 @@ void CLI::runCommand(String input) {
// led <r> <g> <b> [<brightness>]
else if ((list->size() >= 4) && (list->size() <= 5) && eqlsCMD(0, CLI_LED)) {
if (list->size() == 4) {
led->setColor(list->get(1).toInt(), list->get(2).toInt(), list->get(3).toInt(), true);
led.setColor(list->get(1).toInt(), list->get(2).toInt(), list->get(3).toInt(), true);
} else {
led->setColor(list->get(1).toInt(), list->get(2).toInt(), list->get(3).toInt(), list->get(4).toInt(), true);
led.setColor(list->get(1).toInt(), list->get(2).toInt(), list->get(3).toInt(), list->get(4).toInt(), true);
}
}
@@ -977,18 +977,18 @@ void CLI::runCommand(String input) {
strToColor(list->get(1), c);
if (list->size() == 2) {
led->setColor(c[0], c[1], c[2], true);
led.setColor(c[0], c[1], c[2], true);
} else {
led->setColor(c[0], c[1], c[2], list->get(2).toInt(), true);
led.setColor(c[0], c[1], c[2], list->get(2).toInt(), true);
}
}
// led <enable/disable>
else if ((list->size() == 2) && eqlsCMD(0, CLI_LED)) {
if (eqlsCMD(1, CLI_ENABLE)) {
led->tempEnable();
led.tempEnable();
} else if (eqlsCMD(1, CLI_DISABLE)) {
led->tempDisable();
led.tempDisable();
} else {
parameterError(list->get(1));
}
@@ -1006,7 +1006,7 @@ void CLI::runCommand(String input) {
scan.update(); // run scan
attack.update(); // run attacks
ssids.update(); // run random mode, if enabled
led->update(); // update LED color
led.update(); // update LED color
// auto-save
if (settings.getAutosave() && (currentTime - autosaveTime > settings.getAutosaveTime())) {

View File

@@ -18,7 +18,7 @@ extern "C" {
#include "DisplayUI.h"
#include "LED.h"
extern LED* led;
extern LED led;
extern Settings settings;
extern Names names;
extern SSIDs ssids;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -7,28 +7,16 @@ LED::~LED() {
}
void LED::setup() {
#ifdef DIGITAL_LED
#if defined(DIGITAL_LED)
led = new DigitalLED(LED_PIN_R, LED_PIN_G, LED_PIN_B, LED_ANODE);
led->setup();
return;
#endif // ifdef DIGITAL_LED
#ifdef RGB_LED
#elif defined(RGB_LED)
led = new LED::AnalogRGBLED(LED_PIN_R, LED_PIN_G, LED_PIN_B, LED_MODE_BRIGHTNESS, LED_ANODE);
led->setup();
return;
#endif // ifdef RGB_LED
#ifdef NEOPIXEL_LED
#elif defined(NEOPIXEL_LED)
led = new LED::NeopixelLED(LED_NEOPIXEL_NUM, LED_NEOPIXEL_PIN, LED_MODE_BRIGHTNESS);
led->setup();
return;
#endif // ifdef NEOPIXEL_LED
prntln(L_NOT_CONFIGURED);
#endif
}
void LED::update() {
@@ -52,19 +40,15 @@ void LED::setMode(uint8_t mode, bool force) {
case LED_MODE::OFF:
led->setColor(0, 0, 0);
break;
case LED_MODE::SCAN:
led->setColor(0, 0, 255);
break;
case LED_MODE::ATTACK:
led->setColor(255, 255, 0);
break;
case LED_MODE::DEAUTH:
led->setColor(255, 0, 0);
break;
case LED_MODE::IDLE:
led->setColor(0, 255, 0);
break;

View File

@@ -24,7 +24,7 @@ extern "C" {
#include "LED.h"
// Run-Time Variables //
LED* led;
LED led;
Settings settings;
Names names;
SSIDs ssids;
@@ -105,13 +105,9 @@ void setup() {
// create scan.json
scan.setup();
// setup LED
led = new LED();
led->setup();
// set channel
setWifiChannel(settings.getChannel());
// load Wifi settings: SSID, password,...
#ifdef DEFAULT_SSID
if(settings.getSSID() == "pwned") settings.setSSID(DEFAULT_SSID);
@@ -135,19 +131,21 @@ void setup() {
// version
prntln(settings.getVersion());
// setup LED
led.setup();
}
void loop() {
currentTime = millis();
led.update(); // update LED color
wifiUpdate(); // manage access point
attack.update(); // run attacks
displayUI.update();
cli.update(); // read and run serial input
scan.update(); // run scan
ssids.update(); // run random mode, if enabled
led->update(); // update LED color
// auto-save
if (settings.getAutosave() && (currentTime - autosaveTime > settings.getAutosaveTime())) {
@@ -162,5 +160,8 @@ void loop() {
EEPROM.write(0, 0);
EEPROM.commit();
booted = true;
#ifdef HIGHLIGHT_LED
displayUI.setupLED();
#endif
}
}

View File

@@ -283,6 +283,7 @@ const char D_REMOVE[] PROGMEM = "REMOVE";
const char D_SELECT_ALL[] PROGMEM = "SELECT ALL";
const char D_DESELECT_ALL[] PROGMEM = "DESELECT ALL";
const char D_CLONE[] PROGMEM = "CLONE SSID";
const char D_LED[] PROGMEM = "LED";
// BUTTON TEST
const char D_UP[] PROGMEM = "UP:";