ArdBir / Open-ArdBir

Arduino Code for Single Vessel Brewing System
GNU General Public License v2.0
67 stars 50 forks source link

Bug: Integer value passed to a byte parameter #4

Open allthepies opened 8 years ago

allthepies commented 8 years ago

Hi Guys,

I believe I've found a bug in the Open-ArdBir.ino file.

Line 1280: Set((stageTime), 1440, 15, 15, Timer, Verso);

This invokes the following overloaded function from Funzioni.h:

byte Set(byte& Set, byte Up, byte Low, byte Step, long Timer, byte Verso)

Parameter 2 (byte Up) is being passed an integer value 1440 which causes a compilation warning (if warnings are enabled at compile time) and runtime truncation of the value passed.

I don't know how/if this manifests itself while running, it's just something I noticed while compiling the code with warnings enabled.

kenmcc commented 8 years ago

I noticed something similar when playing with the settings - the delayed start can only be set to circa 2 hours 15 or something, as it is truncated to byte. I changed the type of this to an int and it can then do 12 hours delay correctly.

But as you point out there is discrepancy in the overloading, which needs to be lined up.

tico-tico commented 8 years ago

They have changed many things in v2.8.3rc8 and int for stageTime is among them. I have no idea why they didn't update the rep.