DutchDevelop / BLLEDController

Other
94 stars 26 forks source link

Finish State is not left because of closing bracket at wrong position #33

Open 0x0172 opened 6 months ago

0x0172 commented 6 months ago

I think i found a bug in the Code. The finish state (green light) is not left because a bracket is not at the right place. The closing bracket needs to be behind ">= 300000)"

https://github.com/DutchDevelop/BLLEDController/blame/0763358e4dc4158633b3bb70be3c480c71d9acba/src/leds.h#L271

Thanks!

jcwren commented 5 months ago

This is why one should always enable the -W and -Wall compiler flags.

In file included from src/web-server.h:11,
                 from src/main.cpp:2:
src/leds.h: In function 'void updateleds()':
src/leds.h:234:68: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
     if (printerVariables.stage == 0 || printerVariables.stage == 2 && printerVariables.gcodeState == "RUNNING"){ //Printing or Resume after Pausing
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

src/leds.h: In function 'void ledsloop()':
src/leds.h:271:90: warning: comparison of constant '300000' with boolean expression is always false [-Wbool-compare]
     if((printerVariables.finishstartms > 0 && millis() - printerVariables.finishstartms) >= 300000 && printerVariables.gcodeState == "FINISH"){
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
wile1411 commented 5 months ago

Noticed that and fixed in latest version BLLC_19.3.24.bin version from official site https://www.dutchdevelop.com/bl-led-controller/ Also thanks for the info on the build_flags - I've added it to my dev env. (I've just done some work on the code as a community member)