{"action":"opened","issue":{"url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/issues/1636","repository_url":"https://api.github.com/repos/nodemcu/nodemcu-firmware","labels_url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/issues/1636/labels{/name}","comments_url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/issues/1636/comments","events_url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/issues/1636/events","html_url":"https://github.com/nodemcu/nodemcu-firmware/issues/1636","id":193317499,"number":1636,"title":"bug in bme280.c","user":{"login":"eyaleb","id":8308047,"avatar_url":"https://avatars.githubusercontent.com/u/8308047?v=3","gravatar_id":"","url":"https://api.github.com/users/eyaleb","html_url":"https://github.com/eyaleb","followers_url":"https://api.github.com/users/eyaleb/followers","following_url":"https://api.github.com/users/eyaleb/following{/other_user}","gists_url":"https://api.github.com/users/eyaleb/gists{/gist_id}","starred_url":"https://api.github.com/users/eyaleb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eyaleb/subscriptions","organizations_url":"https://api.github.com/users/eyaleb/orgs","repos_url":"https://api.github.com/users/eyaleb/repos","events_url":"https://api.github.com/users/eyaleb/events{/privacy}","received_events_url":"https://api.github.com/users/eyaleb/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-12-03T22:27:24Z","updated_at":"2016-12-03T22:27:24Z","closed_at":null,"body":"When converting the module to use i2c bust reads I noticed a mismatch from the doco.\r\nI wonder if the doco is known to be wrong? After all a bad extraction should have produced wrong result in `bme280_compensate_H()` and I did not see a complaint.\r\n### Expected behavior\r\nThe data-sheet says (**6.2.2 Trimming parameter readout**)\r\n```\r\n0xE4 / 0xE5[3:0]  -> dig_H4 [11:4] / [3:0]  signed short\r\n0xE5[7:4] / 0xE6  -> dig_H5 [3:0] / [11:4]  signed short\r\n0xE7              -> dig_H6                 signed char\r\n```\r\n### Actual behavior\r\nThe code for extracting the humidity parameters  does\r\n```\r\nbme280_data.dig_H4 = ((int16_t)r8u(reg) << 4 | (r8u(reg+1) & 0xF)); reg+=2;\r\nbme280_data.dig_H5 = ((int16_t)r8u(reg+1) << 4 | (r8u(reg) >> 4)); reg+=2; \r\nbme280_data.dig_H6 = (int8_t)r8u(reg);\r\n```\r\nNote the `reg+=2` after extracting `H4`. `0xE5` should be split between `H4` and `H5`. The current code seems to extract `H5` from `0xE7/0xE6` then `H6` from `0xE8` (out of range). A `++reg` should be done instead.\r\nDo I read this correctly?\r\n### Test code\r\nNone, this is what I find looking at the code.\r\n### NodeMCU version\r\nLatest dev branch\r\n### Hardware\r\nNone, this is what I find looking at the code.\r\n"}}
{"actor":{"display_login":"eyaleb"}}