SOLVED:
The outer loop was going beyond the scope of the array - yet there was no obvious reason - I need to chase that... but oddly - it was returnig a value in a float that wasn't recognised - even as the incorrect value?!
Sigh.
Code taken directly from my source with excess removed.
I'll post the whole function if asked - but it's getting a bit big.
ticket_total and line_total are both declared as float
char priceString[8];
THIS BLOCK OF CODE WORKS... in the same program
:::: within a for-loop
line_total = num_serves[index] * item.price_per_serve;
dtostrf(line_total, 5, 2, priceString);
Serial.println(priceString); << shows fine
ticket_total += line_total;
::::
(end of the loop)
dtostrf(ticket_total, 6, 2, priceString);
Serial.print(F("TOTAL this order $"));
Serial.println(priceString); << shows fine
::::
THIS BLOCK displays line-total correctly - BUT shows ticket_total as NAN
:::: within a for-loop
line_total = num_serves[index] * item.price_per_serve;
Serial.println(line_total); << shows fine
ticket_total += line_total;
Serial.println(ticket_total); << shows NAN
::::
(end of the loop)
dtostrf(ticket_total, 6, 2, priceString);
lcd_goto(lcd_row[1]); lcd_puts("Order TOTAL $"); lcd_puts(priceString); << shows NAN
::::
Any helpful ideas or experience why ticket_total is not getting tallied correctly in the second example ?
or whydtostrf() would be calling a float a NAN - yet it works two lines earlier in the same code for line_total?