Compare commits
2 commits
33754f5258
...
016c57bb14
Author | SHA1 | Date | |
---|---|---|---|
![]() |
016c57bb14 | ||
![]() |
7fd1d7c71e |
3 changed files with 16 additions and 4 deletions
|
@ -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):
|
||||
|
||||
```sh
|
||||
chmod a+rw /dev/<DEVICE NAME>
|
||||
sudo 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).
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue