Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Sprinkler] Initialize timers early to avoid crash #5499

Merged
merged 6 commits into from Oct 9, 2023

Commits on Oct 8, 2023

  1. [Sprinkler] Initialize timers early to avoid crash

    Attempting to set `standby_switch` of a controller to ON at early boot
    stages results in the crash below. Such flow could be introduced by a
    switch that sets controller(s) to standby (i.e. a global disable
    switch).
    
    The issue is resolved by adding non-default constructor to `Sprinkler`
    class that initialized timers (valve selection and state machine ones)
    early, hence activating standby (and shutdown action it invokes
    internally) is now a safe operation.
    
    	(gdb) bt
    	#0  isr_hardfault () at /home/earle/Arduino/hardware/pico/rp2040/pico-sdk/src/rp2_common/pico_standard_link/crt0.S:98
    	esphome#1  <signal handler called>
    	esphome#2  0x47701c18 in ?? ()
    	esphome#3  0x10016206 in std::function<void ()>::function(std::function<void ()> const&) ()
    	esphome#4  0x10016234 in esphome::sprinkler::Sprinkler::start_timer_(esphome::sprinkler::SprinklerTimerIndex) ()
    	esphome#5  0x10016292 in esphome::sprinkler::Sprinkler::fsm_transition_to_shutdown_() ()
    	esphome#6  0x100162d0 in esphome::sprinkler::Sprinkler::shutdown(bool) ()
    	esphome#7  0x100162f6 in esphome::sprinkler::ShutdownAction<>::play() ()
    	esphome#8  0x100149da in esphome::Action<>::play_complex() ()
    	esphome#9  0x10014caa in esphome::Trigger<>::trigger() [clone .isra.0] ()
    	esphome#10 0x10014cd8 in esphome::sprinkler::SprinklerControllerSwitch::write_state(bool) ()
    	esphome#11 0x100174f2 in esphome::switch_::Switch::turn_on() ()
    	esphome#12 0x1001d9c6 in std::_Function_handler<void (), setup::{lambda()esphome#48}>::_M_invoke(std::_Any_data const&) ()
    	esphome#13 0x1001d80c in esphome::LambdaAction<>::play() ()
    	esphome#14 0x100149da in esphome::Action<>::play_complex() ()
    	esphome#15 0x10017cae in esphome::Trigger<>::trigger() [clone .isra.0] ()
    	esphome#16 0x10017cdc in esphome::template_::TemplateSwitch::write_state(bool) ()
    	esphome#17 0x100174f2 in esphome::switch_::Switch::turn_on() ()
    	esphome#18 0x10017c0e in esphome::template_::TemplateSwitch::setup() ()
    	esphome#19 0x1001bdd0 in esphome::Component::call_setup() ()
    	esphome#20 0x1001beb0 in esphome::Component::call() ()
    	esphome#21 0x1001bbfe in esphome::Application::setup() ()
    	esphome#22 0x100252d4 in setup ()
    	esphome#23 0x00000000 in ?? ()
    hostcc committed Oct 8, 2023
    Configuration menu
    Copy the full SHA
    cab21e0 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    8f4d8d2 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    5b5ccd8 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    b4b2361 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    7067ab7 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    5704509 View commit details
    Browse the repository at this point in the history