Fehler #705
MAX31855: Negative values are not calculated correctly
Beginn:
03.11.2025
Abgabedatum:
% erledigt:
0%
Geschätzter Aufwand:
CS Zielversion:
Beschreibung
Not very important. But at least some unit tests would be nice. And plausibilisation will make more sense. 201°C vs -55°C (Ref).
The integer values have just to be extended when signed; shifting is signed, nice.
if( raw & 0b1000'0000'0000 )
{
raw|=0b1111'1111'1111'1111'1111'0000'0000'0000;
}
int temp=( raw * 100.0 );
temp = temp >> 4;
Alternatively 2 shift operators could be used; left/right. Check binary sizes on Eufa.
int raw=0b1100'1001'0000'0000; // RAW -55.0000
raw = ( raw<<16 ) >> (16+4);
Hopefully ARM gcc make the same result
static_assert( ( -1 >> 1 ) == -1 );
Historie
Von Maximilian Seesslen vor etwa 8 Stunden aktualisiert
- Beschreibung aktualisiert (diff)
- Status wurde von Neu zu Gelöst geändert