mirror of
https://github.com/scottbez1/smartknob.git
synced 2025-11-04 17:19:40 +08:00
Breaking change to protobuf messages to support new detent configurations - adds more flexibility compared to existing config parameters (e.g. min/max position rather than just number of positions). New magnetic detent mode allows for config to specify up to 5 nearest detent positions (with smooth scrolling in between them); the intent is a higher-level controller (e.g. connected demo app, see below) to dynamically update that list as the position changes, in order to support an unlimited number of magnetic detents. --- React demo app implements a mock video editor timeline, with the ability to interact with it via the SmartKnob connected over USB serial. (Currently uses a node backend to stream config/state to the frontend via websockets, but it would probably be possible to do everything on the frontend with webserial in the future?). The 3 demo input modes are: - Scroll: quickly smooth-scroll through the timeline, with magnetic detents at clip boundaries. Scroll speed is determined by zoom level (currently only controllable by mouse scroll wheel) - Frames: small detents (1.5 degrees) to move frame-by-frame through video - Speed/playback: "spring-loaded" speed control, biased to return to center (paused), with detents at powers of 2: 1x, 2x, 4x playback Currently the frontend app has some bugs, particularly with the current playback position when switching modes and zooming, but planning to merge anyway to get the other breaking changes into master along with the initial demo framework.
59 lines
1.1 KiB
Protocol Buffer
59 lines
1.1 KiB
Protocol Buffer
syntax = "proto3";
|
|
|
|
import "nanopb.proto";
|
|
|
|
package PB;
|
|
|
|
/*
|
|
* Message FROM the SmartKnob to USB host
|
|
*/
|
|
message FromSmartKnob {
|
|
oneof payload {
|
|
Ack ack = 1;
|
|
Log log = 2;
|
|
SmartKnobState smartknob_state = 3;
|
|
}
|
|
}
|
|
|
|
message Ack {
|
|
uint32 nonce = 1;
|
|
}
|
|
|
|
message Log {
|
|
string msg = 1 [(nanopb).max_length = 255];
|
|
}
|
|
|
|
message SmartKnobState {
|
|
int32 current_position = 1;
|
|
float sub_position_unit = 2;
|
|
SmartKnobConfig config = 3;
|
|
}
|
|
|
|
/*
|
|
* Message TO the Smartknob from the USB host
|
|
*/
|
|
message ToSmartknob {
|
|
uint32 nonce = 1;
|
|
|
|
oneof payload {
|
|
RequestState request_state = 2;
|
|
SmartKnobConfig smartknob_config = 3;
|
|
}
|
|
}
|
|
|
|
message SmartKnobConfig {
|
|
int32 position = 1;
|
|
int32 min_position = 2;
|
|
int32 max_position = 3;
|
|
float position_width_radians = 4;
|
|
float detent_strength_unit = 5;
|
|
float endstop_strength_unit = 6;
|
|
float snap_point = 7;
|
|
string text = 8 [(nanopb).max_length = 50];
|
|
repeated int32 detent_positions = 9 [(nanopb).max_count = 5];
|
|
float snap_point_bias = 10;
|
|
}
|
|
|
|
message RequestState {}
|
|
|