Kaynağa Gözat

Improved mechanism for downloading files from SD card

Victor 3 yıl önce
ebeveyn
işleme
0a1664b13e
3 değiştirilmiş dosya ile 2 ekleme ve 3 silme
  1. 1 1
      Sensors.c
  2. 0 1
      sensors/BMP280.c
  3. 1 1
      unitemp.c

+ 1 - 1
Sensors.c

@@ -265,7 +265,7 @@ bool unitemp_sensors_load(void) {
     //Сколько байт до конца строки
     size_t line_end = 0;
 
-    while(line_end != STRING_FAILURE) {
+    while(line_end != STRING_FAILURE && line_end != (size_t)(file_size - 1)) {
         //Имя датчика
         char name[11] = {0};
         //Тип датчика

+ 0 - 1
sensors/BMP280.c

@@ -211,7 +211,6 @@ UnitempStatus unitemp_BMP280_update(Sensor* sensor) {
     int32_t adc_P = ((int32_t)buff[0] << 12) | ((int32_t)buff[1] << 4) | ((int32_t)buff[2] >> 4);
     sensor->temp = bmp280_compensate_T_double(i2c_sensor, adc_T);
     sensor->pressure = bmp280_compensate_P_int(i2c_sensor, adc_P);
-    FURI_LOG_D(APP_NAME, "pressure: %d pa ", (int)sensor->pressure);
     return UT_OK;
 }
 

+ 1 - 1
unitemp.c

@@ -130,7 +130,7 @@ bool unitemp_loadSettings(void) {
     //Сколько байт до конца строки
     size_t line_end = 0;
 
-    while(line_end != STRING_FAILURE) {
+    while(line_end != STRING_FAILURE && line_end != (size_t)(file_size - 1)) {
         char buff[20] = {0};
         sscanf(((char*)(file_buf + line_end)), "%s", buff);