You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// P2.5 Display Parameters and definitions
#define PANEL_RES_X 128 // Number of pixels wide of each INDIVIDUAL panel module.
#define PANEL_RES_Y 64 // Number of pixels tall of each INDIVIDUAL panel module.
#define PANEL_CHAIN 1 // Total number of panels chained one to another horizontally only.
// display functions
void displaySetup(); // Set up the display , define pins and initialize the module
void displayMessage(const char* name, const char* contact); // Display the Message (name and contact details)
void displaySettings(); // Display the changed Settings
TaskHandle_t displayTaskHandle; // Task Handler for display functions
int displayDurationGlobal; // Store the display duration globally
int Display_Power_Pin = 46; // Pin to enable Power to Display module
void setup() {
// put your setup code here, to run once:
wokeup_duration = millis();
debug.begin(115200);
Serial.begin(115200);
xTaskCreatePinnedToCore(displayTask, "display task", 16384, NULL, 2, &displayTaskHandle, 1); // Stack size: 4096, priority: 1
debug.println("---------------------RTOS Tasks Created----------------------");
xTaskNotifyGive(displayTaskHandle); // Assuming displayTaskHandle is the handle for the displaying the task
activate_esp_deepsleep();
}
int scrollSpeed = 50; // Scroll spped
int startX = PANEL_RES_X; // Start from the right edge of the screen
int nameLength = 0;
unsigned long displayStartTime = 0;
unsigned long lastUpdate = 0; // Stores the last time the display was updated
// Function to handle the display logic in a separate task
void displayTask(void* parameter) {
while (true) {
// if (newDataAvailable) {
ulTaskNotifyTake(pdTRUE, portMAX_DELAY); // Wait indefinetely for a notification
digitalWrite(Display_Power_Pin, HIGH);
delay(500);
displaySetup(); // Setup the display MOdule
// dma_display.end();
digitalWrite(Display_Power_Pin, LOW);
delay(500);
// Small delay to allow other tasks to run
vTaskDelay(10 / portTICK_PERIOD_MS); // 10 ms delay for FreeRTOS task scheduling
}
}
void displaySetup() {
if(dma_display.begin()) debug.println("\n[Info] Display Successfully Initialized!!");
else{
debug.println("\n[Info] Display not Initialized!!");
if(settingsON || newDataAvailable){
settingsON = false;
newDataAvailable = false;
}
return;
}
// Colour Codes to use in Display
uint16_t myBLACK = dma_display.color565(0, 0, 0); // Black
uint16_t myWHITE = dma_display.color565(255, 255, 255); // White
uint16_t myRED = dma_display.color565(255, 0, 0); // Red
uint16_t myGREEN = dma_display.color565(0, 255, 0); // Green
uint16_t myBLUE = dma_display.color565(0, 0, 255); // Blue
uint16_t myYELLOW = dma_display.color565(255, 255, 0); // Yellow
uint16_t myCYAN = dma_display.color565(0, 255, 255); // Cyan
uint16_t myMAGENTA = dma_display.color565(255, 0, 255); // Magenta
uint16_t myORANGE = dma_display.color565(255, 165, 0); // Orange
uint16_t myPURPLE = dma_display.color565(128, 0, 128); // Purple
uint16_t myPINK = dma_display.color565(255, 105, 180); // Pink
uint16_t myBROWN = dma_display.color565(165, 42, 42); // Brown
uint16_t myGREY = dma_display.color565(128, 128, 128); // Grey
uint16_t myDARKBLUE = dma_display.color565(0, 0, 139); // Dark Blue
uint16_t myDARKGREEN = dma_display.color565(0, 100, 0); // Dark Green
uint16_t myDARKRED = dma_display.color565(139, 0, 0); // Dark Red
uint16_t myLIGHTBLUE = dma_display.color565(173, 216, 230); // Light Blue
uint16_t myLIGHTGREEN = dma_display.color565(144, 238, 144); // Light Green
dma_display.setBrightness(255); // (0-255)
dma_display.setTextWrap(false); // Disable text wrap
dma_display.clearScreen();
if(boot_count == 1){
debug.println("[Info] Display [Info] Displaing Device name:");
long Info_display_timer = millis();
dma_display.clearScreen();
while(millis() - Info_display_timer <= 10000){
// Set text size and color
dma_display.setTextSize(2); // size 1 == 8 pixels high
dma_display.setTextColor(myRED); // White text
dma_display.setCursor(5, 5);
dma_display.print("Community");
dma_display.setCursor(5, 21);
dma_display.print("Siren");
dma_display.setCursor(5, 40);
dma_display.setTextColor(myPINK); // White text
dma_display.print("ID: " + device_ID);
delay(100);
// yield();
}
dma_display.clearScreen();
info_displayed = true;
}
if(settingsON){
Serial.println("Display ON!!!");
settingsON = false;
// displaySettings();
preferences.begin("CS_CONFIG", true);
lora_SF = preferences.getInt("lora_SF", 12);
lora_BW = preferences.getFloat("lora_BW", 125.0);
lora_CR = preferences.getInt("lora_CR", 6);
lora_CH = preferences.getChar("lora_CH", 'D');
lora_FQ = getChannelFrequency(lora_CH);
float wakeInterval = preferences.getFloat("wakeup_time", 30);
preferences.end();
// Clear the screen
dma_display.clearScreen();
// Set text size and color
dma_display.setTextSize(2); // size 1 == 8 pixels high
// Set initial cursor position
int cursorY = 2 ;
dma_display.setCursor(8, cursorY);
dma_display.setTextColor(myPINK); // White text
dma_display.print("Settings");
//Display Freq
cursorY +=20;
dma_display.setTextSize(1);
dma_display.setCursor(2, cursorY);
dma_display.setTextColor(myWHITE); // White text
dma_display.print("Freq: ");
lora_FQ = getChannelFrequency(lora_CH);
dma_display.print(lora_FQ);
dma_display.print(" MHz");
//Display Duty Cycle
cursorY +=8;
dma_display.setCursor(2, cursorY);
dma_display.setTextColor(myWHITE); // White text
dma_display.print("Lora SF: ");
dma_display.print(lora_SF);
// dma_display.print(" s");
//Display Duty Cycle
cursorY +=8;
dma_display.setCursor(2, cursorY);
dma_display.setTextColor(myWHITE); // White text
dma_display.print("Lora_CR: ");
dma_display.print(lora_CR);
// dma_display.print(" s");
//Display Siren Duration
cursorY +=8;
dma_display.setCursor(2, cursorY);
dma_display.setTextColor(myWHITE); // White text
dma_display.print("Beacon Time: ");
dma_display.print((int)wakeInterval);
dma_display.print(" min");
//Display Display Duration
cursorY +=8;
// dma_display.setCursor(2, cursorY);
// dma_display.setTextColor(myWHITE); // White text
// dma_display.print("Display Time: ");
// dma_display.print(displayDurationGlobal);
// dma_display.print(" s");
delay(5000);
// vTaskDelay( 2000/ portTICK_PERIOD_MS);
dma_display.clearScreen();
}else if(newDataAvailable){
Serial.println("Display ON!!!");
newDataAvailable = false;
debug.println("------------------------------------------------");
debug.println("[Info] Displaying the Caller Details..");
// displayMessage(currentName.c_str(), currentPhone.c_str());
// Clear the screen
dma_display.clearScreen();
// Set text size and color
dma_display.setTextSize(2); // size 1 == 8 pixels high
// Display Name
nameLength = strlen(currentName.c_str()) * 12; // 12 pixels width per character
// Set initial cursor position
int cursorY = 2 ;
// Display Contact
cursorY +=16;
dma_display.setCursor(5, cursorY);
dma_display.setTextColor(myPINK); // White text
dma_display.print(currentPhone);
//Display Date
cursorY += 16; // Move cursor down
// dma_display.fillRect(0, cursorY-1, PANEL_RES_X, 16, myWHITE); // Fill rectangle with white for date
dma_display.setCursor(5, cursorY);
dma_display.setTextColor(myWHITE); // White text
dma_display.print(Date);
//Display Time
cursorY += 16; // Move cursor down
dma_display.setCursor(5, cursorY);
// dma_display.fillRect(0, cursorY-1, PANEL_RES_X, 16, myWHITE); // Fill rectangle with white for Time
dma_display.setTextColor(myWHITE); // White text
dma_display.print(Time);
startX = PANEL_RES_X;
displayStartTime = millis();
cursorY = 2; // Y position for the name display
dma_display.setTextColor(myGREEN);
unsigned long startTime = millis();
while (millis() - startTime < displayDurationGlobal * 1000) {
// debug.print("D");
// clear the previous position
dma_display.fillRect(0, cursorY, PANEL_RES_X, 14, myBLACK); // Clear the rectange for displaying name
// set the cursor position for the name
dma_display.setCursor(startX, cursorY);
dma_display.print(currentName);
//Move the name to the left
startX -=2;
//If the name has moved off the screen, reset the position
if(startX < -nameLength){
startX = PANEL_RES_X;
}
// vTaskDelay(scrollSpeed / portTICK_PERIOD_MS);
delay(scrollSpeed);
// yield();
}
debug.println();
// Clear the screen
dma_display.fillScreen(myBLACK);
}
Above code is only the snippet of display functions. I have tried pointer definition for display, also not working at all. On the reset as a first boot of esp, display gets initialized and also displays on the board but after wake up from the deep sleep, it fails to initialize, nothing at the display.
I'll see if I can replicate. Could be some DMA engine stuff that goes wrong after a deep sleep... but I'm not sure how given the entire setup() function would get called again upon wake from sleep.
//----------------------------------P2.5 Display -------------------------------------------------------------//
// P2.5 display has following connections with esp32s3
#define R1_PIN 4
#define G1_PIN 5
#define B1_PIN 6
#define R2_PIN 7
#define G2_PIN 15
#define B2_PIN 16
#define A_PIN 17
#define B_PIN 18
#define C_PIN 21
#define D_PIN 20
#define E_PIN 19
#define LAT_PIN 26
#define OE_PIN 48
#define CLK_PIN 47
// P2.5 Display Parameters and definitions
#define PANEL_RES_X 128 // Number of pixels wide of each INDIVIDUAL panel module.
#define PANEL_RES_Y 64 // Number of pixels tall of each INDIVIDUAL panel module.
#define PANEL_CHAIN 1 // Total number of panels chained one to another horizontally only.
// Defining the HUB75 pins of display
HUB75_I2S_CFG::i2s_pins _pins = { R1_PIN, G1_PIN, B1_PIN, R2_PIN, G2_PIN, B2_PIN, A_PIN, B_PIN, C_PIN, D_PIN, E_PIN, LAT_PIN, OE_PIN, CLK_PIN };
//Configuration of display
HUB75_I2S_CFG mxconfig(
PANEL_RES_X, // module width
PANEL_RES_Y, // module height
PANEL_CHAIN, // Chain length
_pins,
HUB75_I2S_CFG::ICN2038S // driver chip
);
// MatrixPanel_I2S_DMA *dma_display = nullptr;
int x_offset, y_offset;
// display functions
void displaySetup(); // Set up the display , define pins and initialize the module
void displayMessage(const char* name, const char* contact); // Display the Message (name and contact details)
void displaySettings(); // Display the changed Settings
TaskHandle_t displayTaskHandle; // Task Handler for display functions
int displayDurationGlobal; // Store the display duration globally
int Display_Power_Pin = 46; // Pin to enable Power to Display module
void setup() {
// put your setup code here, to run once:
wokeup_duration = millis();
debug.begin(115200);
Serial.begin(115200);
xTaskCreatePinnedToCore(displayTask, "display task", 16384, NULL, 2, &displayTaskHandle, 1); // Stack size: 4096, priority: 1
debug.println("---------------------RTOS Tasks Created----------------------");
xTaskNotifyGive(displayTaskHandle); // Assuming displayTaskHandle is the handle for the displaying the task
activate_esp_deepsleep();
}
int scrollSpeed = 50; // Scroll spped
int startX = PANEL_RES_X; // Start from the right edge of the screen
int nameLength = 0;
unsigned long displayStartTime = 0;
unsigned long lastUpdate = 0; // Stores the last time the display was updated
// Function to handle the display logic in a separate task
void displayTask(void* parameter) {
while (true) {
// if (newDataAvailable) {
}
}
void displaySetup() {
// }
// mxconfig.gpio.e = 42;
// mxconfig.clkphase = false;
}
The text was updated successfully, but these errors were encountered: