Closed Gex31 closed 4 years ago
There may be some elements of the JavaScript that gets sent that does not agree with your browser for whatever reason. I would initially try to simplify the message sent to a simple "Hello World" or similar type confirmation that you have loaded the page and your link works properly and then work up the complexity from there.
Hello, Thanks for your answer. I success to display a simple text with the serial monitor. I can also change the message with the IP adress to connected to. It works. The DHCP assign an IP adress well, ping is OK. But when I enter the IP adress in my brower (chrome) on my computer or smartphone, same problem : ERR_EMPTY_MESSAGE.
I can also display a web page with the micro controleur with others library, so I think my network is OK (firewall, security filters ok).
That's why I dont understand. I bought other types of ESP maybe is it the firmware/hardware ?
Thanks a lot if you have any idea..
Guillaume
The only thing I can think of is to print what is being sent at the ESP32 to the serial monitor to check that it is not an empty message. If you say a plain text message is received, then it is a matter of just trying to incrementally make the message bigger/more complicated to see if it stops working at come point, at which point the last change caused the issue.
Sorry I cannot be more help on this.
Hello, Thanks for your help. It works now with scrolling. But with french caracters like "ç" "é" è" "à" the display is with %^¨ and some things like this. I think it is in the webserver because it's the same on the web form : if I want an "é" it's false on the screen...
Have you any idea where i can select the right font ?
Thank you, Guillaume
Hello Guillaume, About your 2 Aug 2020 solution for the Web Page not working properly, Did you find a solution...?
Thank you, Pierre @Gex31
IMPORTANT
Before submitting this issue [ ] Have you tried using the latest version of the library? [ ] Have you checked this has not already been submitted and/or resolved? [ ] If you are requesting help a better choice may be the Arduino forum
Subject of the issue
Describe your issue here.
Your Environment
Library Version: MD_PAROLA 3.2.0 Arduino IDE version: 1.8.13 **Hardware model/type: ESPRESSIF ESP32-WROOM-32 IDE on Windows 10
Steps to Reproduce
Explain how to reproduce this issue. Please provide working code below to demonstrate the issue. When I test the exemple Simple Wifi Server, it works, I can connect to the web page.
But with MD_PAROLA Scrolling 8266 (I made little changes and rename it in "MD_PAROLA Scrollin ESP32 GEX") i Connect the wifi, but when i try to access the webpage I have a error message in the browser "ERR_EMPTY_RESPONSE" plus in french "Cette page ne fonctionne pas"
I try to change the wifi.h, but nothing change,
Please can you indicate me the way ?
Thanks a lot
Guillaume
Expected Behaviour
Explain what should happen. I want to enter a string on a web page to be displayed on the MAX7219 LED and manage the scrolling effects... That's the purpose of this library I believ..
Actual Behaviour
Explain what happens instead. Provide log messages if relevant. The serial moniteur shows we are connect to the Wifi :
Code Demonstrating the Issue
Insert your code here. // Use the Parola library to scroll text on the display // // Demonstrates the use of the scrolling function to display text received // from the serial interface // // User can enter text through a web browser and this will display as a // scrolling message on the display. Some parameters for the text can also // be controlled from the web page. // // IP address for the ESP8266 is displayed on the scrolling display // after startup initialisation and connected to the WiFi network. // // Connections for ESP8266 hardware SPI are: // Vcc 3v3 LED matrices seem to work at 3.3V // GND GND GND // DIN D7 HSPID or HMOSI // CS or LD D8 HSPICS or HCS // CLK D5 CLK or HCLK // // MD_MAX72XX library can be found at https://github.com/MajicDesigns/MD_MAX72XX //
//#include
include
include
include
include
// Turn on debug statements to the serial output
define DEBUG 0
if DEBUG
define PRINT(s, x) { Serial.print(F(s)); Serial.print(x); }
define PRINTS(x) Serial.print(F(x))
define PRINTX(x) Serial.println(x, HEX)
else
define PRINT(s, x)
define PRINTS(x)
define PRINTX(x)
endif
// Define the number of devices we have in the chain and the hardware interface // NOTE: These pin numbers are for ESO8266 hardware SPI and will probably not // work with your hardware and may need to be adapted
define HARDWARE_TYPE MD_MAX72XX::FC16_HW
define MAX_DEVICES 8
define CLK_PIN 18 // or SCK
define DATA_PIN 23 // or MOSI
define CS_PIN 5// or SS
//GEX //#define CLK_PIN D5 // or SCK //#define DATA_PIN D7 // or MOSI //#define CS_PIN D8 // or SS //GEX
// HARDWARE SPI MD_Parola P = MD_Parola(HARDWARE_TYPE, CS_PIN, MAX_DEVICES); // SOFTWARE SPI //MD_Parola P = MD_Parola(HARDWARE_TYPE, DATA_PIN, CLK_PIN, CS_PIN, MAX_DEVICES);
// WiFi login parameters - network name and password const char ssid = "Android GEX"; const char password = "XXXXXXXX";
// WiFi Server object and parameters WiFiServer server(80);
// Scrolling parameters uint8_t frameDelay = 25; // default frame delay value textEffect_t scrollEffect = PA_SCROLL_LEFT;
// Global message buffers shared by Wifi and Scrolling functions
define BUF_SIZE 512
char curMessage[BUF_SIZE]; char newMessage[BUF_SIZE]; bool newMessageAvailable = false;
const char WebResponse[] = "HTTP/1.1 200 OK\nContent-Type: text/html\n\n";
const char WebPage[] = "<!DOCTYPE html>" \ "" \ "
" \ """ \ "" \
"
" \ "MD_Parola set message
" \"<form id=\"data_form\" name=\"frmText\">" \ "" \ "
" \ "<input type = \"radio\" name = \"Invert\" value = \"0\" checked> Normal" \ "<input type = \"radio\" name = \"Invert\" value = \"1\"> Inverse" \ "
" \ "<input type = \"radio\" name = \"ScrollType\" value = \"L\" checked> Left Scroll" \ "<input type = \"radio\" name = \"ScrollType\" value = \"R\"> Right Scroll" \ "
" \ "
const char *err2Str(wl_status_t code) { switch (code) { case WL_IDLE_STATUS: return("IDLE"); break; // WiFi is in process of changing between statuses case WL_NO_SSID_AVAIL: return("NO_SSID_AVAIL"); break; // case configured SSID cannot be reached case WL_CONNECTED: return("CONNECTED"); break; // successful connection is established case WL_CONNECT_FAILED: return("CONNECT_FAILED"); break; // password is incorrect case WL_DISCONNECTED: return("CONNECT_FAILED"); break; // module is not configured in station mode default: return("??"); } }
uint8_t htoi(char c) { c = toupper(c); if ((c >= '0') && (c <= '9')) return(c - '0'); if ((c >= 'A') && (c <= 'F')) return(c - 'A' + 0xa); return(0); }
void getData(char szMesg, uint16_t len) // Message may contain data for: // New text (/&MSG=) // Scroll direction (/&SD=) // Invert (/&I=) // Speed (/&SP=) { char pStart, *pEnd; // pointer to start and end of text
// check text message pStart = strstr(szMesg, "/&MSG="); if (pStart != NULL) { char *psz = newMessage;
}
// check scroll direction pStart = strstr(szMesg, "/&SD="); if (pStart != NULL) { pStart += 5; // skip to start of data
}
// check invert pStart = strstr(szMesg, "/&I="); if (pStart != NULL) { pStart += 4; // skip to start of data
}
// check speed pStart = strstr(szMesg, "/&SP="); if (pStart != NULL) { pStart += 5; // skip to start of data
} }
void handleWiFi(void) { static enum { S_IDLE, S_WAIT_CONN, S_READ, S_EXTRACT, S_RESPONSE, S_DISCONN } state = S_IDLE; static char szBuf[1024]; static uint16_t idxBuf = 0; static WiFiClient client; static uint32_t timeStart;
switch (state) { case S_IDLE: // initialise PRINTS("\nS_IDLE"); idxBuf = 0; state = S_WAIT_CONN; break;
case S_WAIT_CONN: // waiting for connection { client = server.available(); if (!client) break; if (!client.connected()) break;
if DEBUG
endif
} break;
case S_READ: // get the first line of data PRINTS("\nS_READ ");
case S_EXTRACT: // extract data PRINTS("\nS_EXTRACT"); // Extract the string from the message if there is one getData(szBuf, BUF_SIZE); state = S_RESPONSE; break;
case S_RESPONSE: // send the response to the client PRINTS("\nS_RESPONSE"); // Return the response to the client (web page) client.print(WebResponse); client.print(WebPage); state = S_DISCONN; break;
case S_DISCONN: // disconnect client PRINTS("\nS_DISCONN"); client.flush(); client.stop(); state = S_IDLE; break;
default: state = S_IDLE; } }
void setup() { Serial.begin(57600); PRINTS("\n[MD_Parola WiFi Message Display]\nType a message for the scrolling display from your internet browser");
P.begin(); P.displayClear(); P.displaySuspend(false);
P.displayScroll(curMessage, PA_LEFT, scrollEffect, frameDelay);
curMessage[0] = newMessage[0] = '\0';
// Connect to and initialise WiFi network PRINT("\nConnecting to ", ssid);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) { PRINT("\n", err2Str(WiFi.status())); delay(500); } PRINTS("\nWiFi connected");
Serial.println(""); Serial.println("WiFi connected."); Serial.println("IP address: "); Serial.println(WiFi.localIP());
// Start the server server.begin(); PRINTS("\nServer started");
// Set up first message as the IP address sprintf(curMessage, "%03d:%03d:%03d:%03d", WiFi.localIP()[0], WiFi.localIP()[1], WiFi.localIP()[2], WiFi.localIP()[3]); PRINT("\nAssigned IP ", curMessage); }
void loop() { handleWiFi();
if (P.displayAnimate()) { if (newMessageAvailable) { strcpy(curMessage, newMessage); newMessageAvailable = false; } P.displayReset(); } }