Compare commits

..

No commits in common. "016c57bb149573a4b51e28909be6e6c520a1a4c4" and "33754f52583719c66f9fab2f2e3ddee4e5c3cafd" have entirely different histories.

3 changed files with 4 additions and 16 deletions

View file

@ -77,7 +77,7 @@ Error: × Failed to open serial port /dev/<DEVICE NAME>
Granting read/write permissions to all users, should be sufficient to resolve the above issue (note that this is required each time the device is physically reconnected): Granting read/write permissions to all users, should be sufficient to resolve the above issue (note that this is required each time the device is physically reconnected):
```sh ```sh
sudo chmod a+rw /dev/<DEVICE NAME> chmod a+rw /dev/<DEVICE NAME>
``` ```
The port will be saved to `espflash_ports.toml`. For further information, refer to the [`espflash` documentation](https://github.com/esp-rs/espflash/blob/1daf446a0a553d23309e77c8781679ca25fc007a/espflash/README.md). The port will be saved to `espflash_ports.toml`. For further information, refer to the [`espflash` documentation](https://github.com/esp-rs/espflash/blob/1daf446a0a553d23309e77c8781679ca25fc007a/espflash/README.md).

View file

@ -1,16 +1,5 @@
/// 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";

View file

@ -14,8 +14,7 @@ use log::info;
mod config; mod config;
const SNTP_STATUS_POLL_INTVL_MS: u32 = 2000; const SNTP_STATUS_POLL_INTVL_MS: u32 = 2000;
/// Delay between executions of the main control loop, in milliseconds. const CONTROL_LOOP_INTVL_MS: u32 = 60000;
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
@ -58,7 +57,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);
@ -85,7 +84,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); FreeRtos::delay_ms(CONTROL_LOOP_INTVL_MS);
} }
} }