Add shortcuts to switch the camera torch

MOD+l turns on the camera torch, MOD+Shift+l turns it off.

TODO ref 6243

Co-authored-by: Tommie <teh420@gmail.com>
This commit is contained in:
Romain Vimont
2025-11-28 22:32:05 +01:00
parent ce5a2aa224
commit 31fbd9bfb1
11 changed files with 137 additions and 3 deletions

View File

@@ -446,6 +446,25 @@ static void test_serialize_reset_video(void) {
assert(!memcmp(buf, expected, sizeof(expected)));
}
static void test_serialize_camera_set_torch(void) {
struct sc_control_msg msg = {
.type = SC_CONTROL_MSG_TYPE_CAMERA_SET_TORCH,
.camera_set_torch = {
.on = true,
},
};
uint8_t buf[SC_CONTROL_MSG_MAX_SIZE];
size_t size = sc_control_msg_serialize(&msg, buf);
assert(size == 2);
const uint8_t expected[] = {
SC_CONTROL_MSG_TYPE_CAMERA_SET_TORCH,
0x01, // true
};
assert(!memcmp(buf, expected, sizeof(expected)));
}
int main(int argc, char *argv[]) {
(void) argc;
(void) argv;
@@ -470,5 +489,6 @@ int main(int argc, char *argv[]) {
test_serialize_open_hard_keyboard();
test_serialize_start_app();
test_serialize_reset_video();
test_serialize_camera_set_torch();
return 0;
}