{"action":"created","issue":{"url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/issues/633","labels_url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/issues/633/labels{/name}","comments_url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/issues/633/comments","events_url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/issues/633/events","html_url":"https://github.com/nodemcu/nodemcu-firmware/issues/633","id":104662591,"number":633,"title":"dht_lib.lua bug?","user":{"login":"neophox","id":14004794,"avatar_url":"https://avatars.githubusercontent.com/u/14004794?v=3","gravatar_id":"","url":"https://api.github.com/users/neophox","html_url":"https://github.com/neophox","followers_url":"https://api.github.com/users/neophox/followers","following_url":"https://api.github.com/users/neophox/following{/other_user}","gists_url":"https://api.github.com/users/neophox/gists{/gist_id}","starred_url":"https://api.github.com/users/neophox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neophox/subscriptions","organizations_url":"https://api.github.com/users/neophox/orgs","repos_url":"https://api.github.com/users/neophox/repos","events_url":"https://api.github.com/users/neophox/events{/privacy}","received_events_url":"https://api.github.com/users/neophox/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-09-03T10:17:01Z","updated_at":"2015-09-03T12:09:21Z","closed_at":null,"body":"I was reviewing dht support in nodemcu and i think there may be a bug in dht_lib.lua when decoding DHT temperature data (L106). Shouldn't it be byte_3 instead of byte_2? \r\nIt seems to me that integral part gets overwritten by decimal part in that line.\r\n"},"comment":{"url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/issues/comments/137418482","html_url":"https://github.com/nodemcu/nodemcu-firmware/issues/633#issuecomment-137418482","issue_url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/issues/633","id":137418482,"user":{"login":"vowstar","id":394260,"avatar_url":"https://avatars.githubusercontent.com/u/394260?v=3","gravatar_id":"","url":"https://api.github.com/users/vowstar","html_url":"https://github.com/vowstar","followers_url":"https://api.github.com/users/vowstar/followers","following_url":"https://api.github.com/users/vowstar/following{/other_user}","gists_url":"https://api.github.com/users/vowstar/gists{/gist_id}","starred_url":"https://api.github.com/users/vowstar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vowstar/subscriptions","organizations_url":"https://api.github.com/users/vowstar/orgs","repos_url":"https://api.github.com/users/vowstar/repos","events_url":"https://api.github.com/users/vowstar/events{/privacy}","received_events_url":"https://api.github.com/users/vowstar/received_events","type":"User","site_admin":false},"created_at":"2015-09-03T12:09:21Z","updated_at":"2015-09-03T12:09:21Z","body":"Please test this code:\r\nhttps://github.com/nodemcu/nodemcu-firmware/wiki/nodemcu_api_en#dhtread\r\n```\r\npin = 5\r\nstatus,temp,humi,temp_decimial,humi_decimial = dht.read(pin)\r\nif( status == dht.OK ) then\r\n  -- Integer firmware using this example\r\n  print(     \r\n    string.format(\r\n      \"DHT Temperature:%d.%03d;Humidity:%d.%03d\\r\\n\",\r\n      math.floor(temp),\r\n      temp_decimial,\r\n      math.floor(humi),\r\n      humi_decimial\r\n    )\r\n  )\r\n  -- Float firmware using this example\r\n  print(\"DHT Temperature:\"..temp..\";\"..\"Humidity:\"..humi)\r\nelseif( status == dht.ERROR_CHECKSUM ) then\r\n  print( \"DHT Checksum error.\" );\r\nelseif( status == dht.ERROR_TIMEOUT ) then\r\n  print( \"DHT Time out.\" );\r\nend\r\n```"}}