A couple of fixups prior to merging into main project

Changed the ds_sensor_t struct to just return a float instead of major/minor
Renamed ds18b20.h functions to have consistent `ds18b20_*` naming.
Removed some unnecessary LICENSE files.  Clarified onewire origin/license.
This commit is contained in:
Alex Stewart 2016-02-22 21:18:50 -08:00
parent 6178865cc6
commit d0ed5f03a2
9 changed files with 37 additions and 88 deletions

View file

@ -58,7 +58,7 @@ void broadcast_temperature(void *pvParameters)
for(;;) {
// Search all DS18B20, return its amount and feed 't' structure with result data.
amount = readDS18B20(GPIO_FOR_ONE_WIRE, t);
amount = ds18b20_read_all(GPIO_FOR_ONE_WIRE, t);
if (amount < sensors){
printf("Something is wrong, I expect to see %d sensors \nbut just %d was detected!\n", sensors, amount);
@ -66,8 +66,10 @@ void broadcast_temperature(void *pvParameters)
for (int i = 0; i < amount; ++i)
{
int intpart = (int)t[i].value;
int fraction = (int)((t[i].value - intpart) * 100);
// Multiple "" here is just to satisfy compiler and don`t raise 'hex escape sequence out of range' warning.
sprintf(msg, "Sensor %d report: %d.%d ""\xC2""\xB0""C\n",t[i].id, t[i].major, t[i].minor);
sprintf(msg, "Sensor %d report: %d.%02d ""\xC2""\xB0""C\n",t[i].id, intpart, fraction);
printf("%s", msg);
struct netbuf* buf = netbuf_new();