Skip to content

Conversation

@R6DJO
Copy link

@R6DJO R6DJO commented Jan 14, 2026

Summary

  • Fixed incorrect display of negative temperature values in T1000-E sensor variant
  • Changed ntc_temp2 array type from char to int8_t

Problem

The ntc_temp2 lookup table in variants/t1000-e/t1000e_sensors.cpp was declared as char, which can be unsigned on some platforms (depending on compiler defaults). This caused negative temperature values (from -30°C to -1°C) to be incorrectly interpreted as large positive values.

Solution

Changed the array declaration from:

static char ntc_temp2[136] = { -30, -29, -28, ... }

to:

static int8_t ntc_temp2[136] = { -30, -29, -28, ... }

This ensures the array is always treated as signed, allowing proper handling of negative temperatures.

Impact

  • Fixes temperature readings in cold environments (below 0°C)
  • No impact on positive temperature readings
  • Single-line change with no API modifications

Test plan

  • [*] Compile for T1000-E variant
  • [*] Test temperature readings in sub-zero conditions

Fixes #1389

🤖 Generated with Claude Code

The ntc_temp2 lookup table was declared as 'char', which can be
unsigned on some platforms, causing negative temperature values
(-30°C to -1°C) to be incorrectly interpreted.

Changed to int8_t to ensure proper signed integer handling of
negative temperatures.

Fixes meshcore-dev#1389

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@R6DJO R6DJO changed the title T1000-E: Negative temperature values incorrectly displayed due to char signedness #1389 T1000-E: Negative temperature values incorrectly displayed due to char signedness Jan 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant