PaxInstruments / t400-firmware

Firmware for the Pax Instruments T400 temperature datalogger
22 stars 5 forks source link

Y-axis location based on number of digits #221

Closed charlespax closed 8 years ago

charlespax commented 8 years ago

When the temperature has two digits the graph y-axis looks like this. img_20160713_091111

In commit 43543b7205458c8e6638093725c884eada44a73c the y-axis will shift to the right when the number of digits increases from two to three like this. img_20160713_091122

In the most recent commit 9fe18bb790af0158d80564159aebaab4549c275b the y-axis does not shift to the right. It looks like this. img_20160713_090044

This is probably happening around line 155 in functions.cpp

   // Calculate the number of axes digits to display
 -  if(graphMin + graphScale*4 > 999 || graphMin < -99) {        +  axisDigits = 2;
 +  if((min + (graphScale*4)) > 9999 || min < -999) {
      axisDigits = 4;             axisDigits = 4;
    }           }
 -  else if(graphMin + graphScale*4 > 99 || graphMin < -9) {         +  else if((min + (graphScale*4)) > 999 || min < -99) {
      axisDigits = 3;             axisDigits = 3;
    }           }
 -  else {       +
 -    axisDigits = 2;        +  return;
charlespax commented 8 years ago

Additional information:

If we start with two digit temperatures like this... img_20160713_093458 and heat things up, we get wonky graphics. img_20160713_093503

But if we heat the thermocouple before turning on the T400, we can start with only three digit numbers. Then we get a nice graph like this. img_20160713_093525 We can keep our nice graph even if we let things cool down. img_20160713_093534

Also notice that in the original firmware the two digits are right justified while on the newer firmware they are left justified. They should be right justified. img_20160713_093534 copy

charlespax commented 8 years ago

Also a weird gap with negative numbers. It seems like the scaling does not happen based on the location of the y-axis, but more to the left. Perhaps the code is looking at the last element in the data array rather than what is displayed. Not sure which is better or if it matters. img_20160713_111627

In that image you may have also noticed the double negative.

protological commented 8 years ago

The logic for the number of character spaces needs to be updated for the new 1/10th temperature values. I have some updated code and will push a fixed branch

protological commented 8 years ago

Fixed in commit 78bd24936d339fcaf88add8d64a5a1af9bf23ccc