more startup debugging
This commit is contained in:
@@ -161,9 +161,11 @@ pub(crate) async fn create_v4(
|
||||
info!("Start v4");
|
||||
let mut awake = Output::new(peripherals.gpio21, Level::High, OutputConfig::default());
|
||||
awake.set_high();
|
||||
info!("v4: gpio21 awake ok");
|
||||
|
||||
let mut general_fault = Output::new(peripherals.gpio23, Level::Low, OutputConfig::default());
|
||||
general_fault.set_low();
|
||||
info!("v4: gpio23 general_fault ok");
|
||||
|
||||
let twai_config = Some(TwaiConfiguration::new(
|
||||
peripherals.twai,
|
||||
@@ -172,17 +174,24 @@ pub(crate) async fn create_v4(
|
||||
TWAI_BAUDRATE,
|
||||
TwaiMode::Normal,
|
||||
));
|
||||
info!("v4: twai config ok");
|
||||
|
||||
let extra1 = Output::new(peripherals.gpio6, Level::Low, OutputConfig::default());
|
||||
info!("v4: gpio6 extra1 ok");
|
||||
let extra2 = Output::new(peripherals.gpio15, Level::Low, OutputConfig::default());
|
||||
info!("v4: gpio15 extra2 ok");
|
||||
|
||||
let one_wire_pin = Flex::new(peripherals.gpio18);
|
||||
info!("v4: gpio18 one_wire ok");
|
||||
let tank_power_pin = Output::new(peripherals.gpio11, Level::Low, OutputConfig::default());
|
||||
info!("v4: gpio11 tank_power ok");
|
||||
let flow_sensor_pin = Input::new(
|
||||
peripherals.gpio4,
|
||||
InputConfig::default().with_pull(Pull::Up),
|
||||
);
|
||||
info!("v4: gpio4 flow_sensor ok");
|
||||
|
||||
info!("v4: creating tank sensor");
|
||||
let tank_sensor = TankSensor::create(
|
||||
one_wire_pin,
|
||||
peripherals.adc1,
|
||||
@@ -191,12 +200,17 @@ pub(crate) async fn create_v4(
|
||||
flow_sensor_pin,
|
||||
peripherals.pcnt1,
|
||||
)?;
|
||||
info!("v4: tank sensor ok");
|
||||
|
||||
let can_power = Output::new(peripherals.gpio22, Level::Low, OutputConfig::default());
|
||||
info!("v4: gpio22 can_power ok");
|
||||
|
||||
let solar_is_day = Input::new(peripherals.gpio7, InputConfig::default());
|
||||
info!("v4: gpio7 solar_is_day ok");
|
||||
let light = Output::new(peripherals.gpio10, Level::Low, Default::default());
|
||||
info!("v4: gpio10 light ok");
|
||||
let charge_indicator = Output::new(peripherals.gpio3, Level::Low, Default::default());
|
||||
info!("v4: gpio3 charge_indicator ok");
|
||||
|
||||
info!("Start pump expander");
|
||||
let pump_device = I2cDevice::new(I2C_DRIVER.get().await);
|
||||
|
||||
@@ -44,22 +44,31 @@ impl<'a> TankSensor<'a> {
|
||||
one_wire_pin.set_high();
|
||||
one_wire_pin.set_input_enable(true);
|
||||
one_wire_pin.set_output_enable(true);
|
||||
info!("tank: one_wire pin config ok");
|
||||
|
||||
let mut adc1_config = AdcConfig::new();
|
||||
info!("tank: adc config created");
|
||||
let tank_pin =
|
||||
adc1_config.enable_pin_with_cal::<_, AdcCalLine<_>>(gpio5, Attenuation::_11dB);
|
||||
info!("tank: adc pin cal ok");
|
||||
let tank_channel = Adc::new(adc1, adc1_config).into_async();
|
||||
info!("tank: adc channel ok");
|
||||
|
||||
let one_wire_bus = OneWire::new(one_wire_pin, false);
|
||||
info!("tank: one_wire bus ok");
|
||||
|
||||
pcnt1.set_high_limit(Some(i16::MAX))?;
|
||||
info!("tank: pcnt high limit ok");
|
||||
|
||||
let ch0 = &pcnt1.channel0;
|
||||
ch0.set_edge_signal(flow_sensor.peripheral_input());
|
||||
info!("tank: pcnt edge signal ok");
|
||||
ch0.set_input_mode(Hold, Increment);
|
||||
ch0.set_ctrl_mode(Keep, Keep);
|
||||
info!("tank: pcnt input/ctrl mode ok");
|
||||
|
||||
pcnt1.listen();
|
||||
info!("tank: pcnt listen ok");
|
||||
|
||||
Ok(TankSensor {
|
||||
one_wire_bus,
|
||||
|
||||
@@ -4,7 +4,7 @@ use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex;
|
||||
use embassy_sync::blocking_mutex::Mutex as BlockingMutex;
|
||||
use log::{LevelFilter, Log, Metadata, Record};
|
||||
|
||||
const MAX_LIVE_LOG_ENTRIES: usize = 64;
|
||||
const MAX_LIVE_LOG_ENTRIES: usize = 128;
|
||||
|
||||
struct LiveLogBuffer {
|
||||
entries: Vec<(u64, String)>,
|
||||
|
||||
Reference in New Issue
Block a user