jyberg / Enhanced-Nextion-Library

Enhanced Nextion library for Arduino, NodeMcu, Esp8266,...
MIT License
47 stars 23 forks source link

attashpush is unreachable. #28

Closed australopitheque closed 2 years ago

australopitheque commented 2 years ago

Hello when I want to use attashpush, I get an error while in attachpop it works.

NexButton paramkelvin(next,0,1,"param1");

in error line paramkelvin.attachPush(kelvinpush,&paramkelvin);

The error message tells me that attashpush is unreachable.

fonction "NexButton::attachPush" (déclaré à la ligne 50 de "C:\USERS\JACQU\DOCUMENTS\PLATFORMIO\PROJECTS\WS2812\.PIO\LIBDEPS\MEGA2560 V3\ENHANCED-NEXTION-LIBRARY\INCLUDE\NexButton.h") est inaccessible

jyberg commented 2 years ago

I enabled it on version 1.4.1. I have no idea why it was disabled in original Nextion libary version but now it is enabled...

Can you ping if worked so that I can close this issue...

australopitheque commented 2 years ago

hello the attachepush is now working. I just have to try to find how to make it work on mega2560

Nextion *next = Nextion::GetInstance(Serial); // HW serial

because it can't communicate with my nextion in

SoftwareSerial mySerial(15,14); // RX, TX
Nextion *next = Nextion::GetInstance(mySerial); // software serial

it works but only on non HW ports.

I can't find how to modify on nexconfig.hand assign the port for the nextion on RX/TX hardware

I tried directly:

HardwareSerial mySerial(Serial2) ;

but no communication. Did I make a mistake?

jyberg commented 2 years ago

When you request nextion instace you define HardwareSerial or SoftwareSerial, I have mainly used SoftwareSerial as my espn has no free HardwareSerial port

SoftwareSerial nexSerial(D2, D1); // RX, TX Nextion *nextion = Nextion::GetInstance(nexSerial);

if not available check that you have set #define NEX_ENABLE_HW_SERIAL as all different serial options are behind of #ifdefs

australopitheque commented 2 years ago

I found it, it was as simple as that ^^ I had to declare it before.

#ifdef ESP8266
// esp8266 / NodeMCU software serial ports
SoftwareSerial mySerial(D2, D1); // RX, TX
#else
//SoftwareSerial mySerial(15,14); // RX, TX
//HardwareSerial mySerial(Serial3)  ; //is useless lol
#endif
Nextion *next = Nextion::GetInstance(Serial3); // HW serial3
//Nextion *next = Nextion::GetInstance(mySerial); //   software serial

thank you very much for your help

jyberg commented 2 years ago

done