mirror of
https://github.com/stakwork/sphinx-key.git
synced 2026-02-06 16:24:37 +01:00
sphinx-key: fixup btn binary, and update button states led colors
This commit is contained in:
@@ -1,18 +1,23 @@
|
||||
mod conn;
|
||||
mod core;
|
||||
mod ota;
|
||||
mod periph;
|
||||
mod status;
|
||||
|
||||
use status::Status;
|
||||
|
||||
use esp_idf_sys as _; // If using the `binstart` feature of `esp-idf-sys`, always keep this module imported
|
||||
|
||||
// use embedded_svc::storage::StorageBase;
|
||||
pub use crate::core::control::FlashPersister;
|
||||
use esp_idf_hal::peripherals::Peripherals;
|
||||
use esp_idf_svc::nvs::EspDefaultNvsPartition;
|
||||
use esp_idf_svc::nvs::EspNvs;
|
||||
use esp_idf_svc::nvs::*;
|
||||
use esp_idf_sys as _; // If using the `binstart` feature of `esp-idf-sys`, always keep this module imported
|
||||
use status::Status;
|
||||
use std::sync::mpsc;
|
||||
use std::sync::{Arc, Mutex};
|
||||
use std::thread;
|
||||
use std::time::Duration;
|
||||
|
||||
const ID_LEN: usize = 12;
|
||||
|
||||
fn main() -> anyhow::Result<()> {
|
||||
esp_idf_sys::link_patches();
|
||||
|
||||
@@ -28,7 +33,10 @@ fn main() -> anyhow::Result<()> {
|
||||
periph::led::led_control_loop(pins.gpio0, peripherals.rmt.channel0, led_rx);
|
||||
|
||||
// BUTTON thread
|
||||
periph::button::button_loop(pins.gpio9, led_tx.clone());
|
||||
let default_nvs = EspDefaultNvsPartition::take()?;
|
||||
let flash_per = FlashPersister::new(default_nvs.clone());
|
||||
let flash_arc = Arc::new(Mutex::new(flash_per));
|
||||
periph::button::button_loop(pins.gpio9, led_tx.clone(), flash_arc);
|
||||
|
||||
loop {
|
||||
thread::sleep(Duration::from_millis(1000));
|
||||
|
||||
@@ -21,7 +21,7 @@ use std::time::Duration;
|
||||
use std::time::SystemTime;
|
||||
|
||||
use esp_idf_hal::peripherals::Peripherals;
|
||||
use esp_idf_svc::nvs::*;
|
||||
use esp_idf_svc::nvs::EspDefaultNvsPartition;
|
||||
|
||||
use sphinx_signer::lightning_signer::bitcoin::Network;
|
||||
use sphinx_signer::sphinx_glyph::control::{Config, ControlPersist, Policy, Velocity};
|
||||
|
||||
@@ -17,7 +17,6 @@ pub struct Led {
|
||||
|
||||
fn states() -> BTreeMap<Status, (Color, Time)> {
|
||||
let mut s = BTreeMap::new();
|
||||
s.insert(Status::Starting, (0x000001, 100)); // Blue
|
||||
s.insert(Status::MountingSDCard, (0x000102, 100)); // Cyan
|
||||
s.insert(Status::SyncingTime, (0x000122, 100)); // Cyan
|
||||
s.insert(Status::WifiAccessPoint, (0x000100, 100)); // Green
|
||||
@@ -27,8 +26,13 @@ fn states() -> BTreeMap<Status, (Color, Time)> {
|
||||
s.insert(Status::Connected, (0x000101, 400)); // Cyan
|
||||
s.insert(Status::Signing, (0x111111, 100)); // White
|
||||
s.insert(Status::Ota, (0xffa500, 100)); // Orange
|
||||
s.insert(Status::Reset1, (0x017700, 100)); // yellow?
|
||||
s.insert(Status::Reset2, (0xffa500, 100)); // orange?
|
||||
s.insert(Status::Waiting, (0x000001, 100)); // Blue
|
||||
s.insert(Status::Starting, (0x000001, 100)); // Blue
|
||||
s.insert(Status::Reset1a, (0x017700, 100)); // yellow
|
||||
s.insert(Status::Reset1, (0x017700, 100)); // yellow
|
||||
s.insert(Status::Reset2a, (0xffa500, 100)); // orange
|
||||
s.insert(Status::Reset2, (0xffa500, 100)); // orange
|
||||
s.insert(Status::Reset3a, (0x010000, 100)); // Red
|
||||
s.insert(Status::Reset3, (0x010000, 100)); // Red
|
||||
s
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user