dragino / LoRa_STM32

Source code for Dragino LoRa module base on STM32 Chip
76 stars 77 forks source link

The DS18B20 temperature conversion looses the sign before LORAWan send message #1

Closed silvanoAdami closed 6 years ago

silvanoAdami commented 6 years ago

The method DS18B20_GetTemp_SkipRom() returns always a positive temperature to be sent through LORAWan protocol. This is a bug that causes many wrong behaviour.

silvanoAdami commented 6 years ago

Here's an abstract of what I mean:

from TM32CubeExpansion_LRWAN_V1.2/Drivers/BSP/Components/ds18b20/ds18b20.c

float DS18B20_GetTemp_SkipRom ( void ) { ...... tplsb = DS18B20_ReadByte();
tpmsb = DS18B20_ReadByte(); s_tem = tpmsb<<8; s_tem = s_tem | tplsb; if( s_tem < 0 ) f_tem = (~s_tem+1) * 0.0625;
else f_tem = s_tem * 0.0625;

return f_tem; }

f_tem returned is always positive, the original sign of the temperature is lost.

dragino commented 6 years ago

The problem is fixed last month and the update code is here: https://github.com/dragino/LoRa_STM32/blob/master/STM32CubeExpansion_LRWAN_V1.2/Drivers/BSP/Components/ds18b20/ds18b20.c

silvanoAdami commented 6 years ago

Hi Edwin! Thank you for the fix indications. Do you know if there's a cheap way to flash all the modules we bought with the patched software? Keil uVision is a very expensive compiler, and the flashLoader need a serial port on a windows PC. Do you know if are there alternatives to flash all modules we bought? Thanks