diff --git a/src/config.rs b/src/config.rs index 939a4ef..1a08346 100644 --- a/src/config.rs +++ b/src/config.rs @@ -1,5 +1,16 @@ +/// Firmware configuration values, hard coded. + +/// Address of SNTP server, as IPv4 address or FQDN. pub(crate) const SNTP_SERVER: &'static str = "time.nist.gov"; + +/// Start of "on" cycle for switch, in 24 hour "HH:MM" format. pub(crate) const T_ON: &'static str = "17:00"; + +/// End of "on" cycle for switch, in 24 hour "HH:MM" format. pub(crate) const T_OFF: &'static str = "09:00"; + +/// Access point SSID. pub(crate) const WIFI_SSID: &'static str = "Example"; + +/// WPA2 Personal password for access point. pub(crate) const WIFI_PASS: &'static str = "guest"; diff --git a/src/main.rs b/src/main.rs index 3b58440..34f3896 100644 --- a/src/main.rs +++ b/src/main.rs @@ -14,7 +14,8 @@ use log::info; mod config; const SNTP_STATUS_POLL_INTVL_MS: u32 = 2000; -const CONTROL_LOOP_INTVL_MS: u32 = 60000; +/// Delay between executions of the main control loop, in milliseconds. +const CONTROL_LOOP_INTVL: u32 = 60000; fn main() -> Result<()> { // It is necessary to call this function once. Otherwise some patches to @@ -57,7 +58,7 @@ fn main() -> Result<()> { FreeRtos::delay_ms(SNTP_STATUS_POLL_INTVL_MS); } - // Main control loop: + // ======== Main Control Loop ======== // loop { let now = Utc::now().with_timezone(&Pacific); info!("Current time: {}", now); @@ -84,7 +85,7 @@ fn main() -> Result<()> { // TODO: enter low power mode ("light sleep" or "deep sleep") instead // of waiting in normal mode. - FreeRtos::delay_ms(CONTROL_LOOP_INTVL_MS); + FreeRtos::delay_ms(CONTROL_LOOP_INTVL); } }