PCD8544 - Nokia 5110/3310 LCD - beta plugin
Moderators: grovkillen, Stuntteam, TD-er
Re: PCD8544 - Nokia 5110/3310 LCD - beta plugin
It looks like, this plugin is not working any more on ESPEasy_ESP32_mega-20201130.
Does somebody knows how to solve this compiling error: I'v treid to sole this problem for many hours....
C:/Users/xx/Documents/PlatformIO/Projects/ESPEasy3_P208/src/_P208_LCD_PCD8544.ino:99:39: error: expected primary-expression before '.' token
String tmpString = WebServer.arg(argc);
^
C:/Users/xx/Documents/PlatformIO/Projects/ESPEasy3_P208/src/_P208_LCD_PCD8544.ino:127:20: warning: unused variable 'setTextWrap' [-Wunused-variable]
boolean setTextWrap = false;
^
C:/Users/xx/Documents/PlatformIO/Projects/ESPEasy3_P208/src/_P208_LCD_PCD8544.ino:149:35: error: 'displayText' was not declared in this scope
displayText(deviceTemplate);
^
C:/Users/xx/Documents/PlatformIO/Projects/ESPEasy3_P208/src/_P208_LCD_PCD8544.ino:154:138: error: 'setPinState' was not declared in this scope
setPinState(1, Settings.TaskDevicePin3[event->TaskIndex], PIN_MODE_OUTPUT, Settings.TaskDevicePluginConfig[event->TaskIndex][3]);}
^
^
*** [.pio\build\custom_ESP32_4M316k\src\ESPEasy.ino.cpp.o] Error 1
Does somebody knows how to solve this compiling error: I'v treid to sole this problem for many hours....
C:/Users/xx/Documents/PlatformIO/Projects/ESPEasy3_P208/src/_P208_LCD_PCD8544.ino:99:39: error: expected primary-expression before '.' token
String tmpString = WebServer.arg(argc);
^
C:/Users/xx/Documents/PlatformIO/Projects/ESPEasy3_P208/src/_P208_LCD_PCD8544.ino:127:20: warning: unused variable 'setTextWrap' [-Wunused-variable]
boolean setTextWrap = false;
^
C:/Users/xx/Documents/PlatformIO/Projects/ESPEasy3_P208/src/_P208_LCD_PCD8544.ino:149:35: error: 'displayText' was not declared in this scope
displayText(deviceTemplate);
^
C:/Users/xx/Documents/PlatformIO/Projects/ESPEasy3_P208/src/_P208_LCD_PCD8544.ino:154:138: error: 'setPinState' was not declared in this scope
setPinState(1, Settings.TaskDevicePin3[event->TaskIndex], PIN_MODE_OUTPUT, Settings.TaskDevicePluginConfig[event->TaskIndex][3]);}
^
^
*** [.pio\build\custom_ESP32_4M316k\src\ESPEasy.ino.cpp.o] Error 1
Re: PCD8544 - Nokia 5110/3310 LCD - beta plugin
There are probably more things to change, but for starters, change WebServer into web_server.
Re: PCD8544 - Nokia 5110/3310 LCD - beta plugin
I have done some initial work on this plugin, but didn't get it to display any text yet , I've shelved it for a while already, and probably give it a retry in the new year
/Ton (PayPal.me)
Re: PCD8544 - Nokia 5110/3310 LCD - beta plugin
Great, changing WebServer into web_server works.
Now i'm struggling with these two errors. Does anyone have any advice?
_P208_LCD_PCD8544.ino:149:35: error: 'displayText' was not declared in this scope
displayText(deviceTemplate);
_P208_LCD_PCD8544.ino:154:138: error: 'setPinState' was not declared in this scope
setPinState(1, Settings.TaskDevicePin3[event->TaskIndex], PIN_MODE_OUTPUT, Settings.TaskDevicePluginConfig[event->TaskIndex][3]);}
Now i'm struggling with these two errors. Does anyone have any advice?
_P208_LCD_PCD8544.ino:149:35: error: 'displayText' was not declared in this scope
displayText(deviceTemplate);
_P208_LCD_PCD8544.ino:154:138: error: 'setPinState' was not declared in this scope
setPinState(1, Settings.TaskDevicePin3[event->TaskIndex], PIN_MODE_OUTPUT, Settings.TaskDevicePluginConfig[event->TaskIndex][3]);}
Re: PCD8544 - Nokia 5110/3310 LCD - beta plugin
I guess adding this as the first line of your .ino file will fix a lot of (future) compile errors:
But setPinState is no longer implemented in the code, so you will need to make a lot more changes which makes it very hard to tell you what you should change.
This means I probably have to look at the code myself to see what else is missing or needs to be changed.
Code: Select all
#include "_Plugin_Helper.h"
This means I probably have to look at the code myself to see what else is missing or needs to be changed.
Re: PCD8544 - Nokia 5110/3310 LCD - beta plugin
I had already included the line "#include "_Plugin_Helper.h".....
-
- New user
- Posts: 8
- Joined: 06 Feb 2021, 20:25
Re: PCD8544 - Nokia 5110/3310 LCD - beta plugin
Hi Everybody,
i have successfully connected the LCD with the precompiled Image.
On thing won't work. Sending of display text via http cmd won't work.
As i understand the plugin code the behaviour should be compatible to the lcd2004 plugin:
http://192.168.1.242/control?cmd=pcd854 ... TTODISPLAY
But nothing appears. No Logging. But no message "wrong or unknown command". Thats appearing if you use cmd=whatever.
It's a pity, that the code isn'T working with the actual ESPEasy Source.
Any Idea, or what i'm doing wrong?
BR
Stephan
i have successfully connected the LCD with the precompiled Image.
On thing won't work. Sending of display text via http cmd won't work.
As i understand the plugin code the behaviour should be compatible to the lcd2004 plugin:
http://192.168.1.242/control?cmd=pcd854 ... TTODISPLAY
But nothing appears. No Logging. But no message "wrong or unknown command". Thats appearing if you use cmd=whatever.
Code: Select all
case PLUGIN_WRITE:
{
String tmpString = string;
int argIndex = tmpString.indexOf(',');
if (argIndex)
tmpString = tmpString.substring(0, argIndex);
if (tmpString.equalsIgnoreCase(F("PCD8544")))
{
success = true;
argIndex = string.lastIndexOf(',');
tmpString = string.substring(argIndex + 1);
lcd2->setCursor(event->Par2 - 1, event->Par1 - 1);
lcd2->println(tmpString.c_str());
}
if (tmpString.equalsIgnoreCase(F("PCD8544CMD")))
{
success = true;
argIndex = string.lastIndexOf(',');
tmpString = string.substring(argIndex + 1);
if (tmpString.equalsIgnoreCase(F("Clear")))
lcd2->clearDisplay();
}
break;
}
It's a pity, that the code isn'T working with the actual ESPEasy Source.
Any Idea, or what i'm doing wrong?
BR
Stephan
Re: PCD8544 - Nokia 5110/3310 LCD - beta plugin
What exact build did you use?
Asking this because lots of users still install old builds linked from some blog post for example.
Asking this because lots of users still install old builds linked from some blog post for example.
-
- New user
- Posts: 8
- Joined: 06 Feb 2021, 20:25
Re: PCD8544 - Nokia 5110/3310 LCD - beta plugin
Hi,
I don't have tried to compile it by myself.
I have downloaded the binary from Post #23:
viewtopic.php?p=32154#p32154
And i have read the draft for the plugin. And read within this thread, that the plugin is only usable with sources around 2018.
So the next step for me is:
try to update the plugin to compile with actual releases, and / or use a release from ~2018.
Then it's possible to (re)check, if the http command will work.
In the precompiled version only the following informations are found on the info page:
Update:
Setting up platformio with visual studio code and compiling a unchanged repository successfully.
Now i have made the first advises to create a updated plugin.
Change for setPinState (might be the right way, after study of other plugins)
Compiling done and image is working. Display is showing the configured lines.
Next step: verify http command....
BR
Stephan
I don't have tried to compile it by myself.
I have downloaded the binary from Post #23:
viewtopic.php?p=32154#p32154
And i have read the draft for the plugin. And read within this thread, that the plugin is only usable with sources around 2018.
So the next step for me is:
try to update the plugin to compile with actual releases, and / or use a release from ~2018.
Then it's possible to (re)check, if the http command will work.
In the precompiled version only the following informations are found on the info page:
Code: Select all
Build 20102 - Mega
Libraries ESP82xx Core 2_4_2, NONOS SDK 2.2.1(cfd48f3), LWIP: 2.0.3
GIT version
Plugins 73 [Normal] [Testing]
Build Md5 4d44355f4d44355f4d44355f4d44355f
Md5 check fail !
Build time Sep 22 2018 19:29:53
Binary filename ThisIsTheDummyPlaceHolderForTheBinaryFilename64ByteLongFilenames
Setting up platformio with visual studio code and compiling a unchanged repository successfully.
Now i have made the first advises to create a updated plugin.
Change for setPinState (might be the right way, after study of other plugins)
Code: Select all
pinMode(Settings.TaskDevicePin3[event->TaskIndex], OUTPUT);
digitalWrite(Settings.TaskDevicePin3[event->TaskIndex],Settings.TaskDevicePluginConfig[event->TaskIndex][0]);
// setPinState(1, Settings.TaskDevicePin3[event->TaskIndex], PIN_MODE_OUTPUT, Settings.TaskDevicePluginConfig[event->TaskIndex][3]);}
portStatusStruct newStatus;
const uint32_t key = createKey(1, Settings.TaskDevicePin3[event->TaskIndex]);
// WARNING: operator [] creates an entry in the map if key does not exist
newStatus = globalMapPortStatus[key];
newStatus.command = 1;
newStatus.mode = PIN_MODE_OUTPUT;
newStatus.state = Settings.TaskDevicePluginConfig[event->TaskIndex][3];
savePortStatus(key, newStatus);}
Compiling done and image is working. Display is showing the configured lines.
Next step: verify http command....
BR
Stephan
-
- New user
- Posts: 8
- Joined: 06 Feb 2021, 20:25
Re: PCD8544 - Nokia 5110/3310 LCD - beta plugin
One step forward.
Find here the code for the PCD8544 Display compatible to ESP_Easy_mega_20210207.
Something might be buggy. The ESP was sometime not directly reachable. But i don't find any reason or logging about.
Feel free to optimize the code, but give here some feedback.
// Working:
// - Display Text & Var via ESPEasy Webinterface (Line1-LineX)
// - Clear Display via httpcmd (http://ESP-IP/control?cmd=pcd8544cmd,clear)
// - Send Text via httpcmd (but don't clear the line ) (http://ESP-IP/control?cmd=pcd8544,1,1,Hello%20World!)
//
// Mixed Mode (Display Data from ESP Easy and HTTP-request) is not easy to handle. Some problems are known from P012 LCD2004 Plugin
// Set Interval to 0 seconds for only using the http requests. Otherwise display clear will occur every cycle.
//
//
// ToDo:
// - If no Data via Webinterface (Line 1-x) exists. don't clear the display or no update!
// - How to "overwrite" via Webcmd the actual line. -> No garbage character
// (introduce clear line command? depending on orientation write n spaces. then write the new text?)
Find here the code for the PCD8544 Display compatible to ESP_Easy_mega_20210207.
Something might be buggy. The ESP was sometime not directly reachable. But i don't find any reason or logging about.
Feel free to optimize the code, but give here some feedback.
// Working:
// - Display Text & Var via ESPEasy Webinterface (Line1-LineX)
// - Clear Display via httpcmd (http://ESP-IP/control?cmd=pcd8544cmd,clear)
// - Send Text via httpcmd (but don't clear the line ) (http://ESP-IP/control?cmd=pcd8544,1,1,Hello%20World!)
//
// Mixed Mode (Display Data from ESP Easy and HTTP-request) is not easy to handle. Some problems are known from P012 LCD2004 Plugin
// Set Interval to 0 seconds for only using the http requests. Otherwise display clear will occur every cycle.
//
//
// ToDo:
// - If no Data via Webinterface (Line 1-x) exists. don't clear the display or no update!
// - How to "overwrite" via Webcmd the actual line. -> No garbage character
// (introduce clear line command? depending on orientation write n spaces. then write the new text?)
Code: Select all
#ifdef USES_P208
//#######################################################################################################
//################################## Plugin 208: NOKIA lcd2 ###############################################
//#######################################################################################################
// Working:
// - Display Text & Var via ESPEasy Webinterface (Line1-Linex)
// - Clear Display via httpcmd (http://ESP-IP/control?cmd=pcd8544cmd,clear)
// - Send Text via httpcmd (but don't clear the line :-( ) (http://ESP-IP/control?cmd=pcd8544,1,1,Hello%20World!)
//
// Mixed Mode (Display Data from ESP Easy and HTTP-request) is not easy to handle. Some problems are known from P012 LCD2004 Plugin
// Set Interval to 0 seconds for only using the http requests
//
// ToDo:
// - If no Data via Webinterface (Line 1-x) exists. don't clear the display or no update!
// - How to "overwrite" via Webcmd the actual line. -> No garbage character
//
#define PLUGIN_208
#define PLUGIN_ID_208 208
#define PLUGIN_NAME_208 "Display - LCD PCD8544 [TESTING]"
#define PLUGIN_VALUENAME1_208 "Backlight"
#define PLUGIN_VALUENAME2_208 "Contrast"
#define PLUGIN_VALUENAME3_208 "Rotation"
#include "_Plugin_Helper.h"
//#include <SPI.h>
#include <Adafruit_GFX.h>
#include <Adafruit_PCD8544.h>
Adafruit_PCD8544 *lcd2;
byte lines = 6;
boolean Plugin_208(byte function, struct EventStruct *event, String& string)
{
boolean success = false;
switch (function)
{
case PLUGIN_DEVICE_ADD:
{
Device[++deviceCount].Number = PLUGIN_ID_208 ;
Device[deviceCount].Type = DEVICE_TYPE_SINGLE;
Device[deviceCount].VType = Sensor_VType::SENSOR_TYPE_SINGLE;
Device[deviceCount].Ports = 0;
Device[deviceCount].PullUpOption = false;
Device[deviceCount].InverseLogicOption = false;
Device[deviceCount].FormulaOption = false;
Device[deviceCount].ValueCount = 3;
Device[deviceCount].SendDataOption = false;
Device[deviceCount].TimerOption = true;
Device[deviceCount].TimerOptional = true;
break;
}
case PLUGIN_GET_DEVICENAME:
{
string = F(PLUGIN_NAME_208);
break;
}
case PLUGIN_GET_DEVICEVALUENAMES:
{
strcpy_P(ExtraTaskSettings.TaskDeviceValueNames[0], PSTR(PLUGIN_VALUENAME1_208));
strcpy_P(ExtraTaskSettings.TaskDeviceValueNames[1], PSTR(PLUGIN_VALUENAME2_208));
strcpy_P(ExtraTaskSettings.TaskDeviceValueNames[2], PSTR(PLUGIN_VALUENAME3_208));
break;
}
case PLUGIN_WEBFORM_LOAD:
{
addFormNumericBox(F("Display Contrast(50-100):"), F("plugin_208_contrast"), Settings.TaskDevicePluginConfig[event->TaskIndex][1]);
addFormPinSelect(F("Backlight PIN"), F("taskdevicepin3"), Settings.TaskDevicePin3[event->TaskIndex]);
byte choice3 = Settings.TaskDevicePluginConfig[event->TaskIndex][2];
int optionValues3[4] = { 0, 1, 2, 3 };
String options3[4] = { F("0"), F("90"), F("180"), F("270") };
addFormSelector(F("Display Rotation"), F("plugin_208_rotation"), 4, options3, optionValues3, choice3);
byte choice4 = Settings.TaskDevicePluginConfig[event->TaskIndex][0];
String options4[2] = { F("ON"), F("OFF") };
int optionValues4[2] = { 0, 1 };
addFormSelector(F("Backlight"), F("plugin_208_backlight"), 2, options4, optionValues4, choice4);
char deviceTemplate [lines][48];
LoadCustomTaskSettings(event->TaskIndex, (byte*)&deviceTemplate, sizeof(deviceTemplate));
for (byte varNr = 0; varNr < lines; varNr++)
{
addFormTextBox(String(F("Line ")) + (varNr + 1), String(F("Plugin_208_template")) + (varNr + 1), deviceTemplate[varNr], 80);
}
success = true;
break;
}
case PLUGIN_WEBFORM_SAVE:
{
Settings.TaskDevicePluginConfig[event->TaskIndex][0] = getFormItemInt(F("plugin_208_backlight"));
Settings.TaskDevicePluginConfig[event->TaskIndex][1] = getFormItemInt(F("plugin_208_contrast"));
Settings.TaskDevicePluginConfig[event->TaskIndex][2] = getFormItemInt(F("plugin_208_rotation"));
char deviceTemplate[lines][48];
for (byte varNr = 0; varNr < lines; varNr++)
{
char argc[25];
String arg = F("Plugin_208_template");
arg += varNr + 1;
arg.toCharArray(argc, 25);
String tmpString = web_server.arg(argc);
strncpy(deviceTemplate[varNr], tmpString.c_str(), sizeof(deviceTemplate[varNr]));
}
// Settings.TaskDeviceID[event->TaskIndex] = 1; // temp fix, needs a dummy value
SaveCustomTaskSettings(event->TaskIndex, (byte*)&deviceTemplate, sizeof(deviceTemplate));
success = true;
break;
}
case PLUGIN_INIT:
{
if (!lcd2)
{
// pin 14 - Serial clock out (SCLK)
// pin 13 - Serial data out (DIN)
// pin 12 - Data/Command select (D/C)
// pin 5 - LCD chip select (CS)
// pin 4 - LCD reset (RST)
//lcd2 = new Adafruit_PCD8544(14, 13, 12, 5, 4);
#if defined(ESP8266)
lcd2 = new Adafruit_PCD8544(15, 2, -1); // D/C (need to be connected) GPIO2 , CS(CEN) GPIO15 , RESET not connected
#endif
#if defined(ESP32)
lcd2 = new Adafruit_PCD8544(16, 17, -1); // D/C (need to be connected) GPIO16 , CS(CEN) GPIO17 , RESET not connected
#endif
boolean setTextWrap = false;
}
// Setup lcd2 display
byte plugin1 = Settings.TaskDevicePluginConfig[event->TaskIndex][2]; // rotation
byte plugin2 = Settings.TaskDevicePluginConfig[event->TaskIndex][1]; // contrast
byte plugin4 = Settings.TaskDevicePluginConfig[event->TaskIndex][0]; // backlight_onoff
UserVar[event->BaseVarIndex+2]=plugin1;
UserVar[event->BaseVarIndex+1]=plugin2;
UserVar[event->BaseVarIndex]=!plugin4;
if (plugin1==0 || plugin1==2)
{
lines=6;
}
else{
lines=10;
}
lcd2->begin(); // initialize the lcd2
lcd2->setContrast(plugin2);
lcd2->setRotation(plugin1);
lcd2->clearDisplay();
char deviceTemplate[lines][48];
LoadCustomTaskSettings(event->TaskIndex, (byte*)&deviceTemplate, sizeof(deviceTemplate));
displayText(deviceTemplate);
lcd2->display();
if (Settings.TaskDevicePin3[event->TaskIndex] != -1){
pinMode(Settings.TaskDevicePin3[event->TaskIndex], OUTPUT);
digitalWrite(Settings.TaskDevicePin3[event->TaskIndex],Settings.TaskDevicePluginConfig[event->TaskIndex][0]);
// setPinState(1, Settings.TaskDevicePin3[event->TaskIndex], PIN_MODE_OUTPUT, Settings.TaskDevicePluginConfig[event->TaskIndex][3]);}
portStatusStruct newStatus;
const uint32_t key = createKey(1, Settings.TaskDevicePin3[event->TaskIndex]);
// WARNING: operator [] creates an entry in the map if key does not exist
newStatus = globalMapPortStatus[key];
newStatus.command = 1;
newStatus.mode = PIN_MODE_OUTPUT;
newStatus.state = Settings.TaskDevicePluginConfig[event->TaskIndex][3];
savePortStatus(key, newStatus);}
success = true;
break;
}
case PLUGIN_READ:
{
char deviceTemplate[lines][48];
LoadCustomTaskSettings(event->TaskIndex, (byte*)&deviceTemplate, sizeof(deviceTemplate));
displayText(deviceTemplate);
success = false;
break;
}
case PLUGIN_WRITE:
{
String tmpString = string;
int argIndex = tmpString.indexOf(',');
if (argIndex)
tmpString = tmpString.substring(0, argIndex);
if (tmpString.equalsIgnoreCase(F("PCD8544")))
{
success = true;
argIndex = string.lastIndexOf(',');
tmpString = string.substring(argIndex + 1);
lcd2->setTextSize(1);
int colPos = event->Par2 - 1;
int rowPos = event->Par1 - 1;
lcd2->setCursor(colPos, rowPos*8); // 8 Pixel
//addLog(LOG_LEVEL_INFO, F("Position set"));
lcd2->println(tmpString.c_str());
lcd2->display();
}
if (tmpString.equalsIgnoreCase(F("PCD8544CMD")))
{
success = true;
argIndex = string.lastIndexOf(',');
tmpString = string.substring(argIndex + 1);
if (tmpString.equalsIgnoreCase(F("Clear")))
// addLog(LOG_LEVEL_INFO, F("Clear Display"));
// Works!
lcd2->clearDisplay();
lcd2->display();
}
break;
}
}
return success;
}
boolean displayText(char deviceTemplate[][48]){
String log = F("PCD8544: ");
String string = F("");
lcd2->clearDisplay();
lcd2->setTextSize(1);
lcd2->setTextColor(BLACK);
lcd2->setCursor(0,0);
for (byte x = 0; x < lines; x++)
{
String tmpString = deviceTemplate[x];
if (tmpString.length())
{
String newString = parseTemplate(tmpString, 48);
lcd2->setCursor(0,x*8);
lcd2->print(newString);
string+=newString+"\\";
}
}
log += String(F("displayed text: \"")) + String(string) + String(F("\""));
addLog(LOG_LEVEL_INFO, log);
lcd2->display();
return true;
}
#endif // USES_P208
Re: PCD8544 - Nokia 5110/3310 LCD - beta plugin
Does anyone has compiled firmware newer than post 23?
Could uploaded here?
Is there any compiled firmware in nightly builds?
Thanks.
Could uploaded here?
Is there any compiled firmware in nightly builds?
Thanks.
Re: PCD8544 - Nokia 5110/3310 LCD - beta plugin
Hello Stephan2204,
I'v compile'd you code without errors. That's fine. But i have a question. I like to wire the 5110 directly to the ESP32. (5110-pins: CLK, DIN, DC, CE, RST). In your code, at PLUGIN_INIT, you only define pin D/C and CS.
#if defined(ESP32)
lcd2 = new Adafruit_PCD8544(16, 17, -1); // D/C (need to be connected) GPIO16 , CS(CEN) GPIO17 , RESET not connected
#endif
What about the other pins...?
I'v compile'd you code without errors. That's fine. But i have a question. I like to wire the 5110 directly to the ESP32. (5110-pins: CLK, DIN, DC, CE, RST). In your code, at PLUGIN_INIT, you only define pin D/C and CS.
#if defined(ESP32)
lcd2 = new Adafruit_PCD8544(16, 17, -1); // D/C (need to be connected) GPIO16 , CS(CEN) GPIO17 , RESET not connected
#endif
What about the other pins...?
Re: PCD8544 - Nokia 5110/3310 LCD - beta plugin
The display is connected through SPI, so you'll have to enable SPI on the Hardware tab, en there it also shows the pins used.
/Ton (PayPal.me)
Re: PCD8544 - Nokia 5110/3310 LCD - beta plugin
Ok, that was great information. Now the 5110 works. But:
1/ I had to connect 5110-pin-1 (RST) to Vcc (5V with 10k resistor!).
2/ I had to disable\comment the 1e and last line ("//#ifdef USES_P208" and "//#endif // USES_P208").
So what is the proper way\place to define USES_P208 ?
1/ I had to connect 5110-pin-1 (RST) to Vcc (5V with 10k resistor!).
2/ I had to disable\comment the 1e and last line ("//#ifdef USES_P208" and "//#endif // USES_P208").
So what is the proper way\place to define USES_P208 ?
Re: PCD8544 - Nokia 5110/3310 LCD - beta plugin
I like to display the current time. I used the ESPeasy-variable %systime%.
The displayed value on the screen is "10%3a37%3a53" meaning 10:37 and 53 sec.
Does somebody know why "%3a" is displayed?
The displayed value on the screen is "10%3a37%3a53" meaning 10:37 and 53 sec.
Does somebody know why "%3a" is displayed?
Re: PCD8544 - Nokia 5110/3310 LCD - beta plugin
Looks like the values are "URL encoded"
Re: PCD8544 - Nokia 5110/3310 LCD - beta plugin
This code:
should be changed to:
parseTemplate() with a second argument defines a bool to use url encoding, and that 48 fits within a byte, then acting as a bool that's != 0...
Code: Select all
String newString = parseTemplate(tmpString, 48);
Code: Select all
String newString = parseTemplate_padded(tmpString, 48);
/Ton (PayPal.me)
Re: PCD8544 - Nokia 5110/3310 LCD - beta plugin
Thanks, Great, now the Plugin works fine for me. But...... Better is to replace
String newString = parseTemplate_padded(tmpString, 48); // 2e parameter is a bool!
in
String newString = parseTemplate_padded(tmpString, false);
Is there somebody who can answer my queston in post #64 at bullit "2/".
String newString = parseTemplate_padded(tmpString, 48); // 2e parameter is a bool!
in
String newString = parseTemplate_padded(tmpString, false);
Is there somebody who can answer my queston in post #64 at bullit "2/".
Re: PCD8544 - Nokia 5110/3310 LCD - beta plugin
You can use a custom build and create a Custom.h file from the sample provided with all stuff you need enabled, the add there #define USES_P208, or add that define to a set (normal does have enough flash space) in define_plugin_sets.h and run that build from the pio list in VSCode/Atom
/Ton (PayPal.me)
Re: PCD8544 - Nokia 5110/3310 LCD - beta plugin
Thanks, I used the "define_plugin_sets.h" way. The _P208 is now compile and works OK.
But... The code after "#ifdef USES_P208" in _P208 is grey-out as shown in attachment. Can somebody tell me how to change that?
But... The code after "#ifdef USES_P208" in _P208 is grey-out as shown in attachment. Can somebody tell me how to change that?
- Attachments
-
- Knipsel.JPG (90.54 KiB) Viewed 14675 times
Re: PCD8544 - Nokia 5110/3310 LCD - beta plugin
I have futher developed this code, removed some bugs and added some extra functions. I think is is now free of bugs.
/ - support different digit-size's
// - Display Text via
// 1. ESPEasy-Webinterface (Line-1-Line-x)
// 2. http-request:
// - BackLight on via httpcmd (http://ESP-IP/control?cmd=pcd8544cmd,blOn)
// - BackLight off via httpcmd (http://ESP-IP/control?cmd=pcd8544cmd,blOff)
// - Clear Display via httpcmd (http://ESP-IP/control?cmd=pcd8544cmd,clear)
// - Send Text via httpcmd (http://ESP-IP/control?cmd=pcd8544,1,Hello World!) // 1 : line#
// Send Text via http-request only works for the empty lines in ESPEasy-Webinterface!
// 3. See "PLUGIN_INIT:" for pin connections.
The code is placed in my fork of ESPeasy and I have made a pullrequest.
Example shows:
CO2 ppm
temp humidity
date time
/ - support different digit-size's
// - Display Text via
// 1. ESPEasy-Webinterface (Line-1-Line-x)
// 2. http-request:
// - BackLight on via httpcmd (http://ESP-IP/control?cmd=pcd8544cmd,blOn)
// - BackLight off via httpcmd (http://ESP-IP/control?cmd=pcd8544cmd,blOff)
// - Clear Display via httpcmd (http://ESP-IP/control?cmd=pcd8544cmd,clear)
// - Send Text via httpcmd (http://ESP-IP/control?cmd=pcd8544,1,Hello World!) // 1 : line#
// Send Text via http-request only works for the empty lines in ESPEasy-Webinterface!
// 3. See "PLUGIN_INIT:" for pin connections.
The code is placed in my fork of ESPeasy and I have made a pullrequest.
Example shows:
CO2 ppm
temp humidity
date time
- Attachments
-
- Knipsel.JPG (42.27 KiB) Viewed 14353 times
Last edited by joost d on 09 Mar 2021, 07:40, edited 1 time in total.
Re: PCD8544 - Nokia 5110/3310 LCD - beta plugin
Have you set https://github.com/letscontrolit/ESPEasy as the upstream repository from your fork? As it currently isn't visible on the ESPEasy repo
You only have to do this once, when using VSCode you can type this from the terminal window when at the root directory of your forked repo.
Code: Select all
git remote add upstream https://github.com/letscontrolit/ESPEasy
/Ton (PayPal.me)
Re: PCD8544 - Nokia 5110/3310 LCD - beta plugin
I can see my pullrequest in https://github.com/letscontrolit/ESPEas ... ound/pulls. But other people don't.
I think it has to do with a message display om my github:
Your account has been flagged.
Because of that, your profile is hidden from the public. If you believe this is a mistake, contact support to have your account status reviewed.
I'v reported this at GitHub-support.
I think it has to do with a message display om my github:
Your account has been flagged.
Because of that, your profile is hidden from the public. If you believe this is a mistake, contact support to have your account status reviewed.
I'v reported this at GitHub-support.
Re: PCD8544 - Nokia 5110/3310 LCD - beta plugin
Possibly your email address is abused by spammers? That's nasty, and hard to resolve I guess. But a new Google email address is cheap
/Ton (PayPal.me)
Re: PCD8544 - Nokia 5110/3310 LCD - beta plugin
OK, my account on GitHub is not "flaged" anymore. So You can see my pullrequest of "_P208 NOKIA 5110 LCD plugin".
Re: PCD8544 - Nokia 5110/3310 LCD - beta plugin
Yep, and replied to it
-
- New user
- Posts: 8
- Joined: 06 Feb 2021, 20:25
Re: PCD8544 - Nokia 5110/3310 LCD - beta plugin
Great Job!
I just want to integrate the last changes into my build.
But i've got some errors.
I've just replaced the P208.ino from me with your file from github (ESPEasyPluginPlayground).
No difference with 20210223 or 20210114.
VSC report this lines:
The first line points to this part of the file:
But it looks fine for me.
For my github knowhow:
The PluginPlayground is only a collection of plugins. Theres no possibility to download/clone and compile espeasy?
BR
Stephan
I just want to integrate the last changes into my build.
But i've got some errors.
I've just replaced the P208.ino from me with your file from github (ESPEasyPluginPlayground).
No difference with 20210223 or 20210114.
VSC report this lines:
Code: Select all
C:/Users/Stephan/Downloads/ESPEASY Nokia Display/source/src/_P208_Nokia_LCD_5110.ino: In function 'boolean Plugin_208(byte, EventStruct*, String&)':
C:/Users/Stephan/Downloads/ESPEASY Nokia Display/source/src/_P208_Nokia_LCD_5110.ino:200:85: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i=line_content_soll.length(); i < line_content_ist.length(); i++){
^
In file included from C:\Users\Stephan\.platformio\packages\framework-arduinoespressif8266\cores\esp8266/Arduino.h:243:0,
from C:\Users\Stephan\AppData\Local\Temp\tmp1omtbdm5:1:
C:/Users/Stephan/Downloads/ESPEASY Nokia Display/source/src/_P208_Nokia_LCD_5110.ino: In function 'boolean displayText3(char (*)[48], EventStruct*)':
C:\Users\Stephan\.platformio\packages\framework-arduinoespressif8266\tools\sdk\libc\xtensa-lx106-elf\include/sys/pgmspace.h:44:239: error: initializer fails to determine size of '__c'
#define PSTRN(s,n) (__extension__({static const char __c[] __attribute__((__aligned__(n))) __attribute__((section( "\".irom0.pstr." __FILE__ "." __STRINGIZE(__LINE__) "." __STRINGIZE(__COUNTER__) "\", \"aSM\", @progbits, 1 #"))) = (s); &__c[0];}))
^
C:\Users\Stephan\.platformio\packages\framework-arduinoespressif8266\cores\esp8266/WString.h:38:76: note: in definition of macro 'FPSTR'
#define FPSTR(pstr_pointer) (reinterpret_cast<const __FlashStringHelper *>(pstr_pointer))
^
C:\Users\Stephan\.platformio\packages\framework-arduinoespressif8266\tools\sdk\libc\xtensa-lx106-elf\include/sys/pgmspace.h:48:19: note: in expansion of macro 'PSTRN'
#define PSTR(s) PSTRN(s,PSTR_ALIGN)
^
C:\Users\Stephan\.platformio\packages\framework-arduinoespressif8266\cores\esp8266/WString.h:39:34: note: in expansion of macro 'PSTR'
#define F(string_literal) (FPSTR(PSTR(string_literal)))
^
C:/Users/Stephan/Downloads/ESPEASY Nokia Display/source/src/_P208_Nokia_LCD_5110.ino:265:30: note: in expansion of macro 'F'
String tmpString = F(deviceTemplate[x]);
^
C:\Users\Stephan\.platformio\packages\framework-arduinoespressif8266\tools\sdk\libc\xtensa-lx106-elf\include/sys/pgmspace.h:44:239: error: array must be initialized with a brace-enclosed initializer
#define PSTRN(s,n) (__extension__({static const char __c[] __attribute__((__aligned__(n))) __attribute__((section( "\".irom0.pstr." __FILE__ "." __STRINGIZE(__LINE__) "." __STRINGIZE(__COUNTER__) "\", \"aSM\", @progbits, 1 #"))) = (s); &__c[0];}))
^
C:\Users\Stephan\.platformio\packages\framework-arduinoespressif8266\cores\esp8266/WString.h:38:76: note: in definition of macro 'FPSTR'
#define FPSTR(pstr_pointer) (reinterpret_cast<const __FlashStringHelper *>(pstr_pointer))
^
C:\Users\Stephan\.platformio\packages\framework-arduinoespressif8266\tools\sdk\libc\xtensa-lx106-elf\include/sys/pgmspace.h:48:19: note: in expansion of macro 'PSTRN'
#define PSTR(s) PSTRN(s,PSTR_ALIGN)
^
C:\Users\Stephan\.platformio\packages\framework-arduinoespressif8266\cores\esp8266/WString.h:39:34: note: in expansion of macro 'PSTR'
#define F(string_literal) (FPSTR(PSTR(string_literal)))
^
C:/Users/Stephan/Downloads/ESPEASY Nokia Display/source/src/_P208_Nokia_LCD_5110.ino:265:30: note: in expansion of macro 'F'
String tmpString = F(deviceTemplate[x]);
^
Code: Select all
if (!linedefinition.length()){ // only if value is not definde in plugin-webform
line_content_ist = html_input[event->Par1-1];
line_content_soll = string.substring(argIndex + 1);
if (line_content_soll.length() < line_content_ist.length() ) {
for(int i=line_content_soll.length(); i < line_content_ist.length(); i++){
line_content_soll += " ";
}
}
For my github knowhow:
The PluginPlayground is only a collection of plugins. Theres no possibility to download/clone and compile espeasy?
BR
Stephan
Re: PCD8544 - Nokia 5110/3310 LCD - beta plugin
The F() macro can only be used on static strings which are known at compile time.
Code: Select all
// deviceTemplate[x] is not a static string, but a structure holding arrays of char.
// This will not work
String tmpString = F(deviceTemplate[x]);
// This is constructing a new String object from an array of char, which is valid.
String tmpString = deviceTemplate[x];
Re: PCD8544 - Nokia 5110/3310 LCD - beta plugin
The message is in fact saying it (though not too obvious), so it should be something like:Stephan2204 wrote: ↑08 Apr 2021, 09:41Code: Select all
C:/Users/Stephan/Downloads/ESPEASY Nokia Display/source/src/_P208_Nokia_LCD_5110.ino: In function 'boolean Plugin_208(byte, EventStruct*, String&)': C:/Users/Stephan/Downloads/ESPEASY Nokia Display/source/src/_P208_Nokia_LCD_5110.ino:200:85: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(int i=line_content_soll.length(); i < line_content_ist.length(); i++){
Code: Select all
for(unsigned int i=line_content_soll.length(); i < line_content_ist.length(); i++){
/Ton (PayPal.me)
-
- New user
- Posts: 8
- Joined: 06 Feb 2021, 20:25
Re: PCD8544 - Nokia 5110/3310 LCD - beta plugin
Thanks a lot.
The unsigned error was clear for me. The F() macro is a higher level story .
I'm wondering, because the pulled version was working for joost d.
Seems that the uploaded code might be different to the working code from joost.
@joost d: It is possible to verify your P208 file?
brachiate through the error messages shows the next issue.
Might be easier to doublecheck with joost.
The unsigned error was clear for me. The F() macro is a higher level story .
I'm wondering, because the pulled version was working for joost d.
Seems that the uploaded code might be different to the working code from joost.
@joost d: It is possible to verify your P208 file?
brachiate through the error messages shows the next issue.
Might be easier to doublecheck with joost.
Code: Select all
C:/ESPEasy_ESP82xx_mega-20210223/source/src/_P208_Nokia_LCD_5110.ino: In function 'boolean displayText3(char (*)[48], EventStruct*)':
C:\.platformio\packages\framework-arduinoespressif8266\tools\sdk\libc\xtensa-lx106-elf\include/sys/pgmspace.h:44:239: error: initializer fails to determine size of '__c'
Code: Select all
boolean displayText3(char deviceTemplate[][48], struct EventStruct *event ){
// 48 must be equal to "#define Digits_per_template_line"
// OLD F Macro String log = F("PCD8544: ");
// OLD F Macro String string =F("");
String log = "PCD8544: ";
String string ="";
Re: PCD8544 - Nokia 5110/3310 LCD - beta plugin
Code: Select all
boolean displayText3(char deviceTemplate[][48], struct EventStruct *event ){
Why not simply call it like this:
Code: Select all
boolean displayText3(const char* text, struct EventStruct *event ){
Code: Select all
String string ="";
Code: Select all
String string;
Code: Select all
String log = F("PCD8544: ");
Re: PCD8544 - Nokia 5110/3310 LCD - beta plugin
I compared my source with the playgroned (https://github.com/letscontrolit/ESPEas ... D_5110.ino).
The are exactly the same.
The are exactly the same.
-
- New user
- Posts: 8
- Joined: 06 Feb 2021, 20:25
Re: PCD8544 - Nokia 5110/3310 LCD - beta plugin
Very suspicious...
What i have done:
- downloading new ESPEasy Sources (old one same behaviour)
- adding the P208 file vom github
- creating new project (using VSC)
- enable P208 plugin
- adding adafruit Lib (PCD8544)
-> And the issues occurs...
What i have done:
- downloading new ESPEasy Sources (old one same behaviour)
- adding the P208 file vom github
- creating new project (using VSC)
- enable P208 plugin
- adding adafruit Lib (PCD8544)
-> And the issues occurs...
Re: PCD8544 - Nokia 5110/3310 LCD - beta plugin
I'm Using:
1/ PlatformIO and
2/ building with the "Default" environment.
In platfomio.ini :
default_envs =
normal_ESP32_4M316k
3/ ESPeasy: https://github.com/letscontrolit/ESPEas ... a-20210223
1/ PlatformIO and
2/ building with the "Default" environment.
In platfomio.ini :
default_envs =
normal_ESP32_4M316k
3/ ESPeasy: https://github.com/letscontrolit/ESPEas ... a-20210223
-
- New user
- Posts: 8
- Joined: 06 Feb 2021, 20:25
Re: PCD8544 - Nokia 5110/3310 LCD - beta plugin
Found.... We are using different HW. I'm using ESP8266_4M_1M.
Build might run. Adafruit and P208 will be compiled without errors. The bin can't be created. But this should be another issue.
Easier to order some ESP32 Shields for the future...
Code: Select all
Generating factory bin for genuine esp units
*** [.pio\build\normal_ESP32_4M316k\ESP_Easy_mega_20210409_normal_ESP32_4M316k.bin] ValueError : too many values to unpack (expected 2)
Re: PCD8544 - Nokia 5110/3310 LCD - beta plugin
You probably have a space in your path where you try to build the firmware.
Re: PCD8544 - Nokia 5110/3310 LCD - beta plugin
@td'r:
You suggested "boolean displayText3(const char* text, struct EventStruct *event ){"
But I can't make that working correct. Ofcourse, it should be nice to pass the parameter "char deviceTemplate[][48]" by reference, but I can't make that working correct.
I will soon make a pullrequest with some other small optimizations.
You suggested "boolean displayText3(const char* text, struct EventStruct *event ){"
But I can't make that working correct. Ofcourse, it should be nice to pass the parameter "char deviceTemplate[][48]" by reference, but I can't make that working correct.
I will soon make a pullrequest with some other small optimizations.
-
- New user
- Posts: 8
- Joined: 06 Feb 2021, 20:25
Re: PCD8544 - Nokia 5110/3310 LCD - beta plugin
char arrays will always be handed over like a char pointer (char*) and an array of arrays like char**, but how you do it now, it will only accept objects that match exactly this definition. (can be to make sure you can make assumptions about the sizes, so isn't always a bad idea)joost d wrote: ↑09 Apr 2021, 10:45 @td'r:
You suggested "boolean displayText3(const char* text, struct EventStruct *event ){"
But I can't make that working correct. Ofcourse, it should be nice to pass the parameter "char deviceTemplate[][48]" by reference, but I can't make that working correct.
I will soon make a pullrequest with some other small optimizations.
So you could make it slightly more readable by making it a typedef, so you only have the "48" defined once.
At least it won't be copied, as it is a pointer anyway.
Who is online
Users browsing this forum: No registered users and 77 guests