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]
|
[dependencies]
|
||||||
gem-remotes-lib = { path = "../gem-remotes-lib" }
|
gem-remotes-lib = { path = "../gem-remotes-lib" }
|
||||||
log = { version = "0.4", default-features = false, features = ["max_level_trace"] }
|
log = { version = "0.4", default-features = false, features = ["max_level_trace"] }
|
||||||
esp-idf-svc = { version = "0.49", default-features = false }
|
esp-idf-svc = { version = "0.51.0", default-features = false }
|
||||||
esp32-nimble = "0.7.0"
|
esp32-nimble = "0.11.1"
|
||||||
esp-idf-hal = "0.44.1"
|
esp-idf-hal = "0.45.2"
|
||||||
esp-idf-sys = "0.35.0"
|
esp-idf-sys = "0.36.1"
|
||||||
embedded-cli = "0.2.1"
|
embedded-cli = "0.2.1"
|
||||||
embedded-io = "0.6.1"
|
embedded-io = "0.6.1"
|
||||||
anyhow = "1.0.86"
|
anyhow = "1.0.86"
|
||||||
futures-lite = "2.3.0"
|
futures-lite = "2.3.0"
|
||||||
async-executor = "1.13.0"
|
async-executor = "1.13.0"
|
||||||
async-channel = "2.3.1"
|
async-channel = "2.3.1"
|
||||||
strum = "0.26.3"
|
strum = "0.27.2"
|
||||||
strum_macros = "0.26.4"
|
strum_macros = "0.27.2"
|
||||||
closure = "0.3.0"
|
closure = "0.3.0"
|
||||||
bitflags = "2.6.0"
|
bitflags = "2.9.4"
|
||||||
|
|
||||||
[build-dependencies]
|
[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.
|
# 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]
|
[package.metadata.cargo-udeps.ignore]
|
||||||
|
|||||||
@ -192,7 +192,7 @@ impl BleServer {
|
|||||||
on_bluetooth_cmd(&sender, args, Commands::BluetoothAuto {data: Button::Released})
|
on_bluetooth_cmd(&sender, args, Commands::BluetoothAuto {data: Button::Released})
|
||||||
}));
|
}));
|
||||||
let button_auto_name = button_auto.lock().create_descriptor(BleUuid::Uuid16(0x2901), DescriptorProperties::READ);
|
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 --------------------------------------------------------
|
// --- Device Name Bluetooth GATT --------------------------------------------------------
|
||||||
let device_name = lift_service.lock().create_characteristic(
|
let device_name = lift_service.lock().create_characteristic(
|
||||||
UUID_BLUETOOTH_NAME,
|
UUID_BLUETOOTH_NAME,
|
||||||
@ -214,21 +214,21 @@ impl BleServer {
|
|||||||
UUID_STATUS_MOTOR,
|
UUID_STATUS_MOTOR,
|
||||||
NimbleProperties::READ | NimbleProperties::INDICATE,
|
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_motor_name.lock().set_value(b"Status of motors");
|
||||||
// --- Status Status Bluetooth GATT --------------------------------------------------------
|
// --- Status Status Bluetooth GATT --------------------------------------------------------
|
||||||
let status_status = lift_service.lock().create_characteristic(
|
let status_status = lift_service.lock().create_characteristic(
|
||||||
UUID_STATUS_STATUS,
|
UUID_STATUS_STATUS,
|
||||||
NimbleProperties::READ | NimbleProperties::INDICATE,
|
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_status_name.lock().set_value(b"Status flags");
|
||||||
// --- Status Reason Bluetooth GATT --------------------------------------------------------
|
// --- Status Reason Bluetooth GATT --------------------------------------------------------
|
||||||
let status_reason = lift_service.lock().create_characteristic(
|
let status_reason = lift_service.lock().create_characteristic(
|
||||||
UUID_STATUS_REASON,
|
UUID_STATUS_REASON,
|
||||||
NimbleProperties::READ | NimbleProperties::INDICATE,
|
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");
|
status_reason_name.lock().set_value(b"Status reason");
|
||||||
|
|
||||||
// Default to not pairable
|
// Default to not pairable
|
||||||
|
|||||||
@ -72,6 +72,7 @@ async fn main_loop() -> Result<()> {
|
|||||||
|
|
||||||
// Setup of various drivers that need to out-live the executor
|
// Setup of various drivers that need to out-live the executor
|
||||||
let mut f_pic = FakePic::with_defaults(&mut dp);
|
let mut f_pic = FakePic::with_defaults(&mut dp);
|
||||||
|
f_pic.sync_pic().await?;
|
||||||
// Setup callback timers
|
// Setup callback timers
|
||||||
let mut button_timer = MessageTimer::<Commands, Commands>::new_on_dispatch(
|
let mut button_timer = MessageTimer::<Commands, Commands>::new_on_dispatch(
|
||||||
Commands::ButtonTimerRestart,
|
Commands::ButtonTimerRestart,
|
||||||
|
|||||||
@ -17,5 +17,5 @@ async-channel = "2.3.1"
|
|||||||
async-io = "2.3.4"
|
async-io = "2.3.4"
|
||||||
bitflags = "2.6.0"
|
bitflags = "2.6.0"
|
||||||
log = "0.4.22"
|
log = "0.4.22"
|
||||||
strum = "0.26.3"
|
strum = "0.27.2"
|
||||||
strum_macros = "0.26.4"
|
strum_macros = "0.27.2"
|
||||||
|
|||||||
@ -71,6 +71,15 @@ impl FakePic {
|
|||||||
recv_q: dp.get_callback_channel(&cmd_filter),
|
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 ======================================================
|
// === Change Fake Hardware Parameters ======================================================
|
||||||
pub fn change_limits(&mut self, l: Limits) -> () {
|
pub fn change_limits(&mut self, l: Limits) -> () {
|
||||||
self.limit_state = l;
|
self.limit_state = l;
|
||||||
|
|||||||
Reference in New Issue
Block a user