smartknob.proto 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. syntax = "proto3";
  2. import "nanopb.proto";
  3. package PB;
  4. /*
  5. * Message FROM the SmartKnob to the host
  6. */
  7. message FromSmartKnob {
  8. uint32 protocol_version = 1 [(nanopb).int_size = IS_8];
  9. oneof payload {
  10. Ack ack = 2;
  11. Log log = 3;
  12. SmartKnobState smartknob_state = 4;
  13. }
  14. }
  15. /*
  16. * Message TO the Smartknob from the host
  17. */
  18. message ToSmartknob {
  19. uint32 protocol_version = 1 [(nanopb).int_size = IS_8];
  20. uint32 nonce = 2;
  21. oneof payload {
  22. RequestState request_state = 3;
  23. SmartKnobConfig smartknob_config = 4;
  24. }
  25. }
  26. message Ack {
  27. uint32 nonce = 1;
  28. }
  29. message Log {
  30. string msg = 1 [(nanopb).max_length = 255];
  31. }
  32. message SmartKnobState {
  33. int32 current_position = 1;
  34. float sub_position_unit = 2;
  35. SmartKnobConfig config = 3;
  36. }
  37. message SmartKnobConfig {
  38. int32 position = 1;
  39. float sub_position_unit = 2;
  40. /**
  41. * Position is normally only applied when it changes, but sometimes it's desirable
  42. * to reset the position to the same value, so a nonce change can be used to force
  43. * the position values to be applied as well.
  44. *
  45. * NOTE: Must be < 256
  46. */
  47. uint32 position_nonce = 3 [(nanopb).int_size = IS_8];
  48. int32 min_position = 4;
  49. int32 max_position = 5;
  50. float position_width_radians = 6;
  51. float detent_strength_unit = 7;
  52. float endstop_strength_unit = 8;
  53. float snap_point = 9;
  54. string text = 10 [(nanopb).max_length = 50];
  55. repeated int32 detent_positions = 11 [(nanopb).max_count = 5];
  56. float snap_point_bias = 12;
  57. }
  58. message RequestState {}
  59. message PersistentConfiguration {
  60. uint32 version = 1;
  61. MotorCalibration motor = 2;
  62. }
  63. message MotorCalibration {
  64. bool calibrated = 1;
  65. float zero_electrical_offset = 2;
  66. bool direction_cw = 3;
  67. uint32 pole_pairs = 4;
  68. }