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/15 23:59:35 UTC

[GitHub] [mynewt-core] apache-mynewt-bot commented on pull request #2376: FWS-665 pressure sensor optimization

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


   
   <!-- 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;
   @@ -3411,7 +3445,7 @@
        }
    
        bmp388 = (struct bmp388 *)SENSOR_GET_DEVICE(sensor);
   -    
   +
        cfg = &bmp388->cfg;
    
        if (cfg->read_mode.mode != BMP388_READ_M_HYBRID) {
   @@ -3419,31 +3453,29 @@
            return SYS_EINVAL;
        }
    
   -    if (bmp388->bmp388_cfg_complete == false)
   -    {
   +    if (bmp388->bmp388_cfg_complete == false) {
            /* no interrupt feature */
            /* enable normal mode for fifo feature */
            rc = bmp388_set_normal_mode(bmp388);
   -        if (rc)
   -        {
   +        if (rc) {
                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 != 0) {
   +        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;
   @@ -3465,8 +3497,7 @@
        } while ((--try_count > 0) && (rc != BMP3_OK));
    
    
   -    if ((rc != BMP3_OK) || (try_count == 0))
   -    {
   +    if ((rc != BMP3_OK) || (try_count == 0)) {
    #if FIFOPARSE_DEBUG
            BMP388_LOG_ERROR("*****status %d\n", rc);
            BMP388_LOG_ERROR("*****try_count is %d\n", try_count);
   @@ -3477,23 +3508,20 @@
        }
    
        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)
   -    {
   +
   +    if (fifo.settings.time_en) {
            fifo.no_need_sensortime = false;
        } else {
            fifo.no_need_sensortime = true;
        }
    
        rc = bmp3_extract_fifo_data(sensor_data, &bmp388->bmp3_dev);
   -    
   -    if (fifo.data.frame_not_available)
   -    {
   +
   +    if (fifo.data.frame_not_available) {
            /* No valid frame read */
            BMP388_LOG_ERROR("*****No valid Fifo Frames %d\n", rc);
            goto error;
   @@ -3503,19 +3531,16 @@
    #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;
                }
            }
    
   -        if (fifo.sensortime_updated)
   -        {
   +        if (fifo.sensortime_updated) {
                BMP388_LOG_ERROR("*****BMP388 SENSOR TIME %d\n", fifo.data.sensor_time);
                fifo.sensortime_updated = false;
            }
   @@ -3524,18 +3549,17 @@
    #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((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;
                }
   -            
   +
                delay_msec(2);
    #if FIFOPARSE_DEBUG
                BMP388_LOG_ERROR("*****status %d\n", rc);
   @@ -3555,13 +3579,13 @@
            }
    
        }
   -#endif // #if MYNEWT_VAL(BMP388_FIFO_ENABLE)
   +#endif /* #if MYNEWT_VAL(BMP388_FIFO_ENABLE) */
    
        if (time_ms != 0 && OS_TIME_TICK_GT(os_time_get(), stop_ticks)) {
            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;
    
   @@ -3627,7 +3651,7 @@
            rc = bmp388_poll_read(sensor, type, data_func, data_arg, timeout);
        } else if (cfg->read_mode.mode == BMP388_READ_M_STREAM) {
            rc = bmp388_stream_read(sensor, type, data_func, data_arg, timeout);
   -    } else { // hybrid mode
   +    } else { /* hybrid mode */
            rc = bmp388_hybrid_read(sensor, type, data_func, data_arg, timeout);
        }
    err:
   ```
   
   </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