Fehler #705
MAX31855: Negative values are not calculated correctly
Start date:
11/03/2025
Due date:
% Done:
0%
Estimated time:
CS Zielversion:
Description
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 );
History
Updated by Maximilian Seesslen about 1 month ago
- Description updated (diff)
- Status changed from Neu to Gelöst