working ethernet version
This commit is contained in:
46
src/main.cpp
46
src/main.cpp
@ -1,6 +1,7 @@
|
||||
// Includes
|
||||
#include <WiFi.h>
|
||||
//#include <WiFi.h>
|
||||
//#include <WiFiServer.h>
|
||||
#include <W5500lwIP.h>
|
||||
#include <LEAmDNS.h>
|
||||
#include <HTTPUpdateServer.h>
|
||||
#include <WebServer.h>
|
||||
@ -9,8 +10,8 @@
|
||||
|
||||
// User configurable
|
||||
|
||||
const char* ssid = "iPhone 14"; // WiFi SSID
|
||||
const char* password = "givemewifi"; // WiFi Password
|
||||
//const char* ssid = "iPhone 14"; // WiFi SSID
|
||||
//const char* password = "givemewifi"; // WiFi Password
|
||||
const char* ntpserver = "pool.ntp.org"; // Address of NTP server. Example: pool.ntp.org
|
||||
const char* HOSTNAME = "lighttest";
|
||||
|
||||
@ -18,9 +19,11 @@ const char* update_path = "/firmware";
|
||||
const char* update_username = "admin";
|
||||
const char* update_password = "pico-stripper";
|
||||
|
||||
//Wiznet5500lwIP eth(1);
|
||||
|
||||
//#define DEBUG
|
||||
// Total LED count
|
||||
#define MAX_LEDS 50
|
||||
#define MAX_LEDS 150
|
||||
|
||||
#define LED_TYPE WS2812B
|
||||
// Amount of color channels per pixel - i.e. RGB = 3, RGBW = 4
|
||||
@ -31,7 +34,7 @@ const char* update_password = "pico-stripper";
|
||||
|
||||
// Define the data pin connection to each strip
|
||||
// Only uncomment the strips you use
|
||||
#define STRIP1 28
|
||||
#define STRIP1 0
|
||||
//#define STRIP2 0
|
||||
//#define STRIP3 2
|
||||
//#define STRIP4 3
|
||||
@ -43,7 +46,7 @@ const char* update_password = "pico-stripper";
|
||||
#define RGB_ORDER RGB
|
||||
|
||||
// define how many LEDs / zones are in each strip
|
||||
int strips[LED_STRIPS] = {50};
|
||||
int strips[LED_STRIPS] = {150};
|
||||
|
||||
// Begin code
|
||||
|
||||
@ -141,13 +144,25 @@ void write_universe(int universe, uint8_t data[]) {
|
||||
}
|
||||
|
||||
void setup() {
|
||||
pinMode(22, OUTPUT);
|
||||
digitalWrite(22, LOW); // Enable buffer output!
|
||||
pinMode(20, OUTPUT);
|
||||
digitalWrite(20, LOW); // reset W5500
|
||||
delay(1);
|
||||
digitalWrite(20, HIGH);
|
||||
SPI.setRX(16);
|
||||
SPI.setCS(17);
|
||||
SPI.setSCK(18);
|
||||
SPI.setTX(19);
|
||||
pinMode(8, OUTPUT);
|
||||
digitalWrite(8, LOW); // Enable buffer output!
|
||||
//pinMode(0, OUTPUT);
|
||||
//digitalWrite(0, HIGH);
|
||||
Serial.begin(115200);
|
||||
delay(3000);
|
||||
PRINTLNFUNC("========= PicoLighter v1.0 Initializing =========");
|
||||
if (!e131.begin()) {
|
||||
PRINTFUNC("Connection failed. Retrying.");
|
||||
rp2040.reboot();
|
||||
}
|
||||
while (ready == 0) {
|
||||
delay(100);
|
||||
}
|
||||
@ -236,17 +251,17 @@ void setup1() {
|
||||
#endif
|
||||
// Test all lights
|
||||
for (int i = 0; i < MAX_LEDS; i++) {
|
||||
ledstrip[i] = CRGB(130, 130, 130);
|
||||
ledstrip[i] = CRGB(50, 50, 50);
|
||||
FastLED.show();
|
||||
delay(30);
|
||||
ledstrip[i] = CRGB(0, 0, 0);
|
||||
}
|
||||
FastLED.show();
|
||||
delay(3000);
|
||||
WiFi.noLowPowerMode();
|
||||
if (e131.begin(ssid, password) != WL_CONNECTED) {
|
||||
PRINTFUNC("Connection failed. Retrying.");
|
||||
rp2040.reboot();
|
||||
// WiFi.noLowPowerMode();
|
||||
ready = 1;
|
||||
while (ready == 1) {
|
||||
delay(100);
|
||||
}
|
||||
PRINTLNFUNC("Starting mDNS client.");
|
||||
MDNS.begin(HOSTNAME);
|
||||
@ -261,10 +276,7 @@ void setup1() {
|
||||
PRINTFUNC(" and password ");
|
||||
PRINTLNFUNC(update_password);
|
||||
server.begin();
|
||||
ready = 1;
|
||||
while (ready == 1) {
|
||||
delay(100);
|
||||
}
|
||||
|
||||
// If we get here, then WiFi is good to go
|
||||
PRINTFUNC("Starting NTP client.");
|
||||
NTP.begin(ntpserver);
|
||||
|
Reference in New Issue
Block a user