Shift m before compare to 0
This commit is contained in:
parent
9f69fbe5ee
commit
48d1bd29cb
|
@ -1191,9 +1191,8 @@ void Temperature::manage_heater() {
|
||||||
#define SCAN_THERMISTOR_TABLE(TBL,LEN) do{ \
|
#define SCAN_THERMISTOR_TABLE(TBL,LEN) do{ \
|
||||||
uint8_t l = 0, r = LEN, m; \
|
uint8_t l = 0, r = LEN, m; \
|
||||||
for (;;) { \
|
for (;;) { \
|
||||||
m = l + r; \
|
m = (l + r) >> 1; \
|
||||||
if (!m) return short(pgm_read_word(&TBL[0][1])); \
|
if (!m) return short(pgm_read_word(&TBL[0][1])); \
|
||||||
m >>= 1; \
|
|
||||||
if (m == l || m == r) return short(pgm_read_word(&TBL[LEN-1][1])); \
|
if (m == l || m == r) return short(pgm_read_word(&TBL[LEN-1][1])); \
|
||||||
short v00 = pgm_read_word(&TBL[m-1][0]), \
|
short v00 = pgm_read_word(&TBL[m-1][0]), \
|
||||||
v10 = pgm_read_word(&TBL[m-0][0]); \
|
v10 = pgm_read_word(&TBL[m-0][0]); \
|
||||||
|
|
Loading…
Reference in a new issue