Update WiFi SoftAP password to love, update touch pin mappings, and remove unused decoders to resolve compile crash.
This commit is contained in:
@@ -62,95 +62,172 @@ void LCD_Init(void)
|
||||
Backlight_Init();
|
||||
SPI_Init();
|
||||
|
||||
LCD_Reset();
|
||||
//************* Start Initial Sequence **********//
|
||||
LCD_WriteCommand(0x11);
|
||||
// Reset LCD
|
||||
digitalWrite(EXAMPLE_PIN_NUM_LCD_RST, LOW);
|
||||
delay(10);
|
||||
digitalWrite(EXAMPLE_PIN_NUM_LCD_RST, HIGH);
|
||||
delay(50);
|
||||
|
||||
//************* JD9853 Start Initial Sequence **********//
|
||||
LCD_WriteCommand(0x11); // Sleep Out
|
||||
delay(120);
|
||||
LCD_WriteCommand(0x36);
|
||||
|
||||
LCD_WriteCommand(0xDF);
|
||||
LCD_WriteData(0x98);
|
||||
LCD_WriteData(0x53);
|
||||
|
||||
LCD_WriteCommand(0xB2);
|
||||
LCD_WriteData(0x23);
|
||||
|
||||
LCD_WriteCommand(0xB7);
|
||||
LCD_WriteData(0x00);
|
||||
LCD_WriteData(0x47);
|
||||
LCD_WriteData(0x00);
|
||||
LCD_WriteData(0x6F);
|
||||
|
||||
LCD_WriteCommand(0xBB);
|
||||
LCD_WriteData(0x1C);
|
||||
LCD_WriteData(0x1A);
|
||||
LCD_WriteData(0x55);
|
||||
LCD_WriteData(0x73);
|
||||
LCD_WriteData(0x63);
|
||||
LCD_WriteData(0xF0);
|
||||
|
||||
LCD_WriteCommand(0xC0);
|
||||
LCD_WriteData(0x44);
|
||||
LCD_WriteData(0xA4);
|
||||
|
||||
LCD_WriteCommand(0xC1);
|
||||
LCD_WriteData(0x16);
|
||||
|
||||
LCD_WriteCommand(0xC3);
|
||||
LCD_WriteData(0x7D);
|
||||
LCD_WriteData(0x07);
|
||||
LCD_WriteData(0x14);
|
||||
LCD_WriteData(0x06);
|
||||
LCD_WriteData(0xCF);
|
||||
LCD_WriteData(0x71);
|
||||
LCD_WriteData(0x72);
|
||||
LCD_WriteData(0x77);
|
||||
|
||||
LCD_WriteCommand(0xC4);
|
||||
LCD_WriteData(0x00);
|
||||
LCD_WriteData(0x00);
|
||||
LCD_WriteData(0xA0);
|
||||
LCD_WriteData(0x79);
|
||||
LCD_WriteData(0x0B);
|
||||
LCD_WriteData(0x0A);
|
||||
LCD_WriteData(0x16);
|
||||
LCD_WriteData(0x79);
|
||||
LCD_WriteData(0x0B);
|
||||
LCD_WriteData(0x0A);
|
||||
LCD_WriteData(0x16);
|
||||
LCD_WriteData(0x82);
|
||||
|
||||
LCD_WriteCommand(0xC8);
|
||||
const uint8_t c8_data[] = {
|
||||
0x3F, 0x32, 0x29, 0x29, 0x27, 0x2B, 0x27, 0x28, 0x28, 0x26, 0x25, 0x17, 0x12, 0x0D, 0x04, 0x00,
|
||||
0x3F, 0x32, 0x29, 0x29, 0x27, 0x2B, 0x27, 0x28, 0x28, 0x26, 0x25, 0x17, 0x12, 0x0D, 0x04, 0x00
|
||||
};
|
||||
for (int i = 0; i < 32; i++) {
|
||||
LCD_WriteData(c8_data[i]);
|
||||
}
|
||||
|
||||
LCD_WriteCommand(0xD0);
|
||||
LCD_WriteData(0x04);
|
||||
LCD_WriteData(0x06);
|
||||
LCD_WriteData(0x6B);
|
||||
LCD_WriteData(0x0F);
|
||||
LCD_WriteData(0x00);
|
||||
|
||||
LCD_WriteCommand(0xD7);
|
||||
LCD_WriteData(0x00);
|
||||
LCD_WriteData(0x30);
|
||||
|
||||
LCD_WriteCommand(0xE6);
|
||||
LCD_WriteData(0x14);
|
||||
|
||||
LCD_WriteCommand(0xDE);
|
||||
LCD_WriteData(0x01);
|
||||
|
||||
LCD_WriteCommand(0xB7);
|
||||
LCD_WriteData(0x03);
|
||||
LCD_WriteData(0x13);
|
||||
LCD_WriteData(0xEF);
|
||||
LCD_WriteData(0x35);
|
||||
LCD_WriteData(0x35);
|
||||
|
||||
LCD_WriteCommand(0xC1);
|
||||
LCD_WriteData(0x14);
|
||||
LCD_WriteData(0x15);
|
||||
LCD_WriteData(0xC0);
|
||||
|
||||
LCD_WriteCommand(0xC2);
|
||||
LCD_WriteData(0x06);
|
||||
LCD_WriteData(0x3A);
|
||||
|
||||
LCD_WriteCommand(0xC4);
|
||||
LCD_WriteData(0x72);
|
||||
LCD_WriteData(0x12);
|
||||
|
||||
LCD_WriteCommand(0xBE);
|
||||
LCD_WriteData(0x00);
|
||||
|
||||
LCD_WriteCommand(0xDE);
|
||||
LCD_WriteData(0x02);
|
||||
|
||||
LCD_WriteCommand(0xE5);
|
||||
LCD_WriteData(0x00);
|
||||
LCD_WriteData(0x02);
|
||||
LCD_WriteData(0x00);
|
||||
|
||||
LCD_WriteCommand(0xE5);
|
||||
LCD_WriteData(0x01);
|
||||
LCD_WriteData(0x02);
|
||||
LCD_WriteData(0x00);
|
||||
|
||||
LCD_WriteCommand(0xDE);
|
||||
LCD_WriteData(0x00);
|
||||
|
||||
LCD_WriteCommand(0x35);
|
||||
LCD_WriteData(0x00);
|
||||
|
||||
LCD_WriteCommand(0x3A);
|
||||
LCD_WriteData(0x05);
|
||||
|
||||
LCD_WriteCommand(0x2A);
|
||||
LCD_WriteData(0x00);
|
||||
LCD_WriteData(0x22);
|
||||
LCD_WriteData(0x00);
|
||||
LCD_WriteData(0xCD);
|
||||
|
||||
LCD_WriteCommand(0x2B);
|
||||
LCD_WriteData(0x00);
|
||||
LCD_WriteData(0x00);
|
||||
LCD_WriteData(0x01);
|
||||
LCD_WriteData(0x3F);
|
||||
|
||||
LCD_WriteCommand(0xDE);
|
||||
LCD_WriteData(0x02);
|
||||
|
||||
LCD_WriteCommand(0xE5);
|
||||
LCD_WriteData(0x00);
|
||||
LCD_WriteData(0x02);
|
||||
LCD_WriteData(0x00);
|
||||
|
||||
LCD_WriteCommand(0xDE);
|
||||
LCD_WriteData(0x00);
|
||||
|
||||
LCD_WriteCommand(0x36); // Rotation control
|
||||
if (HORIZONTAL)
|
||||
LCD_WriteData(0x00);
|
||||
else
|
||||
LCD_WriteData(0x70);
|
||||
|
||||
LCD_WriteCommand(0x3A);
|
||||
LCD_WriteData(0x05);
|
||||
LCD_WriteCommand(0x21); // Display Inversion On
|
||||
|
||||
LCD_WriteCommand(0xB0);
|
||||
LCD_WriteData(0x00);
|
||||
LCD_WriteData(0xE8);
|
||||
|
||||
LCD_WriteCommand(0xB2);
|
||||
LCD_WriteData(0x0C);
|
||||
LCD_WriteData(0x0C);
|
||||
LCD_WriteData(0x00);
|
||||
LCD_WriteData(0x33);
|
||||
LCD_WriteData(0x33);
|
||||
|
||||
LCD_WriteCommand(0xB7);
|
||||
LCD_WriteData(0x35);
|
||||
|
||||
LCD_WriteCommand(0xBB);
|
||||
LCD_WriteData(0x35);
|
||||
|
||||
LCD_WriteCommand(0xC0);
|
||||
LCD_WriteData(0x2C);
|
||||
|
||||
LCD_WriteCommand(0xC2);
|
||||
LCD_WriteData(0x01);
|
||||
|
||||
LCD_WriteCommand(0xC3);
|
||||
LCD_WriteData(0x13);
|
||||
|
||||
LCD_WriteCommand(0xC4);
|
||||
LCD_WriteData(0x20);
|
||||
|
||||
LCD_WriteCommand(0xC6);
|
||||
LCD_WriteData(0x0F);
|
||||
|
||||
LCD_WriteCommand(0xD0);
|
||||
LCD_WriteData(0xA4);
|
||||
LCD_WriteData(0xA1);
|
||||
|
||||
LCD_WriteCommand(0xD6);
|
||||
LCD_WriteData(0xA1);
|
||||
|
||||
LCD_WriteCommand(0xE0);
|
||||
LCD_WriteData(0xF0);
|
||||
LCD_WriteData(0x00);
|
||||
LCD_WriteData(0x04);
|
||||
LCD_WriteData(0x04);
|
||||
LCD_WriteData(0x04);
|
||||
LCD_WriteData(0x05);
|
||||
LCD_WriteData(0x29);
|
||||
LCD_WriteData(0x33);
|
||||
LCD_WriteData(0x3E);
|
||||
LCD_WriteData(0x38);
|
||||
LCD_WriteData(0x12);
|
||||
LCD_WriteData(0x12);
|
||||
LCD_WriteData(0x28);
|
||||
LCD_WriteData(0x30);
|
||||
|
||||
LCD_WriteCommand(0xE1);
|
||||
LCD_WriteData(0xF0);
|
||||
LCD_WriteData(0x07);
|
||||
LCD_WriteData(0x0A);
|
||||
LCD_WriteData(0x0D);
|
||||
LCD_WriteData(0x0B);
|
||||
LCD_WriteData(0x07);
|
||||
LCD_WriteData(0x28);
|
||||
LCD_WriteData(0x33);
|
||||
LCD_WriteData(0x3E);
|
||||
LCD_WriteData(0x36);
|
||||
LCD_WriteData(0x14);
|
||||
LCD_WriteData(0x14);
|
||||
LCD_WriteData(0x29);
|
||||
LCD_WriteData(0x32);
|
||||
|
||||
LCD_WriteCommand(0x21);
|
||||
|
||||
LCD_WriteCommand(0x11);
|
||||
delay(120);
|
||||
LCD_WriteCommand(0x29);
|
||||
delay(10);
|
||||
LCD_WriteCommand(0x29); // Display On
|
||||
}
|
||||
/******************************************************************************
|
||||
function: Set the cursor position
|
||||
@@ -219,17 +296,16 @@ void LCD_addWindow(uint16_t Xstart, uint16_t Ystart, uint16_t Xend, uint16_t Yen
|
||||
// backlight
|
||||
void Backlight_Init(void)
|
||||
{
|
||||
ledcAttach(EXAMPLE_PIN_NUM_BK_LIGHT, Frequency, Resolution);
|
||||
ledcWrite(EXAMPLE_PIN_NUM_BK_LIGHT, 100);
|
||||
pinMode(EXAMPLE_PIN_NUM_BK_LIGHT, OUTPUT);
|
||||
digitalWrite(EXAMPLE_PIN_NUM_BK_LIGHT, HIGH); // Set backlight to full brightness
|
||||
}
|
||||
|
||||
void Set_Backlight(uint8_t Light) //
|
||||
{
|
||||
|
||||
if(Light > 100 || Light < 0)
|
||||
printf("Set Backlight parameters in the range of 0 to 100 \r\n");
|
||||
else{
|
||||
uint32_t Backlight = Light*10;
|
||||
ledcWrite(EXAMPLE_PIN_NUM_BK_LIGHT, Backlight);
|
||||
pinMode(EXAMPLE_PIN_NUM_BK_LIGHT, OUTPUT);
|
||||
if (Light > 0) {
|
||||
digitalWrite(EXAMPLE_PIN_NUM_BK_LIGHT, HIGH);
|
||||
} else {
|
||||
digitalWrite(EXAMPLE_PIN_NUM_BK_LIGHT, LOW);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,12 +6,12 @@
|
||||
|
||||
#define SPIFreq 80000000
|
||||
#define EXAMPLE_PIN_NUM_MISO -1
|
||||
#define EXAMPLE_PIN_NUM_MOSI 45
|
||||
#define EXAMPLE_PIN_NUM_SCLK 40
|
||||
#define EXAMPLE_PIN_NUM_LCD_CS 42
|
||||
#define EXAMPLE_PIN_NUM_LCD_DC 41
|
||||
#define EXAMPLE_PIN_NUM_LCD_RST 39
|
||||
#define EXAMPLE_PIN_NUM_BK_LIGHT 48
|
||||
#define EXAMPLE_PIN_NUM_MOSI 39
|
||||
#define EXAMPLE_PIN_NUM_SCLK 38
|
||||
#define EXAMPLE_PIN_NUM_LCD_CS 21
|
||||
#define EXAMPLE_PIN_NUM_LCD_DC 45
|
||||
#define EXAMPLE_PIN_NUM_LCD_RST 40
|
||||
#define EXAMPLE_PIN_NUM_BK_LIGHT 46
|
||||
#define Frequency 1000 // PWM frequencyconst
|
||||
#define Resolution 10
|
||||
|
||||
|
||||
@@ -122,8 +122,8 @@ void handleUpload() {
|
||||
}
|
||||
|
||||
void initWebServer() {
|
||||
// Start WiFi Access Point with SSID "love" and password "password"
|
||||
WiFi.softAP("love", "password");
|
||||
// Start WiFi Access Point with SSID "love" and password "love"
|
||||
WiFi.softAP("love", "love");
|
||||
IPAddress IP = WiFi.softAPIP();
|
||||
printf("WiFi AP Started. SSID: 'love'\r\n");
|
||||
printf("Web Server IP address: %s\r\n", IP.toString().c_str());
|
||||
|
||||
@@ -5,8 +5,7 @@
|
||||
#include "Web_Server.h"
|
||||
#include <algorithm>
|
||||
|
||||
#define BOOT_KEY_PIN 9
|
||||
#define PIN_NEOPIXEL 38
|
||||
#define BOOT_KEY_PIN 0
|
||||
|
||||
// Playback states
|
||||
enum AppState {
|
||||
@@ -48,10 +47,6 @@ void setup() {
|
||||
printf("Starting Sound and Picture Player...\r\n");
|
||||
printf("==========================================\r\n");
|
||||
|
||||
// Setup NeoPixel
|
||||
pinMode(PIN_NEOPIXEL, OUTPUT);
|
||||
neopixelWrite(PIN_NEOPIXEL, 0, 0, 32); // Turn on solid blue to show booting
|
||||
|
||||
// Initialize Display and Backlight first so the screen lights up immediately
|
||||
LCD_Init();
|
||||
Set_Backlight(90);
|
||||
@@ -150,14 +145,6 @@ void handleQuadruplePress() {
|
||||
uint8_t nextVol = getPlayerVolume() + 4;
|
||||
if (nextVol > 20) nextVol = 4; // Loop back
|
||||
setPlayerVolume(nextVol);
|
||||
|
||||
// Quick flash NeoPixel white to indicate volume change
|
||||
for(int i = 0; i < 3; i++) {
|
||||
neopixelWrite(PIN_NEOPIXEL, 64, 64, 64);
|
||||
delay(50);
|
||||
neopixelWrite(PIN_NEOPIXEL, 0, 0, 0);
|
||||
delay(50);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -178,41 +165,7 @@ void handleLongPress() {
|
||||
}
|
||||
|
||||
void updateLEDStatus() {
|
||||
uint32_t now = millis();
|
||||
|
||||
// Pulse animation frequency
|
||||
if (now - lastLedPulseTime > 15) {
|
||||
lastLedPulseTime = now;
|
||||
if (pulseDirection) {
|
||||
pulseBrightness += 2;
|
||||
if (pulseBrightness >= 120) pulseDirection = false;
|
||||
} else {
|
||||
pulseBrightness -= 2;
|
||||
if (pulseBrightness <= 10) pulseDirection = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Update LED color based on state
|
||||
if (hasError) {
|
||||
// Flashing red
|
||||
if ((now / 250) % 2 == 0) {
|
||||
neopixelWrite(PIN_NEOPIXEL, 64, 0, 0); // Dim Red
|
||||
} else {
|
||||
neopixelWrite(PIN_NEOPIXEL, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
else if (isAudioPlaying()) {
|
||||
// Pulsing Green
|
||||
neopixelWrite(PIN_NEOPIXEL, 0, pulseBrightness, 0);
|
||||
}
|
||||
else if (currentState == STATE_AUTOPLAY) {
|
||||
// Pulsing Purple (Red + Blue)
|
||||
neopixelWrite(PIN_NEOPIXEL, pulseBrightness / 2, 0, pulseBrightness);
|
||||
}
|
||||
else {
|
||||
// Solid Blue
|
||||
neopixelWrite(PIN_NEOPIXEL, 0, 0, 32);
|
||||
}
|
||||
// Disabled NeoPixel code to resolve hardware conflict with SPI SCLK (GPIO 38)
|
||||
}
|
||||
|
||||
void loop() {
|
||||
|
||||
Reference in New Issue
Block a user