From d1495a833451323eaa33b1ac59da444c4cbfcadf Mon Sep 17 00:00:00 2001 From: Scott Bezek Date: Sun, 9 Jul 2023 17:25:18 -0700 Subject: [PATCH] Strain calibration --- firmware/src/configuration.cpp | 11 ++ firmware/src/configuration.h | 1 + firmware/src/interface_task.cpp | 110 ++++++++++++------ firmware/src/interface_task.h | 15 ++- firmware/src/main.cpp | 2 + firmware/src/proto_gen/smartknob.pb.c | 3 + firmware/src/proto_gen/smartknob.pb.h | 31 ++++- .../src/serial/serial_protocol_plaintext.cpp | 11 +- .../src/serial/serial_protocol_plaintext.h | 4 +- firmware/src/util.cpp | 6 + firmware/src/util.h | 2 + proto/smartknob.proto | 6 + software/python/proto_gen/smartknob_pb2.py | 18 ++- 13 files changed, 173 insertions(+), 47 deletions(-) create mode 100644 firmware/src/util.cpp diff --git a/firmware/src/configuration.cpp b/firmware/src/configuration.cpp index fa71397..98db03f 100644 --- a/firmware/src/configuration.cpp +++ b/firmware/src/configuration.cpp @@ -40,6 +40,7 @@ bool Configuration::loadFromDisk() { char buf[200]; snprintf(buf, sizeof(buf), "Decoding failed: %s", PB_GET_ERROR(&stream)); log(buf); + pb_buffer_ = {}; return false; } @@ -47,6 +48,7 @@ bool Configuration::loadFromDisk() { char buf[200]; snprintf(buf, sizeof(buf), "Invalid config version. Expected %u, received %u", PERSISTENT_CONFIGURATION_VERSION, pb_buffer_.version); log(buf); + pb_buffer_ = {}; return false; } loaded_ = true; @@ -118,6 +120,15 @@ bool Configuration::setMotorCalibrationAndSave(PB_MotorCalibration& motor_calibr return saveToDisk(); } +bool Configuration::setStrainCalibrationAndSave(PB_StrainCalibration& strain_calibration) { + { + SemaphoreGuard lock(mutex_); + pb_buffer_.strain = strain_calibration; + pb_buffer_.has_strain = true; + } + return saveToDisk(); +} + void Configuration::setLogger(Logger* logger) { logger_ = logger; } diff --git a/firmware/src/configuration.h b/firmware/src/configuration.h index e788db8..912ce27 100644 --- a/firmware/src/configuration.h +++ b/firmware/src/configuration.h @@ -19,6 +19,7 @@ class Configuration { bool saveToDisk(); PB_PersistentConfiguration get(); bool setMotorCalibrationAndSave(PB_MotorCalibration& motor_calibration); + bool setStrainCalibrationAndSave(PB_StrainCalibration& strain_calibration); private: SemaphoreHandle_t mutex_; diff --git a/firmware/src/interface_task.cpp b/firmware/src/interface_task.cpp index a0c7634..b51a80b 100644 --- a/firmware/src/interface_task.cpp +++ b/firmware/src/interface_task.cpp @@ -11,6 +11,7 @@ #endif #include "interface_task.h" +#include "semaphore_guard.h" #include "util.h" #if SK_LEDS @@ -208,7 +209,7 @@ static PB_SmartKnobConfig configs[] = { }; InterfaceTask::InterfaceTask(const uint8_t task_core, MotorTask& motor_task, DisplayTask* display_task) : - Task("Interface", 3000, 1, task_core), + Task("Interface", 3400, 1, task_core), stream_(), motor_task_(motor_task), display_task_(display_task), @@ -223,6 +224,13 @@ InterfaceTask::InterfaceTask(const uint8_t task_core, MotorTask& motor_task, Dis knob_state_queue_ = xQueueCreate(1, sizeof(PB_SmartKnobState)); assert(knob_state_queue_ != NULL); + + mutex_ = xSemaphoreCreateMutex(); + assert(mutex_ != NULL); +} + +InterfaceTask::~InterfaceTask() { + vSemaphoreDelete(mutex_); } void InterfaceTask::run() { @@ -252,11 +260,37 @@ void InterfaceTask::run() { motor_task_.setConfig(configs[0]); motor_task_.addListener(knob_state_queue_); - - // Start in legacy protocol mode plaintext_protocol_.init([this] () { changeConfig(true); + }, [this] () { + if (!configuration_loaded_) { + return; + } + if (strain_calibration_step_ == 0) { + log("Strain calibration step 1: Don't touch the knob, then press 'S' again"); + strain_calibration_step_ = 1; + } else if (strain_calibration_step_ == 1) { + configuration_value_.strain.idle_value = strain_reading_; + snprintf(buf_, sizeof(buf_), " idle_value=%d", configuration_value_.strain.idle_value); + log(buf_); + log("Strain calibration step 2: Push and hold down the knob with medium pressure, and press 'S' again"); + strain_calibration_step_ = 2; + } else if (strain_calibration_step_ == 2) { + configuration_value_.strain.press_delta = strain_reading_ - configuration_value_.strain.idle_value; + configuration_value_.has_strain = true; + snprintf(buf_, sizeof(buf_), " press_delta=%d", configuration_value_.strain.press_delta); + log(buf_); + log("Strain calibration complete! Saving..."); + strain_calibration_step_ = 0; + if (configuration_->setStrainCalibrationAndSave(configuration_value_.strain)) { + log(" Saved!"); + } else { + log(" FAILED to save config!!!"); + } + } }); + + // Start in legacy protocol mode SerialProtocol* current_protocol = &plaintext_protocol_; ProtocolChangeCallback protocol_change_callback = [this, ¤t_protocol] (uint8_t protocol) { @@ -293,6 +327,14 @@ void InterfaceTask::run() { updateHardware(); + if (!configuration_loaded_) { + SemaphoreGuard lock(mutex_); + if (configuration_ != nullptr) { + configuration_value_ = configuration_->get(); + configuration_loaded_ = true; + } + } + delay(1); } } @@ -316,7 +358,6 @@ void InterfaceTask::changeConfig(bool next) { } } - char buf_[256]; snprintf(buf_, sizeof(buf_), "Changing config to %d -- %s", current_config_, configs[current_config_].text); log(buf_); motor_task_.setConfig(configs[current_config_]); @@ -332,7 +373,7 @@ void InterfaceTask::updateHardware() { float lux = veml.readLux(); lux_avg = lux * LUX_ALPHA + lux_avg * (1 - LUX_ALPHA); static uint32_t last_als; - if (millis() - last_als > 1000) { + if (millis() - last_als > 1000 && strain_calibration_step_ == 0) { snprintf(buf_, sizeof(buf_), "millilux: %.2f", lux*1000); log(buf_); last_als = millis(); @@ -341,40 +382,38 @@ void InterfaceTask::updateHardware() { #if SK_STRAIN if (scale.wait_ready_timeout(100)) { - int32_t reading = scale.read(); + strain_reading_ = scale.read(); static uint32_t last_reading_display; - if (millis() - last_reading_display > 1000) { - snprintf(buf_, sizeof(buf_), "HX711 reading: %d", reading); + if (millis() - last_reading_display > 1000 && strain_calibration_step_ == 0) { + snprintf(buf_, sizeof(buf_), "HX711 reading: %d", strain_reading_); log(buf_); last_reading_display = millis(); } + if (configuration_loaded_ && configuration_value_.has_strain && strain_calibration_step_ == 0) { + // TODO: calibrate and track (long term moving average) idle point (lower) + press_value_unit = lerp(strain_reading_, configuration_value_.strain.idle_value, configuration_value_.strain.idle_value + configuration_value_.strain.press_delta, 0, 1); - // TODO: calibrate and track (long term moving average) zero point (lower); allow calibration of set point offset - const int32_t lower = 950000; - const int32_t upper = 1800000; - // Ignore readings that are way out of expected bounds - if (reading >= lower - (upper - lower) && reading < upper + (upper - lower)*2) { - long value = CLAMP(reading, lower, upper); - press_value_unit = 1. * (value - lower) / (upper - lower); - - static bool pressed; - static uint8_t press_count; - if (!pressed && press_value_unit > 0.75) { - press_count++; - if (press_count > 2) { - motor_task_.playHaptic(true); - pressed = true; - changeConfig(true); + // Ignore readings that are way out of expected bounds + if (-1 < press_value_unit && press_value_unit < 2) { + static bool pressed; + static uint8_t press_count; + if (!pressed && press_value_unit > 0.75) { + press_count++; + if (press_count > 2) { + motor_task_.playHaptic(true); + pressed = true; + changeConfig(true); + } + } else if (pressed && press_value_unit < 0.25) { + press_count++; + if (press_count > 2) { + motor_task_.playHaptic(false); + pressed = false; + } + } else { + press_count = 0; } - } else if (pressed && press_value_unit < 0.25) { - press_count++; - if (press_count > 2) { - motor_task_.playHaptic(false); - pressed = false; - } - } else { - press_count = 0; } } } else { @@ -401,7 +440,7 @@ void InterfaceTask::updateHardware() { #if SK_LEDS for (uint8_t i = 0; i < NUM_LEDS; i++) { - leds[i].setHSV(200 * press_value_unit, 255, brightness >> 8); + leds[i].setHSV(200 * CLAMP(press_value_unit, (float)0, (float)1), 255, brightness >> 8); // Gamma adjustment leds[i].r = dim8_video(leds[i].r); @@ -411,3 +450,8 @@ void InterfaceTask::updateHardware() { FastLED.show(); #endif } + +void InterfaceTask::setConfiguration(Configuration* configuration) { + SemaphoreGuard lock(mutex_); + configuration_ = configuration; +} diff --git a/firmware/src/interface_task.h b/firmware/src/interface_task.h index bc121d7..194a965 100644 --- a/firmware/src/interface_task.h +++ b/firmware/src/interface_task.h @@ -3,6 +3,7 @@ #include #include +#include "configuration.h" #include "display_task.h" #include "logger.h" #include "motor_task.h" @@ -16,9 +17,10 @@ class InterfaceTask : public Task, public Logger { public: InterfaceTask(const uint8_t task_core, MotorTask& motor_task, DisplayTask* display_task); - virtual ~InterfaceTask() {}; + virtual ~InterfaceTask(); void log(const char* msg) override; + void setConfiguration(Configuration* configuration); protected: void run(); @@ -31,7 +33,16 @@ class InterfaceTask : public Task, public Logger { #endif MotorTask& motor_task_; DisplayTask* display_task_; - char buf_[64]; + char buf_[128]; + + SemaphoreHandle_t mutex_; + Configuration* configuration_ = nullptr; // protected by mutex_ + + PB_PersistentConfiguration configuration_value_; + bool configuration_loaded_ = false; + + uint8_t strain_calibration_step_ = 0; + int32_t strain_reading_ = 0; int current_config_ = 0; diff --git a/firmware/src/main.cpp b/firmware/src/main.cpp index fc60540..e4f90b8 100644 --- a/firmware/src/main.cpp +++ b/firmware/src/main.cpp @@ -32,6 +32,8 @@ void setup() { config.setLogger(&interface_task); config.loadFromDisk(); + interface_task.setConfiguration(&config); + motor_task.setLogger(&interface_task); motor_task.begin(); diff --git a/firmware/src/proto_gen/smartknob.pb.c b/firmware/src/proto_gen/smartknob.pb.c index 9d3db19..4388625 100644 --- a/firmware/src/proto_gen/smartknob.pb.c +++ b/firmware/src/proto_gen/smartknob.pb.c @@ -33,4 +33,7 @@ PB_BIND(PB_PersistentConfiguration, PB_PersistentConfiguration, AUTO) PB_BIND(PB_MotorCalibration, PB_MotorCalibration, AUTO) +PB_BIND(PB_StrainCalibration, PB_StrainCalibration, AUTO) + + diff --git a/firmware/src/proto_gen/smartknob.pb.h b/firmware/src/proto_gen/smartknob.pb.h index 0149ff5..c40f35e 100644 --- a/firmware/src/proto_gen/smartknob.pb.h +++ b/firmware/src/proto_gen/smartknob.pb.h @@ -80,10 +80,17 @@ typedef struct _PB_MotorCalibration { uint32_t pole_pairs; } PB_MotorCalibration; +typedef struct _PB_StrainCalibration { + int32_t idle_value; + int32_t press_delta; +} PB_StrainCalibration; + typedef struct _PB_PersistentConfiguration { uint32_t version; bool has_motor; PB_MotorCalibration motor; + bool has_strain; + PB_StrainCalibration strain; } PB_PersistentConfiguration; @@ -99,8 +106,9 @@ extern "C" { #define PB_SmartKnobState_init_default {0, 0, false, PB_SmartKnobConfig_init_default} #define PB_SmartKnobConfig_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0, "", 0, {0, 0, 0, 0, 0}, 0} #define PB_RequestState_init_default {0} -#define PB_PersistentConfiguration_init_default {0, false, PB_MotorCalibration_init_default} +#define PB_PersistentConfiguration_init_default {0, false, PB_MotorCalibration_init_default, false, PB_StrainCalibration_init_default} #define PB_MotorCalibration_init_default {0, 0, 0, 0} +#define PB_StrainCalibration_init_default {0, 0} #define PB_FromSmartKnob_init_zero {0, 0, {PB_Ack_init_zero}} #define PB_ToSmartknob_init_zero {0, 0, 0, {PB_RequestState_init_zero}} #define PB_Ack_init_zero {0} @@ -108,8 +116,9 @@ extern "C" { #define PB_SmartKnobState_init_zero {0, 0, false, PB_SmartKnobConfig_init_zero} #define PB_SmartKnobConfig_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0, "", 0, {0, 0, 0, 0, 0}, 0} #define PB_RequestState_init_zero {0} -#define PB_PersistentConfiguration_init_zero {0, false, PB_MotorCalibration_init_zero} +#define PB_PersistentConfiguration_init_zero {0, false, PB_MotorCalibration_init_zero, false, PB_StrainCalibration_init_zero} #define PB_MotorCalibration_init_zero {0, 0, 0, 0} +#define PB_StrainCalibration_init_zero {0, 0} /* Field tags (for use in manual encoding/decoding) */ #define PB_Ack_nonce_tag 1 @@ -141,8 +150,11 @@ extern "C" { #define PB_MotorCalibration_zero_electrical_offset_tag 2 #define PB_MotorCalibration_direction_cw_tag 3 #define PB_MotorCalibration_pole_pairs_tag 4 +#define PB_StrainCalibration_idle_value_tag 1 +#define PB_StrainCalibration_press_delta_tag 2 #define PB_PersistentConfiguration_version_tag 1 #define PB_PersistentConfiguration_motor_tag 2 +#define PB_PersistentConfiguration_strain_tag 3 /* Struct field encoding specification for nanopb */ #define PB_FromSmartKnob_FIELDLIST(X, a) \ @@ -207,10 +219,12 @@ X(a, STATIC, SINGULAR, FLOAT, snap_point_bias, 12) #define PB_PersistentConfiguration_FIELDLIST(X, a) \ X(a, STATIC, SINGULAR, UINT32, version, 1) \ -X(a, STATIC, OPTIONAL, MESSAGE, motor, 2) +X(a, STATIC, OPTIONAL, MESSAGE, motor, 2) \ +X(a, STATIC, OPTIONAL, MESSAGE, strain, 3) #define PB_PersistentConfiguration_CALLBACK NULL #define PB_PersistentConfiguration_DEFAULT NULL #define PB_PersistentConfiguration_motor_MSGTYPE PB_MotorCalibration +#define PB_PersistentConfiguration_strain_MSGTYPE PB_StrainCalibration #define PB_MotorCalibration_FIELDLIST(X, a) \ X(a, STATIC, SINGULAR, BOOL, calibrated, 1) \ @@ -220,6 +234,12 @@ X(a, STATIC, SINGULAR, UINT32, pole_pairs, 4) #define PB_MotorCalibration_CALLBACK NULL #define PB_MotorCalibration_DEFAULT NULL +#define PB_StrainCalibration_FIELDLIST(X, a) \ +X(a, STATIC, SINGULAR, INT32, idle_value, 1) \ +X(a, STATIC, SINGULAR, INT32, press_delta, 2) +#define PB_StrainCalibration_CALLBACK NULL +#define PB_StrainCalibration_DEFAULT NULL + extern const pb_msgdesc_t PB_FromSmartKnob_msg; extern const pb_msgdesc_t PB_ToSmartknob_msg; extern const pb_msgdesc_t PB_Ack_msg; @@ -229,6 +249,7 @@ extern const pb_msgdesc_t PB_SmartKnobConfig_msg; extern const pb_msgdesc_t PB_RequestState_msg; extern const pb_msgdesc_t PB_PersistentConfiguration_msg; extern const pb_msgdesc_t PB_MotorCalibration_msg; +extern const pb_msgdesc_t PB_StrainCalibration_msg; /* Defines for backwards compatibility with code written before nanopb-0.4.0 */ #define PB_FromSmartKnob_fields &PB_FromSmartKnob_msg @@ -240,16 +261,18 @@ extern const pb_msgdesc_t PB_MotorCalibration_msg; #define PB_RequestState_fields &PB_RequestState_msg #define PB_PersistentConfiguration_fields &PB_PersistentConfiguration_msg #define PB_MotorCalibration_fields &PB_MotorCalibration_msg +#define PB_StrainCalibration_fields &PB_StrainCalibration_msg /* Maximum encoded size of messages (where known) */ #define PB_Ack_size 6 #define PB_FromSmartKnob_size 264 #define PB_Log_size 258 #define PB_MotorCalibration_size 15 -#define PB_PersistentConfiguration_size 23 +#define PB_PersistentConfiguration_size 47 #define PB_RequestState_size 0 #define PB_SmartKnobConfig_size 173 #define PB_SmartKnobState_size 192 +#define PB_StrainCalibration_size 22 #define PB_ToSmartknob_size 185 #ifdef __cplusplus diff --git a/firmware/src/serial/serial_protocol_plaintext.cpp b/firmware/src/serial/serial_protocol_plaintext.cpp index 2a1b3bb..ea44d98 100644 --- a/firmware/src/serial/serial_protocol_plaintext.cpp +++ b/firmware/src/serial/serial_protocol_plaintext.cpp @@ -41,11 +41,16 @@ void SerialProtocolPlaintext::loop() { } } else if (b == 'C') { motor_task_.runCalibration(); + } else if (b == 'S') { + if (strain_calibration_callback_) { + strain_calibration_callback_(); + } } } } -void SerialProtocolPlaintext::init(DemoConfigChangeCallback cb) { - demo_config_change_callback_ = cb; - stream_.println("SmartKnob starting!\n\nSerial mode: plaintext\nPress 'C' at any time to calibrate.\nPress to change haptic modes."); +void SerialProtocolPlaintext::init(DemoConfigChangeCallback demo_config_change_callback, StrainCalibrationCallback strain_calibration_callback) { + demo_config_change_callback_ = demo_config_change_callback; + strain_calibration_callback_ = strain_calibration_callback; + stream_.println("SmartKnob starting!\n\nSerial mode: plaintext\nPress 'C' at any time to calibrate motor/sensor.\nPress 'S' at any time to calibrate strain sensors.\nPress to change haptic modes."); } diff --git a/firmware/src/serial/serial_protocol_plaintext.h b/firmware/src/serial/serial_protocol_plaintext.h index aa691a8..2f77e53 100644 --- a/firmware/src/serial/serial_protocol_plaintext.h +++ b/firmware/src/serial/serial_protocol_plaintext.h @@ -7,6 +7,7 @@ #include "uart_stream.h" typedef std::function DemoConfigChangeCallback; +typedef std::function StrainCalibrationCallback; class SerialProtocolPlaintext : public SerialProtocol { public: @@ -16,11 +17,12 @@ class SerialProtocolPlaintext : public SerialProtocol { void loop() override; void handleState(const PB_SmartKnobState& state) override; - void init(DemoConfigChangeCallback cb); + void init(DemoConfigChangeCallback demo_config_change_callback, StrainCalibrationCallback strain_calibration_callback); private: Stream& stream_; MotorTask& motor_task_; PB_SmartKnobState latest_state_ = {}; DemoConfigChangeCallback demo_config_change_callback_; + StrainCalibrationCallback strain_calibration_callback_; }; diff --git a/firmware/src/util.cpp b/firmware/src/util.cpp new file mode 100644 index 0000000..c3d71e9 --- /dev/null +++ b/firmware/src/util.cpp @@ -0,0 +1,6 @@ +#include "util.h" + +float lerp(const float value, const float inMin, const float inMax, const float min, const float max) { + // Map the input value from the input range to the output range + return ((value - inMin) / (inMax - inMin)) * (max - min) + min; +} diff --git a/firmware/src/util.h b/firmware/src/util.h index 84c4137..3aa5916 100644 --- a/firmware/src/util.h +++ b/firmware/src/util.h @@ -7,3 +7,5 @@ template T CLAMP(const T& value, const T& low, const T& high) } #define COUNT_OF(A) (sizeof(A) / sizeof(A[0])) + +float lerp(const float value, const float inMin, const float inMax, const float min, const float max); diff --git a/proto/smartknob.proto b/proto/smartknob.proto index 543793d..5ecae8d 100644 --- a/proto/smartknob.proto +++ b/proto/smartknob.proto @@ -73,6 +73,7 @@ message RequestState {} message PersistentConfiguration { uint32 version = 1; MotorCalibration motor = 2; + StrainCalibration strain = 3; } message MotorCalibration { @@ -81,3 +82,8 @@ message MotorCalibration { bool direction_cw = 3; uint32 pole_pairs = 4; } + +message StrainCalibration { + int32 idle_value = 1; + int32 press_delta = 2; +} diff --git a/software/python/proto_gen/smartknob_pb2.py b/software/python/proto_gen/smartknob_pb2.py index f6cd0ab..c8d9944 100644 --- a/software/python/proto_gen/smartknob_pb2.py +++ b/software/python/proto_gen/smartknob_pb2.py @@ -15,7 +15,7 @@ _sym_db = _symbol_database.Default() import nanopb_pb2 as nanopb__pb2 -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0fsmartknob.proto\x12\x02PB\x1a\x0cnanopb.proto\"\x9a\x01\n\rFromSmartKnob\x12\x1f\n\x10protocol_version\x18\x01 \x01(\rB\x05\x92?\x02\x38\x08\x12\x16\n\x03\x61\x63k\x18\x02 \x01(\x0b\x32\x07.PB.AckH\x00\x12\x16\n\x03log\x18\x03 \x01(\x0b\x32\x07.PB.LogH\x00\x12-\n\x0fsmartknob_state\x18\x04 \x01(\x0b\x32\x12.PB.SmartKnobStateH\x00\x42\t\n\x07payload\"\xa4\x01\n\x0bToSmartknob\x12\x1f\n\x10protocol_version\x18\x01 \x01(\rB\x05\x92?\x02\x38\x08\x12\r\n\x05nonce\x18\x02 \x01(\r\x12)\n\rrequest_state\x18\x03 \x01(\x0b\x32\x10.PB.RequestStateH\x00\x12/\n\x10smartknob_config\x18\x04 \x01(\x0b\x32\x13.PB.SmartKnobConfigH\x00\x42\t\n\x07payload\"\x14\n\x03\x41\x63k\x12\r\n\x05nonce\x18\x01 \x01(\r\"\x1a\n\x03Log\x12\x13\n\x03msg\x18\x01 \x01(\tB\x06\x92?\x03p\xff\x01\"j\n\x0eSmartKnobState\x12\x18\n\x10\x63urrent_position\x18\x01 \x01(\x05\x12\x19\n\x11sub_position_unit\x18\x02 \x01(\x02\x12#\n\x06\x63onfig\x18\x03 \x01(\x0b\x32\x13.PB.SmartKnobConfig\"\xc9\x02\n\x0fSmartKnobConfig\x12\x10\n\x08position\x18\x01 \x01(\x05\x12\x19\n\x11sub_position_unit\x18\x02 \x01(\x02\x12\x1d\n\x0eposition_nonce\x18\x03 \x01(\rB\x05\x92?\x02\x38\x08\x12\x14\n\x0cmin_position\x18\x04 \x01(\x05\x12\x14\n\x0cmax_position\x18\x05 \x01(\x05\x12\x1e\n\x16position_width_radians\x18\x06 \x01(\x02\x12\x1c\n\x14\x64\x65tent_strength_unit\x18\x07 \x01(\x02\x12\x1d\n\x15\x65ndstop_strength_unit\x18\x08 \x01(\x02\x12\x12\n\nsnap_point\x18\t \x01(\x02\x12\x13\n\x04text\x18\n \x01(\tB\x05\x92?\x02p2\x12\x1f\n\x10\x64\x65tent_positions\x18\x0b \x03(\x05\x42\x05\x92?\x02\x10\x05\x12\x17\n\x0fsnap_point_bias\x18\x0c \x01(\x02\"\x0e\n\x0cRequestState\"O\n\x17PersistentConfiguration\x12\x0f\n\x07version\x18\x01 \x01(\r\x12#\n\x05motor\x18\x02 \x01(\x0b\x32\x14.PB.MotorCalibration\"p\n\x10MotorCalibration\x12\x12\n\ncalibrated\x18\x01 \x01(\x08\x12\x1e\n\x16zero_electrical_offset\x18\x02 \x01(\x02\x12\x14\n\x0c\x64irection_cw\x18\x03 \x01(\x08\x12\x12\n\npole_pairs\x18\x04 \x01(\rb\x06proto3') +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0fsmartknob.proto\x12\x02PB\x1a\x0cnanopb.proto\"\x9a\x01\n\rFromSmartKnob\x12\x1f\n\x10protocol_version\x18\x01 \x01(\rB\x05\x92?\x02\x38\x08\x12\x16\n\x03\x61\x63k\x18\x02 \x01(\x0b\x32\x07.PB.AckH\x00\x12\x16\n\x03log\x18\x03 \x01(\x0b\x32\x07.PB.LogH\x00\x12-\n\x0fsmartknob_state\x18\x04 \x01(\x0b\x32\x12.PB.SmartKnobStateH\x00\x42\t\n\x07payload\"\xa4\x01\n\x0bToSmartknob\x12\x1f\n\x10protocol_version\x18\x01 \x01(\rB\x05\x92?\x02\x38\x08\x12\r\n\x05nonce\x18\x02 \x01(\r\x12)\n\rrequest_state\x18\x03 \x01(\x0b\x32\x10.PB.RequestStateH\x00\x12/\n\x10smartknob_config\x18\x04 \x01(\x0b\x32\x13.PB.SmartKnobConfigH\x00\x42\t\n\x07payload\"\x14\n\x03\x41\x63k\x12\r\n\x05nonce\x18\x01 \x01(\r\"\x1a\n\x03Log\x12\x13\n\x03msg\x18\x01 \x01(\tB\x06\x92?\x03p\xff\x01\"j\n\x0eSmartKnobState\x12\x18\n\x10\x63urrent_position\x18\x01 \x01(\x05\x12\x19\n\x11sub_position_unit\x18\x02 \x01(\x02\x12#\n\x06\x63onfig\x18\x03 \x01(\x0b\x32\x13.PB.SmartKnobConfig\"\xc9\x02\n\x0fSmartKnobConfig\x12\x10\n\x08position\x18\x01 \x01(\x05\x12\x19\n\x11sub_position_unit\x18\x02 \x01(\x02\x12\x1d\n\x0eposition_nonce\x18\x03 \x01(\rB\x05\x92?\x02\x38\x08\x12\x14\n\x0cmin_position\x18\x04 \x01(\x05\x12\x14\n\x0cmax_position\x18\x05 \x01(\x05\x12\x1e\n\x16position_width_radians\x18\x06 \x01(\x02\x12\x1c\n\x14\x64\x65tent_strength_unit\x18\x07 \x01(\x02\x12\x1d\n\x15\x65ndstop_strength_unit\x18\x08 \x01(\x02\x12\x12\n\nsnap_point\x18\t \x01(\x02\x12\x13\n\x04text\x18\n \x01(\tB\x05\x92?\x02p2\x12\x1f\n\x10\x64\x65tent_positions\x18\x0b \x03(\x05\x42\x05\x92?\x02\x10\x05\x12\x17\n\x0fsnap_point_bias\x18\x0c \x01(\x02\"\x0e\n\x0cRequestState\"v\n\x17PersistentConfiguration\x12\x0f\n\x07version\x18\x01 \x01(\r\x12#\n\x05motor\x18\x02 \x01(\x0b\x32\x14.PB.MotorCalibration\x12%\n\x06strain\x18\x03 \x01(\x0b\x32\x15.PB.StrainCalibration\"p\n\x10MotorCalibration\x12\x12\n\ncalibrated\x18\x01 \x01(\x08\x12\x1e\n\x16zero_electrical_offset\x18\x02 \x01(\x02\x12\x14\n\x0c\x64irection_cw\x18\x03 \x01(\x08\x12\x12\n\npole_pairs\x18\x04 \x01(\r\"<\n\x11StrainCalibration\x12\x12\n\nidle_value\x18\x01 \x01(\x05\x12\x13\n\x0bpress_delta\x18\x02 \x01(\x05\x62\x06proto3') @@ -28,6 +28,7 @@ _SMARTKNOBCONFIG = DESCRIPTOR.message_types_by_name['SmartKnobConfig'] _REQUESTSTATE = DESCRIPTOR.message_types_by_name['RequestState'] _PERSISTENTCONFIGURATION = DESCRIPTOR.message_types_by_name['PersistentConfiguration'] _MOTORCALIBRATION = DESCRIPTOR.message_types_by_name['MotorCalibration'] +_STRAINCALIBRATION = DESCRIPTOR.message_types_by_name['StrainCalibration'] FromSmartKnob = _reflection.GeneratedProtocolMessageType('FromSmartKnob', (_message.Message,), { 'DESCRIPTOR' : _FROMSMARTKNOB, '__module__' : 'smartknob_pb2' @@ -91,6 +92,13 @@ MotorCalibration = _reflection.GeneratedProtocolMessageType('MotorCalibration', }) _sym_db.RegisterMessage(MotorCalibration) +StrainCalibration = _reflection.GeneratedProtocolMessageType('StrainCalibration', (_message.Message,), { + 'DESCRIPTOR' : _STRAINCALIBRATION, + '__module__' : 'smartknob_pb2' + # @@protoc_insertion_point(class_scope:PB.StrainCalibration) + }) +_sym_db.RegisterMessage(StrainCalibration) + if _descriptor._USE_C_DESCRIPTORS == False: DESCRIPTOR._options = None @@ -121,7 +129,9 @@ if _descriptor._USE_C_DESCRIPTORS == False: _REQUESTSTATE._serialized_start=851 _REQUESTSTATE._serialized_end=865 _PERSISTENTCONFIGURATION._serialized_start=867 - _PERSISTENTCONFIGURATION._serialized_end=946 - _MOTORCALIBRATION._serialized_start=948 - _MOTORCALIBRATION._serialized_end=1060 + _PERSISTENTCONFIGURATION._serialized_end=985 + _MOTORCALIBRATION._serialized_start=987 + _MOTORCALIBRATION._serialized_end=1099 + _STRAINCALIBRATION._serialized_start=1101 + _STRAINCALIBRATION._serialized_end=1161 # @@protoc_insertion_point(module_scope)