Start a new topic

V0.37/v0.38 Dual State Button (dual_state) returns incorrect values

Upgraded from v0.36 to v0.37 last week, today to version v0.38.

Since v0.37 unable to get Dual State Buttons to work correctly. The demo Arduino program (part of the v0.7 library) does even not work anymore. My UNO, Mega2560 and WeMos D1 all show this behaviour.

The variable "dual_state" returns in the CompDualStateButton sample program most of the time a value of 1074810966, its only the first reading after power off and back on of the display that dual_state returns a "1" -the correct- value.

Is it just me that observes this strange behaviour? Help appreciated!

That sounds like the library didn't initialize the variable and relied on mem space being zeroed.

You may need to set the dual-state on startup to a default value to ensure this is not the case.

Also since v37, integers are no longer unsigned, and negative values are possible.

32 bit unsigned range 0 .. 4294967296

32 bit signed range changes to -2147483648 to -2147483647

variables uninitialized may be playing havoc with these changes

The library should be checked for these conditions as well.

Poor practice to rely on conditions that you have not personally set.

NO BUG but my mistake!! I messed things up using Software Serial.

Dear Peter,

How you solve the problem, I am using Wemos D1 mini as MCU and I could not get a proper running SoftwareSerial connection. Receiving data from Nextion to Wemos is not working for me. 

I use HMISerial(4, 5) pins. 


Ensure you are using pins for MCU Hardware UART.
Hardware UART will be more reliable and less pain.

Peter's issue was most likely an Arduino AVR issue
 - bitshifting uint32_t causing invalid results, or uninitialized.

Your issue of establishing communications is unrelated.

Dear Patrick, Could you please share a working example with uart. Because I could not find over the internet with Wemos. Appreciated.

I am sure it is appreciated - How is this related to a Bug Report?

Surely, those following to find example of ESP-12 UART
  will not associate such with incorrect value of v0.38 Dual State.

Perhaps create a new thread in Free Chat
Titled appropriate and described specifically what you request

Trailing at Unrelated Bug Reports 

 - not the right manner

Trailing at year old and 2 year old posts on 20th page

 - not in the right manner

When you have this new thread created

I will try to help you work through your issue

And clean up this misplaced from the Bug Report.

I guess Help is no longer needed.

I will open a new topic thanks Patrick.

as you can see, i got two DualStateButtons, but the code send by nextion screen to my Arduino ONE i the same, eather button i press


Sorry, Jorge

 - posting in Bug report for you help is wrong manner.

 - but I don't see from your screener that you have two DualStateButtons.

 - coding issues does not make it a firmware bug

Pictures received by ticket

(reply to forum notifications does not post in forum)

However, this is not a bug as you claim. 

From the picture above it is clear from the 4 Return Data

 - lower power button was pressed

 - lower power button was pressed

 - upper blue button was pressed

 - upper blue button was pressed

In this stated order.


Coding questions and lack of understanding 

   does not make a firmware BUG

Your issue does not belong under Report a BUG