improve docs
This commit is contained in:
parent
7fd1d7c71e
commit
016c57bb14
2 changed files with 15 additions and 3 deletions
|
@ -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";
|
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";
|
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";
|
pub(crate) const T_OFF: &'static str = "09:00";
|
||||||
|
|
||||||
|
/// Access point SSID.
|
||||||
pub(crate) const WIFI_SSID: &'static str = "Example";
|
pub(crate) const WIFI_SSID: &'static str = "Example";
|
||||||
|
|
||||||
|
/// WPA2 Personal password for access point.
|
||||||
pub(crate) const WIFI_PASS: &'static str = "guest";
|
pub(crate) const WIFI_PASS: &'static str = "guest";
|
||||||
|
|
|
@ -14,7 +14,8 @@ use log::info;
|
||||||
mod config;
|
mod config;
|
||||||
|
|
||||||
const SNTP_STATUS_POLL_INTVL_MS: u32 = 2000;
|
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<()> {
|
fn main() -> Result<()> {
|
||||||
// It is necessary to call this function once. Otherwise some patches to
|
// 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);
|
FreeRtos::delay_ms(SNTP_STATUS_POLL_INTVL_MS);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Main control loop:
|
// ======== Main Control Loop ======== //
|
||||||
loop {
|
loop {
|
||||||
let now = Utc::now().with_timezone(&Pacific);
|
let now = Utc::now().with_timezone(&Pacific);
|
||||||
info!("Current time: {}", now);
|
info!("Current time: {}", now);
|
||||||
|
@ -84,7 +85,7 @@ fn main() -> Result<()> {
|
||||||
|
|
||||||
// TODO: enter low power mode ("light sleep" or "deep sleep") instead
|
// TODO: enter low power mode ("light sleep" or "deep sleep") instead
|
||||||
// of waiting in normal mode.
|
// of waiting in normal mode.
|
||||||
FreeRtos::delay_ms(CONTROL_LOOP_INTVL_MS);
|
FreeRtos::delay_ms(CONTROL_LOOP_INTVL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue