Skip to content

Commit 68ee8e2

Browse files
committed
drivers: sensor: lsm6dl fixing -Wdouble-promotion warning
Fixing this "revealed" bug which got introduced when a PR added the -Wdouble-promotion flag to GCC builds Signed-off-by: Francois Ramu <francois.ramu@st.com>
1 parent 6a41a7a commit 68ee8e2

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

drivers/sensor/lsm6dsl/lsm6dsl.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ static int lsm6dsl_accel_range_set(const struct device *dev, int32_t range)
211211
return -EIO;
212212
}
213213

214-
data->accel_sensitivity = (float)(lsm6dsl_accel_fs_sens[fs]
214+
data->accel_sensitivity = (double)(lsm6dsl_accel_fs_sens[fs]
215215
* SENSI_GRAIN_XL);
216216
return 0;
217217
}
@@ -274,7 +274,7 @@ static int lsm6dsl_gyro_range_set(const struct device *dev, int32_t range)
274274
return -EIO;
275275
}
276276

277-
data->gyro_sensitivity = (float)(lsm6dsl_gyro_fs_sens[fs]
277+
data->gyro_sensitivity = (double)(lsm6dsl_gyro_fs_sens[fs]
278278
* SENSI_GRAIN_G);
279279
return 0;
280280
}

drivers/sensor/lsm6dsl/lsm6dsl.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -647,19 +647,19 @@ struct lsm6dsl_data {
647647
int accel_sample_x;
648648
int accel_sample_y;
649649
int accel_sample_z;
650-
float accel_sensitivity;
650+
double accel_sensitivity;
651651
int gyro_sample_x;
652652
int gyro_sample_y;
653653
int gyro_sample_z;
654-
float gyro_sensitivity;
654+
double gyro_sensitivity;
655655
#if defined(CONFIG_LSM6DSL_ENABLE_TEMP)
656656
int temp_sample;
657657
#endif
658658
#if defined(CONFIG_LSM6DSL_EXT0_LIS2MDL) || defined(CONFIG_LSM6DSL_EXT0_LIS3MDL)
659659
int magn_sample_x;
660660
int magn_sample_y;
661661
int magn_sample_z;
662-
float magn_sensitivity;
662+
double magn_sensitivity;
663663
#endif
664664
#if defined(CONFIG_LSM6DSL_EXT0_LPS22HB)
665665
int sample_press;

0 commit comments

Comments
 (0)