kasjer commented on a change in pull request #2227: fix incorrect check in lis2ds12_set_full_scale URL: https://github.com/apache/mynewt-core/pull/2227#discussion_r388205193
########## File path: hw/drivers/sensors/lis2ds12/src/lis2ds12.c ########## @@ -520,7 +520,7 @@ lis2ds12_set_full_scale(struct sensor_itf *itf, uint8_t fs) int rc; uint8_t reg; - if (fs > LIS2DS12_FS_16G) { + if (fs > LIS2DS12_FS_8G) { Review comment: Code was wrong, thanks @gonccalo, because it rejected correct value. This check implies that value could be wrong, but it could be wrong in more ways that this condition checks. So condition that validates correctness of full scale argument should rather be: if (0 != (fs & ~LIS2DS12_CTRL_REG1_FS)) Condition fs > LIS2DS12_FS_8G on the first look suggest that 8G is limit for this sensor. So @gonccalo would you mind amending this. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services