You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2020/09/17 00:32:03 UTC

[GitHub] [mynewt-core] apache-mynewt-bot commented on pull request #2376: BMP388 Pressure/temperature sensor i2c communtication optimization

apache-mynewt-bot commented on pull request #2376:
URL: https://github.com/apache/mynewt-core/pull/2376#issuecomment-693737211


   
   <!-- style-bot -->
   
   ## Style check summary
   
   ### Our coding style is [here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
   
   
   #### hw/drivers/sensors/bmp388/src/bmp388.c
   <details>
   
   ```diff
   @@ -3379,7 +3413,7 @@
        os_time_t time_ticks;
        os_time_t stop_ticks = 0;
        uint16_t try_count;
   -    
   +
    #if MYNEWT_VAL(BMP388_FIFO_ENABLE)
        /* FIFO object to be assigned to device structure */
        struct bmp3_fifo fifo;
   @@ -3406,13 +3440,13 @@
    
        /* If the read isn't looking for pressure or temperature data, don't do anything. */
        if ((!(sensor_type & SENSOR_TYPE_PRESSURE)) &&
   -            (!(sensor_type & SENSOR_TYPE_TEMPERATURE))) {
   +        (!(sensor_type & SENSOR_TYPE_TEMPERATURE))) {
            BMP388_LOG_ERROR("unsupported sensor type for bmp388\n");
            return SYS_EINVAL;
        }
    
        bmp388 = (struct bmp388 *)SENSOR_GET_DEVICE(sensor);
   -    
   +
        cfg = &bmp388->cfg;
    
        if (cfg->read_mode.mode != BMP388_READ_M_HYBRID) {
   @@ -3428,20 +3462,21 @@
                BMP388_LOG_ERROR("******bmp388_set_normal_mode failed %d\n", rc);
                goto error;
            }
   -        bmp3_fifo_flush(&bmp388->bmp3_dev); 
   +        bmp3_fifo_flush(&bmp388->bmp3_dev);
            bmp388->bmp388_cfg_complete = true;
        }
   -     
   -    
   +
   +
    #if MYNEWT_VAL(BMP388_FIFO_ENABLE)
        bmp388->bmp3_dev.fifo = &fifo;
    
        fifo.data.req_frames = bmp388->bmp3_dev.fifo_watermark_level;
    #endif
   -    
   +
        if (time_ms != 0) {
   -        if (time_ms > BMP388_MAX_STREAM_MS)
   +        if (time_ms > BMP388_MAX_STREAM_MS) {
                time_ms = BMP388_MAX_STREAM_MS;
   +        }
            rc = os_time_ms_to_ticks(time_ms, &time_ticks);
            if (rc) {
                goto error;
   @@ -3459,7 +3494,7 @@
            delay_msec(2);
    #if MYNEWT_VAL(BMP388_INT_ENABLE)
        } while (((bmp388->bmp3_dev.status.intr.fifo_wm == 0) &&
   -                  (bmp388->bmp3_dev.status.intr.fifo_full == 0)) && (try_count > 0));
   +              (bmp388->bmp3_dev.status.intr.fifo_full == 0)) && (try_count > 0));
    #else
        } while ((--try_count > 0) && (rc != BMP3_OK));
    #endif
   @@ -3475,11 +3510,11 @@
        }
    
        rc = bmp3_get_fifo_data(&bmp388->bmp3_dev);
   -    if(rc != BMP3_OK) {
   +    if (rc != BMP3_OK) {
            BMP388_LOG_ERROR("*****BMP388 FIFO READ FAILED\n");
            goto error;
        }
   -    
   +
        if (fifo.settings.time_en) {
            fifo.no_need_sensortime = false;
        } else {
   @@ -3487,7 +3522,7 @@
        }
    
        rc = bmp3_extract_fifo_data(sensor_data, &bmp388->bmp3_dev);
   -    
   +
        if (fifo.data.frame_not_available) {
            /* No valid frame read */
            BMP388_LOG_ERROR("*****No valid Fifo Frames %d\n", rc);
   @@ -3498,10 +3533,10 @@
    #endif
            frame_length = fifo.data.parsed_frames;
    
   -        for(i = 0; i < frame_length; i++) {
   +        for (i = 0; i < frame_length; i++) {
                rc = bmp388_do_report(sensor, sensor_type, read_func, read_arg, &sensor_data[i]);
   -            
   -            if(rc) {
   +
   +            if (rc) {
                    BMP388_LOG_ERROR("*****BMP388_DO_REPORT FAILED %d\n", rc);
                    goto error;
                }
   @@ -3516,21 +3551,21 @@
    #else /* FIFO NOT ENABLED */
        if (bmp388->cfg.fifo_mode == BMP388_FIFO_M_BYPASS) {
            /* make data is available */
   -        try_count = 5; 
   +        try_count = 5;
    
    
            do {
                rc = bmp3_get_status(&bmp388->bmp3_dev);
    #if MYNEWT_VAL(BMP388_INT_ENABLE)
   -            if(bmp388->bmp3_dev.status.intr.drdy) {
   +            if (bmp388->bmp3_dev.status.intr.drdy) {
                    break;
                }
    #else
   -            if((bmp388->bmp3_dev.status.sensor.drdy_press) &&
   -                    (bmp388->bmp3_dev.status.sensor.drdy_temp)) {
   +            if ((bmp388->bmp3_dev.status.sensor.drdy_press) &&
   +                (bmp388->bmp3_dev.status.sensor.drdy_temp)) {
                    break;
                }
   -#endif       
   +#endif
                delay_msec(2);
    #if FIFOPARSE_DEBUG
                BMP388_LOG_ERROR("*****status %d\n", rc);
   @@ -3556,7 +3591,7 @@
            BMP388_LOG_INFO("stream time expired\n");
            BMP388_LOG_INFO("you can make BMP388_MAX_STREAM_MS bigger to extend stream time duration\n");
            goto error;
   -    } 
   +    }
    
        return rc;
    
   ```
   
   </details>


----------------------------------------------------------------
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:
users@infra.apache.org