running 37C3 build - max brightness, SSID, no SSH blinking (lags)

master
Felix Pankratz 9 months ago
parent 8d88780e5a
commit 035519b886

@ -1,9 +1,18 @@
[env:adafruit_qtpy_esp32s2] ; PlatformIO Project Configuration File
platform = espressif32 ;
board = adafruit_qtpy_esp32s2 ; Build options: build flags, source filter
framework = espidf, arduino ; Upload options: custom upload port, speed and extra flags
build_flags = ; Library options: dependencies, extra library storages
'-Iinclude' ; Advanced options: extra scripting
'-DESP_IDF_LWIP_HOOK_FILENAME="lwip_hooks.h"' ;
lib_deps = ; Please visit documentation for the other options and examples
adafruit/Adafruit NeoPixel ; https://docs.platformio.org/page/projectconf.html
[env:adafruit_qtpy_esp32s2]
platform = espressif32
board = adafruit_qtpy_esp32s2
framework = espidf, arduino
build_flags =
'-Iinclude'
'-DESP_IDF_LWIP_HOOK_FILENAME="lwip_hooks.h"'
lib_deps = adafruit/Adafruit NeoPixel@^1.12.0

@ -1,7 +1,7 @@
//file: main.c or main.cpp //file: main.c or main.cpp
#include "Arduino.h" #include "Arduino.h"
#include "WiFi.h" #include "WiFi.h"
#include <Adafruit_Neopixel.h> #include <Adafruit_NeoPixel.h>
#define NUMPIXELS 8 #define NUMPIXELS 8
#define PIN_NEOPIXEL_ONBOARD 39 #define PIN_NEOPIXEL_ONBOARD 39
@ -15,8 +15,8 @@
enum mode{Disco, Gauge}; enum mode{Disco, Gauge};
enum mode active_mode = Disco; enum mode active_mode = Disco;
char ssid[] = "MyNetwork"; // your network SSID (name) char ssid[] = "37C3-open"; // your network SSID (name)
char pass[] = "MyPassphrase"; // your network password (use for WPA, or use as key for WEP) //char pass[] = "Amsterdamrocks!"; // your network password (use for WPA, or use as key for WEP)
Adafruit_NeoPixel pixels(NUMPIXELS, PIN_NEOPIXEL, NEO_GRB + NEO_KHZ800); Adafruit_NeoPixel pixels(NUMPIXELS, PIN_NEOPIXEL, NEO_GRB + NEO_KHZ800);
Adafruit_NeoPixel onboard_pixel(1, PIN_NEOPIXEL_ONBOARD, NEO_GRB + NEO_KHZ800); Adafruit_NeoPixel onboard_pixel(1, PIN_NEOPIXEL_ONBOARD, NEO_GRB + NEO_KHZ800);
@ -34,6 +34,9 @@ uint32_t gauge_colors[] = {
pixels.Color(255, 0, 0) // red pixels.Color(255, 0, 0) // red
}; };
uint32_t last_tcp_color = pixels.Color(0,0,0);
uint32_t last_udp_color = pixels.Color(0,0,0);
void ssh_attempt() { void ssh_attempt() {
printf("Someone connected to SSH!"); printf("Someone connected to SSH!");
pixels.fill(pixels.Color(255, 0, 0)); pixels.fill(pixels.Color(255, 0, 0));
@ -42,10 +45,12 @@ void ssh_attempt() {
pixels.clear(); pixels.clear();
pixels.show(); pixels.show();
delay(100); delay(100);
pixels.fill(pixels.Color(255, 0, 0)); pixels.setPixelColor(4, last_udp_color);
pixels.show(); pixels.setPixelColor(5, last_udp_color);
delay(200); pixels.setPixelColor(6, last_udp_color);
pixels.fill(pixels.Color(0,0,0)); pixels.setPixelColor(0, last_tcp_color);
pixels.setPixelColor(1, last_tcp_color);
pixels.setPixelColor(2, last_tcp_color);
pixels.show(); pixels.show();
} }
@ -69,20 +74,22 @@ extern "C" {
icmp_ping(); icmp_ping();
break; break;
case PROTO_TCP: case PROTO_TCP:
if (port == 22) { // if (port == 22) {
ssh_attempt(); // ssh_attempt();
} else { // } else {
pixels.setPixelColor(0, color); pixels.setPixelColor(0, color);
pixels.setPixelColor(1, color); pixels.setPixelColor(1, color);
pixels.setPixelColor(2, color); pixels.setPixelColor(2, color);
pixels.show(); pixels.show();
} last_tcp_color = color;
//}
break; break;
case PROTO_UDP: case PROTO_UDP:
pixels.setPixelColor(4, color); pixels.setPixelColor(4, color);
pixels.setPixelColor(5, color); pixels.setPixelColor(5, color);
pixels.setPixelColor(6, color); pixels.setPixelColor(6, color);
pixels.show(); pixels.show();
last_udp_color = color;
break; break;
} }
} else if (active_mode == Gauge) { } else if (active_mode == Gauge) {
@ -94,7 +101,7 @@ extern "C" {
pixels.clear(); pixels.clear();
for(int i = 0; i < num_leds; i++) { for(int i = 0; i < num_leds; i++) {
pixels.setPixelColor(i, gauge_colors[i]); pixels.setPixelColor(i, gauge_colors[i]);
} }
pixels.show(); pixels.show();
packets_received = 0; packets_received = 0;
last_gauge_show = millis(); last_gauge_show = millis();
@ -117,13 +124,14 @@ extern "C" void app_main()
#endif #endif
pixels.begin(); // INITIALIZE NeoPixel strip object (REQUIRED) pixels.begin(); // INITIALIZE NeoPixel strip object (REQUIRED)
onboard_pixel.begin(); // INITIALIZE NeoPixel strip object (REQUIRED) onboard_pixel.begin(); // INITIALIZE NeoPixel strip object (REQUIRED)
pixels.setBrightness(20); // not so bright pixels.setBrightness(255); // not so bright
onboard_pixel.setBrightness(20); onboard_pixel.setBrightness(50);
printf("Connecting"); printf("Connecting");
onboard_pixel.fill(onboard_pixel.Color(255, 255, 0)); onboard_pixel.fill(onboard_pixel.Color(255, 255, 0));
onboard_pixel.show(); onboard_pixel.show();
WiFi.begin(ssid, pass); //WiFi.begin(ssid, pass);
WiFi.begin(ssid, NULL);
while (WiFi.status() != WL_CONNECTED) { while (WiFi.status() != WL_CONNECTED) {
delay(500); delay(500);
printf("."); printf(".");
@ -134,6 +142,7 @@ extern "C" void app_main()
printf("\nConnected!\n"); printf("\nConnected!\n");
printf("SSID: %s\n", WiFi.SSID().c_str()); printf("SSID: %s\n", WiFi.SSID().c_str());
printf("IP: %s\n", WiFi.localIP().toString().c_str()); printf("IP: %s\n", WiFi.localIP().toString().c_str());
printf("MAC: %s", WiFi.macAddress().c_str());
long last_touch = 0; long last_touch = 0;

Loading…
Cancel
Save