Merge branch 'develop' into housekeeping
This commit is contained in:
@@ -26,6 +26,7 @@ use esp_idf_hal::{
|
||||
pcnt::{PcntChannel, PcntChannelConfig, PcntControlMode, PcntCountMode, PcntDriver, PinIndex},
|
||||
};
|
||||
use esp_idf_sys::{gpio_hold_dis, gpio_hold_en, vTaskDelay, EspError};
|
||||
use measurements::{Current, Voltage};
|
||||
use one_wire_bus::OneWire;
|
||||
use plant_ctrl2::sipo::ShiftRegister40;
|
||||
use std::result::Result::Ok as OkStd;
|
||||
@@ -249,6 +250,26 @@ pub(crate) fn create_v3(
|
||||
}
|
||||
|
||||
impl<'a> BoardInteraction<'a> for V3<'a> {
|
||||
fn set_charge_indicator(&mut self, charging: bool) -> Result<()> {
|
||||
Ok(self.shift_register.decompose()[CHARGING].set_state(charging.into())?)
|
||||
}
|
||||
|
||||
fn is_day(&self) -> bool {
|
||||
self.solar_is_day.get_level().into()
|
||||
}
|
||||
|
||||
fn get_mptt_voltage(&mut self) -> Result<Voltage> {
|
||||
//if working this is the hardware set mppt voltage
|
||||
if self.is_day() {
|
||||
Ok(Voltage::from_volts(15_f64))
|
||||
} else {
|
||||
Ok(Voltage::from_volts(0_f64))
|
||||
}
|
||||
}
|
||||
|
||||
fn get_mptt_current(&mut self) -> Result<Current> {
|
||||
bail!("Board does not have current sensor")
|
||||
}
|
||||
fn get_esp(&mut self) -> &mut ESP<'a> {
|
||||
&mut self.esp
|
||||
}
|
||||
@@ -261,10 +282,6 @@ impl<'a> BoardInteraction<'a> for V3<'a> {
|
||||
&mut self.battery_monitor
|
||||
}
|
||||
|
||||
fn set_charge_indicator(&mut self, charging: bool) -> Result<()> {
|
||||
Ok(self.shift_register.decompose()[CHARGING].set_state(charging.into())?)
|
||||
}
|
||||
|
||||
fn deep_sleep(&mut self, duration_in_ms: u64) -> ! {
|
||||
let _ = self.shift_register.decompose()[AWAKE].set_low();
|
||||
deep_sleep(duration_in_ms)
|
||||
@@ -366,10 +383,6 @@ impl<'a> BoardInteraction<'a> for V3<'a> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn is_day(&self) -> bool {
|
||||
self.solar_is_day.get_level().into()
|
||||
}
|
||||
|
||||
fn water_temperature_c(&mut self) -> Result<f32> {
|
||||
self.one_wire_bus
|
||||
.reset(&mut self.esp.delay)
|
||||
|
||||
Reference in New Issue
Block a user