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:
		
							parent
							
								
									6178865cc6
								
							
						
					
					
						commit
						d0ed5f03a2
					
				
					 9 changed files with 37 additions and 88 deletions
				
			
		|  | @ -1,22 +0,0 @@ | |||
| The MIT License (MIT) | ||||
| 
 | ||||
| Copyright (c) 2016 Grzegorz Hetman : ghetman@gmail.com | ||||
| 
 | ||||
| Permission is hereby granted, free of charge, to any person obtaining a copy | ||||
| of this software and associated documentation files (the "Software"), to deal | ||||
| in the Software without restriction, including without limitation the rights | ||||
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||||
| copies of the Software, and to permit persons to whom the Software is | ||||
| furnished to do so, subject to the following conditions: | ||||
| 
 | ||||
| The above copyright notice and this permission notice shall be included in all | ||||
| copies or substantial portions of the Software. | ||||
| 
 | ||||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||||
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||||
| FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||||
| AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||||
| LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||||
| OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||||
| SOFTWARE. | ||||
| 
 | ||||
|  | @ -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(); | ||||
|  |  | |||
|  | @ -1,22 +0,0 @@ | |||
| The MIT License (MIT) | ||||
| 
 | ||||
| Copyright (c) 2016 Grzegorz Hetman : ghetman@gmail.com | ||||
| 
 | ||||
| Permission is hereby granted, free of charge, to any person obtaining a copy | ||||
| of this software and associated documentation files (the "Software"), to deal | ||||
| in the Software without restriction, including without limitation the rights | ||||
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||||
| copies of the Software, and to permit persons to whom the Software is | ||||
| furnished to do so, subject to the following conditions: | ||||
| 
 | ||||
| The above copyright notice and this permission notice shall be included in all | ||||
| copies or substantial portions of the Software. | ||||
| 
 | ||||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||||
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||||
| FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||||
| AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||||
| LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||||
| OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||||
| SOFTWARE. | ||||
| 
 | ||||
|  | @ -30,7 +30,7 @@ void print_temperature(void *pvParameters) | |||
|      | ||||
|     while(1) { | ||||
|         // 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); | ||||
|  | @ -38,8 +38,10 @@ void print_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.
 | ||||
|             printf("Sensor %d report: %d.%d ""\xC2""\xB0""C\n",t[i].id, t[i].major, t[i].minor); | ||||
|             printf("Sensor %d report: %d.%02d ""\xC2""\xB0""C\n",t[i].id, intpart, fraction); | ||||
|         } | ||||
|         printf("\n"); | ||||
|         vTaskDelay(delay / portTICK_RATE_MS); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue