Compare commits
3 Commits
efd3277966
...
c271df4bce
| Author | SHA1 | Date | |
|---|---|---|---|
| c271df4bce | |||
| 28e8fdaa4a | |||
| 22859bbe8f |
@ -30,23 +30,23 @@ embassy = ["esp-idf-svc/embassy-sync", "esp-idf-svc/critical-section", "esp-idf-
|
||||
[dependencies]
|
||||
gem-remotes-lib = { path = "../gem-remotes-lib" }
|
||||
log = { version = "0.4", default-features = false, features = ["max_level_trace"] }
|
||||
esp-idf-svc = { version = "0.49", default-features = false }
|
||||
esp32-nimble = "0.7.0"
|
||||
esp-idf-hal = "0.44.1"
|
||||
esp-idf-sys = "0.35.0"
|
||||
esp-idf-svc = { version = "0.51.0", default-features = false }
|
||||
esp32-nimble = "0.11.1"
|
||||
esp-idf-hal = "0.45.2"
|
||||
esp-idf-sys = "0.36.1"
|
||||
embedded-cli = "0.2.1"
|
||||
embedded-io = "0.6.1"
|
||||
anyhow = "1.0.86"
|
||||
futures-lite = "2.3.0"
|
||||
async-executor = "1.13.0"
|
||||
async-channel = "2.3.1"
|
||||
strum = "0.26.3"
|
||||
strum_macros = "0.26.4"
|
||||
strum = "0.27.2"
|
||||
strum_macros = "0.27.2"
|
||||
closure = "0.3.0"
|
||||
bitflags = "2.6.0"
|
||||
bitflags = "2.9.4"
|
||||
|
||||
[build-dependencies]
|
||||
embuild = "0.32.0"
|
||||
embuild = "0.33.1"
|
||||
|
||||
# Cargo udeps can check for unused dependencies; but if there is a dependency we want it to ignore put it here.
|
||||
[package.metadata.cargo-udeps.ignore]
|
||||
|
||||
@ -192,7 +192,7 @@ impl BleServer {
|
||||
on_bluetooth_cmd(&sender, args, Commands::BluetoothAuto {data: Button::Released})
|
||||
}));
|
||||
let button_auto_name = button_auto.lock().create_descriptor(BleUuid::Uuid16(0x2901), DescriptorProperties::READ);
|
||||
button_auto_name.lock().set_value(b"Command Learn");
|
||||
button_auto_name.lock().set_value(b"Command Auto");
|
||||
// --- Device Name Bluetooth GATT --------------------------------------------------------
|
||||
let device_name = lift_service.lock().create_characteristic(
|
||||
UUID_BLUETOOTH_NAME,
|
||||
@ -214,21 +214,21 @@ impl BleServer {
|
||||
UUID_STATUS_MOTOR,
|
||||
NimbleProperties::READ | NimbleProperties::INDICATE,
|
||||
);
|
||||
let status_motor_name = status_limits.lock().create_descriptor(BleUuid::Uuid16(0x2901), DescriptorProperties::READ);
|
||||
let status_motor_name = status_motor.lock().create_descriptor(BleUuid::Uuid16(0x2901), DescriptorProperties::READ);
|
||||
status_motor_name.lock().set_value(b"Status of motors");
|
||||
// --- Status Status Bluetooth GATT --------------------------------------------------------
|
||||
let status_status = lift_service.lock().create_characteristic(
|
||||
UUID_STATUS_STATUS,
|
||||
NimbleProperties::READ | NimbleProperties::INDICATE,
|
||||
);
|
||||
let status_status_name = status_limits.lock().create_descriptor(BleUuid::Uuid16(0x2901), DescriptorProperties::READ);
|
||||
let status_status_name = status_status.lock().create_descriptor(BleUuid::Uuid16(0x2901), DescriptorProperties::READ);
|
||||
status_status_name.lock().set_value(b"Status flags");
|
||||
// --- Status Reason Bluetooth GATT --------------------------------------------------------
|
||||
let status_reason = lift_service.lock().create_characteristic(
|
||||
UUID_STATUS_REASON,
|
||||
NimbleProperties::READ | NimbleProperties::INDICATE,
|
||||
);
|
||||
let status_reason_name = status_limits.lock().create_descriptor(BleUuid::Uuid16(0x2901), DescriptorProperties::READ);
|
||||
let status_reason_name = status_reason.lock().create_descriptor(BleUuid::Uuid16(0x2901), DescriptorProperties::READ);
|
||||
status_reason_name.lock().set_value(b"Status reason");
|
||||
|
||||
// Default to not pairable
|
||||
|
||||
@ -72,6 +72,7 @@ async fn main_loop() -> Result<()> {
|
||||
|
||||
// Setup of various drivers that need to out-live the executor
|
||||
let mut f_pic = FakePic::with_defaults(&mut dp);
|
||||
f_pic.sync_pic().await?;
|
||||
// Setup callback timers
|
||||
let mut button_timer = MessageTimer::<Commands, Commands>::new_on_dispatch(
|
||||
Commands::ButtonTimerRestart,
|
||||
|
||||
@ -17,5 +17,5 @@ async-channel = "2.3.1"
|
||||
async-io = "2.3.4"
|
||||
bitflags = "2.6.0"
|
||||
log = "0.4.22"
|
||||
strum = "0.26.3"
|
||||
strum_macros = "0.26.4"
|
||||
strum = "0.27.2"
|
||||
strum_macros = "0.27.2"
|
||||
|
||||
@ -71,6 +71,15 @@ impl FakePic {
|
||||
recv_q: dp.get_callback_channel(&cmd_filter),
|
||||
}
|
||||
}
|
||||
// === Sync with the pic controller =========================================================
|
||||
// Since we don't have a pic controller, just update the bluetooth with the internal state
|
||||
// of the fake controller.
|
||||
pub async fn sync_pic(&mut self) -> Result<()> {
|
||||
self.send_q.send(Commands::BluetoothStatusMotor { data: self.motor_state }).await?;
|
||||
self.send_q.send(Commands::BluetoothStatusLimits { data: self.limit_state }).await?;
|
||||
self.send_q.send(Commands::BluetoothStatusStatus { data: self.status_state }).await?;
|
||||
Ok(())
|
||||
}
|
||||
// === Change Fake Hardware Parameters ======================================================
|
||||
pub fn change_limits(&mut self, l: Limits) -> () {
|
||||
self.limit_state = l;
|
||||
|
||||
Reference in New Issue
Block a user