adjustable voltages for mppt
This commit is contained in:
@@ -566,6 +566,7 @@ fn safe_main() -> anyhow::Result<()> {
|
||||
let _webserver = httpd(reboot_now.clone());
|
||||
wait_infinity(WaitType::MqttConfig, reboot_now.clone());
|
||||
}
|
||||
board.set_restart_to_conf(false);
|
||||
board.deep_sleep(1000 * 1000 * 60 * deep_sleep_duration_minutes as u64);
|
||||
}
|
||||
|
||||
@@ -966,6 +967,7 @@ fn main() {
|
||||
match result {
|
||||
Ok(_) => {
|
||||
println!("Main app finished, restarting");
|
||||
BOARD_ACCESS.lock().unwrap().set_restart_to_conf(false);
|
||||
BOARD_ACCESS.lock().unwrap().deep_sleep(1);
|
||||
}
|
||||
Err(err) => {
|
||||
|
@@ -24,7 +24,7 @@ use esp_idf_svc::wifi::EspWifi;
|
||||
use measurements::Temperature;
|
||||
use once_cell::sync::Lazy;
|
||||
use plant_ctrl2::sipo::ShiftRegister40;
|
||||
use esp_idf_sys::esp_deep_sleep;
|
||||
use esp_idf_sys::{esp_deep_sleep, esp_sleep_enable_ext1_wakeup, esp_sleep_ext1_wakeup_mode_t_ESP_EXT1_WAKEUP_ANY_LOW};
|
||||
use esp_idf_sys::esp_restart;
|
||||
|
||||
use anyhow::{anyhow, Context};
|
||||
@@ -160,7 +160,7 @@ pub struct PlantCtrlBoard<'a> {
|
||||
main_pump: PinDriver<'a, esp_idf_hal::gpio::AnyIOPin, InputOutput>,
|
||||
tank_power: PinDriver<'a, esp_idf_hal::gpio::AnyIOPin, InputOutput>,
|
||||
general_fault: PinDriver<'a, esp_idf_hal::gpio::AnyIOPin, InputOutput>,
|
||||
pub wifi_driver: EspWifi<'a>,
|
||||
wifi_driver: EspWifi<'a>,
|
||||
one_wire_bus: OneWire<PinDriver<'a, Gpio18, esp_idf_hal::gpio::InputOutput>>,
|
||||
mqtt_client: Option<EspMqttClient<'a>>,
|
||||
battery_driver: Bq34z100g1Driver<MutexDevice<'a, I2cDriver<'a>>, Delay>,
|
||||
@@ -208,7 +208,8 @@ impl PlantCtrlBoard<'_> {
|
||||
if duration_in_ms == 0 {
|
||||
esp_restart();
|
||||
} else {
|
||||
// esp_sleep_enable_ext1_wakeup(0b10u64, esp_sleep_ext1_wakeup_mode_t_ESP_EXT1_WAKEUP_ANY_LOW);
|
||||
//configure gpio 1 to wakeup on low, reused boot button for this
|
||||
esp_sleep_enable_ext1_wakeup(0b10u64, esp_sleep_ext1_wakeup_mode_t_ESP_EXT1_WAKEUP_ANY_LOW);
|
||||
esp_deep_sleep(duration_in_ms);
|
||||
}
|
||||
|
||||
@@ -571,9 +572,8 @@ impl PlantCtrlBoard<'_> {
|
||||
ssid_hidden: false,
|
||||
..Default::default()
|
||||
};
|
||||
let clientconfig = ClientConfiguration::default();
|
||||
self.wifi_driver
|
||||
.set_configuration(&Configuration::Mixed(clientconfig, apconfig))?;
|
||||
.set_configuration(&Configuration::AccessPoint(apconfig))?;
|
||||
self.wifi_driver.start()?;
|
||||
Ok(())
|
||||
}
|
||||
|
Reference in New Issue
Block a user