mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-09 17:29:50 +03:00
Merge remote-tracking branch 'origin/dev' into main
This commit is contained in:
@@ -8,7 +8,7 @@ import MenuItem from '@material-ui/core/MenuItem';
|
||||
import { ENDPOINT_ROOT } from '../api';
|
||||
import { restController, RestControllerProps, RestFormLoader, RestFormProps, FormActions, FormButton, BlockFormControlLabel, SectionContent } from '../components';
|
||||
|
||||
import { isIP, isHostname, or } from '../validators';
|
||||
import { isIP, isHostname, or, optional } from '../validators';
|
||||
|
||||
import { EMSESPSettings } from './EMSESPtypes';
|
||||
|
||||
@@ -19,7 +19,7 @@ type EMSESPSettingsControllerProps = RestControllerProps<EMSESPSettings>;
|
||||
class EMSESPSettingsController extends Component<EMSESPSettingsControllerProps> {
|
||||
|
||||
componentDidMount() {
|
||||
ValidatorForm.addValidationRule('isIPOrHostname', or(isIP, isHostname));
|
||||
ValidatorForm.addValidationRule('isIPOrHostname', optional(or(isIP, isHostname)));
|
||||
this.props.loadData();
|
||||
}
|
||||
|
||||
|
||||
@@ -106,8 +106,12 @@ void Sensors::loop() {
|
||||
case TYPE_DS18S20:
|
||||
case TYPE_DS1822:
|
||||
case TYPE_DS1825:
|
||||
found_.emplace_back(addr);
|
||||
found_.back().temperature_c = get_temperature_c(addr);
|
||||
float f;
|
||||
f = get_temperature_c(addr);
|
||||
if ((f != NAN) && (f >= -55) && (f <= 125)) {
|
||||
found_.emplace_back(addr);
|
||||
found_.back().temperature_c = f;
|
||||
}
|
||||
|
||||
/*
|
||||
// comment out for debugging
|
||||
@@ -220,7 +224,7 @@ float Sensors::get_temperature_c(const uint8_t addr[]) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
uint32_t raw = (raw_value * 625 + 500) / 1000; // round to 0.1
|
||||
uint32_t raw = ((uint32_t)raw_value * 625 + 500) / 1000; // round to 0.1
|
||||
return (float)raw / 10;
|
||||
#else
|
||||
return NAN;
|
||||
|
||||
@@ -633,7 +633,6 @@ bool System::check_upgrade() {
|
||||
#if defined(EMSESP_DEBUG)
|
||||
Serial.begin(115200);
|
||||
Serial.println(F("FS is Littlefs"));
|
||||
Serial.flush();
|
||||
Serial.end();
|
||||
#endif
|
||||
return false;
|
||||
@@ -649,9 +648,11 @@ bool System::check_upgrade() {
|
||||
#if defined(EMSESP_DEBUG)
|
||||
Serial.begin(115200);
|
||||
Serial.println(F("No old SPIFFS found!"));
|
||||
Serial.flush();
|
||||
Serial.end();
|
||||
#endif
|
||||
// if there is neither SPIFFS or LittleFS we can assume the ESP8266 has been erased
|
||||
l_cfg.setAutoFormat(true); // reset to normal behaviour
|
||||
LittleFS.setConfig(l_cfg);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user