Add Neopixel support

This commit is contained in:
Just Call Me Koko
2020-04-23 19:23:00 -04:00
parent 418a8ebf41
commit 1612ac4bf0
5 changed files with 86 additions and 4 deletions

View File

@@ -3,7 +3,7 @@
<!---[![Build Status](https://travis-ci.com/justcallmekoko/ESP32Marauder.svg?branch=master)](https://travis-ci.com/justcallmekoko/ESP32Marauder)--->
<!---Shields/Badges https://shields.io/--->
# ESP32 Marauder v0.6.3
# ESP32 Marauder v0.6.4
<p align="center"><img alt="Marauder logo" src="https://github.com/justcallmekoko/ESP32Marauder/blob/master/pictures/marauder3L.jpg?raw=true" width="300"></p>
<p align="center">
<b>A suite of WiFi/Bluetooth offensive and defensive tools for the ESP32</b>

View File

@@ -13,8 +13,8 @@
#include <TFT_eSPI.h>
#define TFT_SHIELD
//#define TFT_DIY
//#define TFT_SHIELD
#define TFT_DIY
#define SCREEN_WIDTH 240
#define SCREEN_HEIGHT 320
@@ -56,7 +56,7 @@ class Display
TFT_eSPI tft = TFT_eSPI();
TFT_eSprite img = TFT_eSprite(&tft);
TFT_eSPI_Button key[BUTTON_ARRAY_LEN];
String version_number = "v0.6.3";
String version_number = "v0.6.4";
bool printing = false;
bool loading = false;

View File

@@ -0,0 +1,41 @@
#include "LedInterface.h"
LedInterface::LedInterface() {
}
void LedInterface::RunSetup() {
Serial.println("Setting neopixel to black...");
strip.begin();
strip.setBrightness(50);
strip.setPixelColor(0, strip.Color(0, 0, 0));
strip.show();
delay(100);
strip.setPixelColor(0, strip.Color(255, 0, 0));
strip.show();
this->initTime = millis();
}
void LedInterface::main(uint32_t currentTime) {
strip.setPixelColor(0, this->Wheel((0 * 256 / 100 + this->wheel_pos) % 256));
strip.show();
this->current_fade_itter++;
this->wheel_pos = this->wheel_pos - this->wheel_speed;
if (this->wheel_pos < 0)
this->wheel_pos = 255;
};
uint32_t LedInterface::Wheel(byte WheelPos) {
WheelPos = 255 - WheelPos;
if(WheelPos < 85) {
return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3);
}
if(WheelPos < 170) {
WheelPos -= 85;
return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3);
}
WheelPos -= 170;
return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
}

View File

@@ -0,0 +1,31 @@
#ifndef LedInterface_h
#define LedInterface_h
#include <Arduino.h>
#include <Adafruit_NeoPixel.h>
#define PIN 25
#define Pixels 1
extern Adafruit_NeoPixel strip;
class LedInterface {
private:
uint32_t initTime = 0;
int current_fade_itter = 1;
int wheel_pos = 255;
int wheel_speed = 1; // lower = slower
uint32_t Wheel(byte WheelPos);
public:
LedInterface();
void RunSetup();
void main(uint32_t currentTime);
};
#endif

View File

@@ -25,6 +25,7 @@ https://www.online-utility.org/image/convert/to/XBM
#include "Buffer.h"
#include "BatteryInterface.h"
#include "TemperatureInterface.h"
#include "LedInterface.h"
//#include "icons.h"
/*
@@ -46,6 +47,9 @@ Web web_obj;
Buffer buffer_obj;
BatteryInterface battery_obj;
TemperatureInterface temp_obj;
LedInterface led_obj;
Adafruit_NeoPixel strip = Adafruit_NeoPixel(Pixels, PIN, NEO_GRB + NEO_KHZ800);
uint32_t currentTime = 0;
@@ -71,6 +75,9 @@ void setup()
//Serial.println("Internal Temp: " + (String)((temprature_sens_read() - 32) / 1.8));
// Do some LED stuff
led_obj.RunSetup();
// Do some SD stuff
if(sd_obj.initSD())
Serial.println("SD Card supported");
@@ -96,6 +103,8 @@ void setup()
}
else
Serial.println("IP5306 I2C Supported: false");
Serial.println(wifi_scan_obj.freeRAM());
}
@@ -115,6 +124,7 @@ void loop()
sd_obj.main();
battery_obj.main(currentTime);
temp_obj.main(currentTime);
//led_obj.main(currentTime);
//if ((wifi_scan_obj.currentScanMode != WIFI_ATTACK_BEACON_SPAM))
if ((wifi_scan_obj.currentScanMode != WIFI_PACKET_MONITOR) &&
(wifi_scan_obj.currentScanMode != WIFI_SCAN_EAPOL))