Mercurial > public > ostc4
comparison Discovery/Src/settings.c @ 337:38367bb982b8 PressureMeasure_Improvment
Set Max value for pressure offset to 50mBar (20mBar before)
Some OSTC4 might have a higher delta and need a bigger offset
author | ideenmodellierer |
---|---|
date | Sat, 17 Aug 2019 18:47:08 +0200 |
parents | 143fe85f82a2 |
children | 591c03a1e68d 75eedde05ff6 |
comparison
equal
deleted
inserted
replaced
336:449e9e9632e4 | 337:38367bb982b8 |
---|---|
1217 corrections++; | 1217 corrections++; |
1218 } | 1218 } |
1219 | 1219 |
1220 /* int8_t offsetPressure_mbar; | 1220 /* int8_t offsetPressure_mbar; |
1221 */ | 1221 */ |
1222 if((Settings.offsetPressure_mbar > 20) || | 1222 if((Settings.offsetPressure_mbar > PRESSURE_OFFSET_LIMIT_MBAR) || |
1223 (Settings.offsetPressure_mbar < -20)) | 1223 (Settings.offsetPressure_mbar < -1 * PRESSURE_OFFSET_LIMIT_MBAR)) |
1224 { | 1224 { |
1225 Settings.offsetPressure_mbar = 0; | 1225 Settings.offsetPressure_mbar = 0; |
1226 corrections++; | 1226 corrections++; |
1227 } | 1227 } |
1228 | 1228 |
1728 return ERROR_; | 1728 return ERROR_; |
1729 case 0x35: | 1729 case 0x35: |
1730 if(data[1] & 0x80) | 1730 if(data[1] & 0x80) |
1731 { | 1731 { |
1732 data[1] = ~(data[1]); | 1732 data[1] = ~(data[1]); |
1733 if(!checkValue(data[1],0,20)) | 1733 if(!checkValue(data[1],0,PRESSURE_OFFSET_LIMIT_MBAR)) |
1734 return ERROR_; | 1734 return ERROR_; |
1735 Settings.offsetPressure_mbar = 0 - data[1]; | 1735 Settings.offsetPressure_mbar = 0 - data[1]; |
1736 } | 1736 } |
1737 else | 1737 else |
1738 { | 1738 { |
1739 if(!checkValue(data[1],0,20)) | 1739 if(!checkValue(data[1],0,PRESSURE_OFFSET_LIMIT_MBAR)) |
1740 return ERROR_; | 1740 return ERROR_; |
1741 Settings.offsetPressure_mbar = data[1]; | 1741 Settings.offsetPressure_mbar = data[1]; |
1742 } | 1742 } |
1743 break; | 1743 break; |
1744 case 0x36: | 1744 case 0x36: |
2092 data[datacounter++] = 0; | 2092 data[datacounter++] = 0; |
2093 break; | 2093 break; |
2094 | 2094 |
2095 case 0x35: | 2095 case 0x35: |
2096 data[datacounter++] = PARAM_SINT; | 2096 data[datacounter++] = PARAM_SINT; |
2097 data[datacounter++] = (uint8_t)(256 - 20); // == -20 | 2097 data[datacounter++] = (uint8_t)(256 - PRESSURE_OFFSET_LIMIT_MBAR); // == -20 |
2098 if(settingsGetPointerStandard()->offsetPressure_mbar < 0) | 2098 if(settingsGetPointerStandard()->offsetPressure_mbar < 0) |
2099 data[datacounter++] = (uint8_t)(127 - settingsGetPointerStandard()->offsetPressure_mbar); | 2099 data[datacounter++] = (uint8_t)(127 - settingsGetPointerStandard()->offsetPressure_mbar); |
2100 else | 2100 else |
2101 data[datacounter++] = settingsGetPointerStandard()->offsetPressure_mbar; | 2101 data[datacounter++] = settingsGetPointerStandard()->offsetPressure_mbar; |
2102 data[datacounter++] = 20; | 2102 data[datacounter++] = PRESSURE_OFFSET_LIMIT_MBAR; |
2103 break; | 2103 break; |
2104 | 2104 |
2105 case 0x36: | 2105 case 0x36: |
2106 data[datacounter++] = PARAM_BOOL; | 2106 data[datacounter++] = PARAM_BOOL; |
2107 data[datacounter++] = 0; | 2107 data[datacounter++] = 0; |