I am getting a bug only immediately after flashing to an E-Series Development Board using --serial. The bug is not present after flashing in DFU mode, pressing the reset button, or a power up/down cycle.
I am reading from two identical serial devices (PM sensors) each reporting three values on each read. After flashing using --serial, a single value reported by the second sensor initialized will be -0.000(stored as a float). The other two values reported in the same serial read are correct and the checksum is passing consistently. All error checking reports the devices and program is running as intended.
Two two sensors will work as intended when both sensor objects are initialized in the .ino file. This bug only shows up when they are instead instantiated in an aggregate class meant to provide additional functionality to two sensors running in tandem.
The -0.000… value is also a source of confusion; the result every calculation it is used in is also -0.000 (stored as a float). I have been unable to catch this value by checking if a value is equal to 0.0, -0.0, or isnan().
At this point I am lost as to what is causing this bug. I know that flashing over DFU is the ‘recommended’ method, but what about the --serial flash method could be causing the strange bug?