From 0f315fe0e304ee3f959ed17fcd93dd5da05fd91c Mon Sep 17 00:00:00 2001 From: brentru Date: Thu, 2 Nov 2023 13:14:35 -0400 Subject: [PATCH 001/188] brokertodevice --- .../description/v1/description.proto | 27 +-- proto/wippersnapper/ds18x20/v1/ds18x20.proto | 10 +- proto/wippersnapper/i2c/v1/i2c.proto | 92 +++++------ proto/wippersnapper/pixels/v1/pixels.proto | 14 +- proto/wippersnapper/pwm/v1/pwm.proto | 28 ++-- proto/wippersnapper/servo/v1/servo.proto | 12 +- proto/wippersnapper/signal/v1/signal.proto | 154 +++++++----------- proto/wippersnapper/uart/v1/uart.proto | 8 +- 8 files changed, 139 insertions(+), 206 deletions(-) diff --git a/proto/wippersnapper/description/v1/description.proto b/proto/wippersnapper/description/v1/description.proto index 0bbd9751..68a656e6 100644 --- a/proto/wippersnapper/description/v1/description.proto +++ b/proto/wippersnapper/description/v1/description.proto @@ -12,34 +12,15 @@ import "nanopb/nanopb.proto"; message CreateDescriptionRequest { string machine_name = 1 [(nanopb).max_size = 64]; /** Identifies client's physical hardware */ int32 mac_addr = 2; /** Client's UID, last 3 bytes of MAC address */ - int32 usb_vid = 3; /** Optional, USB Vendor ID */ - int32 usb_pid = 4; /** Optional, USB Product ID */ - Version version = 5 [deprecated = true, (nanopb).type = FT_IGNORE]; /** Client's library version. */ - int32 ver_major = 10 [deprecated = true, (nanopb).type = FT_IGNORE]; - int32 ver_minor = 11 [deprecated = true, (nanopb).type = FT_IGNORE]; - int32 ver_patch = 12 [deprecated = true, (nanopb).type = FT_IGNORE]; - string ver_pre_release = 13 [deprecated = true, (nanopb).type = FT_IGNORE, (nanopb).max_size = 6]; - int32 ver_build = 14 [deprecated = true, (nanopb).type = FT_IGNORE]; string str_version = 15 [(nanopb).max_size = 20]; /** Library version, as a string */ - - - message Version { - uint64 major = 1 [deprecated = true, (nanopb).type = FT_IGNORE]; - uint64 minor = 2 [deprecated = true, (nanopb).type = FT_IGNORE]; - uint64 micro = 3 [deprecated = true, (nanopb).type = FT_IGNORE]; - string label = 4 [deprecated = true, (nanopb).type = FT_IGNORE]; - int32 ver_major = 5 [deprecated = true, (nanopb).type = FT_IGNORE]; - int32 ver_minor = 6 [deprecated = true, (nanopb).type = FT_IGNORE]; - int32 ver_patch = 7 [deprecated = true, (nanopb).type = FT_IGNORE]; - string ver_pre_release = 8 [deprecated = true, (nanopb).type = FT_IGNORE]; - int32 ver_build = 9 [deprecated = true, (nanopb).type = FT_IGNORE]; - } } +// TODO: Consider dropping this, and compiling these as a header file (per-board) from the +// JSON if it is possible to do so. /** -* CreateDescriptionResponse represents a device's specifications. +* CreateDescription represents a device's specifications. */ -message CreateDescriptionResponse { +message CreateDescription { Response response = 1; /** Specifies if the hardware definition exists on the server. */ int32 total_gpio_pins = 2; /** Specifies the number of GPIO pins on the client's physical hardware. */ int32 total_analog_pins = 3; /** Specifies the number of analog pins on the client's physical hardware. */ diff --git a/proto/wippersnapper/ds18x20/v1/ds18x20.proto b/proto/wippersnapper/ds18x20/v1/ds18x20.proto index 76e65a59..84d1b153 100644 --- a/proto/wippersnapper/ds18x20/v1/ds18x20.proto +++ b/proto/wippersnapper/ds18x20/v1/ds18x20.proto @@ -9,11 +9,11 @@ import "nanopb/nanopb.proto"; import "wippersnapper/i2c/v1/i2c.proto"; /** -* Ds18x20InitRequest represents a request to initialize +* Ds18x20Init represents a to initialize * a DS18X20 Maxim temperature sensor, from the broker. * NOTE: This API only supports ONE DS18X20 device PER OneWire bus. */ -message Ds18x20InitRequest { +message Ds18x20Init { string onewire_pin = 1 [(nanopb).max_size = 5]; /** The desired pin to use as a OneWire bus. */ int32 sensor_resolution = 2; /** The desired sensor resolution (9, 10, 11, or 12 bits). */ repeated wippersnapper.i2c.v1.I2CDeviceSensorProperties i2c_device_properties = 3[(nanopb).max_count = 2]; /** Properties for the DS18x20 sensor. */ @@ -21,7 +21,7 @@ message Ds18x20InitRequest { /** * ds18x20InitDs18x20InitResponseResponse represents a device's response -* to a ds18x20InitRequest message. +* to a ds18x20Init message. */ message Ds18x20InitResponse { bool is_initialized = 1; /** True if the 1-wire bus has been initialized successfully, False otherwise. */ @@ -29,10 +29,10 @@ message Ds18x20InitResponse { } /** -* Ds18x20DeInitRequest represents a request to de-initialize a DS18X20 +* Ds18x20DeInit represents a to de-initialize a DS18X20 * Maxim temperature sensor, from the broker. */ -message Ds18x20DeInitRequest { +message Ds18x20DeInit { string onewire_pin = 1 [(nanopb).max_size = 5]; /** The desired onewire bus to de-initialize a DS18x sensor on and release. */ } diff --git a/proto/wippersnapper/i2c/v1/i2c.proto b/proto/wippersnapper/i2c/v1/i2c.proto index c89b8414..56fc18c2 100644 --- a/proto/wippersnapper/i2c/v1/i2c.proto +++ b/proto/wippersnapper/i2c/v1/i2c.proto @@ -20,10 +20,10 @@ enum BusResponse { } /** -* I2CBusInitRequest represents a request to +* I2CBusInit represents a to * initialize the I2C bus from the broker. */ -message I2CBusInitRequest { +message I2CBusInit { int32 i2c_pin_scl = 1; /** The desired I2C SCL pin. */ int32 i2c_pin_sda = 2; /** The desired I2C SDA pin. */ uint32 i2c_frequency = 3; /** The desired I2C SCL frequency, in Hz. Default is 100000Hz. */ @@ -31,116 +31,98 @@ message I2CBusInitRequest { } /** -* I2CBusInitResponse represents a response to I2CBusInitRequest +* I2CBusInitResponse represents a response to I2CBusInit */ message I2CBusInitResponse { bool is_initialized = 1 [deprecated = true, (nanopb).type = FT_IGNORE]; /** True if the I2C port has been initialized successfully, False otherwise. */ BusResponse bus_response = 2; /** Whether the I2C bus initialized properly or failed. **/ } -/** -* I2CBusSetFrequency represents a request to change the -* I2C clock speed to a desired frequency, in Hz. -*/ -message I2CBusSetFrequency { - uint32 frequency = 1; /** The desired I2C SCL frequency, in Hz. */ - int32 bus_id = 2; /** An optional I2C bus identifier, if multiple exist. */ -} /** -* I2CBusScanRequest represents the parameters required to execute +* I2CScan represents the parameters required to execute * a device's I2C scan. */ -message I2CBusScanRequest { +message I2CScan { int32 i2c_port_number = 1; /** The desired I2C port to scan. */ - I2CBusInitRequest bus_init_request = 2; /** The I2C bus initialization request. */ + I2CBusInit bus_init_ = 2; /** The I2C bus initialization . */ } /** -* I2CBusScanResponse represents a list of I2C addresses -* found on the bus after I2CBusScanRequest has executed. +* I2CScanResponse represents a list of I2C addresses +* found on the bus after I2CScan has executed. */ -message I2CBusScanResponse { +message I2CScanResponse { repeated uint32 addresses_found = 1 [packed=true, (nanopb).max_count = 120]; /** The 7-bit addresses of the I2C devices found on the bus, empty if not found. */ BusResponse bus_response = 2; /** The I2C bus' status. **/ } /** -* I2CDeviceSensorProperties contains +* I2CSensorProperties contains * the properties of an I2C device's sensor such as * its type and period. */ -message I2CDeviceSensorProperties { +message I2CSensorProperties { SensorType sensor_type = 1; uint32 sensor_period = 2; } /** -* Represents a list of I2CDeviceInitRequest messages. +* Represents a list of I2CInit messages. */ -message I2CDeviceInitRequests { - repeated I2CDeviceInitRequest list = 1; +message I2CInits { + repeated I2CInit list = 1; } /** -* I2CDeviceInitRequest is a wrapper message for -* an I2C device initialization request. +* I2CInit is a wrapper message for +* an I2C device initialization . */ -message I2CDeviceInitRequest { - int32 i2c_port_number = 1; /** The desired I2C port to initialize an I2C device on. */ - I2CBusInitRequest i2c_bus_init_req = 2; /** An I2C bus initialization request. */ - uint32 i2c_device_address = 3; /** The 7-bit I2C address of the device on the bus. */ - string i2c_device_name = 4[(nanopb).max_size = 15]; /** The I2C device's name, MUST MATCH the name on the JSON definition file on https://github.com/adafruit/Wippersnapper_Components. */ - repeated I2CDeviceSensorProperties i2c_device_properties = 5[(nanopb).max_count = 15]; /** Properties of each sensor on the I2C device. */ +message I2CInit { + int32 i2c_port_number = 1; /** The desired I2C port to initialize an I2C device on. */ + I2CBusInit i2c_bus_init_req = 2; /** An I2C bus initialization . */ + uint32 i2c_device_address = 3; /** The 7-bit I2C address of the device on the bus. */ + string i2c_device_name = 4[(nanopb).max_size = 15]; /** The I2C device's name, MUST MATCH the name on the JSON definition file on https://github.com/adafruit/Wippersnapper_Components. */ + repeated I2CSensorProperties i2c_device_properties = 5[(nanopb).max_count = 15]; /** Properties of each sensor on the I2C device. */ } /** -* I2CDeviceInitResponse contains the response from a -* device after processing a I2CDeviceInitRequest message. +* I2CInitResponse contains the response from a +* device after processing a I2CInit message. */ -message I2CDeviceInitResponse { +message I2CInitResponse { bool is_success = 1 [deprecated = true, (nanopb).type = FT_IGNORE]; /** !!DEPRECATED!! True if i2c device initialized successfully, false otherwise. */ uint32 i2c_device_address = 2; /** The 7-bit I2C address of the device on the bus. */ BusResponse bus_response = 3; /** The I2C bus' status. **/ } -/** -* I2CDeviceUpdateRequest is a wrapper message which -* contains a message to update a specific device's properties. -*/ -message I2CDeviceUpdateRequest { - int32 i2c_port_number = 1; /** The desired I2C port. */ - uint32 i2c_device_address = 2; /** The 7-bit I2C address of the device on the bus. */ - string i2c_device_name = 3[(nanopb).max_size = 15]; /** The I2C device's name, MUST MATCH the name on the JSON file. */ - repeated I2CDeviceSensorProperties i2c_device_properties = 4[(nanopb).max_count = 15]; /** Properties for the I2C device's sensors. */ -} /** -* I2CDeviceUpdateResponse represents if an I2C device's +* I2CUpdateResponse represents if an I2C device's * sensor(s) is/are successfully updated. */ -message I2CDeviceUpdateResponse { +message I2CUpdateResponse { uint32 i2c_device_address = 1; /** The 7-bit I2C address of the device which was updated. */ - bool is_success = 2 [deprecated = true, (nanopb).type = FT_IGNORE]; /** !!DEPRECATED!! True if the update request succeeded, False otherwise. */ + bool is_success = 2 [deprecated = true, (nanopb).type = FT_IGNORE]; /** !!DEPRECATED!! True if the update succeeded, False otherwise. */ BusResponse bus_response = 3; /** The I2C bus' status. **/ } /** -* I2CDeviceDeinitRequest is a wrapper message containing -* a deinitialization request for a specific i2c device. +* I2CDeinit is a wrapper message containing +* a deinitialization for a specific i2c device. */ -message I2CDeviceDeinitRequest { +message I2CDeinit { int32 i2c_port_number = 1; /** The desired I2C port to de-initialize an I2C device on. */ uint32 i2c_device_address = 2; /** The 7-bit I2C address of the device on the bus. */ } /** -* I2CDeviceDeinitResponse represents if an I2C device's +* I2CDeinitResponse represents if an I2C device's * sensor(s) is/are successfully de-initialized. */ -message I2CDeviceDeinitResponse { - bool is_success = 1 [deprecated = true, (nanopb).type = FT_IGNORE]; /** True if the deinitialization request succeeded, False otherwise. */ +message I2CDeinitResponse { + bool is_success = 1 [deprecated = true, (nanopb).type = FT_IGNORE]; /** True if the deinitialization succeeded, False otherwise. */ uint32 i2c_device_address = 2; /** The 7-bit I2C address of the device which was initialized. */ BusResponse bus_response = 3; /** The I2C bus' status. **/ } @@ -197,11 +179,11 @@ message SensorEvent { } /** -* Each I2CDeviceEvent represents data from **one** I2C sensor. -* NOTE: An I2CDeviceEvent can have multiple sensor events if +* Each I2CEvent represents data from **one** I2C sensor. +* NOTE: An I2CEvent can have multiple sensor events if * the I2C device contains > 1 sensor. */ -message I2CDeviceEvent { +message I2CEvent { uint32 sensor_address = 1; /** The 7-bit I2C address of the I2C device. */ repeated SensorEvent sensor_event = 2[(nanopb).max_count = 15]; /** A, optionally repeated, SensorEvent from a sensor. */ } diff --git a/proto/wippersnapper/pixels/v1/pixels.proto b/proto/wippersnapper/pixels/v1/pixels.proto index 348abb1f..5ef01178 100644 --- a/proto/wippersnapper/pixels/v1/pixels.proto +++ b/proto/wippersnapper/pixels/v1/pixels.proto @@ -32,11 +32,11 @@ enum PixelsOrder { } /** -* PixelsCreateRequest represents a call from IO to a device. +* PixelsCreate represents a call from IO to a device. * Creates a strand of addressable pixels. * Initial brightness is always 128. */ -message PixelsCreateRequest { +message PixelsCreate { PixelsType pixels_type = 1; /** Defines the model/type of pixel strand */ uint32 pixels_num = 2; /** Number of pixels attached to strand. */ PixelsOrder pixels_ordering = 3; /** Defines the pixel strand's color ordering. */ @@ -48,7 +48,7 @@ message PixelsCreateRequest { /** * PixelsCreateResponse represents response from a WipperSnapper -* device to IO after a PixelsCreateRequest call +* device to IO after a PixelsCreate call */ message PixelsCreateResponse { bool is_success = 1; /** True if the strand initialized successfully, False otherwise. */ @@ -56,19 +56,19 @@ message PixelsCreateResponse { } /** -* PixelCreateRequest represents a call from IO to a device +* PixelCreate represents a call from IO to a device * Deletes a strand of addressable pixels and release the resources and pin. */ -message PixelsDeleteRequest { +message PixelsDelete { PixelsType pixels_type = 1; /** Defines the model/type of pixel strand */ string pixels_pin_data = 2 [(nanopb).max_size = 6]; /** Data pin a strand is connected to. */ } /** -* PixelsWriteRequest represents a call from IO to a device. +* PixelsWrite represents a call from IO to a device. * Writes to a strand of pixels. */ -message PixelsWriteRequest { +message PixelsWrite { PixelsType pixels_type = 1; /** Defines the model/type of pixel strand */ string pixels_pin_data = 2 [(nanopb).max_size = 6]; /** Data pin a strand is connected to. */ uint32 pixels_color = 3; /* 32-bit color value. Most significant byte is white (for RGBW pixels) or ignored (for RGB pixels), next is red, then green, and least significant byte is blue. */ diff --git a/proto/wippersnapper/pwm/v1/pwm.proto b/proto/wippersnapper/pwm/v1/pwm.proto index 5b464b51..66675c6a 100644 --- a/proto/wippersnapper/pwm/v1/pwm.proto +++ b/proto/wippersnapper/pwm/v1/pwm.proto @@ -6,11 +6,11 @@ package wippersnapper.pwm.v1; import "nanopb/nanopb.proto"; /** -* PWMAttachRequest represents a request to a device to attach/allocate a PWM pin. +* PWMAttach represents a to a device to attach/allocate a PWM pin. * On ESP32 Arduino, this will "attach" a pin to a LEDC channel/timer group. * On non-ESP32 Arduino, this does nothing. */ -message PWMAttachRequest { +message PWMAttach { string pin = 1 [(nanopb).max_size = 6]; /** The pin to be attached. */ int32 frequency = 2; /** PWM frequency of an analog pin, in Hz. **/ int32 resolution = 3; /** The resolution of an analog pin, in bits. **/ @@ -18,44 +18,44 @@ message PWMAttachRequest { /** * PWMAttachResponse represents a response from a device's execution of an -* AttachRequest message. +* Attach message. */ message PWMAttachResponse { - string pin = 1 [(nanopb).max_size = 6]; /** The requested pin. */ - bool did_attach = 2; /** True if AttachRequest successful, False otherwise. */ + string pin = 1 [(nanopb).max_size = 6]; /** The ed pin. */ + bool did_attach = 2; /** True if Attach successful, False otherwise. */ } /** -* PWMDetachRequest represents a request to stop PWM'ing and release the pin for re-use. +* PWMDetach represents a to stop PWM'ing and release the pin for re-use. * On ESP32, this will "detach" a pin from a LEDC channel/timer group. * On non-ESP32 Arduino, this calls digitalWrite(LOW) on the pin */ -message PWMDetachRequest { +message PWMDetach { string pin = 1 [(nanopb).max_size = 6]; /** The PWM pin to de-initialized. */ } /** -* WriteDutyCycleRequest represents a request to write a duty cycle to a pin with a frequency (fixed). +* WriteDutyCycle represents a to write a duty cycle to a pin with a frequency (fixed). * This is used for controlling LEDs. */ -message PWMWriteDutyCycleRequest { +message PWMWriteDutyCycle { string pin = 1 [(nanopb).max_size = 6]; /** The pin to write to. */ int32 duty_cycle = 2; /** The desired duty cycle to write. This value will be changed by the slider on Adafruit IO. **/ } /** -* WriteDutyCycle represents a wrapper request to write duty cycles to multiple pins. +* WriteDutyCycle represents a wrapper to write duty cycles to multiple pins. * This is used for controlling RGB/RGBW LEDs. */ -message PWMWriteDutyCycleMultiRequest { - repeated PWMWriteDutyCycleRequest write_duty_cycle_req = 1 [(nanopb).max_count = 4]; +message PWMWriteDutyCycleMulti { + repeated PWMWriteDutyCycle write_duty_cycle_req = 1 [(nanopb).max_count = 4]; } /** -* WriteFrequencyRequest represents a request to write a Frequency, in Hz, to a pin with a duty cycle of 50%. +* WriteFrequency represents a to write a Frequency, in Hz, to a pin with a duty cycle of 50%. * This is used for playing tones using a piezo buzzer or speaker. */ -message PWMWriteFrequencyRequest { +message PWMWriteFrequency { string pin = 1 [(nanopb).max_size = 6]; /** The pin to write to. */ int32 frequency = 2; /** The desired PWM frequency, in Hz. This value will be changed by the slider on Adafruit IO. **/ } \ No newline at end of file diff --git a/proto/wippersnapper/servo/v1/servo.proto b/proto/wippersnapper/servo/v1/servo.proto index 92a5ec5e..ffbe1591 100644 --- a/proto/wippersnapper/servo/v1/servo.proto +++ b/proto/wippersnapper/servo/v1/servo.proto @@ -6,9 +6,9 @@ package wippersnapper.servo.v1; import "nanopb/nanopb.proto"; /** -* ServoAttachRequest represents a request to attach a servo to a pin. +* ServoAttach represents a request to attach a servo to a pin. */ -message ServoAttachRequest { +message ServoAttach { string servo_pin = 1 [(nanopb).max_size = 6]; /** The name of pin to attach a servo to. */ int32 servo_freq = 2; /** The overall PWM frequency, default sent by Adafruit IO is 50Hz. **/ int32 min_pulse_width = 3; /** The minimum pulse length in uS. Default sent by Adafruit IO is 500uS. **/ @@ -24,20 +24,20 @@ message ServoAttachResponse { } /** -* ServoDetachRequest represents a request to detach a servo from a pin and de-initialize the pin for other uses. +* ServoDetach represents a request to detach a servo from a pin and de-initialize the pin for other uses. */ -message ServoDetachRequest { +message ServoDetach { string servo_pin = 1 [(nanopb).max_size = 5]; /** The name of pin to use as a servo pin. */ } /** -* ServoWriteReq represents a message to write the servo's position. +* ServoWrite represents a message to write the servo's position. * * NOTE: Position is sent from Adafruit IO as a pulse width in uS between 500uS * and 2500uS. The client application must convert pulse width to duty cycle w/fixed * freq of 50Hz prior to writing to the servo pin. */ -message ServoWriteRequest { +message ServoWrite { string servo_pin = 1 [(nanopb).max_size = 5]; /** The name of pin we're addressing. */ int32 pulse_width = 2; /** The pulse width to write to the servo, in uS **/ } diff --git a/proto/wippersnapper/signal/v1/signal.proto b/proto/wippersnapper/signal/v1/signal.proto index 707bcf08..1e2a6b30 100644 --- a/proto/wippersnapper/signal/v1/signal.proto +++ b/proto/wippersnapper/signal/v1/signal.proto @@ -5,9 +5,8 @@ syntax = "proto3"; package wippersnapper.signal.v1; // Non-WipperSnapper -import "nanopb/nanopb.proto"; - -// WipperSnapper +import "nanopb/nanopb.proto";// WipperSnapper +import "wippersnapper/description/v1/description.proto"; import "wippersnapper/pin/v1/pin.proto"; import "wippersnapper/i2c/v1/i2c.proto"; import "wippersnapper/servo/v1/servo.proto"; @@ -16,65 +15,94 @@ import "wippersnapper/ds18x20/v1/ds18x20.proto"; import "wippersnapper/pixels/v1/pixels.proto"; import "wippersnapper/uart/v1/uart.proto"; -/** -* UARTRequest represents a UART command sent to a device. -*/ -message UARTRequest { + +message BrokerToDevice { option (nanopb_msgopt).submsg_callback = true; oneof payload { - wippersnapper.uart.v1.UARTDeviceAttachRequest req_uart_device_attach = 1; + // TODO: Leaving pin.proto out as it'll be refactored + // TODO: try "add/remove" + // description.proto + wippersnapper.description.v1.CreateDescription create_description = 1; + // servo.proto + wippersnapper.servo.v1.ServoAttach servo_attach = 1; + wippersnapper.servo.v1.ServoDetach servo_detach = 2; + wippersnapper.servo.v1.ServoWrite servo_write = 3; + // pwm.proto + wippersnapper.pwm.v1.PWMAttach pwm_attach = 2; + wippersnapper.pwm.v1.PWMDetach pwm_detach = 3; + wippersnapper.pwm.v1.PWMWriteDutyCycle pwm_write_duty = 4; + wippersnapper.pwm.v1.PWMWriteDutyCycleMulti pwm_write_duty_multi = 5; + wippersnapper.pwm.v1.PWMWriteFrequency pwm_write_freq = 6; + // pixels.proto + wippersnapper.pixels.v1.PixelsCreate pixels_create = 7; + wippersnapper.pixels.v1.PixelsDelete pixels_delete = 8; + wippersnapper.pixels.v1.PixelsWrite pixels_write = 9; + // ds18x20.proto + wippersnapper.ds18x20.v1.Ds18x20Init ds18x20_init = 10; + wippersnapper.ds18x20.v1.Ds18x20DeInit ds18x20_deinit = 11; + // uart.proto + wippersnapper.uart.v1.UARTDeviceAttach uart_device_attach = 1; + // TODO: add uart detach once merged into master + // i2c.proto + wippersnapper.i2c.v1.I2CScan i2c_scan = 2; + wippersnapper.i2c.v1.I2CInits i2c_inits = 7; + wippersnapper.i2c.v1.I2CDeinit i2c_deinit = 5; } } -/** -* UARTResponse represents a UART command from a device. -*/ -message UARTResponse { +message DeviceToBroker { + option (nanopb_msgopt).submsg_callback = true; +} + + + +message CreateSignalRequest { option (nanopb_msgopt).submsg_callback = true; oneof payload { - wippersnapper.uart.v1.UARTDeviceAttachResponse resp_uart_device_attach = 1; - wippersnapper.uart.v1.UARTDeviceEvent resp_uart_device_event = 2; + // Create, update or remove a GPIO pin + wippersnapper.pin.v1.ConfigurePinRequests pin_configs = 6; + // Update a pins state + wippersnapper.pin.v1.PinEvent pin_event = 15; + // Update a pin's state + wippersnapper.pin.v1.PinEvents pin_events = 7; } } /** -* Ds18x20Request represents a Ds18x20 command sent to a device. +* Response from a signal message payload (device->broker) */ -message Ds18x20Request { - option (nanopb_msgopt).submsg_callback = true; +message SignalResponse { oneof payload { - wippersnapper.ds18x20.v1.Ds18x20InitRequest req_ds18x20_init = 1; - wippersnapper.ds18x20.v1.Ds18x20DeInitRequest req_ds18x20_deinit = 2; + bool configuration_complete = 1; /** True if a device successfully completed a ConfigurePinRequests message, False otherwise. */ } } + /** -* Ds18x20Response represents a Ds18x20 message from the device. +* UARTResponse represents a UART command from a device. */ -message Ds18x20Response { +message UARTResponse { option (nanopb_msgopt).submsg_callback = true; oneof payload { - wippersnapper.ds18x20.v1.Ds18x20InitResponse resp_ds18x20_init = 1; - wippersnapper.ds18x20.v1.Ds18x20DeviceEvent resp_ds18x20_event = 2; + wippersnapper.uart.v1.UARTDeviceAttachResponse resp_uart_device_attach = 1; + wippersnapper.uart.v1.UARTDeviceEvent resp_uart_device_event = 2; } } + /** -* I2CRequest represents the broker's request for a specific i2c command to a device. +* Ds18x20Response represents a Ds18x20 message from the device. */ -message I2CRequest { +message Ds18x20Response { option (nanopb_msgopt).submsg_callback = true; oneof payload { - wippersnapper.i2c.v1.I2CBusInitRequest req_i2c_init = 1 [deprecated = true, (nanopb).type = FT_IGNORE]; - wippersnapper.i2c.v1.I2CBusScanRequest req_i2c_scan = 2; - wippersnapper.i2c.v1.I2CBusSetFrequency req_i2c_set_freq = 3; - wippersnapper.i2c.v1.I2CDeviceInitRequest req_i2c_device_init = 4; - wippersnapper.i2c.v1.I2CDeviceDeinitRequest req_i2c_device_deinit = 5; - wippersnapper.i2c.v1.I2CDeviceUpdateRequest req_i2c_device_update = 6; - wippersnapper.i2c.v1.I2CDeviceInitRequests req_i2c_device_init_requests = 7; + wippersnapper.ds18x20.v1.Ds18x20InitResponse resp_ds18x20_init = 1; + wippersnapper.ds18x20.v1.Ds18x20DeviceEvent resp_ds18x20_event = 2; } } + + /** * I2CResponse represents the device's response to an I2C-specific message from IO. */ @@ -82,7 +110,7 @@ message I2CResponse { option (nanopb_msgopt).submsg_callback = true; oneof payload { wippersnapper.i2c.v1.I2CBusInitResponse resp_i2c_init = 1 [deprecated = true, (nanopb).type = FT_IGNORE]; - wippersnapper.i2c.v1.I2CBusScanResponse resp_i2c_scan = 2; + wippersnapper.i2c.v1.I2CScanResponse resp_i2c_scan = 2; wippersnapper.i2c.v1.I2CDeviceInitResponse resp_i2c_device_init = 3; wippersnapper.i2c.v1.I2CDeviceDeinitResponse resp_i2c_device_deinit = 4; wippersnapper.i2c.v1.I2CDeviceUpdateResponse resp_i2c_device_update = 5; @@ -90,17 +118,7 @@ message I2CResponse { } } -/** -* ServoRequest represents the broker's request across the servo sub-topic. -*/ -message ServoRequest { - option (nanopb_msgopt).submsg_callback = true; - oneof payload { - wippersnapper.servo.v1.ServoAttachRequest servo_attach = 1; - wippersnapper.servo.v1.ServoDetachRequest servo_detach = 2; - wippersnapper.servo.v1.ServoWriteRequest servo_write = 3; - } -} + /** * ServoResponse represents the device's response across the servo sub-topic. @@ -112,17 +130,6 @@ message ServoResponse { } } -/** -* PixelsRequest represents the broker's request across the pixels sub-topic. -*/ -message PixelsRequest { - option (nanopb_msgopt).submsg_callback = true; - oneof payload { - wippersnapper.pixels.v1.PixelsCreateRequest req_pixels_create = 1; - wippersnapper.pixels.v1.PixelsDeleteRequest req_pixels_delete = 2; - wippersnapper.pixels.v1.PixelsWriteRequest req_pixels_write = 3; - } -} message PixelsResponse { option (nanopb_msgopt).submsg_callback = true; @@ -131,44 +138,7 @@ message PixelsResponse { } } -message CreateSignalRequest { - option (nanopb_msgopt).submsg_callback = true; - oneof payload { - // Create, update or remove a GPIO pin - wippersnapper.pin.v1.ConfigurePinRequests pin_configs = 6; - // Update a pins state - wippersnapper.pin.v1.PinEvent pin_event = 15; - // Create, update or remove a PWM output pin - wippersnapper.pin.v1.ConfigurePWMPinRequests pwm_pin_config = 10 [deprecated = true, (nanopb).type = FT_IGNORE]; - // Write duty cycle to a PWM output pin - wippersnapper.pin.v1.PWMPinEvents pwm_pin_event = 12 [deprecated = true, (nanopb).type = FT_IGNORE]; - // Update a pin's state - wippersnapper.pin.v1.PinEvents pin_events = 7; - } -} - -/** -* Response from a signal message payload (device->broker) -*/ -message SignalResponse { - oneof payload { - bool configuration_complete = 1; /** True if a device successfully completed a ConfigurePinRequests message, False otherwise. */ - } -} -/** -* PWMRequest represents a broker's request across the PWM sub-topic. -*/ -message PWMRequest { - option (nanopb_msgopt).submsg_callback = true; - oneof payload { - wippersnapper.pwm.v1.PWMAttachRequest attach_request = 1; - wippersnapper.pwm.v1.PWMDetachRequest detach_request = 2; - wippersnapper.pwm.v1.PWMWriteDutyCycleRequest write_duty_request = 3; - wippersnapper.pwm.v1.PWMWriteDutyCycleMultiRequest write_duty_multi_request = 4; - wippersnapper.pwm.v1.PWMWriteFrequencyRequest write_freq_request = 5; - } -} /** * PWMRequest represents a devices's response across the PWM sub-topic. diff --git a/proto/wippersnapper/uart/v1/uart.proto b/proto/wippersnapper/uart/v1/uart.proto index f78c46d3..b780ee9f 100644 --- a/proto/wippersnapper/uart/v1/uart.proto +++ b/proto/wippersnapper/uart/v1/uart.proto @@ -8,7 +8,7 @@ import "wippersnapper/i2c/v1/i2c.proto"; /** * UARTBusData represents a message to configure a UART bus for communication with a device. -* NOTE: This message is never sent directly, it is packed inside UARTDeviceAttachRequest. +* NOTE: This message is never sent directly, it is packed inside UARTDeviceAttach. */ message UARTBusData { int32 baudrate = 1; /** The baudrate to use for UART communication (may be a common baud rate such as: 1200bps, 2400bps, 4800bps, 19200bps, 38400bps, 57600bps, or 115200bps). */ @@ -18,10 +18,10 @@ message UARTBusData { } /** -* UARTDeviceAttachRequest represents a message sent from IO to a device +* UARTDeviceAttach represents a message sent from IO to a device * to configure the UART bus (if not already configured) and attach a device. */ -message UARTDeviceAttachRequest { +message UARTDeviceAttach { UARTBusData bus_info = 1; /** The UART bus configuration. */ string device_id = 2[(nanopb).max_size = 15]; /** The unique identifier of the device to attach to the UART bus, from Adafruit_WipperSnapper_Components. */ int32 polling_interval = 3; /** The polling interval, in milliseconds, to use for the device. */ @@ -33,7 +33,7 @@ message UARTDeviceAttachRequest { */ message UARTDeviceAttachResponse { string device_id = 1[(nanopb).max_size = 15]; /** The unique identifier of the device to attach to the UART bus, from Adafruit_WipperSnapper_Components. */ - bool is_success = 2; /** True if the UARTInitRequest was successful, False otherwise. */ + bool is_success = 2; /** True if the UARTInit was successful, False otherwise. */ } /** From c20cd1c8ef275a797242185db3e97ce8b2bafc54 Mon Sep 17 00:00:00 2001 From: brentru Date: Thu, 2 Nov 2023 13:32:17 -0400 Subject: [PATCH 002/188] devicetobroker --- proto/wippersnapper/signal/v1/signal.proto | 114 ++++----------------- 1 file changed, 20 insertions(+), 94 deletions(-) diff --git a/proto/wippersnapper/signal/v1/signal.proto b/proto/wippersnapper/signal/v1/signal.proto index 1e2a6b30..4ba87fbc 100644 --- a/proto/wippersnapper/signal/v1/signal.proto +++ b/proto/wippersnapper/signal/v1/signal.proto @@ -52,100 +52,26 @@ message BrokerToDevice { message DeviceToBroker { option (nanopb_msgopt).submsg_callback = true; -} - - - -message CreateSignalRequest { - option (nanopb_msgopt).submsg_callback = true; - oneof payload { - // Create, update or remove a GPIO pin - wippersnapper.pin.v1.ConfigurePinRequests pin_configs = 6; - // Update a pins state - wippersnapper.pin.v1.PinEvent pin_event = 15; - // Update a pin's state - wippersnapper.pin.v1.PinEvents pin_events = 7; - } -} - -/** -* Response from a signal message payload (device->broker) -*/ -message SignalResponse { - oneof payload { - bool configuration_complete = 1; /** True if a device successfully completed a ConfigurePinRequests message, False otherwise. */ - } -} - - -/** -* UARTResponse represents a UART command from a device. -*/ -message UARTResponse { - option (nanopb_msgopt).submsg_callback = true; - oneof payload { - wippersnapper.uart.v1.UARTDeviceAttachResponse resp_uart_device_attach = 1; - wippersnapper.uart.v1.UARTDeviceEvent resp_uart_device_event = 2; - } -} - - -/** -* Ds18x20Response represents a Ds18x20 message from the device. -*/ -message Ds18x20Response { - option (nanopb_msgopt).submsg_callback = true; - oneof payload { - wippersnapper.ds18x20.v1.Ds18x20InitResponse resp_ds18x20_init = 1; - wippersnapper.ds18x20.v1.Ds18x20DeviceEvent resp_ds18x20_event = 2; - } -} - - - -/** -* I2CResponse represents the device's response to an I2C-specific message from IO. -*/ -message I2CResponse { - option (nanopb_msgopt).submsg_callback = true; - oneof payload { - wippersnapper.i2c.v1.I2CBusInitResponse resp_i2c_init = 1 [deprecated = true, (nanopb).type = FT_IGNORE]; - wippersnapper.i2c.v1.I2CScanResponse resp_i2c_scan = 2; - wippersnapper.i2c.v1.I2CDeviceInitResponse resp_i2c_device_init = 3; - wippersnapper.i2c.v1.I2CDeviceDeinitResponse resp_i2c_device_deinit = 4; - wippersnapper.i2c.v1.I2CDeviceUpdateResponse resp_i2c_device_update = 5; - wippersnapper.i2c.v1.I2CDeviceEvent resp_i2c_device_event = 6; - } -} - - - -/** -* ServoResponse represents the device's response across the servo sub-topic. -*/ -message ServoResponse { - option (nanopb_msgopt).submsg_callback = true; - oneof payload { - wippersnapper.servo.v1.ServoAttachResponse servo_attach_resp = 1; - } -} - - -message PixelsResponse { - option (nanopb_msgopt).submsg_callback = true; oneof payload { - wippersnapper.pixels.v1.PixelsCreateResponse resp_pixels_create = 1; - } -} - - - -/** -* PWMRequest represents a devices's response across the PWM sub-topic. -*/ -message PWMResponse { - option (nanopb_msgopt).submsg_callback = true; - oneof payload { - wippersnapper.pwm.v1.PWMAttachResponse attach_response = 1; + // TODO: move to pins.proto?: This is sent from the device2IO + // we may be able to get rid of it after removing `CreateDescription` + bool configuration_complete = 1; + // servo.proto + wippersnapper.servo.v1.ServoAdded servo_added = 1; + // pwm.proto + wippersnapper.pwm.v1.PWMAdded pwm_added = 1; + // pixels.proto + wippersnapper.pixels.v1.PixelsAdded pixels_added = 1; + // ds18x20.proto + wippersnapper.ds18x20.v1.Ds18x20Added ds18x20_added = 1; + wippersnapper.ds18x20.v1.Ds18x20Event ds18x20_event = 2; + // uart.proto + wippersnapper.uart.v1.UARTAdded uart_added = 1; + wippersnapper.uart.v1.UARTEvent uart_event = 2; + // i2c.proto + wippersnapper.i2c.v1.I2CScanResponse resp_i2c_scan = 2; + wippersnapper.i2c.v1.I2CAdded i2c_added = 3; + wippersnapper.i2c.v1.I2CRemoved i2c_removed = 4; + wippersnapper.i2c.v1.I2CEvent i2c_event = 6; } } From d472b778f505eccade70ad22d20256e4863f0bf7 Mon Sep 17 00:00:00 2001 From: brentru Date: Thu, 2 Nov 2023 13:46:18 -0400 Subject: [PATCH 003/188] add adafruit sensor.proto --- proto/wippersnapper/ds18x20/v1/ds18x20.proto | 6 +- proto/wippersnapper/i2c/v1/i2c.proto | 58 ++------------------ proto/wippersnapper/sensor/v1/sensor.proto | 57 +++++++++++++++++++ proto/wippersnapper/signal/v1/signal.proto | 2 +- proto/wippersnapper/uart/v1/uart.proto | 4 +- 5 files changed, 67 insertions(+), 60 deletions(-) create mode 100644 proto/wippersnapper/sensor/v1/sensor.proto diff --git a/proto/wippersnapper/ds18x20/v1/ds18x20.proto b/proto/wippersnapper/ds18x20/v1/ds18x20.proto index 84d1b153..eb11cab6 100644 --- a/proto/wippersnapper/ds18x20/v1/ds18x20.proto +++ b/proto/wippersnapper/ds18x20/v1/ds18x20.proto @@ -6,7 +6,7 @@ syntax = "proto3"; package wippersnapper.ds18x20.v1; import "nanopb/nanopb.proto"; -import "wippersnapper/i2c/v1/i2c.proto"; +import "wippersnapper/sensor/sensor.proto"; /** * Ds18x20Init represents a to initialize @@ -16,7 +16,7 @@ import "wippersnapper/i2c/v1/i2c.proto"; message Ds18x20Init { string onewire_pin = 1 [(nanopb).max_size = 5]; /** The desired pin to use as a OneWire bus. */ int32 sensor_resolution = 2; /** The desired sensor resolution (9, 10, 11, or 12 bits). */ - repeated wippersnapper.i2c.v1.I2CDeviceSensorProperties i2c_device_properties = 3[(nanopb).max_count = 2]; /** Properties for the DS18x20 sensor. */ + repeated wippersnapper.sensor.v1.SensorType sensor_type = 3[(nanopb).max_count = 2]; /** Properties for the DS18x20 sensor. */ } /** @@ -41,5 +41,5 @@ message Ds18x20DeInit { */ message Ds18x20DeviceEvent { string onewire_pin = 1 [(nanopb).max_size = 5]; /** The desired pin to use as a OneWire bus. */ - repeated wippersnapper.i2c.v1.SensorEvent sensor_event = 2 [(nanopb).max_count = 2]; /** The DS18X20's SensorEvent. */ + repeated wippersnapper.sensor.v1.SensorEvent sensor_event = 2 [(nanopb).max_count = 2]; /** The DS18X20's SensorEvent. */ } \ No newline at end of file diff --git a/proto/wippersnapper/i2c/v1/i2c.proto b/proto/wippersnapper/i2c/v1/i2c.proto index 56fc18c2..1b4ef1a8 100644 --- a/proto/wippersnapper/i2c/v1/i2c.proto +++ b/proto/wippersnapper/i2c/v1/i2c.proto @@ -4,6 +4,7 @@ syntax = "proto3"; package wippersnapper.i2c.v1; import "nanopb/nanopb.proto"; +import "wippersnapper/sensor/sensor.proto"; /** * BusResponse represents the state of the I2C bus, from a device. @@ -63,8 +64,7 @@ message I2CScanResponse { * its type and period. */ message I2CSensorProperties { - SensorType sensor_type = 1; - uint32 sensor_period = 2; + wippersnapper.i2c.v1.SensorType sensor_type = 1; } @@ -84,7 +84,7 @@ message I2CInit { I2CBusInit i2c_bus_init_req = 2; /** An I2C bus initialization . */ uint32 i2c_device_address = 3; /** The 7-bit I2C address of the device on the bus. */ string i2c_device_name = 4[(nanopb).max_size = 15]; /** The I2C device's name, MUST MATCH the name on the JSON definition file on https://github.com/adafruit/Wippersnapper_Components. */ - repeated I2CSensorProperties i2c_device_properties = 5[(nanopb).max_count = 15]; /** Properties of each sensor on the I2C device. */ + repeated wippersnapper.i2c.v1.SensorType sensor_type = 5[(nanopb).max_count = 15]; /** Properties of each sensor on the I2C device. */ } /** @@ -127,56 +127,6 @@ message I2CDeinitResponse { BusResponse bus_response = 3; /** The I2C bus' status. **/ } -/** Adafruit Unified Sensor Library Messages. */ - -/** -* SensorType allows us determine what types of units the sensor uses, etc. -*/ -enum SensorType { - SENSOR_TYPE_UNSPECIFIED = 0; /** Sensor value type which is not defined by this list, "Raw Value: {value}". */ - SENSOR_TYPE_ACCELEROMETER = 1; /** Acceleration, in meter per second per second, "{value}m/s/s". */ - SENSOR_TYPE_MAGNETIC_FIELD = 2; /** Magnetic field strength, in micro-Tesla, "{value}µT". */ - SENSOR_TYPE_ORIENTATION = 3; /** Orientation angle, in degrees, "{value}°". */ - SENSOR_TYPE_GYROSCOPE = 4; /** Angular rate, in radians per second, "{value}rad/s". */ - SENSOR_TYPE_LIGHT = 5; /** Light-level, non-unit-specific (For a unit-specific measurement, see: Lux), , "Raw Value: {value}". */ - SENSOR_TYPE_PRESSURE = 6; /** Pressure, in hectopascal, , "{value}hPa". */ - SENSOR_TYPE_PROXIMITY = 8; /** Distance from an object to a sensor, non-unit-specific, "Raw Value: {value}". */ - SENSOR_TYPE_GRAVITY = 9; /** Metres per second squared, "{value}m/s^2". */ - SENSOR_TYPE_LINEAR_ACCELERATION = 10; /** Acceleration not including gravity, in meter per second squared, "{value}m/s^2". */ - SENSOR_TYPE_ROTATION_VECTOR = 11; /** An angle in radians, "{value} rad".*/ - SENSOR_TYPE_RELATIVE_HUMIDITY = 12; /** in percent (%), "{value}%". */ - SENSOR_TYPE_AMBIENT_TEMPERATURE = 13; /** Temperature of the air around a sensor, in degrees Celsius, "{value}°C". */ - SENSOR_TYPE_OBJECT_TEMPERATURE = 14; /** Temperature of the object a sensor is touching/pointed at, in degrees Celsius, "{value}°C".*/ - SENSOR_TYPE_VOLTAGE = 15; /** Volts, "{value}V". */ - SENSOR_TYPE_CURRENT = 16; /** Milliamps, "{value}mA". */ - SENSOR_TYPE_COLOR = 17; /** Values are in 0..1.0 RGB channel luminosity and 32-bit RGBA format. "Color: {value}".*/ - SENSOR_TYPE_RAW = 18; /** Sensor reads a value which is not defined by this list, "Raw Value: {value}".*/ - SENSOR_TYPE_PM10_STD = 19; /** Standard Particulate Matter 1.0, in ppm, "{value}ppm". */ - SENSOR_TYPE_PM25_STD = 20; /** Standard Particulate Matter 2.5, in ppm, "{value}ppm". */ - SENSOR_TYPE_PM100_STD = 21; /** Standard Particulate Matter 100, in ppm, "{value}ppm". */ - SENSOR_TYPE_PM10_ENV = 22; /** Environmental Particulate Matter 1.0, in ppm, "{value}ppm". */ - SENSOR_TYPE_PM25_ENV = 23; /** Environmental Particulate Matter 2.5, in ppm, "{value}ppm". */ - SENSOR_TYPE_PM100_ENV = 24; /** Environmental Particulate Matter 100, in ppm, "{value}ppm".*/ - SENSOR_TYPE_CO2 = 25; /** Measured CO2, in ppm, "{value}ppm". */ - SENSOR_TYPE_GAS_RESISTANCE = 26; /** Proportional to the amount of VOC particles in the air, in Ohms, "{value}Ω". */ - SENSOR_TYPE_ALTITUDE = 27; /** Values are in meters (m), "${$v} m". */ - SENSOR_TYPE_LUX = 28; /** Light level, in lux, "Lux: {value}". */ - SENSOR_TYPE_ECO2 = 29; /** equivalent/estimated CO2 in ppm (estimated from some other measurement), "{value}ppm". */ - SENSOR_TYPE_UNITLESS_PERCENT = 30; /** Percentage, unit-less, "{value}%". */ - SENSOR_TYPE_AMBIENT_TEMPERATURE_FAHRENHEIT = 31; /** Temperature of the air around a sensor, in degrees Fahrenheit, "{value}°F". */ - SENSOR_TYPE_OBJECT_TEMPERATURE_FAHRENHEIT = 32; /** Temperature of the object a sensor is touching/pointed at, in degrees Fahrenheit, "{value}°F".*/ - SENSOR_TYPE_VOC_INDEX = 33; /** Values are an index from 1-500 with 100 being normal, "${$v} VOC".*/ - SENSOR_TYPE_NOX_INDEX = 34; /** Values are an index from 1-500 with 100 being normal, "${$v} NOx".*/ - SENSOR_TYPE_TVOC = 35; /** Values are in parts per billion (ppb), "${$v} ppb". */ -} - -/** -* SensorEvent is used to return the sensor's value and type. -*/ -message SensorEvent { - SensorType type = 1; /** The sensor's type and corresponding SI unit */ - float value = 2; /** The sensor's value */ -} /** * Each I2CEvent represents data from **one** I2C sensor. @@ -185,5 +135,5 @@ message SensorEvent { */ message I2CEvent { uint32 sensor_address = 1; /** The 7-bit I2C address of the I2C device. */ - repeated SensorEvent sensor_event = 2[(nanopb).max_count = 15]; /** A, optionally repeated, SensorEvent from a sensor. */ + repeated wippersnapper.sensor.v1.SensorEvent sensor_event = 2[(nanopb).max_count = 15]; /** A, optionally repeated, SensorEvent from a sensor. */ } diff --git a/proto/wippersnapper/sensor/v1/sensor.proto b/proto/wippersnapper/sensor/v1/sensor.proto new file mode 100644 index 00000000..ac9389f5 --- /dev/null +++ b/proto/wippersnapper/sensor/v1/sensor.proto @@ -0,0 +1,57 @@ +// SPDX-FileCopyrightText: 2023 Brent Rubell, Loren Norman for Adafruit Industries +// SPDX-License-Identifier: MIT +syntax = "proto3"; + +package wippersnapper.sensor.v1; +import "nanopb/nanopb.proto"; + +/** +* SensorType allows us determine what types of units the sensor uses, etc. +*/ +enum SensorType { + SENSOR_TYPE_UNSPECIFIED = 0; /** Sensor value type which is not defined by this list, "Raw Value: {value}". */ + SENSOR_TYPE_ACCELEROMETER = 1; /** Acceleration, in meter per second per second, "{value}m/s/s". */ + SENSOR_TYPE_MAGNETIC_FIELD = 2; /** Magnetic field strength, in micro-Tesla, "{value}µT". */ + SENSOR_TYPE_ORIENTATION = 3; /** Orientation angle, in degrees, "{value}°". */ + SENSOR_TYPE_GYROSCOPE = 4; /** Angular rate, in radians per second, "{value}rad/s". */ + SENSOR_TYPE_LIGHT = 5; /** Light-level, non-unit-specific (For a unit-specific measurement, see: Lux), , "Raw Value: {value}". */ + SENSOR_TYPE_PRESSURE = 6; /** Pressure, in hectopascal, , "{value}hPa". */ + SENSOR_TYPE_PROXIMITY = 8; /** Distance from an object to a sensor, non-unit-specific, "Raw Value: {value}". */ + SENSOR_TYPE_GRAVITY = 9; /** Metres per second squared, "{value}m/s^2". */ + SENSOR_TYPE_LINEAR_ACCELERATION = 10; /** Acceleration not including gravity, in meter per second squared, "{value}m/s^2". */ + SENSOR_TYPE_ROTATION_VECTOR = 11; /** An angle in radians, "{value} rad".*/ + SENSOR_TYPE_RELATIVE_HUMIDITY = 12; /** in percent (%), "{value}%". */ + SENSOR_TYPE_AMBIENT_TEMPERATURE = 13; /** Temperature of the air around a sensor, in degrees Celsius, "{value}°C". */ + SENSOR_TYPE_OBJECT_TEMPERATURE = 14; /** Temperature of the object a sensor is touching/pointed at, in degrees Celsius, "{value}°C".*/ + SENSOR_TYPE_VOLTAGE = 15; /** Volts, "{value}V". */ + SENSOR_TYPE_CURRENT = 16; /** Milliamps, "{value}mA". */ + SENSOR_TYPE_COLOR = 17; /** Values are in 0..1.0 RGB channel luminosity and 32-bit RGBA format. "Color: {value}".*/ + SENSOR_TYPE_RAW = 18; /** Sensor reads a value which is not defined by this list, "Raw Value: {value}".*/ + SENSOR_TYPE_PM10_STD = 19; /** Standard Particulate Matter 1.0, in ppm, "{value}ppm". */ + SENSOR_TYPE_PM25_STD = 20; /** Standard Particulate Matter 2.5, in ppm, "{value}ppm". */ + SENSOR_TYPE_PM100_STD = 21; /** Standard Particulate Matter 100, in ppm, "{value}ppm". */ + SENSOR_TYPE_PM10_ENV = 22; /** Environmental Particulate Matter 1.0, in ppm, "{value}ppm". */ + SENSOR_TYPE_PM25_ENV = 23; /** Environmental Particulate Matter 2.5, in ppm, "{value}ppm". */ + SENSOR_TYPE_PM100_ENV = 24; /** Environmental Particulate Matter 100, in ppm, "{value}ppm".*/ + SENSOR_TYPE_CO2 = 25; /** Measured CO2, in ppm, "{value}ppm". */ + SENSOR_TYPE_GAS_RESISTANCE = 26; /** Proportional to the amount of VOC particles in the air, in Ohms, "{value}Ω". */ + SENSOR_TYPE_ALTITUDE = 27; /** Values are in meters (m), "${$v} m". */ + SENSOR_TYPE_LUX = 28; /** Light level, in lux, "Lux: {value}". */ + SENSOR_TYPE_ECO2 = 29; /** equivalent/estimated CO2 in ppm (estimated from some other measurement), "{value}ppm". */ + SENSOR_TYPE_UNITLESS_PERCENT = 30; /** Percentage, unit-less, "{value}%". */ + SENSOR_TYPE_AMBIENT_TEMPERATURE_FAHRENHEIT = 31; /** Temperature of the air around a sensor, in degrees Fahrenheit, "{value}°F". */ + SENSOR_TYPE_OBJECT_TEMPERATURE_FAHRENHEIT = 32; /** Temperature of the object a sensor is touching/pointed at, in degrees Fahrenheit, "{value}°F".*/ + SENSOR_TYPE_VOC_INDEX = 33; /** Values are an index from 1-500 with 100 being normal, "${$v} VOC".*/ + SENSOR_TYPE_NOX_INDEX = 34; /** Values are an index from 1-500 with 100 being normal, "${$v} NOx".*/ + SENSOR_TYPE_TVOC = 35; /** Values are in parts per billion (ppb), "${$v} ppb". */ +} + +/** +* SensorEvent is used to return the sensor's value and type. +*/ +message SensorEvent { + SensorType type = 1; /** The sensor's type and corresponding SI unit */ + oneof value { + float float_value = 2; /** The sensor's value as a float. */ + } +} \ No newline at end of file diff --git a/proto/wippersnapper/signal/v1/signal.proto b/proto/wippersnapper/signal/v1/signal.proto index 4ba87fbc..8aef2f3a 100644 --- a/proto/wippersnapper/signal/v1/signal.proto +++ b/proto/wippersnapper/signal/v1/signal.proto @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2020-2021 Brent Rubell for Adafruit Industries +// SPDX-FileCopyrightText: 2020-2023 Brent Rubell, Loren Norman for Adafruit Industries // SPDX-License-Identifier: MIT syntax = "proto3"; diff --git a/proto/wippersnapper/uart/v1/uart.proto b/proto/wippersnapper/uart/v1/uart.proto index b780ee9f..4fb28f85 100644 --- a/proto/wippersnapper/uart/v1/uart.proto +++ b/proto/wippersnapper/uart/v1/uart.proto @@ -4,7 +4,7 @@ syntax = "proto3"; package wippersnapper.uart.v1; import "nanopb/nanopb.proto"; -import "wippersnapper/i2c/v1/i2c.proto"; +import "wippersnapper/sensor/sensor.proto"; /** * UARTBusData represents a message to configure a UART bus for communication with a device. @@ -41,5 +41,5 @@ message UARTDeviceAttachResponse { */ message UARTDeviceEvent { string device_id = 1[(nanopb).max_size = 15]; /** The unique identifier of the device to attach to the UART bus, from Adafruit_WipperSnapper_Components. */ - repeated wippersnapper.i2c.v1.SensorEvent sensor_event = 2[(nanopb).max_count = 15]; /** A, optionally repeated, SensorEvent from a sensor. */ + repeated wippersnapper.sensor.v1.SensorEvent sensor_event = 2[(nanopb).max_count = 15]; /** A, optionally repeated, SensorEvent from a sensor. */ } From b165561ba75004340241db09e68ba676d7243f56 Mon Sep 17 00:00:00 2001 From: brentru Date: Thu, 2 Nov 2023 14:02:34 -0400 Subject: [PATCH 004/188] add TODO --- .../description/v1/description.proto | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/proto/wippersnapper/description/v1/description.proto b/proto/wippersnapper/description/v1/description.proto index 68a656e6..9286e5a2 100644 --- a/proto/wippersnapper/description/v1/description.proto +++ b/proto/wippersnapper/description/v1/description.proto @@ -17,6 +17,11 @@ message CreateDescriptionRequest { // TODO: Consider dropping this, and compiling these as a header file (per-board) from the // JSON if it is possible to do so. + +// This is handled within decodeRegistrationResp(). We would like to drop it completely. +// TODO: Try the new esp32 function sto detect totoal gpio, analog and reference +// If that works, we can try to remove WipperSnapper_Register.cpp entirely and use the esp32 func +// to detect on ESP32 platforms, otherwise add these values into _Boards.h /** * CreateDescription represents a device's specifications. */ @@ -44,15 +49,3 @@ message CreateDescription { message RegistrationComplete { bool is_complete = 1; /** True if device successfully configured its components, False otherwise. */ } - -// Request the board definition JSON from a device -// MQTT Topic: `device/ID/description/get` -message GetDefinitionRequest { - string data = 1 [deprecated = true, (nanopb).type = FT_IGNORE]; // Request may be any UTF-8 string value -} - -// Response from Adafruit IO with the JSON board definition as a string -// MQTT Topic: `device/ID/description/get` -message GetDefinitionResponse { - string board_definition = 1 [deprecated = true, (nanopb).type = FT_IGNORE]; // Response is JSON data encoded as a string -} From 8122ce275ea4bc2ec556269517f1831b289f5c88 Mon Sep 17 00:00:00 2001 From: brentru Date: Mon, 6 Nov 2023 12:42:27 -0500 Subject: [PATCH 005/188] cleanup from pair session --- proto/wippersnapper/ds18x20/v1/ds18x20.proto | 20 +++---- proto/wippersnapper/i2c/v1/i2c.proto | 20 +++---- proto/wippersnapper/pixels/v1/pixels.proto | 18 +++---- proto/wippersnapper/pwm/v1/pwm.proto | 16 +++--- proto/wippersnapper/servo/v1/servo.proto | 12 ++--- proto/wippersnapper/signal/v1/signal.proto | 57 ++++++++++---------- proto/wippersnapper/uart/v1/uart.proto | 16 +++--- 7 files changed, 79 insertions(+), 80 deletions(-) diff --git a/proto/wippersnapper/ds18x20/v1/ds18x20.proto b/proto/wippersnapper/ds18x20/v1/ds18x20.proto index eb11cab6..847d9d49 100644 --- a/proto/wippersnapper/ds18x20/v1/ds18x20.proto +++ b/proto/wippersnapper/ds18x20/v1/ds18x20.proto @@ -6,40 +6,40 @@ syntax = "proto3"; package wippersnapper.ds18x20.v1; import "nanopb/nanopb.proto"; -import "wippersnapper/sensor/sensor.proto"; +import "wippersnapper/sensor/v1/sensor.proto"; /** -* Ds18x20Init represents a to initialize +* Ds18x20Add represents a to initialize * a DS18X20 Maxim temperature sensor, from the broker. * NOTE: This API only supports ONE DS18X20 device PER OneWire bus. */ -message Ds18x20Init { +message Ds18x20Add { string onewire_pin = 1 [(nanopb).max_size = 5]; /** The desired pin to use as a OneWire bus. */ int32 sensor_resolution = 2; /** The desired sensor resolution (9, 10, 11, or 12 bits). */ repeated wippersnapper.sensor.v1.SensorType sensor_type = 3[(nanopb).max_count = 2]; /** Properties for the DS18x20 sensor. */ } /** -* ds18x20InitDs18x20InitResponseResponse represents a device's response -* to a ds18x20Init message. +* Ds18x20AddDs18x20AddedResponse represents a device's response +* to a Ds18x20Add message. */ -message Ds18x20InitResponse { +message Ds18x20Added { bool is_initialized = 1; /** True if the 1-wire bus has been initialized successfully, False otherwise. */ string onewire_pin = 2 [(nanopb).max_size = 5]; /** The pin being used as a OneWire bus. */ } /** -* Ds18x20DeInit represents a to de-initialize a DS18X20 +* Ds18x20Remove represents a to de-initialize a DS18X20 * Maxim temperature sensor, from the broker. */ -message Ds18x20DeInit { +message Ds18x20Remove { string onewire_pin = 1 [(nanopb).max_size = 5]; /** The desired onewire bus to de-initialize a DS18x sensor on and release. */ } /** -* Ds18x20DeviceEvent event represents data from **one** DS18X20 sensor. +* Ds18x20Event event represents data from **one** DS18X20 sensor. */ -message Ds18x20DeviceEvent { +message Ds18x20Event { string onewire_pin = 1 [(nanopb).max_size = 5]; /** The desired pin to use as a OneWire bus. */ repeated wippersnapper.sensor.v1.SensorEvent sensor_event = 2 [(nanopb).max_count = 2]; /** The DS18X20's SensorEvent. */ } \ No newline at end of file diff --git a/proto/wippersnapper/i2c/v1/i2c.proto b/proto/wippersnapper/i2c/v1/i2c.proto index 1b4ef1a8..79ef716b 100644 --- a/proto/wippersnapper/i2c/v1/i2c.proto +++ b/proto/wippersnapper/i2c/v1/i2c.proto @@ -4,7 +4,7 @@ syntax = "proto3"; package wippersnapper.i2c.v1; import "nanopb/nanopb.proto"; -import "wippersnapper/sensor/sensor.proto"; +import "wippersnapper/sensor/v1/sensor.proto"; /** * BusResponse represents the state of the I2C bus, from a device. @@ -46,7 +46,7 @@ message I2CBusInitResponse { */ message I2CScan { int32 i2c_port_number = 1; /** The desired I2C port to scan. */ - I2CBusInit bus_init_ = 2; /** The I2C bus initialization . */ + I2CBusInit bus_init = 2; /** The I2C bus initialization . */ } /** @@ -64,7 +64,7 @@ message I2CScanResponse { * its type and period. */ message I2CSensorProperties { - wippersnapper.i2c.v1.SensorType sensor_type = 1; + wippersnapper.sensor.v1.SensorType sensor_type = 1; } @@ -84,14 +84,14 @@ message I2CInit { I2CBusInit i2c_bus_init_req = 2; /** An I2C bus initialization . */ uint32 i2c_device_address = 3; /** The 7-bit I2C address of the device on the bus. */ string i2c_device_name = 4[(nanopb).max_size = 15]; /** The I2C device's name, MUST MATCH the name on the JSON definition file on https://github.com/adafruit/Wippersnapper_Components. */ - repeated wippersnapper.i2c.v1.SensorType sensor_type = 5[(nanopb).max_count = 15]; /** Properties of each sensor on the I2C device. */ + repeated wippersnapper.sensor.v1.SensorType sensor_type = 5[(nanopb).max_count = 15]; /** Properties of each sensor on the I2C device. */ } /** -* I2CInitResponse contains the response from a +* I2CAdded contains the response from a * device after processing a I2CInit message. */ -message I2CInitResponse { +message I2CAdded { bool is_success = 1 [deprecated = true, (nanopb).type = FT_IGNORE]; /** !!DEPRECATED!! True if i2c device initialized successfully, false otherwise. */ uint32 i2c_device_address = 2; /** The 7-bit I2C address of the device on the bus. */ BusResponse bus_response = 3; /** The I2C bus' status. **/ @@ -109,19 +109,19 @@ message I2CUpdateResponse { } /** -* I2CDeinit is a wrapper message containing +* I2CRemove is a wrapper message containing * a deinitialization for a specific i2c device. */ -message I2CDeinit { +message I2CRemove { int32 i2c_port_number = 1; /** The desired I2C port to de-initialize an I2C device on. */ uint32 i2c_device_address = 2; /** The 7-bit I2C address of the device on the bus. */ } /** -* I2CDeinitResponse represents if an I2C device's +* I2CRemoved represents if an I2C device's * sensor(s) is/are successfully de-initialized. */ -message I2CDeinitResponse { +message I2CRemoved { bool is_success = 1 [deprecated = true, (nanopb).type = FT_IGNORE]; /** True if the deinitialization succeeded, False otherwise. */ uint32 i2c_device_address = 2; /** The 7-bit I2C address of the device which was initialized. */ BusResponse bus_response = 3; /** The I2C bus' status. **/ diff --git a/proto/wippersnapper/pixels/v1/pixels.proto b/proto/wippersnapper/pixels/v1/pixels.proto index 5ef01178..d214651a 100644 --- a/proto/wippersnapper/pixels/v1/pixels.proto +++ b/proto/wippersnapper/pixels/v1/pixels.proto @@ -32,11 +32,11 @@ enum PixelsOrder { } /** -* PixelsCreate represents a call from IO to a device. -* Creates a strand of addressable pixels. +* PixelsAdd represents a call from IO to a device. +* Adds a strand of addressable pixels. * Initial brightness is always 128. */ -message PixelsCreate { +message PixelsAdd { PixelsType pixels_type = 1; /** Defines the model/type of pixel strand */ uint32 pixels_num = 2; /** Number of pixels attached to strand. */ PixelsOrder pixels_ordering = 3; /** Defines the pixel strand's color ordering. */ @@ -47,19 +47,19 @@ message PixelsCreate { } /** -* PixelsCreateResponse represents response from a WipperSnapper -* device to IO after a PixelsCreate call +* PixelsAdded represents response from a WipperSnapper +* device to IO after a PixelsAdd call */ -message PixelsCreateResponse { +message PixelsAdded { bool is_success = 1; /** True if the strand initialized successfully, False otherwise. */ string pixels_pin_data = 2 [(nanopb).max_size = 6]; /** Data pin the responding strand is connected to. */ } /** -* PixelCreate represents a call from IO to a device -* Deletes a strand of addressable pixels and release the resources and pin. +* PixelAdd represents a call from IO to a device +* Removes a strand of addressable pixels and release the resources and pin. */ -message PixelsDelete { +message PixelsRemove { PixelsType pixels_type = 1; /** Defines the model/type of pixel strand */ string pixels_pin_data = 2 [(nanopb).max_size = 6]; /** Data pin a strand is connected to. */ } diff --git a/proto/wippersnapper/pwm/v1/pwm.proto b/proto/wippersnapper/pwm/v1/pwm.proto index 66675c6a..f4d5a68a 100644 --- a/proto/wippersnapper/pwm/v1/pwm.proto +++ b/proto/wippersnapper/pwm/v1/pwm.proto @@ -6,31 +6,31 @@ package wippersnapper.pwm.v1; import "nanopb/nanopb.proto"; /** -* PWMAttach represents a to a device to attach/allocate a PWM pin. +* PWMAdd represents a to a device to attach/allocate a PWM pin. * On ESP32 Arduino, this will "attach" a pin to a LEDC channel/timer group. * On non-ESP32 Arduino, this does nothing. */ -message PWMAttach { +message PWMAdd { string pin = 1 [(nanopb).max_size = 6]; /** The pin to be attached. */ int32 frequency = 2; /** PWM frequency of an analog pin, in Hz. **/ int32 resolution = 3; /** The resolution of an analog pin, in bits. **/ } /** -* PWMAttachResponse represents a response from a device's execution of an -* Attach message. +* PWMAdded represents a response from a device's execution of an +* Add message. */ -message PWMAttachResponse { +message PWMAdded { string pin = 1 [(nanopb).max_size = 6]; /** The ed pin. */ - bool did_attach = 2; /** True if Attach successful, False otherwise. */ + bool did_attach = 2; /** True if Add successful, False otherwise. */ } /** -* PWMDetach represents a to stop PWM'ing and release the pin for re-use. +* PWMRemove represents a to stop PWM'ing and release the pin for re-use. * On ESP32, this will "detach" a pin from a LEDC channel/timer group. * On non-ESP32 Arduino, this calls digitalWrite(LOW) on the pin */ -message PWMDetach { +message PWMRemove { string pin = 1 [(nanopb).max_size = 6]; /** The PWM pin to de-initialized. */ } diff --git a/proto/wippersnapper/servo/v1/servo.proto b/proto/wippersnapper/servo/v1/servo.proto index ffbe1591..6a00e6f7 100644 --- a/proto/wippersnapper/servo/v1/servo.proto +++ b/proto/wippersnapper/servo/v1/servo.proto @@ -6,9 +6,9 @@ package wippersnapper.servo.v1; import "nanopb/nanopb.proto"; /** -* ServoAttach represents a request to attach a servo to a pin. +* ServoAdd represents a request to attach a servo to a pin. */ -message ServoAttach { +message ServoAdd { string servo_pin = 1 [(nanopb).max_size = 6]; /** The name of pin to attach a servo to. */ int32 servo_freq = 2; /** The overall PWM frequency, default sent by Adafruit IO is 50Hz. **/ int32 min_pulse_width = 3; /** The minimum pulse length in uS. Default sent by Adafruit IO is 500uS. **/ @@ -16,17 +16,17 @@ message ServoAttach { } /** -* ServoAttachResponse represents the result of attaching a servo to a pin. +* ServoAdded represents the result of attaching a servo to a pin. */ -message ServoAttachResponse { +message ServoAdded { bool attach_success = 1; /** True if a servo was attached successfully, False otherwise. **/ string servo_pin = 2 [(nanopb).max_size = 6]; /** The name of pin we're responding about. */ } /** -* ServoDetach represents a request to detach a servo from a pin and de-initialize the pin for other uses. +* ServoRemove represents a request to detach a servo from a pin and de-initialize the pin for other uses. */ -message ServoDetach { +message ServoRemove { string servo_pin = 1 [(nanopb).max_size = 5]; /** The name of pin to use as a servo pin. */ } diff --git a/proto/wippersnapper/signal/v1/signal.proto b/proto/wippersnapper/signal/v1/signal.proto index 8aef2f3a..15851358 100644 --- a/proto/wippersnapper/signal/v1/signal.proto +++ b/proto/wippersnapper/signal/v1/signal.proto @@ -20,33 +20,32 @@ message BrokerToDevice { option (nanopb_msgopt).submsg_callback = true; oneof payload { // TODO: Leaving pin.proto out as it'll be refactored - // TODO: try "add/remove" // description.proto wippersnapper.description.v1.CreateDescription create_description = 1; // servo.proto - wippersnapper.servo.v1.ServoAttach servo_attach = 1; - wippersnapper.servo.v1.ServoDetach servo_detach = 2; - wippersnapper.servo.v1.ServoWrite servo_write = 3; + wippersnapper.servo.v1.ServoAdd servo_add = 2; + wippersnapper.servo.v1.ServoRemove servo_remove = 3; + wippersnapper.servo.v1.ServoWrite servo_write = 4; // pwm.proto - wippersnapper.pwm.v1.PWMAttach pwm_attach = 2; - wippersnapper.pwm.v1.PWMDetach pwm_detach = 3; - wippersnapper.pwm.v1.PWMWriteDutyCycle pwm_write_duty = 4; - wippersnapper.pwm.v1.PWMWriteDutyCycleMulti pwm_write_duty_multi = 5; - wippersnapper.pwm.v1.PWMWriteFrequency pwm_write_freq = 6; + wippersnapper.pwm.v1.PWMAdd pwm_add = 5; + wippersnapper.pwm.v1.PWMRemove pwm_remove = 6; + wippersnapper.pwm.v1.PWMWriteDutyCycle pwm_write_duty = 7; + wippersnapper.pwm.v1.PWMWriteDutyCycleMulti pwm_write_duty_multi = 8; + wippersnapper.pwm.v1.PWMWriteFrequency pwm_write_freq = 9; // pixels.proto - wippersnapper.pixels.v1.PixelsCreate pixels_create = 7; - wippersnapper.pixels.v1.PixelsDelete pixels_delete = 8; - wippersnapper.pixels.v1.PixelsWrite pixels_write = 9; + wippersnapper.pixels.v1.PixelsAdd pixels_add = 10; + wippersnapper.pixels.v1.PixelsRemove pixels_remove = 11; + wippersnapper.pixels.v1.PixelsWrite pixels_write = 12; // ds18x20.proto - wippersnapper.ds18x20.v1.Ds18x20Init ds18x20_init = 10; - wippersnapper.ds18x20.v1.Ds18x20DeInit ds18x20_deinit = 11; + wippersnapper.ds18x20.v1.Ds18x20Add ds18x20_init = 13; + wippersnapper.ds18x20.v1.Ds18x20Remove ds18x20_deinit = 14; // uart.proto - wippersnapper.uart.v1.UARTDeviceAttach uart_device_attach = 1; + wippersnapper.uart.v1.UARTDeviceAdd uart_device_add = 15; // TODO: add uart detach once merged into master // i2c.proto - wippersnapper.i2c.v1.I2CScan i2c_scan = 2; - wippersnapper.i2c.v1.I2CInits i2c_inits = 7; - wippersnapper.i2c.v1.I2CDeinit i2c_deinit = 5; + wippersnapper.i2c.v1.I2CScan i2c_scan = 16; + wippersnapper.i2c.v1.I2CInits i2c_add = 17; + wippersnapper.i2c.v1.I2CRemove i2c_remove = 18; } } @@ -57,21 +56,21 @@ message DeviceToBroker { // we may be able to get rid of it after removing `CreateDescription` bool configuration_complete = 1; // servo.proto - wippersnapper.servo.v1.ServoAdded servo_added = 1; + wippersnapper.servo.v1.ServoAdded servo_added = 2; // pwm.proto - wippersnapper.pwm.v1.PWMAdded pwm_added = 1; + wippersnapper.pwm.v1.PWMAdded pwm_added = 3; // pixels.proto - wippersnapper.pixels.v1.PixelsAdded pixels_added = 1; + wippersnapper.pixels.v1.PixelsAdded pixels_added = 4; // ds18x20.proto - wippersnapper.ds18x20.v1.Ds18x20Added ds18x20_added = 1; - wippersnapper.ds18x20.v1.Ds18x20Event ds18x20_event = 2; + wippersnapper.ds18x20.v1.Ds18x20Added ds18x20_added = 5; + wippersnapper.ds18x20.v1.Ds18x20Event ds18x20_event = 6; // uart.proto - wippersnapper.uart.v1.UARTAdded uart_added = 1; - wippersnapper.uart.v1.UARTEvent uart_event = 2; + wippersnapper.uart.v1.UARTAdded uart_added = 7; + wippersnapper.uart.v1.UARTEvent uart_event = 8; // i2c.proto - wippersnapper.i2c.v1.I2CScanResponse resp_i2c_scan = 2; - wippersnapper.i2c.v1.I2CAdded i2c_added = 3; - wippersnapper.i2c.v1.I2CRemoved i2c_removed = 4; - wippersnapper.i2c.v1.I2CEvent i2c_event = 6; + wippersnapper.i2c.v1.I2CScanResponse resp_i2c_scan = 9; + wippersnapper.i2c.v1.I2CAdded i2c_added = 10; + wippersnapper.i2c.v1.I2CRemoved i2c_removed = 11; + wippersnapper.i2c.v1.I2CEvent i2c_event = 12; } } diff --git a/proto/wippersnapper/uart/v1/uart.proto b/proto/wippersnapper/uart/v1/uart.proto index 4fb28f85..8955184a 100644 --- a/proto/wippersnapper/uart/v1/uart.proto +++ b/proto/wippersnapper/uart/v1/uart.proto @@ -4,11 +4,11 @@ syntax = "proto3"; package wippersnapper.uart.v1; import "nanopb/nanopb.proto"; -import "wippersnapper/sensor/sensor.proto"; +import "wippersnapper/sensor/v1/sensor.proto"; /** * UARTBusData represents a message to configure a UART bus for communication with a device. -* NOTE: This message is never sent directly, it is packed inside UARTDeviceAttach. +* NOTE: This message is never sent directly, it is packed inside UARTDeviceAdd. */ message UARTBusData { int32 baudrate = 1; /** The baudrate to use for UART communication (may be a common baud rate such as: 1200bps, 2400bps, 4800bps, 19200bps, 38400bps, 57600bps, or 115200bps). */ @@ -18,28 +18,28 @@ message UARTBusData { } /** -* UARTDeviceAttach represents a message sent from IO to a device +* UARTDeviceAdd represents a message sent from IO to a device * to configure the UART bus (if not already configured) and attach a device. */ -message UARTDeviceAttach { +message UARTDeviceAdd { UARTBusData bus_info = 1; /** The UART bus configuration. */ string device_id = 2[(nanopb).max_size = 15]; /** The unique identifier of the device to attach to the UART bus, from Adafruit_WipperSnapper_Components. */ int32 polling_interval = 3; /** The polling interval, in milliseconds, to use for the device. */ } /** -* UARTDeviceAttachResponse represents a message sent from a device to IO to +* UARTAdded represents a message sent from a device to IO to * confirm that a device has been attached to the UART bus. */ -message UARTDeviceAttachResponse { +message UARTAdded { string device_id = 1[(nanopb).max_size = 15]; /** The unique identifier of the device to attach to the UART bus, from Adafruit_WipperSnapper_Components. */ bool is_success = 2; /** True if the UARTInit was successful, False otherwise. */ } /** -* UARTDeviceEvent represents incoming data from a UART sensor. +* UARTEvent represents incoming data from a UART sensor. */ -message UARTDeviceEvent { +message UARTEvent { string device_id = 1[(nanopb).max_size = 15]; /** The unique identifier of the device to attach to the UART bus, from Adafruit_WipperSnapper_Components. */ repeated wippersnapper.sensor.v1.SensorEvent sensor_event = 2[(nanopb).max_count = 15]; /** A, optionally repeated, SensorEvent from a sensor. */ } From 5a60b073032c29999d44080d59f83d8c7f0a4f04 Mon Sep 17 00:00:00 2001 From: brentru Date: Mon, 6 Nov 2023 12:48:32 -0500 Subject: [PATCH 006/188] bring uart remove into signal.proto too --- proto/wippersnapper/signal/v1/signal.proto | 10 +++++----- proto/wippersnapper/uart/v1/uart.md | 2 +- proto/wippersnapper/uart/v1/uart.proto | 10 +++++----- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/proto/wippersnapper/signal/v1/signal.proto b/proto/wippersnapper/signal/v1/signal.proto index 15851358..53728028 100644 --- a/proto/wippersnapper/signal/v1/signal.proto +++ b/proto/wippersnapper/signal/v1/signal.proto @@ -40,12 +40,12 @@ message BrokerToDevice { wippersnapper.ds18x20.v1.Ds18x20Add ds18x20_init = 13; wippersnapper.ds18x20.v1.Ds18x20Remove ds18x20_deinit = 14; // uart.proto - wippersnapper.uart.v1.UARTDeviceAdd uart_device_add = 15; - // TODO: add uart detach once merged into master + wippersnapper.uart.v1.UARTAdd uart_add = 15; + wippersnapper.uart.v1.UARTRemove uart_remove = 16; // i2c.proto - wippersnapper.i2c.v1.I2CScan i2c_scan = 16; - wippersnapper.i2c.v1.I2CInits i2c_add = 17; - wippersnapper.i2c.v1.I2CRemove i2c_remove = 18; + wippersnapper.i2c.v1.I2CScan i2c_scan = 17; + wippersnapper.i2c.v1.I2CInits i2c_add = 18; + wippersnapper.i2c.v1.I2CRemove i2c_remove = 19; } } diff --git a/proto/wippersnapper/uart/v1/uart.md b/proto/wippersnapper/uart/v1/uart.md index 2e697d6e..768d60ba 100644 --- a/proto/wippersnapper/uart/v1/uart.md +++ b/proto/wippersnapper/uart/v1/uart.md @@ -51,7 +51,7 @@ IO Broker -->>IO Backend: Parse out repeated sensor_event into apropriate feeds sequenceDiagram autonumber -IO Broker --> Device: UARTDeviceDetachRequest +IO Broker --> Device: UARTRemove Device --> UART Class: Detach UART device from UART bus according to device_id. ``` diff --git a/proto/wippersnapper/uart/v1/uart.proto b/proto/wippersnapper/uart/v1/uart.proto index f4c3186e..17b08734 100644 --- a/proto/wippersnapper/uart/v1/uart.proto +++ b/proto/wippersnapper/uart/v1/uart.proto @@ -8,7 +8,7 @@ import "wippersnapper/sensor/v1/sensor.proto"; /** * UARTBusData represents a message to configure a UART bus for communication with a device. -* NOTE: This message is never sent directly, it is packed inside UARTDeviceAdd. +* NOTE: This message is never sent directly, it is packed inside UARTAdd. */ message UARTBusData { int32 baudrate = 1; /** The baudrate to use for UART communication (may be a common baud rate such as: 1200bps, 2400bps, 4800bps, 19200bps, 38400bps, 57600bps, or 115200bps). */ @@ -18,10 +18,10 @@ message UARTBusData { } /** -* UARTDeviceAdd represents a message sent from IO to a device +* UARTAdd represents a message sent from IO to a device * to configure the UART bus (if not already configured) and attach a device. */ -message UARTDeviceAdd { +message UARTAdd { UARTBusData bus_info = 1; /** The UART bus configuration. */ string device_id = 2[(nanopb).max_size = 15]; /** The unique identifier of the device to attach to the UART bus, from Adafruit_WipperSnapper_Components. */ int32 polling_interval = 3; /** The polling interval, in milliseconds, to use for the device. */ @@ -37,10 +37,10 @@ message UARTAdded { } /* -* UARTDeviceDetachRequest represents a message sent from IO to a device +* UARTRemove represents a message sent from IO to a device * to detach a device from the UART bus. */ -message UARTDeviceDetachRequest { +message UARTRemove { string device_id = 1[(nanopb).max_size = 15]; /** The unique identifier of the device to detach from the UART bus. */ } From b590556ac52162f79ec2a9e3160bacaeb374a270 Mon Sep 17 00:00:00 2001 From: brentru Date: Thu, 9 Nov 2023 13:56:13 -0500 Subject: [PATCH 007/188] new pin api and error api --- .../wippersnapper/analogio/v1/analogio.proto | 34 +++++ .../description/v1/description.proto | 4 +- .../digitalio/v1/digitalio.proto | 35 +++++ proto/wippersnapper/error/v1/error.proto | 20 +++ proto/wippersnapper/pin/v1/pin.proto | 144 ------------------ proto/wippersnapper/signal/v1/signal.proto | 27 +++- 6 files changed, 112 insertions(+), 152 deletions(-) create mode 100644 proto/wippersnapper/analogio/v1/analogio.proto create mode 100644 proto/wippersnapper/digitalio/v1/digitalio.proto create mode 100644 proto/wippersnapper/error/v1/error.proto delete mode 100644 proto/wippersnapper/pin/v1/pin.proto diff --git a/proto/wippersnapper/analogio/v1/analogio.proto b/proto/wippersnapper/analogio/v1/analogio.proto new file mode 100644 index 00000000..f300b925 --- /dev/null +++ b/proto/wippersnapper/analogio/v1/analogio.proto @@ -0,0 +1,34 @@ +// SPDX-FileCopyrightText: 2023 Brent Rubell, Loren Norman, Tyeth Gundry for Adafruit Industries +// SPDX-License-Identifier: MIT +syntax = "proto3"; + +package wippersnapper.analogio.v1; +import "nanopb/nanopb.proto"; +import "wippersnapper/sensor/v1/sensor.proto"; + +message AnalogIOAdd { + int32 gpio_num = 1; // correlates with `name` in the JSON + float period = 2; + AnalogReadMode read_mode = 3; + + /** + * Selects the type of value read by an analog pin. + * PIN_VALUE: Raw ADC reading. + * PIN_VOLTAGE: Calculated voltage reading. + */ + enum AnalogReadMode { + ANALOG_READ_MODE_UNSPECIFIED = 0; + ANALOG_READ_MODE_PIN_VALUE = 1; + ANALOG_READ_MODE_PIN_VOLTAGE = 2; + } +} + +message AnalogIORemove { + int32 gpio_num = 1; // correlates with `name` in the JSON +} + + +message AnalogIOEvent { + int32 gpio_num = 1; // correlates with `name` in the JSON + wippersnapper.sensor.v1.SensorEvent sensor_event = 2[(nanopb).max_count = 15]; /** A, optionally repeated, SensorEvent from a sensor. */ +} diff --git a/proto/wippersnapper/description/v1/description.proto b/proto/wippersnapper/description/v1/description.proto index 9286e5a2..70195b1c 100644 --- a/proto/wippersnapper/description/v1/description.proto +++ b/proto/wippersnapper/description/v1/description.proto @@ -10,9 +10,7 @@ import "nanopb/nanopb.proto"; * CreateDescriptionRequest identifies a device with Adafruit.io WipperSnapper. */ message CreateDescriptionRequest { - string machine_name = 1 [(nanopb).max_size = 64]; /** Identifies client's physical hardware */ - int32 mac_addr = 2; /** Client's UID, last 3 bytes of MAC address */ - string str_version = 15 [(nanopb).max_size = 20]; /** Library version, as a string */ + string str_version = 1 [(nanopb).max_size = 20]; /** Library version, as a string */ } // TODO: Consider dropping this, and compiling these as a header file (per-board) from the diff --git a/proto/wippersnapper/digitalio/v1/digitalio.proto b/proto/wippersnapper/digitalio/v1/digitalio.proto new file mode 100644 index 00000000..50e7851b --- /dev/null +++ b/proto/wippersnapper/digitalio/v1/digitalio.proto @@ -0,0 +1,35 @@ +// SPDX-FileCopyrightText: 2023 Brent Rubell, Loren Norman, Tyeth Gundry for Adafruit Industries +// SPDX-License-Identifier: MIT +syntax = "proto3"; + +package wippersnapper.digitalio.v1; +import "nanopb/nanopb.proto"; +import "wippersnapper/sensor/v1/sensor.proto"; + +// DigitalInput is a digital input pin. +message DigitalIOAdd { + int32 gpio_num = 1; // correlates with `name` in the JSON + DigitalIODirection gpio_direction = 2; + float period = 3; /** Optionally specifies the time between measurements, in seconds. */ + bool value = 4; /** For sync only - optionally send the pin's value. */ + + /** + * Direction. Specifies the pin's direction, INPUT or OUTPUT. + */ + enum DigitalIODirection { + DIRECTION_UNSPECIFIED = 0; /** Invalid Direction from Broker. */ + DIRECTION_INPUT = 1; /** Set the pin to behave as an input. */ + DIRECTION_INPUT_PULL_UP = 2; /** Set the pin to behave as an input. */ + DIRECTION_OUTPUT = 3; /** Set the pin to behave as an output. */ + } +} + +message DigitalIORemove { + int32 gpio_num = 1; // correlates with `name` in the JSON +} + +message DigitalIOEvent { + int32 gpio_num = 1; + bool value = 2; +} + diff --git a/proto/wippersnapper/error/v1/error.proto b/proto/wippersnapper/error/v1/error.proto new file mode 100644 index 00000000..c7751338 --- /dev/null +++ b/proto/wippersnapper/error/v1/error.proto @@ -0,0 +1,20 @@ +// SPDX-FileCopyrightText: 2023 Brent Rubell, Loren Norman, Tyeth Gundry for Adafruit Industries +// SPDX-License-Identifier: MIT +syntax = "proto3"; + +package wippersnapper.error.v1; +import "nanopb/nanopb.proto"; + +// TODO: Add error handling on the device-side to parse error +// message and either delay on throttle, or disconnect + exponential retry+jitter +// on ban time + +// Jitter should be unique to each device, possibly derived from its clientID + +message Error { +option (nanopb_msgopt).submsg_callback = true; // TODO: Do we need this option field? + oneof payload { + int32 ban_time = 1; + int32 throttle_time = 2; + } +} \ No newline at end of file diff --git a/proto/wippersnapper/pin/v1/pin.proto b/proto/wippersnapper/pin/v1/pin.proto deleted file mode 100644 index 745d1522..00000000 --- a/proto/wippersnapper/pin/v1/pin.proto +++ /dev/null @@ -1,144 +0,0 @@ -// SPDX-FileCopyrightText: 2020 Brent Rubell for Adafruit Industries -// SPDX-License-Identifier: MIT -syntax = "proto3"; - -package wippersnapper.pin.v1; -import "nanopb/nanopb.proto"; - -/** -* Mode. Specifies if a GPIO pin is an analog or digital pin. -*/ -enum Mode { - MODE_UNSPECIFIED = 0; /** Invalid Mode from Broker. */ - MODE_ANALOG = 1; /** Set up an analog pin. */ - MODE_DIGITAL = 2; /** Set up a digital pin. */ -} - -/** -* Represents a list of ConfigurePinRequest messages. -*/ -message ConfigurePinRequests { - repeated ConfigurePinRequest list = 1; -} - -/** - * Represents a request from the broker to create, update, or delete a GPIO pin. - */ -message ConfigurePinRequest { - string pin_name = 1 [(nanopb).max_size = 5]; /** The name of pin we are accessing. */ - Mode mode = 2; /** Specifies the pin's type, analog or input. */ - Direction direction = 3; /** Specifies the pin's behavior. */ - Pull pull = 4; /** Specifies an optional pullup resistor value. */ - float period = 5; /** Specifies the time between measurements, in seconds. */ - RequestType request_type = 6; /** Specifies the type of ConfigurePinRequest. */ - float aref = 7 [deprecated=true]; /** deprecated: Specifies the reference voltage used for analog input, defaults to 3.3v. */ - AnalogReadMode analog_read_mode = 8; /** ANALOG-ONLY: Specifies the read mode for an analog pin. */ - - /** - * Direction. Specifies the pin's direction, INPUT or OUTPUT. - */ - enum Direction { - DIRECTION_UNSPECIFIED = 0; /** Invalid Direction from Broker. */ - DIRECTION_INPUT = 1; /** Set the pin to behave as an input. */ - DIRECTION_OUTPUT = 2; /** Set the pin to behave as an output. */ - } - - /** - * Pull. An optional pullup resistor value - */ - enum Pull { - PULL_UNSPECIFIED = 0; /** Invalid Direction from Broker. */ - PULL_UP = 1; /** Set the pin to pull high. */ - PULL_DOWN = 2; /** Set the pin to pull low. */ - } - - /** - * Request Type. Describes the type of ConfigurePinRequest for the hardware to operate on. - */ - enum RequestType { - REQUEST_TYPE_UNSPECIFIED = 0; /** Invalid request from Broker. */ - REQUEST_TYPE_CREATE = 1; /** The request creates a pin. */ - REQUEST_TYPE_UPDATE = 2; /** The request updates a previously created pin. */ - REQUEST_TYPE_DELETE = 3; /** The request deletes a previously created pin. */ - } - - /** - * Selects the type of value read by an analog pin. - * PIN_VALUE: Raw ADC reading. - * PIN_VOLTAGE: Calculated voltage reading. - * NOTE: This is only applicable to analog pins. - */ - enum AnalogReadMode { - ANALOG_READ_MODE_UNSPECIFIED = 0; - ANALOG_READ_MODE_PIN_VALUE = 1; - ANALOG_READ_MODE_PIN_VOLTAGE = 2; - } - -} - - -/** -* Pin Event. Describes a pin's value. -*/ -message PinEvent { - string pin_name = 1 [(nanopb).max_size = 5]; /** Specifies the pin's name. */ - string pin_value = 2 [(nanopb).max_size = 12]; /** Specifies the pin's value. */ - - Mode mode = 3 [deprecated = true, (nanopb).type = FT_IGNORE]; /** DEPRECATED: Specifies the pin's mode, analog or digital. */ - float pin_value_volts = 4 [deprecated = true, (nanopb).type = FT_IGNORE]; /** DEPRECATED: Specifies an anlog pin's voltage. */ -} - -/** -* ConfigureReferenceVoltage - Changes the reference voltage used for analog inputs. -* Direction: C2D -*/ -message ConfigureReferenceVoltage { - float reference_voltage = 1; /** Specifies an ADC reference voltage. */ -} - -/** -* Sends a list of PinEvents -* NOTE: Not working with nanopb decode repeated -*/ -message PinEvents { - option deprecated = true; - repeated PinEvent list = 1; -} - -/* DEPRECATED - PWM Pin API */ - -// Configures a PWM output pin -message ConfigurePWMPinRequest { - option deprecated = true; - // Pin to write to - string pin_name = 1 [(nanopb).max_size = 5, deprecated = true, (nanopb).type = FT_IGNORE]; - - // Duty cycle between always off (0) - // and always on (255) - int32 duty_cycle = 2 [deprecated = true, (nanopb).type = FT_IGNORE]; - - // Target frequency, in Hz - int32 frequency = 3 [deprecated = true, (nanopb).type = FT_IGNORE]; - - // If the frequency changes over time - // NOTE: CIRCUITPYTHON-API ONLY - bool variable_frequency = 4 [deprecated = true, (nanopb).type = FT_IGNORE]; -} - -message ConfigurePWMPinRequests { - option deprecated = true; - repeated ConfigurePWMPinRequest list = 1 [deprecated = true, (nanopb).type = FT_IGNORE]; -} - -// Write duty cycle to a pin PWM output pin -message PWMPinEvent { - option deprecated = true; - // Duty cycle between always off (0) - // and always on (255) - int32 duty_cycle = 2 [deprecated = true, (nanopb).type = FT_IGNORE]; -} - -message PWMPinEvents { - option deprecated = true; - repeated PWMPinEvent list = 1 [deprecated = true, (nanopb).type = FT_IGNORE]; -} \ No newline at end of file diff --git a/proto/wippersnapper/signal/v1/signal.proto b/proto/wippersnapper/signal/v1/signal.proto index 53728028..84573d3d 100644 --- a/proto/wippersnapper/signal/v1/signal.proto +++ b/proto/wippersnapper/signal/v1/signal.proto @@ -5,7 +5,10 @@ syntax = "proto3"; package wippersnapper.signal.v1; // Non-WipperSnapper -import "nanopb/nanopb.proto";// WipperSnapper +import "nanopb/nanopb.proto"; + +// TODO: Shorten all of these files to: +// wippersnapper/*.proto import "wippersnapper/description/v1/description.proto"; import "wippersnapper/pin/v1/pin.proto"; import "wippersnapper/i2c/v1/i2c.proto"; @@ -14,12 +17,21 @@ import "wippersnapper/pwm/v1/pwm.proto"; import "wippersnapper/ds18x20/v1/ds18x20.proto"; import "wippersnapper/pixels/v1/pixels.proto"; import "wippersnapper/uart/v1/uart.proto"; +import "wippersnapper/error/v1/error.proto"; +import "wippersnapper/digitalio/v1/digitalio.proto"; +import "wippersnapper/analogio/v1/analogio.proto"; message BrokerToDevice { option (nanopb_msgopt).submsg_callback = true; oneof payload { - // TODO: Leaving pin.proto out as it'll be refactored + // digitalio.proto + wippersnapper.digitalio.v1.DigitalIOAdd digitalio_add = 1; + wippersnapper.digitalio.v1.DigitalIOAdd digitalio_remove = 2; + wippersnapper.digitalio.v1.DigitalIOEvent digitalio_event = 3; + // analogio.proto + wippersnapper.analogio.v1.AnalogIOAdd analogio_add = 4; + wippersnapper.analogio.v1.AnalogIOAdd analogio_remove = 5; // description.proto wippersnapper.description.v1.CreateDescription create_description = 1; // servo.proto @@ -37,8 +49,8 @@ message BrokerToDevice { wippersnapper.pixels.v1.PixelsRemove pixels_remove = 11; wippersnapper.pixels.v1.PixelsWrite pixels_write = 12; // ds18x20.proto - wippersnapper.ds18x20.v1.Ds18x20Add ds18x20_init = 13; - wippersnapper.ds18x20.v1.Ds18x20Remove ds18x20_deinit = 14; + wippersnapper.ds18x20.v1.Ds18x20Add ds18x20_add = 13; + wippersnapper.ds18x20.v1.Ds18x20Remove ds18x20_remove = 14; // uart.proto wippersnapper.uart.v1.UARTAdd uart_add = 15; wippersnapper.uart.v1.UARTRemove uart_remove = 16; @@ -46,13 +58,18 @@ message BrokerToDevice { wippersnapper.i2c.v1.I2CScan i2c_scan = 17; wippersnapper.i2c.v1.I2CInits i2c_add = 18; wippersnapper.i2c.v1.I2CRemove i2c_remove = 19; + // error.proto + wippersnapper.error.v1.Error error = 20; } } message DeviceToBroker { option (nanopb_msgopt).submsg_callback = true; oneof payload { - // TODO: move to pins.proto?: This is sent from the device2IO + //digitalio.proto + wippersnapper.digitalio.v1.DigitalIOEvent digitalio_event = 3; + // analogio.proto + wippersnapper.analogio.v1.AnalogIOEvent analogio_event = 5; // we may be able to get rid of it after removing `CreateDescription` bool configuration_complete = 1; // servo.proto From 4daacdca0701b7ea7938d8a4601a57ca49c922e3 Mon Sep 17 00:00:00 2001 From: tyeth Date: Thu, 9 Nov 2023 21:10:31 +0000 Subject: [PATCH 008/188] Update Enum numbering + remove redundant imports --- .../digitalio/v1/digitalio.proto | 1 - proto/wippersnapper/signal/v1/signal.proto | 71 +++++++++---------- 2 files changed, 35 insertions(+), 37 deletions(-) diff --git a/proto/wippersnapper/digitalio/v1/digitalio.proto b/proto/wippersnapper/digitalio/v1/digitalio.proto index 50e7851b..89dab2d6 100644 --- a/proto/wippersnapper/digitalio/v1/digitalio.proto +++ b/proto/wippersnapper/digitalio/v1/digitalio.proto @@ -4,7 +4,6 @@ syntax = "proto3"; package wippersnapper.digitalio.v1; import "nanopb/nanopb.proto"; -import "wippersnapper/sensor/v1/sensor.proto"; // DigitalInput is a digital input pin. message DigitalIOAdd { diff --git a/proto/wippersnapper/signal/v1/signal.proto b/proto/wippersnapper/signal/v1/signal.proto index 84573d3d..8ac0ec58 100644 --- a/proto/wippersnapper/signal/v1/signal.proto +++ b/proto/wippersnapper/signal/v1/signal.proto @@ -10,7 +10,6 @@ import "nanopb/nanopb.proto"; // TODO: Shorten all of these files to: // wippersnapper/*.proto import "wippersnapper/description/v1/description.proto"; -import "wippersnapper/pin/v1/pin.proto"; import "wippersnapper/i2c/v1/i2c.proto"; import "wippersnapper/servo/v1/servo.proto"; import "wippersnapper/pwm/v1/pwm.proto"; @@ -33,33 +32,33 @@ message BrokerToDevice { wippersnapper.analogio.v1.AnalogIOAdd analogio_add = 4; wippersnapper.analogio.v1.AnalogIOAdd analogio_remove = 5; // description.proto - wippersnapper.description.v1.CreateDescription create_description = 1; + wippersnapper.description.v1.CreateDescription create_description = 6; // servo.proto - wippersnapper.servo.v1.ServoAdd servo_add = 2; - wippersnapper.servo.v1.ServoRemove servo_remove = 3; - wippersnapper.servo.v1.ServoWrite servo_write = 4; + wippersnapper.servo.v1.ServoAdd servo_add = 7; + wippersnapper.servo.v1.ServoRemove servo_remove = 8; + wippersnapper.servo.v1.ServoWrite servo_write = 9; // pwm.proto - wippersnapper.pwm.v1.PWMAdd pwm_add = 5; - wippersnapper.pwm.v1.PWMRemove pwm_remove = 6; - wippersnapper.pwm.v1.PWMWriteDutyCycle pwm_write_duty = 7; - wippersnapper.pwm.v1.PWMWriteDutyCycleMulti pwm_write_duty_multi = 8; - wippersnapper.pwm.v1.PWMWriteFrequency pwm_write_freq = 9; + wippersnapper.pwm.v1.PWMAdd pwm_add = 10; + wippersnapper.pwm.v1.PWMRemove pwm_remove = 11; + wippersnapper.pwm.v1.PWMWriteDutyCycle pwm_write_duty = 12; + wippersnapper.pwm.v1.PWMWriteDutyCycleMulti pwm_write_duty_multi = 13; + wippersnapper.pwm.v1.PWMWriteFrequency pwm_write_freq = 14; // pixels.proto - wippersnapper.pixels.v1.PixelsAdd pixels_add = 10; - wippersnapper.pixels.v1.PixelsRemove pixels_remove = 11; - wippersnapper.pixels.v1.PixelsWrite pixels_write = 12; + wippersnapper.pixels.v1.PixelsAdd pixels_add = 15; + wippersnapper.pixels.v1.PixelsRemove pixels_remove = 16; + wippersnapper.pixels.v1.PixelsWrite pixels_write = 17; // ds18x20.proto - wippersnapper.ds18x20.v1.Ds18x20Add ds18x20_add = 13; - wippersnapper.ds18x20.v1.Ds18x20Remove ds18x20_remove = 14; + wippersnapper.ds18x20.v1.Ds18x20Add ds18x20_add = 18; + wippersnapper.ds18x20.v1.Ds18x20Remove ds18x20_remove = 19; // uart.proto - wippersnapper.uart.v1.UARTAdd uart_add = 15; - wippersnapper.uart.v1.UARTRemove uart_remove = 16; + wippersnapper.uart.v1.UARTAdd uart_add = 20; + wippersnapper.uart.v1.UARTRemove uart_remove = 21; // i2c.proto - wippersnapper.i2c.v1.I2CScan i2c_scan = 17; - wippersnapper.i2c.v1.I2CInits i2c_add = 18; - wippersnapper.i2c.v1.I2CRemove i2c_remove = 19; + wippersnapper.i2c.v1.I2CScan i2c_scan = 22; + wippersnapper.i2c.v1.I2CInits i2c_add = 23; + wippersnapper.i2c.v1.I2CRemove i2c_remove = 24; // error.proto - wippersnapper.error.v1.Error error = 20; + wippersnapper.error.v1.Error error = 25; } } @@ -67,27 +66,27 @@ message DeviceToBroker { option (nanopb_msgopt).submsg_callback = true; oneof payload { //digitalio.proto - wippersnapper.digitalio.v1.DigitalIOEvent digitalio_event = 3; + wippersnapper.digitalio.v1.DigitalIOEvent digitalio_event = 1; // analogio.proto - wippersnapper.analogio.v1.AnalogIOEvent analogio_event = 5; + wippersnapper.analogio.v1.AnalogIOEvent analogio_event = 2; // we may be able to get rid of it after removing `CreateDescription` - bool configuration_complete = 1; + bool configuration_complete = 3; // servo.proto - wippersnapper.servo.v1.ServoAdded servo_added = 2; + wippersnapper.servo.v1.ServoAdded servo_added = 4; // pwm.proto - wippersnapper.pwm.v1.PWMAdded pwm_added = 3; + wippersnapper.pwm.v1.PWMAdded pwm_added = 5; // pixels.proto - wippersnapper.pixels.v1.PixelsAdded pixels_added = 4; + wippersnapper.pixels.v1.PixelsAdded pixels_added = 6; // ds18x20.proto - wippersnapper.ds18x20.v1.Ds18x20Added ds18x20_added = 5; - wippersnapper.ds18x20.v1.Ds18x20Event ds18x20_event = 6; + wippersnapper.ds18x20.v1.Ds18x20Added ds18x20_added = 7; + wippersnapper.ds18x20.v1.Ds18x20Event ds18x20_event = 8; // uart.proto - wippersnapper.uart.v1.UARTAdded uart_added = 7; - wippersnapper.uart.v1.UARTEvent uart_event = 8; + wippersnapper.uart.v1.UARTAdded uart_added = 9; + wippersnapper.uart.v1.UARTEvent uart_event = 10; // i2c.proto - wippersnapper.i2c.v1.I2CScanResponse resp_i2c_scan = 9; - wippersnapper.i2c.v1.I2CAdded i2c_added = 10; - wippersnapper.i2c.v1.I2CRemoved i2c_removed = 11; - wippersnapper.i2c.v1.I2CEvent i2c_event = 12; + wippersnapper.i2c.v1.I2CScanResponse resp_i2c_scan = 11; + wippersnapper.i2c.v1.I2CAdded i2c_added = 12; + wippersnapper.i2c.v1.I2CRemoved i2c_removed = 13; + wippersnapper.i2c.v1.I2CEvent i2c_event = 14; } -} +} \ No newline at end of file From a8e116a93cc04751531649b9135c8a801a155cb7 Mon Sep 17 00:00:00 2001 From: brentru Date: Wed, 22 Nov 2023 16:39:40 -0500 Subject: [PATCH 009/188] loren comments and buf lint --- .../digitalio/v1/digitalio.proto | 8 +-- proto/wippersnapper/i2c/v1/i2c.proto | 8 --- proto/wippersnapper/pwm/v1/pwm.proto | 6 +- proto/wippersnapper/signal/v1/signal.proto | 71 +++++++++---------- 4 files changed, 42 insertions(+), 51 deletions(-) diff --git a/proto/wippersnapper/digitalio/v1/digitalio.proto b/proto/wippersnapper/digitalio/v1/digitalio.proto index 50e7851b..510375b8 100644 --- a/proto/wippersnapper/digitalio/v1/digitalio.proto +++ b/proto/wippersnapper/digitalio/v1/digitalio.proto @@ -17,10 +17,10 @@ message DigitalIOAdd { * Direction. Specifies the pin's direction, INPUT or OUTPUT. */ enum DigitalIODirection { - DIRECTION_UNSPECIFIED = 0; /** Invalid Direction from Broker. */ - DIRECTION_INPUT = 1; /** Set the pin to behave as an input. */ - DIRECTION_INPUT_PULL_UP = 2; /** Set the pin to behave as an input. */ - DIRECTION_OUTPUT = 3; /** Set the pin to behave as an output. */ + DIGITAL_IO_DIRECTION_UNSPECIFIED = 0; /** Invalid Direction from Broker. */ + DIGITAL_IO_DIRECTION_INPUT = 1; /** Set the pin to behave as an input. */ + DIGITAL_IO_DIRECTION_INPUT_PULL_UP = 2; /** Set the pin to behave as an input. */ + DIGITAL_IO_DIRECTION_OUTPUT = 3; /** Set the pin to behave as an output. */ } } diff --git a/proto/wippersnapper/i2c/v1/i2c.proto b/proto/wippersnapper/i2c/v1/i2c.proto index 79ef716b..f5da995d 100644 --- a/proto/wippersnapper/i2c/v1/i2c.proto +++ b/proto/wippersnapper/i2c/v1/i2c.proto @@ -67,14 +67,6 @@ message I2CSensorProperties { wippersnapper.sensor.v1.SensorType sensor_type = 1; } - -/** -* Represents a list of I2CInit messages. -*/ -message I2CInits { - repeated I2CInit list = 1; -} - /** * I2CInit is a wrapper message for * an I2C device initialization . diff --git a/proto/wippersnapper/pwm/v1/pwm.proto b/proto/wippersnapper/pwm/v1/pwm.proto index f4d5a68a..71cd5c90 100644 --- a/proto/wippersnapper/pwm/v1/pwm.proto +++ b/proto/wippersnapper/pwm/v1/pwm.proto @@ -35,7 +35,7 @@ message PWMRemove { } /** -* WriteDutyCycle represents a to write a duty cycle to a pin with a frequency (fixed). +* PWMWriteDutyCycle represents a to write a duty cycle to a pin with a frequency (fixed). * This is used for controlling LEDs. */ message PWMWriteDutyCycle { @@ -44,7 +44,7 @@ message PWMWriteDutyCycle { } /** -* WriteDutyCycle represents a wrapper to write duty cycles to multiple pins. +* PWMWriteDutyCycleMulti represents a wrapper to write duty cycles to multiple pins. * This is used for controlling RGB/RGBW LEDs. */ message PWMWriteDutyCycleMulti { @@ -52,7 +52,7 @@ message PWMWriteDutyCycleMulti { } /** -* WriteFrequency represents a to write a Frequency, in Hz, to a pin with a duty cycle of 50%. +* PWMWriteFrequency represents a to write a Frequency, in Hz, to a pin with a duty cycle of 50%. * This is used for playing tones using a piezo buzzer or speaker. */ message PWMWriteFrequency { diff --git a/proto/wippersnapper/signal/v1/signal.proto b/proto/wippersnapper/signal/v1/signal.proto index 84573d3d..93e3b770 100644 --- a/proto/wippersnapper/signal/v1/signal.proto +++ b/proto/wippersnapper/signal/v1/signal.proto @@ -10,7 +10,6 @@ import "nanopb/nanopb.proto"; // TODO: Shorten all of these files to: // wippersnapper/*.proto import "wippersnapper/description/v1/description.proto"; -import "wippersnapper/pin/v1/pin.proto"; import "wippersnapper/i2c/v1/i2c.proto"; import "wippersnapper/servo/v1/servo.proto"; import "wippersnapper/pwm/v1/pwm.proto"; @@ -27,39 +26,39 @@ message BrokerToDevice { oneof payload { // digitalio.proto wippersnapper.digitalio.v1.DigitalIOAdd digitalio_add = 1; - wippersnapper.digitalio.v1.DigitalIOAdd digitalio_remove = 2; + wippersnapper.digitalio.v1.DigitalIORemove digitalio_remove = 2; wippersnapper.digitalio.v1.DigitalIOEvent digitalio_event = 3; // analogio.proto wippersnapper.analogio.v1.AnalogIOAdd analogio_add = 4; wippersnapper.analogio.v1.AnalogIOAdd analogio_remove = 5; // description.proto - wippersnapper.description.v1.CreateDescription create_description = 1; + wippersnapper.description.v1.CreateDescription create_description = 6; // servo.proto - wippersnapper.servo.v1.ServoAdd servo_add = 2; - wippersnapper.servo.v1.ServoRemove servo_remove = 3; - wippersnapper.servo.v1.ServoWrite servo_write = 4; + wippersnapper.servo.v1.ServoAdd servo_add = 7; + wippersnapper.servo.v1.ServoRemove servo_remove = 8; + wippersnapper.servo.v1.ServoWrite servo_write = 9; // pwm.proto - wippersnapper.pwm.v1.PWMAdd pwm_add = 5; - wippersnapper.pwm.v1.PWMRemove pwm_remove = 6; - wippersnapper.pwm.v1.PWMWriteDutyCycle pwm_write_duty = 7; - wippersnapper.pwm.v1.PWMWriteDutyCycleMulti pwm_write_duty_multi = 8; - wippersnapper.pwm.v1.PWMWriteFrequency pwm_write_freq = 9; + wippersnapper.pwm.v1.PWMAdd pwm_add = 10; + wippersnapper.pwm.v1.PWMRemove pwm_remove = 11; + wippersnapper.pwm.v1.PWMWriteDutyCycle pwm_write_duty = 12; + wippersnapper.pwm.v1.PWMWriteDutyCycleMulti pwm_write_duty_multi = 13; + wippersnapper.pwm.v1.PWMWriteFrequency pwm_write_freq = 14; // pixels.proto - wippersnapper.pixels.v1.PixelsAdd pixels_add = 10; - wippersnapper.pixels.v1.PixelsRemove pixels_remove = 11; - wippersnapper.pixels.v1.PixelsWrite pixels_write = 12; + wippersnapper.pixels.v1.PixelsAdd pixels_add = 15; + wippersnapper.pixels.v1.PixelsRemove pixels_remove = 16; + wippersnapper.pixels.v1.PixelsWrite pixels_write = 17; // ds18x20.proto - wippersnapper.ds18x20.v1.Ds18x20Add ds18x20_add = 13; - wippersnapper.ds18x20.v1.Ds18x20Remove ds18x20_remove = 14; + wippersnapper.ds18x20.v1.Ds18x20Add ds18x20_add = 18; + wippersnapper.ds18x20.v1.Ds18x20Remove ds18x20_remove = 19; // uart.proto - wippersnapper.uart.v1.UARTAdd uart_add = 15; - wippersnapper.uart.v1.UARTRemove uart_remove = 16; + wippersnapper.uart.v1.UARTAdd uart_add = 20; + wippersnapper.uart.v1.UARTRemove uart_remove = 21; // i2c.proto - wippersnapper.i2c.v1.I2CScan i2c_scan = 17; - wippersnapper.i2c.v1.I2CInits i2c_add = 18; - wippersnapper.i2c.v1.I2CRemove i2c_remove = 19; + wippersnapper.i2c.v1.I2CScan i2c_scan = 22; + wippersnapper.i2c.v1.I2CInit i2c_add = 23; + wippersnapper.i2c.v1.I2CRemove i2c_remove = 24; // error.proto - wippersnapper.error.v1.Error error = 20; + wippersnapper.error.v1.Error error = 25; } } @@ -67,27 +66,27 @@ message DeviceToBroker { option (nanopb_msgopt).submsg_callback = true; oneof payload { //digitalio.proto - wippersnapper.digitalio.v1.DigitalIOEvent digitalio_event = 3; + wippersnapper.digitalio.v1.DigitalIOEvent digitalio_event = 1; // analogio.proto - wippersnapper.analogio.v1.AnalogIOEvent analogio_event = 5; + wippersnapper.analogio.v1.AnalogIOEvent analogio_event = 2; // we may be able to get rid of it after removing `CreateDescription` - bool configuration_complete = 1; + bool configuration_complete = 3; // servo.proto - wippersnapper.servo.v1.ServoAdded servo_added = 2; + wippersnapper.servo.v1.ServoAdded servo_added = 4; // pwm.proto - wippersnapper.pwm.v1.PWMAdded pwm_added = 3; + wippersnapper.pwm.v1.PWMAdded pwm_added = 5; // pixels.proto - wippersnapper.pixels.v1.PixelsAdded pixels_added = 4; + wippersnapper.pixels.v1.PixelsAdded pixels_added = 6; // ds18x20.proto - wippersnapper.ds18x20.v1.Ds18x20Added ds18x20_added = 5; - wippersnapper.ds18x20.v1.Ds18x20Event ds18x20_event = 6; + wippersnapper.ds18x20.v1.Ds18x20Added ds18x20_added = 7; + wippersnapper.ds18x20.v1.Ds18x20Event ds18x20_event = 8; // uart.proto - wippersnapper.uart.v1.UARTAdded uart_added = 7; - wippersnapper.uart.v1.UARTEvent uart_event = 8; + wippersnapper.uart.v1.UARTAdded uart_added = 9; + wippersnapper.uart.v1.UARTEvent uart_event = 10; // i2c.proto - wippersnapper.i2c.v1.I2CScanResponse resp_i2c_scan = 9; - wippersnapper.i2c.v1.I2CAdded i2c_added = 10; - wippersnapper.i2c.v1.I2CRemoved i2c_removed = 11; - wippersnapper.i2c.v1.I2CEvent i2c_event = 12; + wippersnapper.i2c.v1.I2CScanResponse resp_i2c_scan = 11; + wippersnapper.i2c.v1.I2CAdded i2c_added = 12; + wippersnapper.i2c.v1.I2CRemoved i2c_removed = 13; + wippersnapper.i2c.v1.I2CEvent i2c_event = 14; } } From e66fc450673e38a8883f5f10b52500943078c6b4 Mon Sep 17 00:00:00 2001 From: brentru Date: Thu, 30 Nov 2023 10:28:59 -0500 Subject: [PATCH 010/188] address some of petteri's review --- .../wippersnapper/analogio/v1/analogio.proto | 15 +++- .../digitalio/v1/digitalio.proto | 10 ++- proto/wippersnapper/ds18x20/v1/ds18x20.proto | 4 +- proto/wippersnapper/pwm/v1/pwm.proto | 2 +- proto/wippersnapper/servo/v1/servo.proto | 2 +- proto/wippersnapper/signal/v1/signal.proto | 81 ++++++++++--------- 6 files changed, 66 insertions(+), 48 deletions(-) diff --git a/proto/wippersnapper/analogio/v1/analogio.proto b/proto/wippersnapper/analogio/v1/analogio.proto index f300b925..d936eecf 100644 --- a/proto/wippersnapper/analogio/v1/analogio.proto +++ b/proto/wippersnapper/analogio/v1/analogio.proto @@ -6,10 +6,13 @@ package wippersnapper.analogio.v1; import "nanopb/nanopb.proto"; import "wippersnapper/sensor/v1/sensor.proto"; +/** +* AnalogIOAdd adds an analog pin to the device. +*/ message AnalogIOAdd { - int32 gpio_num = 1; // correlates with `name` in the JSON - float period = 2; - AnalogReadMode read_mode = 3; + int32 gpio_num = 1; // Correlates with `name` in the JSON definition + float period = 2; // Period is in seconds + AnalogReadMode read_mode = 3; // Type of value read by an analog pin. /** * Selects the type of value read by an analog pin. @@ -23,11 +26,17 @@ message AnalogIOAdd { } } +/** +* AnalogIORemove removes an analog pin from the device. +*/ message AnalogIORemove { int32 gpio_num = 1; // correlates with `name` in the JSON } +/** +* AnalogIOEvent is contains a value, sent when an analog pin is read. +*/ message AnalogIOEvent { int32 gpio_num = 1; // correlates with `name` in the JSON wippersnapper.sensor.v1.SensorEvent sensor_event = 2[(nanopb).max_count = 15]; /** A, optionally repeated, SensorEvent from a sensor. */ diff --git a/proto/wippersnapper/digitalio/v1/digitalio.proto b/proto/wippersnapper/digitalio/v1/digitalio.proto index 1b180837..85afa29a 100644 --- a/proto/wippersnapper/digitalio/v1/digitalio.proto +++ b/proto/wippersnapper/digitalio/v1/digitalio.proto @@ -5,7 +5,9 @@ syntax = "proto3"; package wippersnapper.digitalio.v1; import "nanopb/nanopb.proto"; -// DigitalInput is a digital input pin. +/** +* DigitalIOAdd adds a digital pin to the device. +*/ message DigitalIOAdd { int32 gpio_num = 1; // correlates with `name` in the JSON DigitalIODirection gpio_direction = 2; @@ -23,10 +25,16 @@ message DigitalIOAdd { } } +/** +* DigitalIORemove removes a digital pin from the device. +*/ message DigitalIORemove { int32 gpio_num = 1; // correlates with `name` in the JSON } +/** +* DigitalIOEvent is sent from the device to the broker when a digital pin's value changes. +*/ message DigitalIOEvent { int32 gpio_num = 1; bool value = 2; diff --git a/proto/wippersnapper/ds18x20/v1/ds18x20.proto b/proto/wippersnapper/ds18x20/v1/ds18x20.proto index 847d9d49..61e58fdd 100644 --- a/proto/wippersnapper/ds18x20/v1/ds18x20.proto +++ b/proto/wippersnapper/ds18x20/v1/ds18x20.proto @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2022 Brent Rubell for Adafruit Industries +// SPDX-FileCopyrightText: 2023 Brent Rubell for Adafruit Industries // SPDX-License-Identifier: MIT // WipperSnapper's Protobuf communication API for DS18X20 Maxim Temperature ICs @@ -11,7 +11,7 @@ import "wippersnapper/sensor/v1/sensor.proto"; /** * Ds18x20Add represents a to initialize * a DS18X20 Maxim temperature sensor, from the broker. -* NOTE: This API only supports ONE DS18X20 device PER OneWire bus. +* NOTE: This API currently only supports ONE device per OneWire bus. */ message Ds18x20Add { string onewire_pin = 1 [(nanopb).max_size = 5]; /** The desired pin to use as a OneWire bus. */ diff --git a/proto/wippersnapper/pwm/v1/pwm.proto b/proto/wippersnapper/pwm/v1/pwm.proto index 71cd5c90..d477c926 100644 --- a/proto/wippersnapper/pwm/v1/pwm.proto +++ b/proto/wippersnapper/pwm/v1/pwm.proto @@ -40,7 +40,7 @@ message PWMRemove { */ message PWMWriteDutyCycle { string pin = 1 [(nanopb).max_size = 6]; /** The pin to write to. */ - int32 duty_cycle = 2; /** The desired duty cycle to write. This value will be changed by the slider on Adafruit IO. **/ + int32 duty_cycle = 2; /** The desired duty cycle to write (range is from 0 to (2 ** duty_resolution)). This value will be changed by the slider on Adafruit IO. **/ } /** diff --git a/proto/wippersnapper/servo/v1/servo.proto b/proto/wippersnapper/servo/v1/servo.proto index 6a00e6f7..ecd06f34 100644 --- a/proto/wippersnapper/servo/v1/servo.proto +++ b/proto/wippersnapper/servo/v1/servo.proto @@ -33,7 +33,7 @@ message ServoRemove { /** * ServoWrite represents a message to write the servo's position. * -* NOTE: Position is sent from Adafruit IO as a pulse width in uS between 500uS +* NOTE: Position is sent from Adafruit IO as a pulse width in uS between 0uS * and 2500uS. The client application must convert pulse width to duty cycle w/fixed * freq of 50Hz prior to writing to the servo pin. */ diff --git a/proto/wippersnapper/signal/v1/signal.proto b/proto/wippersnapper/signal/v1/signal.proto index f1c9b961..6b5710d7 100644 --- a/proto/wippersnapper/signal/v1/signal.proto +++ b/proto/wippersnapper/signal/v1/signal.proto @@ -25,40 +25,40 @@ message BrokerToDevice { option (nanopb_msgopt).submsg_callback = true; oneof payload { // digitalio.proto - wippersnapper.digitalio.v1.DigitalIOAdd digitalio_add = 1; - wippersnapper.digitalio.v1.DigitalIORemove digitalio_remove = 2; - wippersnapper.digitalio.v1.DigitalIOEvent digitalio_event = 3; + wippersnapper.digitalio.v1.DigitalIOAdd digitalio_add = 10; + wippersnapper.digitalio.v1.DigitalIORemove digitalio_remove = 11; + wippersnapper.digitalio.v1.DigitalIOEvent digitalio_event = 12; // analogio.proto - wippersnapper.analogio.v1.AnalogIOAdd analogio_add = 4; - wippersnapper.analogio.v1.AnalogIOAdd analogio_remove = 5; + wippersnapper.analogio.v1.AnalogIOAdd analogio_add = 20; + wippersnapper.analogio.v1.AnalogIOAdd analogio_remove = 21; // description.proto - wippersnapper.description.v1.CreateDescription create_description = 6; + wippersnapper.description.v1.CreateDescription create_description = 30; // servo.proto - wippersnapper.servo.v1.ServoAdd servo_add = 7; - wippersnapper.servo.v1.ServoRemove servo_remove = 8; - wippersnapper.servo.v1.ServoWrite servo_write = 9; + wippersnapper.servo.v1.ServoAdd servo_add = 40; + wippersnapper.servo.v1.ServoRemove servo_remove = 41; + wippersnapper.servo.v1.ServoWrite servo_write = 42; // pwm.proto - wippersnapper.pwm.v1.PWMAdd pwm_add = 10; - wippersnapper.pwm.v1.PWMRemove pwm_remove = 11; - wippersnapper.pwm.v1.PWMWriteDutyCycle pwm_write_duty = 12; - wippersnapper.pwm.v1.PWMWriteDutyCycleMulti pwm_write_duty_multi = 13; - wippersnapper.pwm.v1.PWMWriteFrequency pwm_write_freq = 14; + wippersnapper.pwm.v1.PWMAdd pwm_add = 50; + wippersnapper.pwm.v1.PWMRemove pwm_remove = 51; + wippersnapper.pwm.v1.PWMWriteDutyCycle pwm_write_duty = 52; + wippersnapper.pwm.v1.PWMWriteDutyCycleMulti pwm_write_duty_multi = 53; + wippersnapper.pwm.v1.PWMWriteFrequency pwm_write_freq = 54; // pixels.proto - wippersnapper.pixels.v1.PixelsAdd pixels_add = 15; - wippersnapper.pixels.v1.PixelsRemove pixels_remove = 16; - wippersnapper.pixels.v1.PixelsWrite pixels_write = 17; + wippersnapper.pixels.v1.PixelsAdd pixels_add = 60; + wippersnapper.pixels.v1.PixelsRemove pixels_remove = 61; + wippersnapper.pixels.v1.PixelsWrite pixels_write = 62; // ds18x20.proto - wippersnapper.ds18x20.v1.Ds18x20Add ds18x20_add = 18; - wippersnapper.ds18x20.v1.Ds18x20Remove ds18x20_remove = 19; + wippersnapper.ds18x20.v1.Ds18x20Add ds18x20_add = 70; + wippersnapper.ds18x20.v1.Ds18x20Remove ds18x20_remove = 71; // uart.proto - wippersnapper.uart.v1.UARTAdd uart_add = 20; - wippersnapper.uart.v1.UARTRemove uart_remove = 21; + wippersnapper.uart.v1.UARTAdd uart_add = 80; + wippersnapper.uart.v1.UARTRemove uart_remove = 81; // i2c.proto - wippersnapper.i2c.v1.I2CScan i2c_scan = 22; - wippersnapper.i2c.v1.I2CInit i2c_add = 23; - wippersnapper.i2c.v1.I2CRemove i2c_remove = 24; + wippersnapper.i2c.v1.I2CScan i2c_scan = 90; + wippersnapper.i2c.v1.I2CInit i2c_add = 91; + wippersnapper.i2c.v1.I2CRemove i2c_remove = 92; // error.proto - wippersnapper.error.v1.Error error = 25; + wippersnapper.error.v1.Error error = 100; } } @@ -66,27 +66,28 @@ message DeviceToBroker { option (nanopb_msgopt).submsg_callback = true; oneof payload { //digitalio.proto - wippersnapper.digitalio.v1.DigitalIOEvent digitalio_event = 1; + wippersnapper.digitalio.v1.DigitalIOEvent digitalio_event = 10; // analogio.proto - wippersnapper.analogio.v1.AnalogIOEvent analogio_event = 2; - // we may be able to get rid of it after removing `CreateDescription` - bool configuration_complete = 3; + wippersnapper.analogio.v1.AnalogIOEvent analogio_event = 20; + // description.proto + // NOTE: we may be able to eventually remove this + wippersnapper.description.v1.RegistrationComplete registration_complete = 30; // servo.proto - wippersnapper.servo.v1.ServoAdded servo_added = 4; + wippersnapper.servo.v1.ServoAdded servo_added = 40; // pwm.proto - wippersnapper.pwm.v1.PWMAdded pwm_added = 5; + wippersnapper.pwm.v1.PWMAdded pwm_added = 50; // pixels.proto - wippersnapper.pixels.v1.PixelsAdded pixels_added = 6; + wippersnapper.pixels.v1.PixelsAdded pixels_added = 60; // ds18x20.proto - wippersnapper.ds18x20.v1.Ds18x20Added ds18x20_added = 7; - wippersnapper.ds18x20.v1.Ds18x20Event ds18x20_event = 8; + wippersnapper.ds18x20.v1.Ds18x20Added ds18x20_added = 70; + wippersnapper.ds18x20.v1.Ds18x20Event ds18x20_event = 80; // uart.proto - wippersnapper.uart.v1.UARTAdded uart_added = 9; - wippersnapper.uart.v1.UARTEvent uart_event = 10; + wippersnapper.uart.v1.UARTAdded uart_added = 90; + wippersnapper.uart.v1.UARTEvent uart_event = 100; // i2c.proto - wippersnapper.i2c.v1.I2CScanResponse resp_i2c_scan = 11; - wippersnapper.i2c.v1.I2CAdded i2c_added = 12; - wippersnapper.i2c.v1.I2CRemoved i2c_removed = 13; - wippersnapper.i2c.v1.I2CEvent i2c_event = 14; + wippersnapper.i2c.v1.I2CScanResponse resp_i2c_scan = 110; + wippersnapper.i2c.v1.I2CAdded i2c_added = 111; + wippersnapper.i2c.v1.I2CRemoved i2c_removed = 112; + wippersnapper.i2c.v1.I2CEvent i2c_event = 113; } } \ No newline at end of file From 2167089d28f8bddc1a3160da00cab49b0460d12c Mon Sep 17 00:00:00 2001 From: brentru Date: Fri, 1 Dec 2023 16:13:30 -0500 Subject: [PATCH 011/188] address petteri and lorens comments --- buf.yaml | 2 +- .../wippersnapper/analogio/v1/analogio.proto | 2 +- .../digitalio/v1/digitalio.proto | 20 +++++++--- proto/wippersnapper/sensor/v1/sensor.proto | 37 ++++++++++++++++++- 4 files changed, 52 insertions(+), 9 deletions(-) diff --git a/buf.yaml b/buf.yaml index 10acfeed..d8dc9abf 100644 --- a/buf.yaml +++ b/buf.yaml @@ -12,4 +12,4 @@ lint: # for accepting changes to finalized protobufs. #breaking: # use: -# - FILE +# - FILE \ No newline at end of file diff --git a/proto/wippersnapper/analogio/v1/analogio.proto b/proto/wippersnapper/analogio/v1/analogio.proto index d936eecf..f6a04235 100644 --- a/proto/wippersnapper/analogio/v1/analogio.proto +++ b/proto/wippersnapper/analogio/v1/analogio.proto @@ -39,5 +39,5 @@ message AnalogIORemove { */ message AnalogIOEvent { int32 gpio_num = 1; // correlates with `name` in the JSON - wippersnapper.sensor.v1.SensorEvent sensor_event = 2[(nanopb).max_count = 15]; /** A, optionally repeated, SensorEvent from a sensor. */ + wippersnapper.sensor.v1.SensorEvent sensor_event = 2; /** A, optionally repeated, SensorEvent from a sensor. */ } diff --git a/proto/wippersnapper/digitalio/v1/digitalio.proto b/proto/wippersnapper/digitalio/v1/digitalio.proto index 85afa29a..6c724c95 100644 --- a/proto/wippersnapper/digitalio/v1/digitalio.proto +++ b/proto/wippersnapper/digitalio/v1/digitalio.proto @@ -9,13 +9,23 @@ import "nanopb/nanopb.proto"; * DigitalIOAdd adds a digital pin to the device. */ message DigitalIOAdd { - int32 gpio_num = 1; // correlates with `name` in the JSON - DigitalIODirection gpio_direction = 2; - float period = 3; /** Optionally specifies the time between measurements, in seconds. */ - bool value = 4; /** For sync only - optionally send the pin's value. */ + int32 gpio_num = 1; /** The pin's GPIO number. */ + DigitalIODirection gpio_direction = 2; /** The pin's direction. */ + DigitalIOSampleMode sample_mode = 3; /** Specifies the pin's sample mode. */ + float period = 4; /** If sample_mode == DIGITAL_IO_SAMPLE_MODE_TIMER, this value specifies the time between measurements, in seconds. */ + bool value = 5; /** Filled by the broker on re-sync only - send the pin's value. */ + + /** + * DigitalIOSampleMode specifies the pin's sample mode. + */ + enum DigitalIOSampleMode { + DIGITAL_IO_SAMPLE_MODE_UNSPECIFIED = 0; /** Invalid Sample Mode from Broker. */ + DIGITAL_IO_SAMPLE_MODE_TIMER = 1; /** Periodically sample the pin's value. */ + DIGITAL_IO_SAMPLE_MODE_EVENT = 2; /** Sample the pin's value when an event occurs. */ + } /** - * Direction. Specifies the pin's direction, INPUT or OUTPUT. + * DigitalIODirection specifies the pin's direction, INPUT or OUTPUT. */ enum DigitalIODirection { DIGITAL_IO_DIRECTION_UNSPECIFIED = 0; /** Invalid Direction from Broker. */ diff --git a/proto/wippersnapper/sensor/v1/sensor.proto b/proto/wippersnapper/sensor/v1/sensor.proto index ac9389f5..751dc4c4 100644 --- a/proto/wippersnapper/sensor/v1/sensor.proto +++ b/proto/wippersnapper/sensor/v1/sensor.proto @@ -44,14 +44,47 @@ enum SensorType { SENSOR_TYPE_VOC_INDEX = 33; /** Values are an index from 1-500 with 100 being normal, "${$v} VOC".*/ SENSOR_TYPE_NOX_INDEX = 34; /** Values are an index from 1-500 with 100 being normal, "${$v} NOx".*/ SENSOR_TYPE_TVOC = 35; /** Values are in parts per billion (ppb), "${$v} ppb". */ + SENSOR_TYPE_BYTES = 36; /** Values are in bytes, "${$v} bytes". */ } /** * SensorEvent is used to return the sensor's value and type. */ message SensorEvent { - SensorType type = 1; /** The sensor's type and corresponding SI unit */ + SensorType type = 1; /** The sensor's type and corresponding SI unit */ oneof value { - float float_value = 2; /** The sensor's value as a float. */ + float float_value = 2; /** The sensor's value as a float. */ + bytes bytes_value = 3; /** The sensor's value as a byte array. */ + SensorEvent3DVector vector_value = 4; /** The sensor's 3D vector values, as floats. */ + SensorEventOrientation orientation_value = 5; /** The sensor's orientation values, as floats. */ + SensorEventColor color_value = 6; /** The sensor's color values, as floats. */ + } + + /** + * SensorEventColor is used to return a sensor's color values in RGB colorspace. + */ + message SensorEventColor { + float r = 1; /** The sensor's red channel value as a float. */ + float g = 2; /** The sensor's green channel value as a float. */ + float b = 3; /** The sensor's blue channel value as a float. */ + float a = 4; /** The sensor's (optional) alpha channel value as a float. */ + } + + /** + * SensorEvent3DVector is used to return a sensor's 3D vector values. + */ + message SensorEvent3DVector { + float x = 1; /** The sensor's x-axis value as a float. */ + float y = 2; /** The sensor's y-axis value as a float. */ + float z = 3; /** The sensor's z-axis value as a float. */ + } + + /** + * SensorEventOrientation is used to return an orientation sensor's values. + */ + message SensorEventOrientation { + float roll = 1; /** The sensor's roll value as a float. */ + float pitch = 2; /** The sensor's pitch value as a float. */ + float heading = 3; /** The sensor's heading value as a float. */ } } \ No newline at end of file From 022f697e708db565ae784fce91666754e304fc46 Mon Sep 17 00:00:00 2001 From: brentru Date: Fri, 8 Dec 2023 12:27:24 -0500 Subject: [PATCH 012/188] moved nanopb submodule to nanopb-0.4.8 --- nanopb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nanopb b/nanopb index 049485ff..6cfe48d6 160000 --- a/nanopb +++ b/nanopb @@ -1 +1 @@ -Subproject commit 049485ff557178f646d573eca3bd647f543b760b +Subproject commit 6cfe48d6f1593f8fa5c0f90437f5e6522587745e From 06cdc87252f52bdeec0eb182b74f3d16bacb64ce Mon Sep 17 00:00:00 2001 From: brentru Date: Mon, 11 Dec 2023 16:20:39 -0500 Subject: [PATCH 013/188] add .options files for 4 proto files --- proto/wippersnapper/analogio/v1/analogio.proto | 1 - .../description/v1/description.options | 2 ++ .../description/v1/description.proto | 5 ++--- proto/wippersnapper/digitalio/v1/digitalio.proto | 1 - proto/wippersnapper/ds18x20/v1/ds18x20.options | 4 ++++ proto/wippersnapper/ds18x20/v1/ds18x20.proto | 15 +++++++-------- proto/wippersnapper/signal/v1/signal.options | 3 +++ proto/wippersnapper/signal/v1/signal.proto | 1 - proto/wippersnapper/uart/v1/uart.options | 5 +++++ proto/wippersnapper/uart/v1/uart.proto | 15 +++++++-------- 10 files changed, 30 insertions(+), 22 deletions(-) create mode 100644 proto/wippersnapper/description/v1/description.options create mode 100644 proto/wippersnapper/ds18x20/v1/ds18x20.options create mode 100644 proto/wippersnapper/signal/v1/signal.options create mode 100644 proto/wippersnapper/uart/v1/uart.options diff --git a/proto/wippersnapper/analogio/v1/analogio.proto b/proto/wippersnapper/analogio/v1/analogio.proto index f6a04235..23e3edc4 100644 --- a/proto/wippersnapper/analogio/v1/analogio.proto +++ b/proto/wippersnapper/analogio/v1/analogio.proto @@ -3,7 +3,6 @@ syntax = "proto3"; package wippersnapper.analogio.v1; -import "nanopb/nanopb.proto"; import "wippersnapper/sensor/v1/sensor.proto"; /** diff --git a/proto/wippersnapper/description/v1/description.options b/proto/wippersnapper/description/v1/description.options new file mode 100644 index 00000000..801bd8b9 --- /dev/null +++ b/proto/wippersnapper/description/v1/description.options @@ -0,0 +1,2 @@ +# description.options +*.CreateDescriptionRequest.str_version max_size:20 \ No newline at end of file diff --git a/proto/wippersnapper/description/v1/description.proto b/proto/wippersnapper/description/v1/description.proto index 70195b1c..ab71c4c6 100644 --- a/proto/wippersnapper/description/v1/description.proto +++ b/proto/wippersnapper/description/v1/description.proto @@ -1,16 +1,15 @@ -// SPDX-FileCopyrightText: 2020-2021 Brent Rubell for Adafruit Industries +// SPDX-FileCopyrightText: 2020-2023 Brent Rubell for Adafruit Industries // SPDX-License-Identifier: MIT // Messages for describing hardware over the description topic syntax = "proto3"; package wippersnapper.description.v1; -import "nanopb/nanopb.proto"; /** * CreateDescriptionRequest identifies a device with Adafruit.io WipperSnapper. */ message CreateDescriptionRequest { - string str_version = 1 [(nanopb).max_size = 20]; /** Library version, as a string */ + string str_version = 1; /** Library version, as a string */ } // TODO: Consider dropping this, and compiling these as a header file (per-board) from the diff --git a/proto/wippersnapper/digitalio/v1/digitalio.proto b/proto/wippersnapper/digitalio/v1/digitalio.proto index 6c724c95..0ee02b0a 100644 --- a/proto/wippersnapper/digitalio/v1/digitalio.proto +++ b/proto/wippersnapper/digitalio/v1/digitalio.proto @@ -3,7 +3,6 @@ syntax = "proto3"; package wippersnapper.digitalio.v1; -import "nanopb/nanopb.proto"; /** * DigitalIOAdd adds a digital pin to the device. diff --git a/proto/wippersnapper/ds18x20/v1/ds18x20.options b/proto/wippersnapper/ds18x20/v1/ds18x20.options new file mode 100644 index 00000000..1acb3b6a --- /dev/null +++ b/proto/wippersnapper/ds18x20/v1/ds18x20.options @@ -0,0 +1,4 @@ +# ds18x20.options +*.ds18x20*.onewire_pin max_size:5 +*.Ds18x20Add.sensor_type max_count:2 +*.Ds18x20Event.sensor_event max_count:2 \ No newline at end of file diff --git a/proto/wippersnapper/ds18x20/v1/ds18x20.proto b/proto/wippersnapper/ds18x20/v1/ds18x20.proto index 61e58fdd..d21d830c 100644 --- a/proto/wippersnapper/ds18x20/v1/ds18x20.proto +++ b/proto/wippersnapper/ds18x20/v1/ds18x20.proto @@ -5,7 +5,6 @@ syntax = "proto3"; package wippersnapper.ds18x20.v1; -import "nanopb/nanopb.proto"; import "wippersnapper/sensor/v1/sensor.proto"; /** @@ -14,9 +13,9 @@ import "wippersnapper/sensor/v1/sensor.proto"; * NOTE: This API currently only supports ONE device per OneWire bus. */ message Ds18x20Add { - string onewire_pin = 1 [(nanopb).max_size = 5]; /** The desired pin to use as a OneWire bus. */ - int32 sensor_resolution = 2; /** The desired sensor resolution (9, 10, 11, or 12 bits). */ - repeated wippersnapper.sensor.v1.SensorType sensor_type = 3[(nanopb).max_count = 2]; /** Properties for the DS18x20 sensor. */ + string onewire_pin = 1; /** The desired pin to use as a OneWire bus. */ + int32 sensor_resolution = 2; /** The desired sensor resolution (9, 10, 11, or 12 bits). */ + repeated wippersnapper.sensor.v1.SensorType sensor_type = 3; /** Properties for the DS18x20 sensor. */ } /** @@ -25,7 +24,7 @@ message Ds18x20Add { */ message Ds18x20Added { bool is_initialized = 1; /** True if the 1-wire bus has been initialized successfully, False otherwise. */ - string onewire_pin = 2 [(nanopb).max_size = 5]; /** The pin being used as a OneWire bus. */ + string onewire_pin = 2; /** The pin being used as a OneWire bus. */ } /** @@ -33,13 +32,13 @@ message Ds18x20Added { * Maxim temperature sensor, from the broker. */ message Ds18x20Remove { - string onewire_pin = 1 [(nanopb).max_size = 5]; /** The desired onewire bus to de-initialize a DS18x sensor on and release. */ + string onewire_pin = 1; /** The desired onewire bus to de-initialize a DS18x sensor on and release. */ } /** * Ds18x20Event event represents data from **one** DS18X20 sensor. */ message Ds18x20Event { - string onewire_pin = 1 [(nanopb).max_size = 5]; /** The desired pin to use as a OneWire bus. */ - repeated wippersnapper.sensor.v1.SensorEvent sensor_event = 2 [(nanopb).max_count = 2]; /** The DS18X20's SensorEvent. */ + string onewire_pin = 1; /** The desired pin to use as a OneWire bus. */ + repeated wippersnapper.sensor.v1.SensorEvent sensor_event = 2; /** The DS18X20's SensorEvent. */ } \ No newline at end of file diff --git a/proto/wippersnapper/signal/v1/signal.options b/proto/wippersnapper/signal/v1/signal.options new file mode 100644 index 00000000..d2b378b7 --- /dev/null +++ b/proto/wippersnapper/signal/v1/signal.options @@ -0,0 +1,3 @@ +# signal.options +*.BrokerToDevice submsg_callback:true +*.DeviceToBroker submsg_callback:true \ No newline at end of file diff --git a/proto/wippersnapper/signal/v1/signal.proto b/proto/wippersnapper/signal/v1/signal.proto index 6b5710d7..4f4d9d94 100644 --- a/proto/wippersnapper/signal/v1/signal.proto +++ b/proto/wippersnapper/signal/v1/signal.proto @@ -22,7 +22,6 @@ import "wippersnapper/analogio/v1/analogio.proto"; message BrokerToDevice { - option (nanopb_msgopt).submsg_callback = true; oneof payload { // digitalio.proto wippersnapper.digitalio.v1.DigitalIOAdd digitalio_add = 10; diff --git a/proto/wippersnapper/uart/v1/uart.options b/proto/wippersnapper/uart/v1/uart.options new file mode 100644 index 00000000..7dbda737 --- /dev/null +++ b/proto/wippersnapper/uart/v1/uart.options @@ -0,0 +1,5 @@ +# uart.options +*.UART*.device_id max_size:15 +*.UARTBusData.pin_rx max_size:6 +*.UARTBusData.pin_tx max_size:6 +*.UARTEvent.sensor_event max_size:2 \ No newline at end of file diff --git a/proto/wippersnapper/uart/v1/uart.proto b/proto/wippersnapper/uart/v1/uart.proto index 17b08734..db03c580 100644 --- a/proto/wippersnapper/uart/v1/uart.proto +++ b/proto/wippersnapper/uart/v1/uart.proto @@ -3,7 +3,6 @@ syntax = "proto3"; package wippersnapper.uart.v1; -import "nanopb/nanopb.proto"; import "wippersnapper/sensor/v1/sensor.proto"; /** @@ -12,8 +11,8 @@ import "wippersnapper/sensor/v1/sensor.proto"; */ message UARTBusData { int32 baudrate = 1; /** The baudrate to use for UART communication (may be a common baud rate such as: 1200bps, 2400bps, 4800bps, 19200bps, 38400bps, 57600bps, or 115200bps). */ - string pin_rx = 2[(nanopb).max_size = 6]; /** The pin on which to receive UART stream data. */ - string pin_tx = 3[(nanopb).max_size = 6]; /** The pin on which to transmit UART stream data. */ + string pin_rx = 2; /** The pin on which to receive UART stream data. */ + string pin_tx = 3; /** The pin on which to transmit UART stream data. */ bool is_invert = 4; /** Inverts the UART signal on RX and TX pins. Defaults to False. */ } @@ -23,7 +22,7 @@ message UARTBusData { */ message UARTAdd { UARTBusData bus_info = 1; /** The UART bus configuration. */ - string device_id = 2[(nanopb).max_size = 15]; /** The unique identifier of the device to attach to the UART bus, from Adafruit_WipperSnapper_Components. */ + string device_id = 2; /** The unique identifier of the device to attach to the UART bus, from Adafruit_WipperSnapper_Components. */ int32 polling_interval = 3; /** The polling interval, in milliseconds, to use for the device. */ } @@ -32,7 +31,7 @@ message UARTAdd { * confirm that a device has been attached to the UART bus. */ message UARTAdded { - string device_id = 1[(nanopb).max_size = 15]; /** The unique identifier of the device to attach to the UART bus, from Adafruit_WipperSnapper_Components. */ + string device_id = 1; /** The unique identifier of the device to attach to the UART bus, from Adafruit_WipperSnapper_Components. */ bool is_success = 2; /** True if the UARTInit was successful, False otherwise. */ } @@ -41,13 +40,13 @@ message UARTAdded { * to detach a device from the UART bus. */ message UARTRemove { - string device_id = 1[(nanopb).max_size = 15]; /** The unique identifier of the device to detach from the UART bus. */ + string device_id = 1; /** The unique identifier of the device to detach from the UART bus. */ } /** * UARTEvent represents incoming data from a UART sensor. */ message UARTEvent { - string device_id = 1[(nanopb).max_size = 15]; /** The unique identifier of the device to attach to the UART bus, from Adafruit_WipperSnapper_Components. */ - repeated wippersnapper.sensor.v1.SensorEvent sensor_event = 2[(nanopb).max_count = 15]; /** A, optionally repeated, SensorEvent from a sensor. */ + string device_id = 1; /** The unique identifier of the device to attach to the UART bus, from Adafruit_WipperSnapper_Components. */ + repeated wippersnapper.sensor.v1.SensorEvent sensor_event = 2; /** A, optionally repeated, SensorEvent from a sensor. */ } From ae5776a403a2f672e3d0a6f98a5fb77d8d655bff Mon Sep 17 00:00:00 2001 From: brentru Date: Mon, 11 Dec 2023 16:22:16 -0500 Subject: [PATCH 014/188] max_count --- proto/wippersnapper/uart/v1/uart.options | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proto/wippersnapper/uart/v1/uart.options b/proto/wippersnapper/uart/v1/uart.options index 7dbda737..0e0349d5 100644 --- a/proto/wippersnapper/uart/v1/uart.options +++ b/proto/wippersnapper/uart/v1/uart.options @@ -1,5 +1,5 @@ # uart.options -*.UART*.device_id max_size:15 +*.UART*.device_id max_count:15 *.UARTBusData.pin_rx max_size:6 *.UARTBusData.pin_tx max_size:6 *.UARTEvent.sensor_event max_size:2 \ No newline at end of file From 607f0d5ffc13eceab7b54561497b4356e595761b Mon Sep 17 00:00:00 2001 From: brentru Date: Mon, 11 Dec 2023 16:45:07 -0500 Subject: [PATCH 015/188] add i2c .options file, remove deprecated feeds --- proto/wippersnapper/i2c/v1/i2c.options | 4 +++ proto/wippersnapper/i2c/v1/i2c.proto | 35 +++++++++++--------------- 2 files changed, 19 insertions(+), 20 deletions(-) create mode 100644 proto/wippersnapper/i2c/v1/i2c.options diff --git a/proto/wippersnapper/i2c/v1/i2c.options b/proto/wippersnapper/i2c/v1/i2c.options new file mode 100644 index 00000000..7dc7036a --- /dev/null +++ b/proto/wippersnapper/i2c/v1/i2c.options @@ -0,0 +1,4 @@ +# i2c.options +*.I2CScanResponse.addresses_found max_count:120 +*.I2CInit.i2c_device_name max_size:15 +*.I2CEvent.sensor_event max_count:15 \ No newline at end of file diff --git a/proto/wippersnapper/i2c/v1/i2c.proto b/proto/wippersnapper/i2c/v1/i2c.proto index f5da995d..dacbdfb4 100644 --- a/proto/wippersnapper/i2c/v1/i2c.proto +++ b/proto/wippersnapper/i2c/v1/i2c.proto @@ -1,9 +1,8 @@ -// SPDX-FileCopyrightText: 2021 Brent Rubell for Adafruit Industries +// SPDX-FileCopyrightText: 2021-2023 Brent Rubell for Adafruit Industries // SPDX-License-Identifier: MIT syntax = "proto3"; package wippersnapper.i2c.v1; -import "nanopb/nanopb.proto"; import "wippersnapper/sensor/v1/sensor.proto"; /** @@ -35,8 +34,7 @@ message I2CBusInit { * I2CBusInitResponse represents a response to I2CBusInit */ message I2CBusInitResponse { - bool is_initialized = 1 [deprecated = true, (nanopb).type = FT_IGNORE]; /** True if the I2C port has been initialized successfully, False otherwise. */ - BusResponse bus_response = 2; /** Whether the I2C bus initialized properly or failed. **/ + BusResponse bus_response = 1; /** Whether the I2C bus initialized properly or failed. **/ } @@ -45,8 +43,8 @@ message I2CBusInitResponse { * a device's I2C scan. */ message I2CScan { - int32 i2c_port_number = 1; /** The desired I2C port to scan. */ - I2CBusInit bus_init = 2; /** The I2C bus initialization . */ + int32 i2c_port_number = 1; /** The desired I2C port to scan. */ + I2CBusInit bus_init = 2; /** The I2C bus initialization . */ } /** @@ -54,7 +52,7 @@ message I2CScan { * found on the bus after I2CScan has executed. */ message I2CScanResponse { - repeated uint32 addresses_found = 1 [packed=true, (nanopb).max_count = 120]; /** The 7-bit addresses of the I2C devices found on the bus, empty if not found. */ + repeated uint32 addresses_found = 1 [packed=true]; /** The 7-bit addresses of the I2C devices found on the bus, empty if not found. */ BusResponse bus_response = 2; /** The I2C bus' status. **/ } @@ -73,10 +71,10 @@ message I2CSensorProperties { */ message I2CInit { int32 i2c_port_number = 1; /** The desired I2C port to initialize an I2C device on. */ - I2CBusInit i2c_bus_init_req = 2; /** An I2C bus initialization . */ + I2CBusInit i2c_bus_init_req = 2; /** An I2C bus initialization . */ uint32 i2c_device_address = 3; /** The 7-bit I2C address of the device on the bus. */ - string i2c_device_name = 4[(nanopb).max_size = 15]; /** The I2C device's name, MUST MATCH the name on the JSON definition file on https://github.com/adafruit/Wippersnapper_Components. */ - repeated wippersnapper.sensor.v1.SensorType sensor_type = 5[(nanopb).max_count = 15]; /** Properties of each sensor on the I2C device. */ + string i2c_device_name = 4; /** The I2C device's name, MUST MATCH the name on the JSON definition file on https://github.com/adafruit/Wippersnapper_Components. */ + repeated wippersnapper.sensor.v1.SensorType sensor_type = 5; /** Properties of each sensor on the I2C device. */ } /** @@ -84,9 +82,8 @@ message I2CInit { * device after processing a I2CInit message. */ message I2CAdded { - bool is_success = 1 [deprecated = true, (nanopb).type = FT_IGNORE]; /** !!DEPRECATED!! True if i2c device initialized successfully, false otherwise. */ - uint32 i2c_device_address = 2; /** The 7-bit I2C address of the device on the bus. */ - BusResponse bus_response = 3; /** The I2C bus' status. **/ + uint32 i2c_device_address = 1; /** The 7-bit I2C address of the device on the bus. */ + BusResponse bus_response = 2; /** The I2C bus' status. **/ } @@ -96,8 +93,7 @@ message I2CAdded { */ message I2CUpdateResponse { uint32 i2c_device_address = 1; /** The 7-bit I2C address of the device which was updated. */ - bool is_success = 2 [deprecated = true, (nanopb).type = FT_IGNORE]; /** !!DEPRECATED!! True if the update succeeded, False otherwise. */ - BusResponse bus_response = 3; /** The I2C bus' status. **/ + BusResponse bus_response = 2; /** The I2C bus' status. **/ } /** @@ -114,9 +110,8 @@ message I2CRemove { * sensor(s) is/are successfully de-initialized. */ message I2CRemoved { - bool is_success = 1 [deprecated = true, (nanopb).type = FT_IGNORE]; /** True if the deinitialization succeeded, False otherwise. */ - uint32 i2c_device_address = 2; /** The 7-bit I2C address of the device which was initialized. */ - BusResponse bus_response = 3; /** The I2C bus' status. **/ + uint32 i2c_device_address = 1; /** The 7-bit I2C address of the device which was initialized. */ + BusResponse bus_response = 2; /** The I2C bus' status. **/ } @@ -126,6 +121,6 @@ message I2CRemoved { * the I2C device contains > 1 sensor. */ message I2CEvent { - uint32 sensor_address = 1; /** The 7-bit I2C address of the I2C device. */ - repeated wippersnapper.sensor.v1.SensorEvent sensor_event = 2[(nanopb).max_count = 15]; /** A, optionally repeated, SensorEvent from a sensor. */ + uint32 sensor_address = 1; /** The 7-bit I2C address of the I2C device. */ + repeated wippersnapper.sensor.v1.SensorEvent sensor_event = 2; /** A, optionally repeated, SensorEvent from a sensor. */ } From ff5c50ca5540475b783395601ab5c87e57244931 Mon Sep 17 00:00:00 2001 From: brentru Date: Tue, 12 Dec 2023 10:41:25 -0500 Subject: [PATCH 016/188] add options for the rest of the files within proto/ that require it, strip nanopb dep off the rest --- .gitignore | 2 ++ proto/wippersnapper/pixels/v1/pixels.options | 5 +++++ proto/wippersnapper/pixels/v1/pixels.proto | 15 +++++++-------- proto/wippersnapper/pwm/v1/pwm.options | 3 +++ proto/wippersnapper/pwm/v1/pwm.proto | 16 +++++++--------- proto/wippersnapper/sensor/v1/sensor.proto | 2 -- proto/wippersnapper/servo/v1/servo.options | 2 ++ proto/wippersnapper/servo/v1/servo.proto | 12 +++++------- 8 files changed, 31 insertions(+), 26 deletions(-) create mode 100644 proto/wippersnapper/pixels/v1/pixels.options create mode 100644 proto/wippersnapper/pwm/v1/pwm.options create mode 100644 proto/wippersnapper/servo/v1/servo.options diff --git a/.gitignore b/.gitignore index a83cb401..b23bc836 100644 --- a/.gitignore +++ b/.gitignore @@ -138,3 +138,5 @@ dmypy.json # Cython debug symbols cython_debug/ + +arduino_out/ diff --git a/proto/wippersnapper/pixels/v1/pixels.options b/proto/wippersnapper/pixels/v1/pixels.options new file mode 100644 index 00000000..0b3bb75d --- /dev/null +++ b/proto/wippersnapper/pixels/v1/pixels.options @@ -0,0 +1,5 @@ +# pixels.options +*.Pixels*.pixels_pin_data max_size: 6 +*.PixelsAdd.pixels_pin_neopixel max_size:6 +*.PixelsAdd.pixels_pin_dotstar_data max_size:6 +*.PixelsAdd.pixels_pin_dotstar_clock max_size:6 diff --git a/proto/wippersnapper/pixels/v1/pixels.proto b/proto/wippersnapper/pixels/v1/pixels.proto index d214651a..64471dfc 100644 --- a/proto/wippersnapper/pixels/v1/pixels.proto +++ b/proto/wippersnapper/pixels/v1/pixels.proto @@ -1,11 +1,10 @@ -// SPDX-FileCopyrightText: 2022 Brent Rubell for Adafruit Industries +// SPDX-FileCopyrightText: 2022-2023 Brent Rubell for Adafruit Industries // SPDX-License-Identifier: MIT // Addressable Pixels API for Adafruit WipperSnapper syntax = "proto3"; package wippersnapper.pixels.v1; -import "nanopb/nanopb.proto"; /** * PixelsType defines the type/model of pixel strand. @@ -41,9 +40,9 @@ message PixelsAdd { uint32 pixels_num = 2; /** Number of pixels attached to strand. */ PixelsOrder pixels_ordering = 3; /** Defines the pixel strand's color ordering. */ uint32 pixels_brightness = 4; /** Strand brightness, 0 to 255 */ - string pixels_pin_neopixel = 5 [(nanopb).max_size = 6]; /** Generic pin a NeoPixel strand is connected to. */ - string pixels_pin_dotstar_data = 6 [(nanopb).max_size = 6]; /** Data pin a DotStar strand is connected to. */ - string pixels_pin_dotstar_clock = 7 [(nanopb).max_size = 6]; /** Clock pin a DotStar strand is connected to. */ + string pixels_pin_neopixel = 5; /** Generic pin a NeoPixel strand is connected to. */ + string pixels_pin_dotstar_data = 6; /** Data pin a DotStar strand is connected to. */ + string pixels_pin_dotstar_clock = 7; /** Clock pin a DotStar strand is connected to. */ } /** @@ -52,7 +51,7 @@ message PixelsAdd { */ message PixelsAdded { bool is_success = 1; /** True if the strand initialized successfully, False otherwise. */ - string pixels_pin_data = 2 [(nanopb).max_size = 6]; /** Data pin the responding strand is connected to. */ + string pixels_pin_data = 2; /** Data pin the responding strand is connected to. */ } /** @@ -61,7 +60,7 @@ message PixelsAdded { */ message PixelsRemove { PixelsType pixels_type = 1; /** Defines the model/type of pixel strand */ - string pixels_pin_data = 2 [(nanopb).max_size = 6]; /** Data pin a strand is connected to. */ + string pixels_pin_data = 2; /** Data pin a strand is connected to. */ } /** @@ -70,6 +69,6 @@ message PixelsRemove { */ message PixelsWrite { PixelsType pixels_type = 1; /** Defines the model/type of pixel strand */ - string pixels_pin_data = 2 [(nanopb).max_size = 6]; /** Data pin a strand is connected to. */ + string pixels_pin_data = 2; /** Data pin a strand is connected to. */ uint32 pixels_color = 3; /* 32-bit color value. Most significant byte is white (for RGBW pixels) or ignored (for RGB pixels), next is red, then green, and least significant byte is blue. */ } diff --git a/proto/wippersnapper/pwm/v1/pwm.options b/proto/wippersnapper/pwm/v1/pwm.options new file mode 100644 index 00000000..6a32e212 --- /dev/null +++ b/proto/wippersnapper/pwm/v1/pwm.options @@ -0,0 +1,3 @@ +# pwm.options +*.PWM*.pin max_size:6 +*.PWMWriteDutyCycleMulti.write_duty_cycle_req max_count:4 \ No newline at end of file diff --git a/proto/wippersnapper/pwm/v1/pwm.proto b/proto/wippersnapper/pwm/v1/pwm.proto index d477c926..1ec3257b 100644 --- a/proto/wippersnapper/pwm/v1/pwm.proto +++ b/proto/wippersnapper/pwm/v1/pwm.proto @@ -1,9 +1,7 @@ -// SPDX-FileCopyrightText: 2022 Brent Rubell for Adafruit Industries +// SPDX-FileCopyrightText: 2022-2023 Brent Rubell for Adafruit Industries // SPDX-License-Identifier: MIT syntax = "proto3"; - package wippersnapper.pwm.v1; -import "nanopb/nanopb.proto"; /** * PWMAdd represents a to a device to attach/allocate a PWM pin. @@ -11,7 +9,7 @@ import "nanopb/nanopb.proto"; * On non-ESP32 Arduino, this does nothing. */ message PWMAdd { - string pin = 1 [(nanopb).max_size = 6]; /** The pin to be attached. */ + string pin = 1; /** The pin to be attached. */ int32 frequency = 2; /** PWM frequency of an analog pin, in Hz. **/ int32 resolution = 3; /** The resolution of an analog pin, in bits. **/ } @@ -21,7 +19,7 @@ message PWMAdd { * Add message. */ message PWMAdded { - string pin = 1 [(nanopb).max_size = 6]; /** The ed pin. */ + string pin = 1; /** The ed pin. */ bool did_attach = 2; /** True if Add successful, False otherwise. */ } @@ -31,7 +29,7 @@ message PWMAdded { * On non-ESP32 Arduino, this calls digitalWrite(LOW) on the pin */ message PWMRemove { - string pin = 1 [(nanopb).max_size = 6]; /** The PWM pin to de-initialized. */ + string pin = 1; /** The PWM pin to de-initialized. */ } /** @@ -39,7 +37,7 @@ message PWMRemove { * This is used for controlling LEDs. */ message PWMWriteDutyCycle { - string pin = 1 [(nanopb).max_size = 6]; /** The pin to write to. */ + string pin = 1; /** The pin to write to. */ int32 duty_cycle = 2; /** The desired duty cycle to write (range is from 0 to (2 ** duty_resolution)). This value will be changed by the slider on Adafruit IO. **/ } @@ -48,7 +46,7 @@ message PWMWriteDutyCycle { * This is used for controlling RGB/RGBW LEDs. */ message PWMWriteDutyCycleMulti { - repeated PWMWriteDutyCycle write_duty_cycle_req = 1 [(nanopb).max_count = 4]; + repeated PWMWriteDutyCycle write_duty_cycle_req = 1; } /** @@ -56,6 +54,6 @@ message PWMWriteDutyCycleMulti { * This is used for playing tones using a piezo buzzer or speaker. */ message PWMWriteFrequency { - string pin = 1 [(nanopb).max_size = 6]; /** The pin to write to. */ + string pin = 1; /** The pin to write to. */ int32 frequency = 2; /** The desired PWM frequency, in Hz. This value will be changed by the slider on Adafruit IO. **/ } \ No newline at end of file diff --git a/proto/wippersnapper/sensor/v1/sensor.proto b/proto/wippersnapper/sensor/v1/sensor.proto index 751dc4c4..d11bbd9b 100644 --- a/proto/wippersnapper/sensor/v1/sensor.proto +++ b/proto/wippersnapper/sensor/v1/sensor.proto @@ -1,9 +1,7 @@ // SPDX-FileCopyrightText: 2023 Brent Rubell, Loren Norman for Adafruit Industries // SPDX-License-Identifier: MIT syntax = "proto3"; - package wippersnapper.sensor.v1; -import "nanopb/nanopb.proto"; /** * SensorType allows us determine what types of units the sensor uses, etc. diff --git a/proto/wippersnapper/servo/v1/servo.options b/proto/wippersnapper/servo/v1/servo.options new file mode 100644 index 00000000..6e46a0c1 --- /dev/null +++ b/proto/wippersnapper/servo/v1/servo.options @@ -0,0 +1,2 @@ +# servo.options +*.servo*.servo_pin max_size:6 \ No newline at end of file diff --git a/proto/wippersnapper/servo/v1/servo.proto b/proto/wippersnapper/servo/v1/servo.proto index ecd06f34..071e6640 100644 --- a/proto/wippersnapper/servo/v1/servo.proto +++ b/proto/wippersnapper/servo/v1/servo.proto @@ -1,15 +1,13 @@ -// SPDX-FileCopyrightText: 2022 Brent Rubell for Adafruit Industries +// SPDX-FileCopyrightText: 2022-2023 Brent Rubell for Adafruit Industries // SPDX-License-Identifier: MIT syntax = "proto3"; - package wippersnapper.servo.v1; -import "nanopb/nanopb.proto"; /** * ServoAdd represents a request to attach a servo to a pin. */ message ServoAdd { - string servo_pin = 1 [(nanopb).max_size = 6]; /** The name of pin to attach a servo to. */ + string servo_pin = 1; /** The name of pin to attach a servo to. */ int32 servo_freq = 2; /** The overall PWM frequency, default sent by Adafruit IO is 50Hz. **/ int32 min_pulse_width = 3; /** The minimum pulse length in uS. Default sent by Adafruit IO is 500uS. **/ int32 max_pulse_width = 4; /** The maximum pulse length in uS. Default sent by Adafruit IO is 2500uS. **/ @@ -20,14 +18,14 @@ message ServoAdd { */ message ServoAdded { bool attach_success = 1; /** True if a servo was attached successfully, False otherwise. **/ - string servo_pin = 2 [(nanopb).max_size = 6]; /** The name of pin we're responding about. */ + string servo_pin = 2; /** The name of pin we're responding about. */ } /** * ServoRemove represents a request to detach a servo from a pin and de-initialize the pin for other uses. */ message ServoRemove { - string servo_pin = 1 [(nanopb).max_size = 5]; /** The name of pin to use as a servo pin. */ + string servo_pin = 1; /** The name of pin to use as a servo pin. */ } /** @@ -38,6 +36,6 @@ message ServoRemove { * freq of 50Hz prior to writing to the servo pin. */ message ServoWrite { - string servo_pin = 1 [(nanopb).max_size = 5]; /** The name of pin we're addressing. */ + string servo_pin = 1; /** The name of pin we're addressing. */ int32 pulse_width = 2; /** The pulse width to write to the servo, in uS **/ } From 16212ea952e990947f61ffcb874e9c2dccc65fcf Mon Sep 17 00:00:00 2001 From: brentru Date: Tue, 12 Dec 2023 11:28:19 -0500 Subject: [PATCH 017/188] protolint pass 1 --- .../wippersnapper/analogio/v1/analogio.proto | 14 +++--- .../description/v1/description.proto | 7 ++- .../digitalio/v1/digitalio.proto | 50 +++++++++---------- proto/wippersnapper/ds18x20/v1/ds18x20.proto | 4 +- proto/wippersnapper/error/v1/error.proto | 10 ++-- proto/wippersnapper/i2c/v1/i2c.proto | 22 ++++---- proto/wippersnapper/pixels/v1/pixels.proto | 9 ++-- proto/wippersnapper/pwm/v1/pwm.proto | 5 +- proto/wippersnapper/sensor/v1/sensor.proto | 13 ++--- proto/wippersnapper/uart/v1/uart.proto | 9 ++-- protolint.yml | 8 +++ 11 files changed, 82 insertions(+), 69 deletions(-) create mode 100644 protolint.yml diff --git a/proto/wippersnapper/analogio/v1/analogio.proto b/proto/wippersnapper/analogio/v1/analogio.proto index 23e3edc4..b69317b0 100644 --- a/proto/wippersnapper/analogio/v1/analogio.proto +++ b/proto/wippersnapper/analogio/v1/analogio.proto @@ -9,9 +9,9 @@ import "wippersnapper/sensor/v1/sensor.proto"; * AnalogIOAdd adds an analog pin to the device. */ message AnalogIOAdd { - int32 gpio_num = 1; // Correlates with `name` in the JSON definition - float period = 2; // Period is in seconds - AnalogReadMode read_mode = 3; // Type of value read by an analog pin. + int32 gpio_num = 1; // Correlates with `name` in the JSON definition + float period = 2; // Period is in seconds + AnalogReadMode read_mode = 3; // Type of value read by an analog pin. /** * Selects the type of value read by an analog pin. @@ -19,9 +19,9 @@ message AnalogIOAdd { * PIN_VOLTAGE: Calculated voltage reading. */ enum AnalogReadMode { - ANALOG_READ_MODE_UNSPECIFIED = 0; - ANALOG_READ_MODE_PIN_VALUE = 1; - ANALOG_READ_MODE_PIN_VOLTAGE = 2; + ANALOG_READ_MODE_UNSPECIFIED = 0; // Default value. + ANALOG_READ_MODE_PIN_VALUE = 1; // Raw ADC reading. + ANALOG_READ_MODE_PIN_VOLTAGE = 2; // Calculated voltage reading. } } @@ -38,5 +38,5 @@ message AnalogIORemove { */ message AnalogIOEvent { int32 gpio_num = 1; // correlates with `name` in the JSON - wippersnapper.sensor.v1.SensorEvent sensor_event = 2; /** A, optionally repeated, SensorEvent from a sensor. */ + wippersnapper.sensor.v1.SensorEvent sensor_event = 2; /** Reading(s) from an analog pin. */ } diff --git a/proto/wippersnapper/description/v1/description.proto b/proto/wippersnapper/description/v1/description.proto index ab71c4c6..7ee9ac6a 100644 --- a/proto/wippersnapper/description/v1/description.proto +++ b/proto/wippersnapper/description/v1/description.proto @@ -2,7 +2,6 @@ // SPDX-License-Identifier: MIT // Messages for describing hardware over the description topic syntax = "proto3"; - package wippersnapper.description.v1; /** @@ -24,8 +23,8 @@ message CreateDescriptionRequest { */ message CreateDescription { Response response = 1; /** Specifies if the hardware definition exists on the server. */ - int32 total_gpio_pins = 2; /** Specifies the number of GPIO pins on the client's physical hardware. */ - int32 total_analog_pins = 3; /** Specifies the number of analog pins on the client's physical hardware. */ + int32 total_gpio_pins = 2; /** Specifies the number of GPIO pins on the device. */ + int32 total_analog_pins = 3; /** Specifies the number of analog pins on the device. */ float reference_voltage = 4; /** Specifies the hardware's default reference voltage. */ int32 total_i2c_ports = 5; /** Specifies the number of hardware's I2C ports (i2cPorts[]). */ @@ -44,5 +43,5 @@ message CreateDescription { * its components and is ready for configuration messages. */ message RegistrationComplete { - bool is_complete = 1; /** True if device successfully configured its components, False otherwise. */ + bool is_complete = 1; /** Did the device successfully configure its components? */ } diff --git a/proto/wippersnapper/digitalio/v1/digitalio.proto b/proto/wippersnapper/digitalio/v1/digitalio.proto index 0ee02b0a..d21dacae 100644 --- a/proto/wippersnapper/digitalio/v1/digitalio.proto +++ b/proto/wippersnapper/digitalio/v1/digitalio.proto @@ -8,44 +8,44 @@ package wippersnapper.digitalio.v1; * DigitalIOAdd adds a digital pin to the device. */ message DigitalIOAdd { - int32 gpio_num = 1; /** The pin's GPIO number. */ - DigitalIODirection gpio_direction = 2; /** The pin's direction. */ - DigitalIOSampleMode sample_mode = 3; /** Specifies the pin's sample mode. */ - float period = 4; /** If sample_mode == DIGITAL_IO_SAMPLE_MODE_TIMER, this value specifies the time between measurements, in seconds. */ - bool value = 5; /** Filled by the broker on re-sync only - send the pin's value. */ + int32 gpio_num = 1; /** The pin's GPIO number. */ + DigitalIODirection gpio_direction = 2; /** The pin's direction. */ + DigitalIOSampleMode sample_mode = 3; /** Specifies the pin's sample mode. */ + float period = 4; /** Time between measurements in seconds, if MODE_TIMER. */ + bool value = 5; /** Re-sync only - send the pin's value. */ - /** - * DigitalIOSampleMode specifies the pin's sample mode. - */ - enum DigitalIOSampleMode { - DIGITAL_IO_SAMPLE_MODE_UNSPECIFIED = 0; /** Invalid Sample Mode from Broker. */ - DIGITAL_IO_SAMPLE_MODE_TIMER = 1; /** Periodically sample the pin's value. */ - DIGITAL_IO_SAMPLE_MODE_EVENT = 2; /** Sample the pin's value when an event occurs. */ - } + /** + * DigitalIOSampleMode specifies the pin's sample mode. + */ + enum DigitalIOSampleMode { + DIGITAL_IO_SAMPLE_MODE_UNSPECIFIED = 0; /** Invalid Sample Mode from Broker. */ + DIGITAL_IO_SAMPLE_MODE_TIMER = 1; /** Periodically sample the pin's value. */ + DIGITAL_IO_SAMPLE_MODE_EVENT = 2; /** Sample the pin's value when an event occurs. */ + } - /** - * DigitalIODirection specifies the pin's direction, INPUT or OUTPUT. - */ - enum DigitalIODirection { - DIGITAL_IO_DIRECTION_UNSPECIFIED = 0; /** Invalid Direction from Broker. */ - DIGITAL_IO_DIRECTION_INPUT = 1; /** Set the pin to behave as an input. */ - DIGITAL_IO_DIRECTION_INPUT_PULL_UP = 2; /** Set the pin to behave as an input. */ - DIGITAL_IO_DIRECTION_OUTPUT = 3; /** Set the pin to behave as an output. */ - } + /** + * DigitalIODirection specifies the pin's direction, INPUT or OUTPUT. + */ + enum DigitalIODirection { + DIGITAL_IO_DIRECTION_UNSPECIFIED = 0; /** Invalid Direction from Broker. */ + DIGITAL_IO_DIRECTION_INPUT = 1; /** Set the pin to behave as an input. */ + DIGITAL_IO_DIRECTION_INPUT_PULL_UP = 2; /** Set the pin to behave as an input. */ + DIGITAL_IO_DIRECTION_OUTPUT = 3; /** Set the pin to behave as an output. */ + } } /** * DigitalIORemove removes a digital pin from the device. */ message DigitalIORemove { - int32 gpio_num = 1; // correlates with `name` in the JSON + int32 gpio_num = 1; // correlates with `name` in the JSON } /** * DigitalIOEvent is sent from the device to the broker when a digital pin's value changes. */ message DigitalIOEvent { - int32 gpio_num = 1; - bool value = 2; + int32 gpio_num = 1; // correlates with `name` in the JSON + bool value = 2; // correlates with `value` in the JSON } diff --git a/proto/wippersnapper/ds18x20/v1/ds18x20.proto b/proto/wippersnapper/ds18x20/v1/ds18x20.proto index d21d830c..d6dfa18a 100644 --- a/proto/wippersnapper/ds18x20/v1/ds18x20.proto +++ b/proto/wippersnapper/ds18x20/v1/ds18x20.proto @@ -15,7 +15,7 @@ import "wippersnapper/sensor/v1/sensor.proto"; message Ds18x20Add { string onewire_pin = 1; /** The desired pin to use as a OneWire bus. */ int32 sensor_resolution = 2; /** The desired sensor resolution (9, 10, 11, or 12 bits). */ - repeated wippersnapper.sensor.v1.SensorType sensor_type = 3; /** Properties for the DS18x20 sensor. */ + repeated wippersnapper.sensor.v1.SensorType sensor_types = 3; /** Properties for the DS18x20 sensor. */ } /** @@ -40,5 +40,5 @@ message Ds18x20Remove { */ message Ds18x20Event { string onewire_pin = 1; /** The desired pin to use as a OneWire bus. */ - repeated wippersnapper.sensor.v1.SensorEvent sensor_event = 2; /** The DS18X20's SensorEvent. */ + repeated wippersnapper.sensor.v1.SensorEvent sensor_events = 2; /** The DS18X20's SensorEvent. */ } \ No newline at end of file diff --git a/proto/wippersnapper/error/v1/error.proto b/proto/wippersnapper/error/v1/error.proto index c7751338..afa6d8fe 100644 --- a/proto/wippersnapper/error/v1/error.proto +++ b/proto/wippersnapper/error/v1/error.proto @@ -12,9 +12,9 @@ import "nanopb/nanopb.proto"; // Jitter should be unique to each device, possibly derived from its clientID message Error { -option (nanopb_msgopt).submsg_callback = true; // TODO: Do we need this option field? - oneof payload { - int32 ban_time = 1; - int32 throttle_time = 2; - } + option (nanopb_msgopt).submsg_callback = true; // TODO: Do we need this option field? + oneof payload { + int32 ban_time = 1; // Account ban time, in seconds + int32 throttle_time = 2; // Account time, in seconds + } } \ No newline at end of file diff --git a/proto/wippersnapper/i2c/v1/i2c.proto b/proto/wippersnapper/i2c/v1/i2c.proto index dacbdfb4..040b235d 100644 --- a/proto/wippersnapper/i2c/v1/i2c.proto +++ b/proto/wippersnapper/i2c/v1/i2c.proto @@ -14,7 +14,8 @@ enum BusResponse { BUS_RESPONSE_ERROR_HANG = 2; /** I2C Bus hang, user should reset their board if this persists. **/ BUS_RESPONSE_ERROR_PULLUPS = 3; /** I2C bus failed to initialize - SDA or SCL needs a pull up. **/ BUS_RESPONSE_ERROR_WIRING = 4; /** I2C bus failed to communicate - Please check your wiring. **/ - BUS_RESPONSE_UNSUPPORTED_SENSOR = 5; /** WipperSnapper firmware is outdated and does not include the sensor type - Please update your WipperSnapper firmware. **/ + BUS_RESPONSE_UNSUPPORTED_SENSOR = 5; /** WipperSnapper firmware is outdated and does not include + the sensor type - Please update your WipperSnapper firmware. **/ BUS_RESPONSE_DEVICE_INIT_FAIL = 6; /** I2C device failed to initialize. **/ BUS_RESPONSE_DEVICE_DEINIT_FAIL = 7; /** I2C device failed to de-initialize. **/ } @@ -52,7 +53,7 @@ message I2CScan { * found on the bus after I2CScan has executed. */ message I2CScanResponse { - repeated uint32 addresses_found = 1 [packed=true]; /** The 7-bit addresses of the I2C devices found on the bus, empty if not found. */ + repeated uint32 found_addresses = 1 [packed=true]; /** The 7-bit addresses of the I2C devices found on the bus, empty if not found. */ BusResponse bus_response = 2; /** The I2C bus' status. **/ } @@ -62,7 +63,7 @@ message I2CScanResponse { * its type and period. */ message I2CSensorProperties { - wippersnapper.sensor.v1.SensorType sensor_type = 1; + wippersnapper.sensor.v1.SensorType sensor_type = 1; /** The type of I2C sensor. **/ } /** @@ -70,11 +71,12 @@ message I2CSensorProperties { * an I2C device initialization . */ message I2CInit { - int32 i2c_port_number = 1; /** The desired I2C port to initialize an I2C device on. */ - I2CBusInit i2c_bus_init_req = 2; /** An I2C bus initialization . */ - uint32 i2c_device_address = 3; /** The 7-bit I2C address of the device on the bus. */ - string i2c_device_name = 4; /** The I2C device's name, MUST MATCH the name on the JSON definition file on https://github.com/adafruit/Wippersnapper_Components. */ - repeated wippersnapper.sensor.v1.SensorType sensor_type = 5; /** Properties of each sensor on the I2C device. */ + int32 i2c_port_number = 1; /** The desired I2C port to initialize an I2C device on. */ + I2CBusInit i2c_bus_init_req = 2; /** An I2C bus initialization . */ + uint32 i2c_device_address = 3; /** The 7-bit I2C address of the device on the bus. */ + string i2c_device_name = 4; /** The I2C device's name, MUST MATCH the name on the JSON definition file on + https://github.com/adafruit/Wippersnapper_Components. */ + repeated wippersnapper.sensor.v1.SensorType sensor_types = 5; /** Properties of each sensor on the I2C device. */ } /** @@ -121,6 +123,6 @@ message I2CRemoved { * the I2C device contains > 1 sensor. */ message I2CEvent { - uint32 sensor_address = 1; /** The 7-bit I2C address of the I2C device. */ - repeated wippersnapper.sensor.v1.SensorEvent sensor_event = 2; /** A, optionally repeated, SensorEvent from a sensor. */ + uint32 sensor_address = 1; /** The 7-bit I2C address of the I2C device. */ + repeated wippersnapper.sensor.v1.SensorEvent sensor_events = 2; /** A, optionally repeated, SensorEvent from a sensor. */ } diff --git a/proto/wippersnapper/pixels/v1/pixels.proto b/proto/wippersnapper/pixels/v1/pixels.proto index 64471dfc..f586ca2c 100644 --- a/proto/wippersnapper/pixels/v1/pixels.proto +++ b/proto/wippersnapper/pixels/v1/pixels.proto @@ -10,9 +10,9 @@ package wippersnapper.pixels.v1; * PixelsType defines the type/model of pixel strand. */ enum PixelsType { - PIXELS_TYPE_UNSPECIFIED = 0; - PIXELS_TYPE_NEOPIXEL = 1; - PIXELS_TYPE_DOTSTAR = 2; + PIXELS_TYPE_UNSPECIFIED = 0; /** Unspecified pixel type, error. */ + PIXELS_TYPE_NEOPIXEL = 1; /** NeoPixel pixel strand. */ + PIXELS_TYPE_DOTSTAR = 2; /** DotStar pixel strand. */ } /** @@ -70,5 +70,6 @@ message PixelsRemove { message PixelsWrite { PixelsType pixels_type = 1; /** Defines the model/type of pixel strand */ string pixels_pin_data = 2; /** Data pin a strand is connected to. */ - uint32 pixels_color = 3; /* 32-bit color value. Most significant byte is white (for RGBW pixels) or ignored (for RGB pixels), next is red, then green, and least significant byte is blue. */ + uint32 pixels_color = 3; /* 32-bit color value. Most significant byte is white (for RGBW pixels) or ignored (for RGB pixels), + next is red, then green, and least significant byte is blue. */ } diff --git a/proto/wippersnapper/pwm/v1/pwm.proto b/proto/wippersnapper/pwm/v1/pwm.proto index 1ec3257b..465d5b85 100644 --- a/proto/wippersnapper/pwm/v1/pwm.proto +++ b/proto/wippersnapper/pwm/v1/pwm.proto @@ -38,7 +38,8 @@ message PWMRemove { */ message PWMWriteDutyCycle { string pin = 1; /** The pin to write to. */ - int32 duty_cycle = 2; /** The desired duty cycle to write (range is from 0 to (2 ** duty_resolution)). This value will be changed by the slider on Adafruit IO. **/ + int32 duty_cycle = 2; /** The desired duty cycle to write (range is from 0 to (2 ** duty_resolution)). + This value will be changed by the slider on Adafruit IO. **/ } /** @@ -46,7 +47,7 @@ message PWMWriteDutyCycle { * This is used for controlling RGB/RGBW LEDs. */ message PWMWriteDutyCycleMulti { - repeated PWMWriteDutyCycle write_duty_cycle_req = 1; + repeated PWMWriteDutyCycle write_duty_cycle_reqs = 1; /** Multiple duty cycles to write, one per pin of a RGB LED. **/ } /** diff --git a/proto/wippersnapper/sensor/v1/sensor.proto b/proto/wippersnapper/sensor/v1/sensor.proto index d11bbd9b..9bd30ae2 100644 --- a/proto/wippersnapper/sensor/v1/sensor.proto +++ b/proto/wippersnapper/sensor/v1/sensor.proto @@ -12,7 +12,8 @@ enum SensorType { SENSOR_TYPE_MAGNETIC_FIELD = 2; /** Magnetic field strength, in micro-Tesla, "{value}µT". */ SENSOR_TYPE_ORIENTATION = 3; /** Orientation angle, in degrees, "{value}°". */ SENSOR_TYPE_GYROSCOPE = 4; /** Angular rate, in radians per second, "{value}rad/s". */ - SENSOR_TYPE_LIGHT = 5; /** Light-level, non-unit-specific (For a unit-specific measurement, see: Lux), , "Raw Value: {value}". */ + SENSOR_TYPE_LIGHT = 5; /** Light-level, non-unit-specific (For a unit-specific measurement, see: Lux), + "Raw Value: {value}". */ SENSOR_TYPE_PRESSURE = 6; /** Pressure, in hectopascal, , "{value}hPa". */ SENSOR_TYPE_PROXIMITY = 8; /** Distance from an object to a sensor, non-unit-specific, "Raw Value: {value}". */ SENSOR_TYPE_GRAVITY = 9; /** Metres per second squared, "{value}m/s^2". */ @@ -38,7 +39,7 @@ enum SensorType { SENSOR_TYPE_ECO2 = 29; /** equivalent/estimated CO2 in ppm (estimated from some other measurement), "{value}ppm". */ SENSOR_TYPE_UNITLESS_PERCENT = 30; /** Percentage, unit-less, "{value}%". */ SENSOR_TYPE_AMBIENT_TEMPERATURE_FAHRENHEIT = 31; /** Temperature of the air around a sensor, in degrees Fahrenheit, "{value}°F". */ - SENSOR_TYPE_OBJECT_TEMPERATURE_FAHRENHEIT = 32; /** Temperature of the object a sensor is touching/pointed at, in degrees Fahrenheit, "{value}°F".*/ + SENSOR_TYPE_OBJECT_TEMPERATURE_FAHRENHEIT = 32; /** Temperature of the object a sensor is touching/pointed at, in Fahrenheit, "{value}°F".*/ SENSOR_TYPE_VOC_INDEX = 33; /** Values are an index from 1-500 with 100 being normal, "${$v} VOC".*/ SENSOR_TYPE_NOX_INDEX = 34; /** Values are an index from 1-500 with 100 being normal, "${$v} NOx".*/ SENSOR_TYPE_TVOC = 35; /** Values are in parts per billion (ppb), "${$v} ppb". */ @@ -62,10 +63,10 @@ message SensorEvent { * SensorEventColor is used to return a sensor's color values in RGB colorspace. */ message SensorEventColor { - float r = 1; /** The sensor's red channel value as a float. */ - float g = 2; /** The sensor's green channel value as a float. */ - float b = 3; /** The sensor's blue channel value as a float. */ - float a = 4; /** The sensor's (optional) alpha channel value as a float. */ + float r = 1; /** The sensor's red channel value as a float. */ + float g = 2; /** The sensor's green channel value as a float. */ + float b = 3; /** The sensor's blue channel value as a float. */ + float a = 4; /** The sensor's (optional) alpha channel value as a float. */ } /** diff --git a/proto/wippersnapper/uart/v1/uart.proto b/proto/wippersnapper/uart/v1/uart.proto index db03c580..e78d1aa0 100644 --- a/proto/wippersnapper/uart/v1/uart.proto +++ b/proto/wippersnapper/uart/v1/uart.proto @@ -10,7 +10,8 @@ import "wippersnapper/sensor/v1/sensor.proto"; * NOTE: This message is never sent directly, it is packed inside UARTAdd. */ message UARTBusData { - int32 baudrate = 1; /** The baudrate to use for UART communication (may be a common baud rate such as: 1200bps, 2400bps, 4800bps, 19200bps, 38400bps, 57600bps, or 115200bps). */ + int32 baudrate = 1; /** The baudrate to use for UART communication (may be a common baud rate such as: + 1200bps, 2400bps, 4800bps, 19200bps, 38400bps, 57600bps, or 115200bps). */ string pin_rx = 2; /** The pin on which to receive UART stream data. */ string pin_tx = 3; /** The pin on which to transmit UART stream data. */ bool is_invert = 4; /** Inverts the UART signal on RX and TX pins. Defaults to False. */ @@ -40,13 +41,13 @@ message UARTAdded { * to detach a device from the UART bus. */ message UARTRemove { - string device_id = 1; /** The unique identifier of the device to detach from the UART bus. */ + string device_id = 1; /** The unique identifier of the device to detach from the UART bus. */ } /** * UARTEvent represents incoming data from a UART sensor. */ message UARTEvent { - string device_id = 1; /** The unique identifier of the device to attach to the UART bus, from Adafruit_WipperSnapper_Components. */ - repeated wippersnapper.sensor.v1.SensorEvent sensor_event = 2; /** A, optionally repeated, SensorEvent from a sensor. */ + string device_id = 1; /** Unique identifier of the device to attach to the UART bus, from Adafruit_WipperSnapper_Components. */ + repeated wippersnapper.sensor.v1.SensorEvent sensor_events = 2; /** An optionally repeated event from a sensor. */ } diff --git a/protolint.yml b/protolint.yml new file mode 100644 index 00000000..7cbba0aa --- /dev/null +++ b/protolint.yml @@ -0,0 +1,8 @@ +--- +lint: + rules: + all_default: true + rules_option: + max_line_length: + max_chars: 150 + tab_chars: 2 \ No newline at end of file From 14e0bd837f8ac9820e581ba406e847078d797050 Mon Sep 17 00:00:00 2001 From: brentru Date: Tue, 12 Dec 2023 11:33:42 -0500 Subject: [PATCH 018/188] protolint pass 2 --- proto/wippersnapper/signal/v1/signal.proto | 25 ++++++++++++++++------ protolint.yml | 11 +++++++++- 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/proto/wippersnapper/signal/v1/signal.proto b/proto/wippersnapper/signal/v1/signal.proto index 4f4d9d94..825bf21f 100644 --- a/proto/wippersnapper/signal/v1/signal.proto +++ b/proto/wippersnapper/signal/v1/signal.proto @@ -9,18 +9,23 @@ import "nanopb/nanopb.proto"; // TODO: Shorten all of these files to: // wippersnapper/*.proto +import "wippersnapper/analogio/v1/analogio.proto"; import "wippersnapper/description/v1/description.proto"; -import "wippersnapper/i2c/v1/i2c.proto"; -import "wippersnapper/servo/v1/servo.proto"; -import "wippersnapper/pwm/v1/pwm.proto"; +import "wippersnapper/digitalio/v1/digitalio.proto"; import "wippersnapper/ds18x20/v1/ds18x20.proto"; +import "wippersnapper/error/v1/error.proto"; +import "wippersnapper/i2c/v1/i2c.proto"; import "wippersnapper/pixels/v1/pixels.proto"; +import "wippersnapper/pwm/v1/pwm.proto"; +import "wippersnapper/servo/v1/servo.proto"; import "wippersnapper/uart/v1/uart.proto"; -import "wippersnapper/error/v1/error.proto"; -import "wippersnapper/digitalio/v1/digitalio.proto"; -import "wippersnapper/analogio/v1/analogio.proto"; - +/* + * BrokerToDevice + * The BrokerToDevice message is sent from the broker to the device. + * It contains a oneof payload, which is a union of all the possible + * messages that can be sent from the broker to a device. + */ message BrokerToDevice { oneof payload { // digitalio.proto @@ -61,6 +66,12 @@ message BrokerToDevice { } } +/* + * DeviceToBroker + * The DeviceToBroker message is sent from the device to the broker. + * It contains a oneof payload, which is a union of all the possible + * messages that can be sent from a device to the broker. + */ message DeviceToBroker { option (nanopb_msgopt).submsg_callback = true; oneof payload { diff --git a/protolint.yml b/protolint.yml index 7cbba0aa..1ca8e8a3 100644 --- a/protolint.yml +++ b/protolint.yml @@ -1,3 +1,5 @@ +# Protolint configuration file for WipperSnapper +# configuration file reference: https://github.com/yoheimuta/protolint/blob/master/_example/config/.protolint.yaml --- lint: rules: @@ -5,4 +7,11 @@ lint: rules_option: max_line_length: max_chars: 150 - tab_chars: 2 \ No newline at end of file + tab_chars: 2 + ignores: + - id: FIELDS_HAVE_COMMENT + files: + - proto/wippersnapper/signal/v1/signal.proto + - id: MESSAGE_NAMES_EXCLUDE_PREPOSITIONS + files: + - proto/wippersnapper/signal/v1/signal.proto \ No newline at end of file From 3e143b6568b9c3ef2a7c9b418237268467162015 Mon Sep 17 00:00:00 2001 From: brentru Date: Tue, 12 Dec 2023 11:37:48 -0500 Subject: [PATCH 019/188] deprecate buf, use protolint instead! --- .github/workflows/buf-checks.yml | 20 -------------------- .github/workflows/protolint.yml | 14 ++++++++++++++ buf.yaml | 15 --------------- protolint.yml | 17 ----------------- 4 files changed, 14 insertions(+), 52 deletions(-) delete mode 100644 .github/workflows/buf-checks.yml create mode 100644 .github/workflows/protolint.yml delete mode 100644 buf.yaml delete mode 100644 protolint.yml diff --git a/.github/workflows/buf-checks.yml b/.github/workflows/buf-checks.yml deleted file mode 100644 index c9d1f4f9..00000000 --- a/.github/workflows/buf-checks.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: Linting and Backwards-Compatibility Checks -on: [pull_request] -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: checkout - if: success() - uses: actions/checkout@v1 - with: - ref: master - - name: checkout-master - if: success() - run: git checkout master - - name: checkout - if: success() - uses: actions/checkout@v1 - - name: make local - if: success() - run: make local diff --git a/.github/workflows/protolint.yml b/.github/workflows/protolint.yml new file mode 100644 index 00000000..82561a7a --- /dev/null +++ b/.github/workflows/protolint.yml @@ -0,0 +1,14 @@ +name: "lint protobuf" +on: pull_request + +jobs: + pr-check: + runs-on: ubuntu-latest + steps: + - name: checkout source + uses: actions/checkout@v3 + - name: run protolint + uses: plexsystems/protolint-action@v0.7.0 + with: + srcDirectory: proto/wippersnapper/* + configDirectory: .github/protolint.yaml \ No newline at end of file diff --git a/buf.yaml b/buf.yaml deleted file mode 100644 index d8dc9abf..00000000 --- a/buf.yaml +++ /dev/null @@ -1,15 +0,0 @@ -version: v1beta1 -build: - roots: - - proto -lint: - use: - - DEFAULT - ignore: - - nanopb/nanopb.proto -# TODO: Note that we've turned off breaking change detection -# while we develop the protobuffs, re-enable this in the repo -# for accepting changes to finalized protobufs. -#breaking: -# use: -# - FILE \ No newline at end of file diff --git a/protolint.yml b/protolint.yml deleted file mode 100644 index 1ca8e8a3..00000000 --- a/protolint.yml +++ /dev/null @@ -1,17 +0,0 @@ -# Protolint configuration file for WipperSnapper -# configuration file reference: https://github.com/yoheimuta/protolint/blob/master/_example/config/.protolint.yaml ---- -lint: - rules: - all_default: true - rules_option: - max_line_length: - max_chars: 150 - tab_chars: 2 - ignores: - - id: FIELDS_HAVE_COMMENT - files: - - proto/wippersnapper/signal/v1/signal.proto - - id: MESSAGE_NAMES_EXCLUDE_PREPOSITIONS - files: - - proto/wippersnapper/signal/v1/signal.proto \ No newline at end of file From ad1c24b151f007ccd93168fd05c725bc4a16f949 Mon Sep 17 00:00:00 2001 From: brentru Date: Tue, 12 Dec 2023 11:39:50 -0500 Subject: [PATCH 020/188] give it path --- .github/workflows/protolint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/protolint.yml b/.github/workflows/protolint.yml index 82561a7a..76cfcafa 100644 --- a/.github/workflows/protolint.yml +++ b/.github/workflows/protolint.yml @@ -10,5 +10,5 @@ jobs: - name: run protolint uses: plexsystems/protolint-action@v0.7.0 with: - srcDirectory: proto/wippersnapper/* + srcDirectory: ./protobuf-checkout/proto/wippersnapper/* configDirectory: .github/protolint.yaml \ No newline at end of file From f82f3ed24973a34afb222f43d4397143baaf48a2 Mon Sep 17 00:00:00 2001 From: brentru Date: Tue, 12 Dec 2023 11:41:28 -0500 Subject: [PATCH 021/188] ls --- .github/workflows/protolint.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/protolint.yml b/.github/workflows/protolint.yml index 76cfcafa..49482f76 100644 --- a/.github/workflows/protolint.yml +++ b/.github/workflows/protolint.yml @@ -7,8 +7,10 @@ jobs: steps: - name: checkout source uses: actions/checkout@v3 + - name: list file directory structure + run: ls -R - name: run protolint uses: plexsystems/protolint-action@v0.7.0 with: - srcDirectory: ./protobuf-checkout/proto/wippersnapper/* + srcDirectory: /home/runner/work/Wippersnapper_Protobuf/ configDirectory: .github/protolint.yaml \ No newline at end of file From 64b22c0b674f227a9f9ff1095d7fd6c3b9eb4373 Mon Sep 17 00:00:00 2001 From: brentru Date: Tue, 12 Dec 2023 11:43:40 -0500 Subject: [PATCH 022/188] source correct dirs --- .github/workflows/protolint.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/protolint.yml b/.github/workflows/protolint.yml index 49482f76..ddf4b503 100644 --- a/.github/workflows/protolint.yml +++ b/.github/workflows/protolint.yml @@ -12,5 +12,5 @@ jobs: - name: run protolint uses: plexsystems/protolint-action@v0.7.0 with: - srcDirectory: /home/runner/work/Wippersnapper_Protobuf/ - configDirectory: .github/protolint.yaml \ No newline at end of file + srcDirectory: ./proto/wippersnapper + configDirectory: ./github/protolint.yaml \ No newline at end of file From 4fbe4572a483e0d3193edd948c5bb075a4ad14aa Mon Sep 17 00:00:00 2001 From: brentru Date: Tue, 12 Dec 2023 11:44:59 -0500 Subject: [PATCH 023/188] fix config dir --- .github/workflows/protolint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/protolint.yml b/.github/workflows/protolint.yml index ddf4b503..d6ab90b1 100644 --- a/.github/workflows/protolint.yml +++ b/.github/workflows/protolint.yml @@ -13,4 +13,4 @@ jobs: uses: plexsystems/protolint-action@v0.7.0 with: srcDirectory: ./proto/wippersnapper - configDirectory: ./github/protolint.yaml \ No newline at end of file + configDirectory: ./github/workflows/protolint.yaml \ No newline at end of file From 70fd758eb1900caa84f9b24cf989243ee1c71270 Mon Sep 17 00:00:00 2001 From: brentru Date: Tue, 12 Dec 2023 11:46:58 -0500 Subject: [PATCH 024/188] mv protolint --- .github/workflows/protolint.yml => protolint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename .github/workflows/protolint.yml => protolint.yml (85%) diff --git a/.github/workflows/protolint.yml b/protolint.yml similarity index 85% rename from .github/workflows/protolint.yml rename to protolint.yml index d6ab90b1..8369bf56 100644 --- a/.github/workflows/protolint.yml +++ b/protolint.yml @@ -13,4 +13,4 @@ jobs: uses: plexsystems/protolint-action@v0.7.0 with: srcDirectory: ./proto/wippersnapper - configDirectory: ./github/workflows/protolint.yaml \ No newline at end of file + configDirectory: . \ No newline at end of file From bc7da7c311be4243d761a3ed2081e9908fbc645d Mon Sep 17 00:00:00 2001 From: brentru Date: Tue, 12 Dec 2023 11:55:21 -0500 Subject: [PATCH 025/188] putback lint config --- .github/workflows/lint.yml | 16 ++++++++++++++++ protolint.yml | 33 +++++++++++++++++---------------- 2 files changed, 33 insertions(+), 16 deletions(-) create mode 100644 .github/workflows/lint.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 00000000..8369bf56 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,16 @@ +name: "lint protobuf" +on: pull_request + +jobs: + pr-check: + runs-on: ubuntu-latest + steps: + - name: checkout source + uses: actions/checkout@v3 + - name: list file directory structure + run: ls -R + - name: run protolint + uses: plexsystems/protolint-action@v0.7.0 + with: + srcDirectory: ./proto/wippersnapper + configDirectory: . \ No newline at end of file diff --git a/protolint.yml b/protolint.yml index 8369bf56..1ca8e8a3 100644 --- a/protolint.yml +++ b/protolint.yml @@ -1,16 +1,17 @@ -name: "lint protobuf" -on: pull_request - -jobs: - pr-check: - runs-on: ubuntu-latest - steps: - - name: checkout source - uses: actions/checkout@v3 - - name: list file directory structure - run: ls -R - - name: run protolint - uses: plexsystems/protolint-action@v0.7.0 - with: - srcDirectory: ./proto/wippersnapper - configDirectory: . \ No newline at end of file +# Protolint configuration file for WipperSnapper +# configuration file reference: https://github.com/yoheimuta/protolint/blob/master/_example/config/.protolint.yaml +--- +lint: + rules: + all_default: true + rules_option: + max_line_length: + max_chars: 150 + tab_chars: 2 + ignores: + - id: FIELDS_HAVE_COMMENT + files: + - proto/wippersnapper/signal/v1/signal.proto + - id: MESSAGE_NAMES_EXCLUDE_PREPOSITIONS + files: + - proto/wippersnapper/signal/v1/signal.proto \ No newline at end of file From 84a84e42b826fa7d175eb32e27a4baaeef07b633 Mon Sep 17 00:00:00 2001 From: brentru Date: Tue, 12 Dec 2023 12:01:17 -0500 Subject: [PATCH 026/188] do a self-checkout instead! --- .github/workflows/lint.yml | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 8369bf56..0eaf9fb4 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -5,12 +5,15 @@ jobs: pr-check: runs-on: ubuntu-latest steps: - - name: checkout source - uses: actions/checkout@v3 - - name: list file directory structure - run: ls -R - - name: run protolint - uses: plexsystems/protolint-action@v0.7.0 - with: - srcDirectory: ./proto/wippersnapper - configDirectory: . \ No newline at end of file + - name: Self Checkout + uses: actions/checkout@v3 + with: + path: protobuf-checkout + submodules: false + - name: list file directory structure + run: ls -R + - name: run protolint + uses: plexsystems/protolint-action@v0.7.0 + with: + srcDirectory: ./protobuf-checkout/proto/wippersnapper/* + configDirectory: ./protobuf-checkout/. \ No newline at end of file From 2ed822f04f3c6434c775297159471d378e8938ad Mon Sep 17 00:00:00 2001 From: brentru Date: Tue, 12 Dec 2023 12:06:06 -0500 Subject: [PATCH 027/188] pass protolint path thru --- .github/workflows/lint.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 0eaf9fb4..1772c4b6 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -15,5 +15,5 @@ jobs: - name: run protolint uses: plexsystems/protolint-action@v0.7.0 with: - srcDirectory: ./protobuf-checkout/proto/wippersnapper/* - configDirectory: ./protobuf-checkout/. \ No newline at end of file + configDirectory: ./protobuf-checkout/protolint.yml + srcDirectory: ./protobuf-checkout/proto/wippersnapper/ \ No newline at end of file From 80d908771b5ad73168c6e2033a8d646237c360a2 Mon Sep 17 00:00:00 2001 From: brentru Date: Tue, 12 Dec 2023 12:07:45 -0500 Subject: [PATCH 028/188] pass dir --- .github/workflows/lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 1772c4b6..a4a4d79c 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -15,5 +15,5 @@ jobs: - name: run protolint uses: plexsystems/protolint-action@v0.7.0 with: - configDirectory: ./protobuf-checkout/protolint.yml + configDirectory: ./protobuf-checkout/. srcDirectory: ./protobuf-checkout/proto/wippersnapper/ \ No newline at end of file From 78e779a5ab94774763398874b83a48ea8082b2f1 Mon Sep 17 00:00:00 2001 From: tyeth Date: Tue, 12 Dec 2023 18:49:57 +0000 Subject: [PATCH 029/188] Update lint.yml --- .github/workflows/lint.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index a4a4d79c..a2e93fc0 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -12,8 +12,8 @@ jobs: submodules: false - name: list file directory structure run: ls -R - - name: run protolint - uses: plexsystems/protolint-action@v0.7.0 + - name: reviewdog protolint + uses: yoheimuta/action-protolint@v1 with: - configDirectory: ./protobuf-checkout/. - srcDirectory: ./protobuf-checkout/proto/wippersnapper/ \ No newline at end of file + workdir: 'protobuf-checkout' + protolint_flags: 'lint -config_dir_path . proto/wippersnapper' \ No newline at end of file From 228b4adba97f8fe2af4cc3d4569cd1c7dd88b1cb Mon Sep 17 00:00:00 2001 From: Tyeth Gundry Date: Tue, 12 Dec 2023 19:39:03 +0000 Subject: [PATCH 030/188] Update lint.yml - fail on protolint errors --- .github/workflows/lint.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index a2e93fc0..aff24aa9 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -16,4 +16,5 @@ jobs: uses: yoheimuta/action-protolint@v1 with: workdir: 'protobuf-checkout' - protolint_flags: 'lint -config_dir_path . proto/wippersnapper' \ No newline at end of file + fail_on_error: true + protolint_flags: 'lint -config_dir_path . proto/wippersnapper' From f54f72a8070450fd8b68df7278d8e6bd4776dfb4 Mon Sep 17 00:00:00 2001 From: brentru Date: Tue, 12 Dec 2023 16:16:44 -0500 Subject: [PATCH 031/188] flatten everything and update scripts --- .../workflows/protoc-wrapper-generation.yml | 6 +- .github/workflows/test-wrapper-arduino.yml | 4 +- .gitignore | 1 + .../{analogio/v1 => }/analogio.proto | 7 +- .../{description/v1 => }/description.options | 0 .../{description/v1 => }/description.proto | 2 +- .../{digitalio/v1 => }/digitalio.proto | 3 +- proto/wippersnapper/ds18x20.options | 4 + .../{ds18x20/v1 => }/ds18x20.proto | 14 +-- .../wippersnapper/ds18x20/v1/ds18x20.options | 4 - .../wippersnapper/{error/v1 => }/error.proto | 3 +- proto/wippersnapper/i2c.options | 4 + proto/wippersnapper/{i2c/v1 => }/i2c.proto | 11 +- proto/wippersnapper/i2c/v1/i2c.options | 4 - proto/wippersnapper/{pixels/v1 => }/pixels.md | 0 .../{pixels/v1 => }/pixels.options | 0 .../{pixels/v1 => }/pixels.proto | 4 +- proto/wippersnapper/{pwm/v1 => }/pwm.md | 0 proto/wippersnapper/{pwm/v1 => }/pwm.options | 2 +- proto/wippersnapper/{pwm/v1 => }/pwm.proto | 2 +- .../{sensor/v1 => }/sensor.proto | 2 +- proto/wippersnapper/{servo/v1 => }/servo.md | 0 .../{servo/v1 => }/servo.options | 0 .../wippersnapper/{servo/v1 => }/servo.proto | 2 +- .../{signal/v1 => }/signal.options | 0 proto/wippersnapper/signal.proto | 100 +++++++++++++++++ proto/wippersnapper/signal/v1/signal.proto | 103 ------------------ proto/wippersnapper/{uart/v1 => }/uart.md | 0 .../wippersnapper/{uart/v1 => }/uart.options | 2 +- proto/wippersnapper/{uart/v1 => }/uart.proto | 7 +- 30 files changed, 140 insertions(+), 151 deletions(-) rename proto/wippersnapper/{analogio/v1 => }/analogio.proto (85%) rename proto/wippersnapper/{description/v1 => }/description.options (100%) rename proto/wippersnapper/{description/v1 => }/description.proto (98%) rename proto/wippersnapper/{digitalio/v1 => }/digitalio.proto (98%) create mode 100644 proto/wippersnapper/ds18x20.options rename proto/wippersnapper/{ds18x20/v1 => }/ds18x20.proto (68%) delete mode 100644 proto/wippersnapper/ds18x20/v1/ds18x20.options rename proto/wippersnapper/{error/v1 => }/error.proto (95%) create mode 100644 proto/wippersnapper/i2c.options rename proto/wippersnapper/{i2c/v1 => }/i2c.proto (92%) delete mode 100644 proto/wippersnapper/i2c/v1/i2c.options rename proto/wippersnapper/{pixels/v1 => }/pixels.md (100%) rename proto/wippersnapper/{pixels/v1 => }/pixels.options (100%) rename proto/wippersnapper/{pixels/v1 => }/pixels.proto (98%) rename proto/wippersnapper/{pwm/v1 => }/pwm.md (100%) rename proto/wippersnapper/{pwm/v1 => }/pwm.options (55%) rename proto/wippersnapper/{pwm/v1 => }/pwm.proto (98%) rename proto/wippersnapper/{sensor/v1 => }/sensor.proto (99%) rename proto/wippersnapper/{servo/v1 => }/servo.md (100%) rename proto/wippersnapper/{servo/v1 => }/servo.options (100%) rename proto/wippersnapper/{servo/v1 => }/servo.proto (97%) rename proto/wippersnapper/{signal/v1 => }/signal.options (100%) create mode 100644 proto/wippersnapper/signal.proto delete mode 100644 proto/wippersnapper/signal/v1/signal.proto rename proto/wippersnapper/{uart/v1 => }/uart.md (100%) rename proto/wippersnapper/{uart/v1 => }/uart.options (78%) rename proto/wippersnapper/{uart/v1 => }/uart.proto (91%) diff --git a/.github/workflows/protoc-wrapper-generation.yml b/.github/workflows/protoc-wrapper-generation.yml index 9f02f92a..57d2dade 100644 --- a/.github/workflows/protoc-wrapper-generation.yml +++ b/.github/workflows/protoc-wrapper-generation.yml @@ -31,7 +31,7 @@ jobs: mkdir ./python_out mkdir ./python_nanopb_out mkdir ./js_out - protoc --proto_path=./protobuf-checkout/proto ./protobuf-checkout/proto/wippersnapper/*/*/*.proto --js_out=import_style=commonjs,binary:js_out --python_out=./python_out + protoc --proto_path=./protobuf-checkout/proto ./protobuf-checkout/proto/wippersnapper/*.proto --js_out=import_style=commonjs,binary:js_out --python_out=./python_out protoc ./protobuf-checkout/nanopb/generator/proto/nanopb.proto --js_out=import_style=commonjs,binary:js_out --python_out=./python_nanopb_out - name: Checkout Python Repo uses: actions/checkout@v2 @@ -62,9 +62,9 @@ jobs: PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION: python run: | mkdir ./arduino_out - protoc --plugin=protobuf-checkout/nanopb/generator/protoc-gen-nanopb -Iprotobuf-checkout/nanopb/generator/proto --proto_path=./protobuf-checkout/proto ./protobuf-checkout/proto/wippersnapper/*/*/*.proto --nanopb_out=./arduino_out --nanopb_opt=-I./protobuf-checkout/proto --nanopb_opt=-t + protoc --plugin=protobuf-checkout/nanopb/generator/protoc-gen-nanopb -Iprotobuf-checkout/nanopb/generator/proto --proto_path=./protobuf-checkout/proto ./protobuf-checkout/proto/wippersnapper/*.proto --nanopb_out=./arduino_out --nanopb_opt=-I./protobuf-checkout/proto --nanopb_opt=-t # Local (non-CI) build command: - # protoc --plugin=nanopb/generator/protoc-gen-nanopb -Inanopb/generator/proto --proto_path=./proto ./proto/wippersnapper/*/*/*.proto --nanopb_out=./arduino_out --nanopb_opt=-I./proto --nanopb_opt=-t + # protoc --plugin=nanopb/generator/protoc-gen-nanopb -Inanopb/generator/proto --proto_path=./proto ./proto/wippersnapper/*.proto --nanopb_out=./arduino_out --nanopb_opt=-I./proto --nanopb_opt=-t - name: Checkout Arduino Repo uses: actions/checkout@v2 with: diff --git a/.github/workflows/test-wrapper-arduino.yml b/.github/workflows/test-wrapper-arduino.yml index 8147716e..c2201896 100644 --- a/.github/workflows/test-wrapper-arduino.yml +++ b/.github/workflows/test-wrapper-arduino.yml @@ -29,9 +29,9 @@ jobs: PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION: python run: | mkdir ./arduino_out - protoc --plugin=protobuf-checkout/nanopb/generator/protoc-gen-nanopb -Iprotobuf-checkout/nanopb/generator/proto --proto_path=./protobuf-checkout/proto ./protobuf-checkout/proto/wippersnapper/*/*/*.proto --nanopb_out=./arduino_out --nanopb_opt=-I./protobuf-checkout/proto --nanopb_opt=-t + protoc --plugin=protobuf-checkout/nanopb/generator/protoc-gen-nanopb -Iprotobuf-checkout/nanopb/generator/proto --proto_path=./protobuf-checkout/proto ./protobuf-checkout/proto/wippersnapper/*.proto --nanopb_out=./arduino_out --nanopb_opt=-I./protobuf-checkout/proto --nanopb_opt=-t # Local (non-CI) build command: - # protoc --plugin=nanopb/generator/protoc-gen-nanopb -Inanopb/generator/proto --proto_path=./proto ./proto/wippersnapper/*/*/*.proto --nanopb_out=./arduino_out --nanopb_opt=-I./proto --nanopb_opt=-t + # protoc --plugin=nanopb/generator/protoc-gen-nanopb -Inanopb/generator/proto --proto_path=./proto ./proto/wippersnapper/*.proto --nanopb_out=./arduino_out --nanopb_opt=-I./proto --nanopb_opt=-t - uses: actions/upload-artifact@v3 with: name: build-artifact-arduino-wrapper diff --git a/.gitignore b/.gitignore index b23bc836..05d52a65 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ __pycache__/ *.py[cod] *$py.class +.DS_Store # C extensions *.so diff --git a/proto/wippersnapper/analogio/v1/analogio.proto b/proto/wippersnapper/analogio.proto similarity index 85% rename from proto/wippersnapper/analogio/v1/analogio.proto rename to proto/wippersnapper/analogio.proto index b69317b0..b89ea2aa 100644 --- a/proto/wippersnapper/analogio/v1/analogio.proto +++ b/proto/wippersnapper/analogio.proto @@ -1,9 +1,8 @@ // SPDX-FileCopyrightText: 2023 Brent Rubell, Loren Norman, Tyeth Gundry for Adafruit Industries // SPDX-License-Identifier: MIT syntax = "proto3"; - -package wippersnapper.analogio.v1; -import "wippersnapper/sensor/v1/sensor.proto"; +package wippersnapper.analogio; +import "wippersnapper/sensor.proto"; /** * AnalogIOAdd adds an analog pin to the device. @@ -38,5 +37,5 @@ message AnalogIORemove { */ message AnalogIOEvent { int32 gpio_num = 1; // correlates with `name` in the JSON - wippersnapper.sensor.v1.SensorEvent sensor_event = 2; /** Reading(s) from an analog pin. */ + wippersnapper.sensor.SensorEvent sensor_event = 2; /** Reading(s) from an analog pin. */ } diff --git a/proto/wippersnapper/description/v1/description.options b/proto/wippersnapper/description.options similarity index 100% rename from proto/wippersnapper/description/v1/description.options rename to proto/wippersnapper/description.options diff --git a/proto/wippersnapper/description/v1/description.proto b/proto/wippersnapper/description.proto similarity index 98% rename from proto/wippersnapper/description/v1/description.proto rename to proto/wippersnapper/description.proto index 7ee9ac6a..6c8c2a59 100644 --- a/proto/wippersnapper/description/v1/description.proto +++ b/proto/wippersnapper/description.proto @@ -2,7 +2,7 @@ // SPDX-License-Identifier: MIT // Messages for describing hardware over the description topic syntax = "proto3"; -package wippersnapper.description.v1; +package wippersnapper.description; /** * CreateDescriptionRequest identifies a device with Adafruit.io WipperSnapper. diff --git a/proto/wippersnapper/digitalio/v1/digitalio.proto b/proto/wippersnapper/digitalio.proto similarity index 98% rename from proto/wippersnapper/digitalio/v1/digitalio.proto rename to proto/wippersnapper/digitalio.proto index d21dacae..2c126d35 100644 --- a/proto/wippersnapper/digitalio/v1/digitalio.proto +++ b/proto/wippersnapper/digitalio.proto @@ -1,8 +1,7 @@ // SPDX-FileCopyrightText: 2023 Brent Rubell, Loren Norman, Tyeth Gundry for Adafruit Industries // SPDX-License-Identifier: MIT syntax = "proto3"; - -package wippersnapper.digitalio.v1; +package wippersnapper.digitalio; /** * DigitalIOAdd adds a digital pin to the device. diff --git a/proto/wippersnapper/ds18x20.options b/proto/wippersnapper/ds18x20.options new file mode 100644 index 00000000..aa56d620 --- /dev/null +++ b/proto/wippersnapper/ds18x20.options @@ -0,0 +1,4 @@ +# ds18x20.options +# ds18x20*.onewire_pin max_size:5 +wippersnapper.ds18x20.Ds18x20Add.sensor_types max_count:2 +wippersnapper.ds18x20.Ds18x20Event.sensor_events max_count:2 \ No newline at end of file diff --git a/proto/wippersnapper/ds18x20/v1/ds18x20.proto b/proto/wippersnapper/ds18x20.proto similarity index 68% rename from proto/wippersnapper/ds18x20/v1/ds18x20.proto rename to proto/wippersnapper/ds18x20.proto index d6dfa18a..6b80c815 100644 --- a/proto/wippersnapper/ds18x20/v1/ds18x20.proto +++ b/proto/wippersnapper/ds18x20.proto @@ -1,11 +1,9 @@ // SPDX-FileCopyrightText: 2023 Brent Rubell for Adafruit Industries // SPDX-License-Identifier: MIT // WipperSnapper's Protobuf communication API for DS18X20 Maxim Temperature ICs - syntax = "proto3"; - -package wippersnapper.ds18x20.v1; -import "wippersnapper/sensor/v1/sensor.proto"; +package wippersnapper.ds18x20; +import "wippersnapper/sensor.proto"; /** * Ds18x20Add represents a to initialize @@ -13,9 +11,9 @@ import "wippersnapper/sensor/v1/sensor.proto"; * NOTE: This API currently only supports ONE device per OneWire bus. */ message Ds18x20Add { - string onewire_pin = 1; /** The desired pin to use as a OneWire bus. */ - int32 sensor_resolution = 2; /** The desired sensor resolution (9, 10, 11, or 12 bits). */ - repeated wippersnapper.sensor.v1.SensorType sensor_types = 3; /** Properties for the DS18x20 sensor. */ + string onewire_pin = 1; /** The desired pin to use as a OneWire bus. */ + int32 sensor_resolution = 2; /** The desired sensor resolution (9, 10, 11, or 12 bits). */ + repeated wippersnapper.sensor.SensorType sensor_types = 3; /** Properties for the DS18x20 sensor. */ } /** @@ -40,5 +38,5 @@ message Ds18x20Remove { */ message Ds18x20Event { string onewire_pin = 1; /** The desired pin to use as a OneWire bus. */ - repeated wippersnapper.sensor.v1.SensorEvent sensor_events = 2; /** The DS18X20's SensorEvent. */ + repeated wippersnapper.sensor.SensorEvent sensor_events = 2; /** The DS18X20's SensorEvent. */ } \ No newline at end of file diff --git a/proto/wippersnapper/ds18x20/v1/ds18x20.options b/proto/wippersnapper/ds18x20/v1/ds18x20.options deleted file mode 100644 index 1acb3b6a..00000000 --- a/proto/wippersnapper/ds18x20/v1/ds18x20.options +++ /dev/null @@ -1,4 +0,0 @@ -# ds18x20.options -*.ds18x20*.onewire_pin max_size:5 -*.Ds18x20Add.sensor_type max_count:2 -*.Ds18x20Event.sensor_event max_count:2 \ No newline at end of file diff --git a/proto/wippersnapper/error/v1/error.proto b/proto/wippersnapper/error.proto similarity index 95% rename from proto/wippersnapper/error/v1/error.proto rename to proto/wippersnapper/error.proto index afa6d8fe..ad710bca 100644 --- a/proto/wippersnapper/error/v1/error.proto +++ b/proto/wippersnapper/error.proto @@ -1,8 +1,7 @@ // SPDX-FileCopyrightText: 2023 Brent Rubell, Loren Norman, Tyeth Gundry for Adafruit Industries // SPDX-License-Identifier: MIT syntax = "proto3"; - -package wippersnapper.error.v1; +package wippersnapper.error; import "nanopb/nanopb.proto"; // TODO: Add error handling on the device-side to parse error diff --git a/proto/wippersnapper/i2c.options b/proto/wippersnapper/i2c.options new file mode 100644 index 00000000..6c1f9702 --- /dev/null +++ b/proto/wippersnapper/i2c.options @@ -0,0 +1,4 @@ +# i2c.options +*.I2CScanResponse.found_addresses max_count:120 +*.I2CInit.i2c_device_name max_size:15 +*.I2CEvent.sensor_events max_count:15 \ No newline at end of file diff --git a/proto/wippersnapper/i2c/v1/i2c.proto b/proto/wippersnapper/i2c.proto similarity index 92% rename from proto/wippersnapper/i2c/v1/i2c.proto rename to proto/wippersnapper/i2c.proto index 040b235d..6efe872a 100644 --- a/proto/wippersnapper/i2c/v1/i2c.proto +++ b/proto/wippersnapper/i2c.proto @@ -1,9 +1,8 @@ // SPDX-FileCopyrightText: 2021-2023 Brent Rubell for Adafruit Industries // SPDX-License-Identifier: MIT syntax = "proto3"; - -package wippersnapper.i2c.v1; -import "wippersnapper/sensor/v1/sensor.proto"; +package wippersnapper.i2c; +import "wippersnapper/sensor.proto"; /** * BusResponse represents the state of the I2C bus, from a device. @@ -63,7 +62,7 @@ message I2CScanResponse { * its type and period. */ message I2CSensorProperties { - wippersnapper.sensor.v1.SensorType sensor_type = 1; /** The type of I2C sensor. **/ + wippersnapper.sensor.SensorType sensor_type = 1; /** The type of I2C sensor. **/ } /** @@ -76,7 +75,7 @@ message I2CInit { uint32 i2c_device_address = 3; /** The 7-bit I2C address of the device on the bus. */ string i2c_device_name = 4; /** The I2C device's name, MUST MATCH the name on the JSON definition file on https://github.com/adafruit/Wippersnapper_Components. */ - repeated wippersnapper.sensor.v1.SensorType sensor_types = 5; /** Properties of each sensor on the I2C device. */ + repeated wippersnapper.sensor.SensorType sensor_types = 5; /** Properties of each sensor on the I2C device. */ } /** @@ -124,5 +123,5 @@ message I2CRemoved { */ message I2CEvent { uint32 sensor_address = 1; /** The 7-bit I2C address of the I2C device. */ - repeated wippersnapper.sensor.v1.SensorEvent sensor_events = 2; /** A, optionally repeated, SensorEvent from a sensor. */ + repeated wippersnapper.sensor.SensorEvent sensor_events = 2; /** A, optionally repeated, SensorEvent from a sensor. */ } diff --git a/proto/wippersnapper/i2c/v1/i2c.options b/proto/wippersnapper/i2c/v1/i2c.options deleted file mode 100644 index 7dc7036a..00000000 --- a/proto/wippersnapper/i2c/v1/i2c.options +++ /dev/null @@ -1,4 +0,0 @@ -# i2c.options -*.I2CScanResponse.addresses_found max_count:120 -*.I2CInit.i2c_device_name max_size:15 -*.I2CEvent.sensor_event max_count:15 \ No newline at end of file diff --git a/proto/wippersnapper/pixels/v1/pixels.md b/proto/wippersnapper/pixels.md similarity index 100% rename from proto/wippersnapper/pixels/v1/pixels.md rename to proto/wippersnapper/pixels.md diff --git a/proto/wippersnapper/pixels/v1/pixels.options b/proto/wippersnapper/pixels.options similarity index 100% rename from proto/wippersnapper/pixels/v1/pixels.options rename to proto/wippersnapper/pixels.options diff --git a/proto/wippersnapper/pixels/v1/pixels.proto b/proto/wippersnapper/pixels.proto similarity index 98% rename from proto/wippersnapper/pixels/v1/pixels.proto rename to proto/wippersnapper/pixels.proto index f586ca2c..f993f28b 100644 --- a/proto/wippersnapper/pixels/v1/pixels.proto +++ b/proto/wippersnapper/pixels.proto @@ -1,10 +1,8 @@ // SPDX-FileCopyrightText: 2022-2023 Brent Rubell for Adafruit Industries // SPDX-License-Identifier: MIT // Addressable Pixels API for Adafruit WipperSnapper - syntax = "proto3"; - -package wippersnapper.pixels.v1; +package wippersnapper.pixels; /** * PixelsType defines the type/model of pixel strand. diff --git a/proto/wippersnapper/pwm/v1/pwm.md b/proto/wippersnapper/pwm.md similarity index 100% rename from proto/wippersnapper/pwm/v1/pwm.md rename to proto/wippersnapper/pwm.md diff --git a/proto/wippersnapper/pwm/v1/pwm.options b/proto/wippersnapper/pwm.options similarity index 55% rename from proto/wippersnapper/pwm/v1/pwm.options rename to proto/wippersnapper/pwm.options index 6a32e212..cf991d16 100644 --- a/proto/wippersnapper/pwm/v1/pwm.options +++ b/proto/wippersnapper/pwm.options @@ -1,3 +1,3 @@ # pwm.options *.PWM*.pin max_size:6 -*.PWMWriteDutyCycleMulti.write_duty_cycle_req max_count:4 \ No newline at end of file +*.PWMWriteDutyCycleMulti.write_duty_cycle_reqs max_count:4 \ No newline at end of file diff --git a/proto/wippersnapper/pwm/v1/pwm.proto b/proto/wippersnapper/pwm.proto similarity index 98% rename from proto/wippersnapper/pwm/v1/pwm.proto rename to proto/wippersnapper/pwm.proto index 465d5b85..963f1521 100644 --- a/proto/wippersnapper/pwm/v1/pwm.proto +++ b/proto/wippersnapper/pwm.proto @@ -1,7 +1,7 @@ // SPDX-FileCopyrightText: 2022-2023 Brent Rubell for Adafruit Industries // SPDX-License-Identifier: MIT syntax = "proto3"; -package wippersnapper.pwm.v1; +package wippersnapper.pwm; /** * PWMAdd represents a to a device to attach/allocate a PWM pin. diff --git a/proto/wippersnapper/sensor/v1/sensor.proto b/proto/wippersnapper/sensor.proto similarity index 99% rename from proto/wippersnapper/sensor/v1/sensor.proto rename to proto/wippersnapper/sensor.proto index 9bd30ae2..82efb154 100644 --- a/proto/wippersnapper/sensor/v1/sensor.proto +++ b/proto/wippersnapper/sensor.proto @@ -1,7 +1,7 @@ // SPDX-FileCopyrightText: 2023 Brent Rubell, Loren Norman for Adafruit Industries // SPDX-License-Identifier: MIT syntax = "proto3"; -package wippersnapper.sensor.v1; +package wippersnapper.sensor; /** * SensorType allows us determine what types of units the sensor uses, etc. diff --git a/proto/wippersnapper/servo/v1/servo.md b/proto/wippersnapper/servo.md similarity index 100% rename from proto/wippersnapper/servo/v1/servo.md rename to proto/wippersnapper/servo.md diff --git a/proto/wippersnapper/servo/v1/servo.options b/proto/wippersnapper/servo.options similarity index 100% rename from proto/wippersnapper/servo/v1/servo.options rename to proto/wippersnapper/servo.options diff --git a/proto/wippersnapper/servo/v1/servo.proto b/proto/wippersnapper/servo.proto similarity index 97% rename from proto/wippersnapper/servo/v1/servo.proto rename to proto/wippersnapper/servo.proto index 071e6640..7eeb1554 100644 --- a/proto/wippersnapper/servo/v1/servo.proto +++ b/proto/wippersnapper/servo.proto @@ -1,7 +1,7 @@ // SPDX-FileCopyrightText: 2022-2023 Brent Rubell for Adafruit Industries // SPDX-License-Identifier: MIT syntax = "proto3"; -package wippersnapper.servo.v1; +package wippersnapper.servo; /** * ServoAdd represents a request to attach a servo to a pin. diff --git a/proto/wippersnapper/signal/v1/signal.options b/proto/wippersnapper/signal.options similarity index 100% rename from proto/wippersnapper/signal/v1/signal.options rename to proto/wippersnapper/signal.options diff --git a/proto/wippersnapper/signal.proto b/proto/wippersnapper/signal.proto new file mode 100644 index 00000000..9cac5b90 --- /dev/null +++ b/proto/wippersnapper/signal.proto @@ -0,0 +1,100 @@ +// SPDX-FileCopyrightText: 2020-2023 Brent Rubell, Loren Norman for Adafruit Industries +// SPDX-License-Identifier: MIT +syntax = "proto3"; +package wippersnapper.signal; +import "nanopb/nanopb.proto"; + +// TODO: Shorten all of these files to: +// wippersnapper/*.proto +import "wippersnapper/analogio.proto"; +import "wippersnapper/description.proto"; +import "wippersnapper/digitalio.proto"; +import "wippersnapper/ds18x20.proto"; +import "wippersnapper/error.proto"; +import "wippersnapper/i2c.proto"; +import "wippersnapper/pixels.proto"; +import "wippersnapper/pwm.proto"; +import "wippersnapper/servo.proto"; +import "wippersnapper/uart.proto"; + +/* + * BrokerToDevice + * The BrokerToDevice message is sent from the broker to the device. + * It contains a oneof payload, which is a union of all the possible + * messages that can be sent from the broker to a device. + */ +message BrokerToDevice { + oneof payload { + // digitalio.proto + wippersnapper.digitalio.DigitalIOAdd digitalio_add = 10; + wippersnapper.digitalio.DigitalIORemove digitalio_remove = 11; + wippersnapper.digitalio.DigitalIOEvent digitalio_event = 12; + // analogio.proto + wippersnapper.analogio.AnalogIOAdd analogio_add = 20; + wippersnapper.analogio.AnalogIOAdd analogio_remove = 21; + // description.proto + wippersnapper.description.CreateDescription create_description = 30; + // servo.proto + wippersnapper.servo.ServoAdd servo_add = 40; + wippersnapper.servo.ServoRemove servo_remove = 41; + wippersnapper.servo.ServoWrite servo_write = 42; + // pwm.proto + wippersnapper.pwm.PWMAdd pwm_add = 50; + wippersnapper.pwm.PWMRemove pwm_remove = 51; + wippersnapper.pwm.PWMWriteDutyCycle pwm_write_duty = 52; + wippersnapper.pwm.PWMWriteDutyCycleMulti pwm_write_duty_multi = 53; + wippersnapper.pwm.PWMWriteFrequency pwm_write_freq = 54; + // pixels.proto + wippersnapper.pixels.PixelsAdd pixels_add = 60; + wippersnapper.pixels.PixelsRemove pixels_remove = 61; + wippersnapper.pixels.PixelsWrite pixels_write = 62; + // ds18x20.proto + wippersnapper.ds18x20.Ds18x20Add ds18x20_add = 70; + wippersnapper.ds18x20.Ds18x20Remove ds18x20_remove = 71; + // uart.proto + wippersnapper.uart.UARTAdd uart_add = 80; + wippersnapper.uart.UARTRemove uart_remove = 81; + // i2c.proto + wippersnapper.i2c.I2CScan i2c_scan = 90; + wippersnapper.i2c.I2CInit i2c_add = 91; + wippersnapper.i2c.I2CRemove i2c_remove = 92; + // error.proto + wippersnapper.error.Error error = 100; + } +} + +/* + * DeviceToBroker + * The DeviceToBroker message is sent from the device to the broker. + * It contains a oneof payload, which is a union of all the possible + * messages that can be sent from a device to the broker. + */ +message DeviceToBroker { + option (nanopb_msgopt).submsg_callback = true; + oneof payload { + //digitalio.proto + wippersnapper.digitalio.DigitalIOEvent digitalio_event = 10; + // analogio.proto + wippersnapper.analogio.AnalogIOEvent analogio_event = 20; + // description.proto + // NOTE: we may be able to eventually remove this + wippersnapper.description.RegistrationComplete registration_complete = 30; + // servo.proto + wippersnapper.servo.ServoAdded servo_added = 40; + // pwm.proto + wippersnapper.pwm.PWMAdded pwm_added = 50; + // pixels.proto + wippersnapper.pixels.PixelsAdded pixels_added = 60; + // ds18x20.proto + wippersnapper.ds18x20.Ds18x20Added ds18x20_added = 70; + wippersnapper.ds18x20.Ds18x20Event ds18x20_event = 80; + // uart.proto + wippersnapper.uart.UARTAdded uart_added = 90; + wippersnapper.uart.UARTEvent uart_event = 100; + // i2c.proto + wippersnapper.i2c.I2CScanResponse resp_i2c_scan = 110; + wippersnapper.i2c.I2CAdded i2c_added = 111; + wippersnapper.i2c.I2CRemoved i2c_removed = 112; + wippersnapper.i2c.I2CEvent i2c_event = 113; + } +} \ No newline at end of file diff --git a/proto/wippersnapper/signal/v1/signal.proto b/proto/wippersnapper/signal/v1/signal.proto deleted file mode 100644 index 825bf21f..00000000 --- a/proto/wippersnapper/signal/v1/signal.proto +++ /dev/null @@ -1,103 +0,0 @@ -// SPDX-FileCopyrightText: 2020-2023 Brent Rubell, Loren Norman for Adafruit Industries -// SPDX-License-Identifier: MIT -syntax = "proto3"; - -package wippersnapper.signal.v1; - -// Non-WipperSnapper -import "nanopb/nanopb.proto"; - -// TODO: Shorten all of these files to: -// wippersnapper/*.proto -import "wippersnapper/analogio/v1/analogio.proto"; -import "wippersnapper/description/v1/description.proto"; -import "wippersnapper/digitalio/v1/digitalio.proto"; -import "wippersnapper/ds18x20/v1/ds18x20.proto"; -import "wippersnapper/error/v1/error.proto"; -import "wippersnapper/i2c/v1/i2c.proto"; -import "wippersnapper/pixels/v1/pixels.proto"; -import "wippersnapper/pwm/v1/pwm.proto"; -import "wippersnapper/servo/v1/servo.proto"; -import "wippersnapper/uart/v1/uart.proto"; - -/* - * BrokerToDevice - * The BrokerToDevice message is sent from the broker to the device. - * It contains a oneof payload, which is a union of all the possible - * messages that can be sent from the broker to a device. - */ -message BrokerToDevice { - oneof payload { - // digitalio.proto - wippersnapper.digitalio.v1.DigitalIOAdd digitalio_add = 10; - wippersnapper.digitalio.v1.DigitalIORemove digitalio_remove = 11; - wippersnapper.digitalio.v1.DigitalIOEvent digitalio_event = 12; - // analogio.proto - wippersnapper.analogio.v1.AnalogIOAdd analogio_add = 20; - wippersnapper.analogio.v1.AnalogIOAdd analogio_remove = 21; - // description.proto - wippersnapper.description.v1.CreateDescription create_description = 30; - // servo.proto - wippersnapper.servo.v1.ServoAdd servo_add = 40; - wippersnapper.servo.v1.ServoRemove servo_remove = 41; - wippersnapper.servo.v1.ServoWrite servo_write = 42; - // pwm.proto - wippersnapper.pwm.v1.PWMAdd pwm_add = 50; - wippersnapper.pwm.v1.PWMRemove pwm_remove = 51; - wippersnapper.pwm.v1.PWMWriteDutyCycle pwm_write_duty = 52; - wippersnapper.pwm.v1.PWMWriteDutyCycleMulti pwm_write_duty_multi = 53; - wippersnapper.pwm.v1.PWMWriteFrequency pwm_write_freq = 54; - // pixels.proto - wippersnapper.pixels.v1.PixelsAdd pixels_add = 60; - wippersnapper.pixels.v1.PixelsRemove pixels_remove = 61; - wippersnapper.pixels.v1.PixelsWrite pixels_write = 62; - // ds18x20.proto - wippersnapper.ds18x20.v1.Ds18x20Add ds18x20_add = 70; - wippersnapper.ds18x20.v1.Ds18x20Remove ds18x20_remove = 71; - // uart.proto - wippersnapper.uart.v1.UARTAdd uart_add = 80; - wippersnapper.uart.v1.UARTRemove uart_remove = 81; - // i2c.proto - wippersnapper.i2c.v1.I2CScan i2c_scan = 90; - wippersnapper.i2c.v1.I2CInit i2c_add = 91; - wippersnapper.i2c.v1.I2CRemove i2c_remove = 92; - // error.proto - wippersnapper.error.v1.Error error = 100; - } -} - -/* - * DeviceToBroker - * The DeviceToBroker message is sent from the device to the broker. - * It contains a oneof payload, which is a union of all the possible - * messages that can be sent from a device to the broker. - */ -message DeviceToBroker { - option (nanopb_msgopt).submsg_callback = true; - oneof payload { - //digitalio.proto - wippersnapper.digitalio.v1.DigitalIOEvent digitalio_event = 10; - // analogio.proto - wippersnapper.analogio.v1.AnalogIOEvent analogio_event = 20; - // description.proto - // NOTE: we may be able to eventually remove this - wippersnapper.description.v1.RegistrationComplete registration_complete = 30; - // servo.proto - wippersnapper.servo.v1.ServoAdded servo_added = 40; - // pwm.proto - wippersnapper.pwm.v1.PWMAdded pwm_added = 50; - // pixels.proto - wippersnapper.pixels.v1.PixelsAdded pixels_added = 60; - // ds18x20.proto - wippersnapper.ds18x20.v1.Ds18x20Added ds18x20_added = 70; - wippersnapper.ds18x20.v1.Ds18x20Event ds18x20_event = 80; - // uart.proto - wippersnapper.uart.v1.UARTAdded uart_added = 90; - wippersnapper.uart.v1.UARTEvent uart_event = 100; - // i2c.proto - wippersnapper.i2c.v1.I2CScanResponse resp_i2c_scan = 110; - wippersnapper.i2c.v1.I2CAdded i2c_added = 111; - wippersnapper.i2c.v1.I2CRemoved i2c_removed = 112; - wippersnapper.i2c.v1.I2CEvent i2c_event = 113; - } -} \ No newline at end of file diff --git a/proto/wippersnapper/uart/v1/uart.md b/proto/wippersnapper/uart.md similarity index 100% rename from proto/wippersnapper/uart/v1/uart.md rename to proto/wippersnapper/uart.md diff --git a/proto/wippersnapper/uart/v1/uart.options b/proto/wippersnapper/uart.options similarity index 78% rename from proto/wippersnapper/uart/v1/uart.options rename to proto/wippersnapper/uart.options index 0e0349d5..ac76df50 100644 --- a/proto/wippersnapper/uart/v1/uart.options +++ b/proto/wippersnapper/uart.options @@ -2,4 +2,4 @@ *.UART*.device_id max_count:15 *.UARTBusData.pin_rx max_size:6 *.UARTBusData.pin_tx max_size:6 -*.UARTEvent.sensor_event max_size:2 \ No newline at end of file +*.UARTEvent.sensor_events max_size:2 \ No newline at end of file diff --git a/proto/wippersnapper/uart/v1/uart.proto b/proto/wippersnapper/uart.proto similarity index 91% rename from proto/wippersnapper/uart/v1/uart.proto rename to proto/wippersnapper/uart.proto index e78d1aa0..6b6e2e52 100644 --- a/proto/wippersnapper/uart/v1/uart.proto +++ b/proto/wippersnapper/uart.proto @@ -1,9 +1,8 @@ // SPDX-FileCopyrightText: 2023 Brent Rubell for Adafruit Industries // SPDX-License-Identifier: MIT syntax = "proto3"; - -package wippersnapper.uart.v1; -import "wippersnapper/sensor/v1/sensor.proto"; +package wippersnapper.uart; +import "wippersnapper/sensor.proto"; /** * UARTBusData represents a message to configure a UART bus for communication with a device. @@ -49,5 +48,5 @@ message UARTRemove { */ message UARTEvent { string device_id = 1; /** Unique identifier of the device to attach to the UART bus, from Adafruit_WipperSnapper_Components. */ - repeated wippersnapper.sensor.v1.SensorEvent sensor_events = 2; /** An optionally repeated event from a sensor. */ + repeated wippersnapper.sensor.SensorEvent sensor_events = 2; /** An optionally repeated event from a sensor. */ } From acfecee6b2d951c6d69f157202b3e3266083e0fe Mon Sep 17 00:00:00 2001 From: brentru Date: Tue, 12 Dec 2023 16:20:36 -0500 Subject: [PATCH 032/188] update linter --- protolint.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/protolint.yml b/protolint.yml index 1ca8e8a3..66e4f711 100644 --- a/protolint.yml +++ b/protolint.yml @@ -11,7 +11,7 @@ lint: ignores: - id: FIELDS_HAVE_COMMENT files: - - proto/wippersnapper/signal/v1/signal.proto + - proto/wippersnapper/signal.proto - id: MESSAGE_NAMES_EXCLUDE_PREPOSITIONS files: - - proto/wippersnapper/signal/v1/signal.proto \ No newline at end of file + - proto/wippersnapper/signal.proto \ No newline at end of file From 160f1a53c1d55b5b9d94f666b086f63c7b48a8d9 Mon Sep 17 00:00:00 2001 From: brentru Date: Thu, 14 Dec 2023 12:04:21 -0500 Subject: [PATCH 033/188] pull AnalogReadMode otu from AnalogIOOut --- proto/wippersnapper/analogio.proto | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/proto/wippersnapper/analogio.proto b/proto/wippersnapper/analogio.proto index b89ea2aa..f9bd883f 100644 --- a/proto/wippersnapper/analogio.proto +++ b/proto/wippersnapper/analogio.proto @@ -4,6 +4,17 @@ syntax = "proto3"; package wippersnapper.analogio; import "wippersnapper/sensor.proto"; +/** +* Selects the type of value read by an analog pin. +* PIN_VALUE: Raw ADC reading. +* PIN_VOLTAGE: Calculated voltage reading. +*/ +enum AnalogReadMode { + ANALOG_READ_MODE_UNSPECIFIED = 0; // Default value. + ANALOG_READ_MODE_PIN_VALUE = 1; // Raw ADC reading. + ANALOG_READ_MODE_PIN_VOLTAGE = 2; // Calculated voltage reading. +} + /** * AnalogIOAdd adds an analog pin to the device. */ @@ -11,17 +22,6 @@ message AnalogIOAdd { int32 gpio_num = 1; // Correlates with `name` in the JSON definition float period = 2; // Period is in seconds AnalogReadMode read_mode = 3; // Type of value read by an analog pin. - - /** - * Selects the type of value read by an analog pin. - * PIN_VALUE: Raw ADC reading. - * PIN_VOLTAGE: Calculated voltage reading. - */ - enum AnalogReadMode { - ANALOG_READ_MODE_UNSPECIFIED = 0; // Default value. - ANALOG_READ_MODE_PIN_VALUE = 1; // Raw ADC reading. - ANALOG_READ_MODE_PIN_VOLTAGE = 2; // Calculated voltage reading. - } } /** From 12294b549ea8543c2c6e8d30a5787e65e64ce282 Mon Sep 17 00:00:00 2001 From: brentru Date: Thu, 14 Dec 2023 12:42:11 -0500 Subject: [PATCH 034/188] pull enums out of add message in digitalio --- proto/wippersnapper/digitalio.proto | 38 ++++++++++++++--------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/proto/wippersnapper/digitalio.proto b/proto/wippersnapper/digitalio.proto index 2c126d35..8ae0a240 100644 --- a/proto/wippersnapper/digitalio.proto +++ b/proto/wippersnapper/digitalio.proto @@ -3,6 +3,25 @@ syntax = "proto3"; package wippersnapper.digitalio; +/** +* DigitalIOSampleMode specifies the pin's sample mode. +*/ +enum DigitalIOSampleMode { + DIGITAL_IO_SAMPLE_MODE_UNSPECIFIED = 0; /** Invalid Sample Mode from Broker. */ + DIGITAL_IO_SAMPLE_MODE_TIMER = 1; /** Periodically sample the pin's value. */ + DIGITAL_IO_SAMPLE_MODE_EVENT = 2; /** Sample the pin's value when an event occurs. */ +} + +/** +* DigitalIODirection specifies the pin's direction, INPUT/INPUT_PULL_UP/OUTPUT. +*/ +enum DigitalIODirection { + DIGITAL_IO_DIRECTION_UNSPECIFIED = 0; /** Invalid Direction from Broker. */ + DIGITAL_IO_DIRECTION_INPUT = 1; /** Set the pin to behave as an input. */ + DIGITAL_IO_DIRECTION_INPUT_PULL_UP = 2; /** Set the pin to behave as an input. */ + DIGITAL_IO_DIRECTION_OUTPUT = 3; /** Set the pin to behave as an output. */ +} + /** * DigitalIOAdd adds a digital pin to the device. */ @@ -12,25 +31,6 @@ message DigitalIOAdd { DigitalIOSampleMode sample_mode = 3; /** Specifies the pin's sample mode. */ float period = 4; /** Time between measurements in seconds, if MODE_TIMER. */ bool value = 5; /** Re-sync only - send the pin's value. */ - - /** - * DigitalIOSampleMode specifies the pin's sample mode. - */ - enum DigitalIOSampleMode { - DIGITAL_IO_SAMPLE_MODE_UNSPECIFIED = 0; /** Invalid Sample Mode from Broker. */ - DIGITAL_IO_SAMPLE_MODE_TIMER = 1; /** Periodically sample the pin's value. */ - DIGITAL_IO_SAMPLE_MODE_EVENT = 2; /** Sample the pin's value when an event occurs. */ - } - - /** - * DigitalIODirection specifies the pin's direction, INPUT or OUTPUT. - */ - enum DigitalIODirection { - DIGITAL_IO_DIRECTION_UNSPECIFIED = 0; /** Invalid Direction from Broker. */ - DIGITAL_IO_DIRECTION_INPUT = 1; /** Set the pin to behave as an input. */ - DIGITAL_IO_DIRECTION_INPUT_PULL_UP = 2; /** Set the pin to behave as an input. */ - DIGITAL_IO_DIRECTION_OUTPUT = 3; /** Set the pin to behave as an output. */ - } } /** From df8d1413a5f4520e6757f1fbd685ed31f5a52db7 Mon Sep 17 00:00:00 2001 From: brentru Date: Thu, 14 Dec 2023 13:05:21 -0500 Subject: [PATCH 035/188] enforce onewirepin option, new i2c sensor properties message from old i2c.proto but now in sensor.proto --- proto/wippersnapper/ds18x20.options | 6 +++--- proto/wippersnapper/ds18x20.proto | 6 +++--- proto/wippersnapper/sensor.proto | 8 ++++++++ 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/proto/wippersnapper/ds18x20.options b/proto/wippersnapper/ds18x20.options index aa56d620..fb6879c0 100644 --- a/proto/wippersnapper/ds18x20.options +++ b/proto/wippersnapper/ds18x20.options @@ -1,4 +1,4 @@ # ds18x20.options -# ds18x20*.onewire_pin max_size:5 -wippersnapper.ds18x20.Ds18x20Add.sensor_types max_count:2 -wippersnapper.ds18x20.Ds18x20Event.sensor_events max_count:2 \ No newline at end of file +*.ds18x20*.onewire_pin max_size:5 +wippersnapper.ds18x20.Ds18x20Add.sensor_properties max_count:2 +wippersnapper.ds18x20.Ds18x20Event.sensor_events max_count:2 \ No newline at end of file diff --git a/proto/wippersnapper/ds18x20.proto b/proto/wippersnapper/ds18x20.proto index 6b80c815..dfc5c13d 100644 --- a/proto/wippersnapper/ds18x20.proto +++ b/proto/wippersnapper/ds18x20.proto @@ -11,9 +11,9 @@ import "wippersnapper/sensor.proto"; * NOTE: This API currently only supports ONE device per OneWire bus. */ message Ds18x20Add { - string onewire_pin = 1; /** The desired pin to use as a OneWire bus. */ - int32 sensor_resolution = 2; /** The desired sensor resolution (9, 10, 11, or 12 bits). */ - repeated wippersnapper.sensor.SensorType sensor_types = 3; /** Properties for the DS18x20 sensor. */ + string onewire_pin = 1; /** The desired pin to use as a OneWire bus. */ + int32 sensor_resolution = 2; /** The desired sensor resolution (9, 10, 11, or 12 bits). */ + repeated wippersnapper.sensor.SensorProperties sensor_properties = 3; /** Properties for the DS18x20 sensor. */ } /** diff --git a/proto/wippersnapper/sensor.proto b/proto/wippersnapper/sensor.proto index 82efb154..6ebcadcd 100644 --- a/proto/wippersnapper/sensor.proto +++ b/proto/wippersnapper/sensor.proto @@ -46,6 +46,14 @@ enum SensorType { SENSOR_TYPE_BYTES = 36; /** Values are in bytes, "${$v} bytes". */ } +/** +* SensorProperties is used to define the sensor's type and period. +*/ +message SensorProperties { + SensorType sensor_type = 1; /** The sensor's type. */ + uint32 sensor_period = 2; /** The sensor's period, in milliseconds. */ +} + /** * SensorEvent is used to return the sensor's value and type. */ From 23462dda4df2163fd475f28dc268d7d7f1192e96 Mon Sep 17 00:00:00 2001 From: brentru Date: Fri, 15 Dec 2023 11:21:54 -0500 Subject: [PATCH 036/188] add sensor_types to i2c options --- proto/wippersnapper/i2c.options | 1 + 1 file changed, 1 insertion(+) diff --git a/proto/wippersnapper/i2c.options b/proto/wippersnapper/i2c.options index 6c1f9702..962496fd 100644 --- a/proto/wippersnapper/i2c.options +++ b/proto/wippersnapper/i2c.options @@ -1,4 +1,5 @@ # i2c.options *.I2CScanResponse.found_addresses max_count:120 *.I2CInit.i2c_device_name max_size:15 +*.I2CInit.sensor_types max_size:15 *.I2CEvent.sensor_events max_count:15 \ No newline at end of file From 1e803388d2d0978887dea258f641f9bf365e4b5a Mon Sep 17 00:00:00 2001 From: brentru Date: Fri, 15 Dec 2023 11:24:33 -0500 Subject: [PATCH 037/188] use max_count instead --- proto/wippersnapper/i2c.options | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proto/wippersnapper/i2c.options b/proto/wippersnapper/i2c.options index 962496fd..5a38f480 100644 --- a/proto/wippersnapper/i2c.options +++ b/proto/wippersnapper/i2c.options @@ -1,5 +1,5 @@ # i2c.options *.I2CScanResponse.found_addresses max_count:120 *.I2CInit.i2c_device_name max_size:15 -*.I2CInit.sensor_types max_size:15 +*.I2CInit.sensor_types max_count:15 *.I2CEvent.sensor_events max_count:15 \ No newline at end of file From f38742008a2f927189715f40ddeaa7777586e469 Mon Sep 17 00:00:00 2001 From: brentru Date: Fri, 15 Dec 2023 11:36:48 -0500 Subject: [PATCH 038/188] move back to how i2cinit looked in v2 --- proto/wippersnapper/i2c.options | 2 +- proto/wippersnapper/i2c.proto | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/proto/wippersnapper/i2c.options b/proto/wippersnapper/i2c.options index 5a38f480..08c3f7d3 100644 --- a/proto/wippersnapper/i2c.options +++ b/proto/wippersnapper/i2c.options @@ -1,5 +1,5 @@ # i2c.options *.I2CScanResponse.found_addresses max_count:120 *.I2CInit.i2c_device_name max_size:15 -*.I2CInit.sensor_types max_count:15 +*.I2CInit.sensor_properties max_count:15 *.I2CEvent.sensor_events max_count:15 \ No newline at end of file diff --git a/proto/wippersnapper/i2c.proto b/proto/wippersnapper/i2c.proto index 6efe872a..d3dee68f 100644 --- a/proto/wippersnapper/i2c.proto +++ b/proto/wippersnapper/i2c.proto @@ -70,12 +70,12 @@ message I2CSensorProperties { * an I2C device initialization . */ message I2CInit { - int32 i2c_port_number = 1; /** The desired I2C port to initialize an I2C device on. */ - I2CBusInit i2c_bus_init_req = 2; /** An I2C bus initialization . */ - uint32 i2c_device_address = 3; /** The 7-bit I2C address of the device on the bus. */ - string i2c_device_name = 4; /** The I2C device's name, MUST MATCH the name on the JSON definition file on + int32 i2c_port_number = 1; /** The desired I2C port to initialize an I2C device on. */ + I2CBusInit i2c_bus_init_req = 2; /** An I2C bus initialization . */ + uint32 i2c_device_address = 3; /** The 7-bit I2C address of the device on the bus. */ + string i2c_device_name = 4; /** The I2C device's name, MUST MATCH the name on the JSON definition file on https://github.com/adafruit/Wippersnapper_Components. */ - repeated wippersnapper.sensor.SensorType sensor_types = 5; /** Properties of each sensor on the I2C device. */ + repeated wippersnapper.sensor.SensorProperties sensor_properties = 5; /** Properties of each sensor on the I2C device. */ } /** From 59fce064be85b249a5054200bd06852e4ee532c8 Mon Sep 17 00:00:00 2001 From: brentru Date: Wed, 28 Feb 2024 15:02:22 -0500 Subject: [PATCH 039/188] generate for Python, too --- .github/workflows/protoc-wrapper-generation.yml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/protoc-wrapper-generation.yml b/.github/workflows/protoc-wrapper-generation.yml index bb76a9c7..bbd94535 100644 --- a/.github/workflows/protoc-wrapper-generation.yml +++ b/.github/workflows/protoc-wrapper-generation.yml @@ -36,7 +36,9 @@ jobs: run: | git config --global user.name adafruitio git config --global user.email adafruitio@adafruit.com - - name: Generate Python & JS Wrapper Files from .proto Files + + # Python Wrappers + - name: Generate Python and JS Wrapper Files from .proto Files run: | mkdir ./python_out mkdir ./python_nanopb_out @@ -51,10 +53,9 @@ jobs: path: python-checkout - name: Copy Python Files run: | - rm -rf ./python-checkout/adafruit_wippersnapper/proto/ - cp -r ./python_out/ ./python-checkout/adafruit_wippersnapper/proto/ - mkdir ./python-checkout/adafruit_wippersnapper/proto/nanopb - mv ./python_nanopb_out/protobuf_checkout/nanopb/generator/proto/nanopb_pb2.py ./python-checkout/adafruit_wippersnapper/proto/nanopb + rm -rf ./python-checkout/src/Adafruit_Wippersnapper_Python/proto + cp -r ./python_out/ ./python-checkout/src/Adafruit_Wippersnapper_Python/proto/ + mv ./python_nanopb_out/protobuf_checkout/nanopb/generator/proto/nanopb_pb2.py ./python-checkout/src/Adafruit_Wippersnapper_Python/proto/nanopb_pb2.py - name: Open Python Pull Request env: GITHUB_USER: adafruitio @@ -67,6 +68,8 @@ jobs: git commit -m "Updating protobuf wrappers" || exit 0 # quit cleanly if nothing to commit hub push origin $PROTOBUF_BRANCH_NAME-$GITHUB_SHA hub pull-request --message ".proto file wrappers updated" --message "Auto-generated by [GitHub Actions on Protobuf Repo][1]" --message "[1]: https://github.com/adafruit/Wippersnapper_Protobuf/blob/master/.github/workflows/protoc-wrapper-generation.yml" + + # Arduino Wrappers - name: Generate Arduino files from .proto Files env: PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION: python From 89e4e3afd64cd839e0b3b1763428baec7d1a64cd Mon Sep 17 00:00:00 2001 From: brentru Date: Wed, 28 Feb 2024 15:47:33 -0500 Subject: [PATCH 040/188] build python locally on PR change --- .../generate-local-python-artifacts.yml | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/generate-local-python-artifacts.yml diff --git a/.github/workflows/generate-local-python-artifacts.yml b/.github/workflows/generate-local-python-artifacts.yml new file mode 100644 index 00000000..ead2d01c --- /dev/null +++ b/.github/workflows/generate-local-python-artifacts.yml @@ -0,0 +1,41 @@ +name: Generate new CPython Protocol Buffer wrapper files and upload them as artifacts +on: [ pull_request ] +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/setup-python@v4 + with: + python-version: '3.x' + - name: Install Protoc + uses: arduino/setup-protoc@v1 + with: + version: '3.13.0' + - name: Install Python dependencies + run : | + python -m pip install --upgrade pip + pip3 install scons protobuf grpcio-tools + - name: Self Checkout + uses: actions/checkout@v3 + with: + path: protobuf-checkout + submodules: true + - name: Configure Git + run: | + git config --global user.name adafruitio + git config --global user.email adafruitio@adafruit.com + - name: Generate python wrapper files from pull request's .proto files + env: + PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION: python + run: | + mkdir ./python_out + mkdir ./python_nanopb_out + protoc --proto_path=./protobuf-checkout/proto ./protobuf-checkout/proto/wippersnapper/*.proto --python_out=./python_out + protoc ./protobuf-checkout/nanopb/generator/proto/nanopb.proto --python_out=./python_nanopb_out + # protoc --plugin=protobuf-checkout/nanopb/generator/protoc-gen-nanopb -Iprotobuf-checkout/nanopb/generator/proto --proto_path=./protobuf-checkout/proto ./protobuf-checkout/proto/wippersnapper/*.proto --nanopb_out=./arduino_out --nanopb_opt=-I./protobuf-checkout/proto --nanopb_opt=-t + # Local (non-CI) build command: + # protoc --plugin=nanopb/generator/protoc-gen-nanopb -Inanopb/generator/proto --proto_path=./proto ./proto/wippersnapper/*.proto --nanopb_out=./arduino_out --nanopb_opt=-I./proto --nanopb_opt=-t + - uses: actions/upload-artifact@v3 + with: + name: build-artifact-python-wrapper + path: ./python_out \ No newline at end of file From 531a560408cd4396deb7ad21c64804cc1ae54996 Mon Sep 17 00:00:00 2001 From: brentru Date: Wed, 28 Feb 2024 15:50:55 -0500 Subject: [PATCH 041/188] separately upload nanopb output --- .github/workflows/generate-local-python-artifacts.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/generate-local-python-artifacts.yml b/.github/workflows/generate-local-python-artifacts.yml index ead2d01c..9cbe73e8 100644 --- a/.github/workflows/generate-local-python-artifacts.yml +++ b/.github/workflows/generate-local-python-artifacts.yml @@ -32,10 +32,11 @@ jobs: mkdir ./python_nanopb_out protoc --proto_path=./protobuf-checkout/proto ./protobuf-checkout/proto/wippersnapper/*.proto --python_out=./python_out protoc ./protobuf-checkout/nanopb/generator/proto/nanopb.proto --python_out=./python_nanopb_out - # protoc --plugin=protobuf-checkout/nanopb/generator/protoc-gen-nanopb -Iprotobuf-checkout/nanopb/generator/proto --proto_path=./protobuf-checkout/proto ./protobuf-checkout/proto/wippersnapper/*.proto --nanopb_out=./arduino_out --nanopb_opt=-I./protobuf-checkout/proto --nanopb_opt=-t - # Local (non-CI) build command: - # protoc --plugin=nanopb/generator/protoc-gen-nanopb -Inanopb/generator/proto --proto_path=./proto ./proto/wippersnapper/*.proto --nanopb_out=./arduino_out --nanopb_opt=-I./proto --nanopb_opt=-t - uses: actions/upload-artifact@v3 with: - name: build-artifact-python-wrapper - path: ./python_out \ No newline at end of file + name: build-python-wrappers + path: ./python_out + - uses: actions/upload-artifact@v3 + with: + name: build-python-nanopb-out + path: ./python_nanopb_out \ No newline at end of file From fb33b842caa44718b981366c1f3c908055b00c33 Mon Sep 17 00:00:00 2001 From: brentru Date: Thu, 29 Feb 2024 16:32:40 -0500 Subject: [PATCH 042/188] swap description for checkin, add response message to b2d msg --- proto/wippersnapper/checkin.options | 2 ++ proto/wippersnapper/checkin.proto | 31 ++++++++++++++++ proto/wippersnapper/description.options | 2 -- proto/wippersnapper/description.proto | 47 ------------------------- proto/wippersnapper/signal.proto | 14 ++++---- 5 files changed, 39 insertions(+), 57 deletions(-) create mode 100644 proto/wippersnapper/checkin.options create mode 100644 proto/wippersnapper/checkin.proto delete mode 100644 proto/wippersnapper/description.options delete mode 100644 proto/wippersnapper/description.proto diff --git a/proto/wippersnapper/checkin.options b/proto/wippersnapper/checkin.options new file mode 100644 index 00000000..0df23f21 --- /dev/null +++ b/proto/wippersnapper/checkin.options @@ -0,0 +1,2 @@ +# description.options +*.CheckInRequest.hardware_uid max_size:64 \ No newline at end of file diff --git a/proto/wippersnapper/checkin.proto b/proto/wippersnapper/checkin.proto new file mode 100644 index 00000000..55d119a3 --- /dev/null +++ b/proto/wippersnapper/checkin.proto @@ -0,0 +1,31 @@ +// SPDX-FileCopyrightText: 2020-2024 Brent Rubell for Adafruit Industries +// SPDX-License-Identifier: MIT +// Messages for registering new and existing hardware with the Adafruit.io MQTT Broker +syntax = "proto3"; +package wippersnapper.checkin; + +message CheckinRequest { + string hardware_uid = 1; /** Identifies the client's physical hardware (board name + last 3 of NIC's MAC address). */ +} + +message CheckinResponse { + Response response = 1; /** Specifies if the hardware definition exists on the server. */ + int32 total_gpio_pins = 2; /** Specifies the number of GPIO pins on the device. */ + int32 total_analog_pins = 3; /** Specifies the number of analog pins on the device. */ + float reference_voltage = 4; /** Specifies the hardware's default reference voltage. */ + int32 total_i2c_ports = 5; /** Specifies the number of hardware's I2C ports (i2cPorts[]). */ + + /** + * Response. Specifies if the hardware definiton is within the database. + */ + enum Response { + RESPONSE_UNSPECIFIED = 0; /** Invalid response from server */ + RESPONSE_OK = 1; /** Board found within definition index */ + RESPONSE_BOARD_NOT_FOUND = 2; /** Board not found in definition index */ + } +} + +message CheckinCompleted { + bool is_complete = 1; /** Specifies if the device has completed the checkin process. */ +} + diff --git a/proto/wippersnapper/description.options b/proto/wippersnapper/description.options deleted file mode 100644 index 801bd8b9..00000000 --- a/proto/wippersnapper/description.options +++ /dev/null @@ -1,2 +0,0 @@ -# description.options -*.CreateDescriptionRequest.str_version max_size:20 \ No newline at end of file diff --git a/proto/wippersnapper/description.proto b/proto/wippersnapper/description.proto deleted file mode 100644 index 6c8c2a59..00000000 --- a/proto/wippersnapper/description.proto +++ /dev/null @@ -1,47 +0,0 @@ -// SPDX-FileCopyrightText: 2020-2023 Brent Rubell for Adafruit Industries -// SPDX-License-Identifier: MIT -// Messages for describing hardware over the description topic -syntax = "proto3"; -package wippersnapper.description; - -/** -* CreateDescriptionRequest identifies a device with Adafruit.io WipperSnapper. -*/ -message CreateDescriptionRequest { - string str_version = 1; /** Library version, as a string */ -} - -// TODO: Consider dropping this, and compiling these as a header file (per-board) from the -// JSON if it is possible to do so. - -// This is handled within decodeRegistrationResp(). We would like to drop it completely. -// TODO: Try the new esp32 function sto detect totoal gpio, analog and reference -// If that works, we can try to remove WipperSnapper_Register.cpp entirely and use the esp32 func -// to detect on ESP32 platforms, otherwise add these values into _Boards.h -/** -* CreateDescription represents a device's specifications. -*/ -message CreateDescription { - Response response = 1; /** Specifies if the hardware definition exists on the server. */ - int32 total_gpio_pins = 2; /** Specifies the number of GPIO pins on the device. */ - int32 total_analog_pins = 3; /** Specifies the number of analog pins on the device. */ - float reference_voltage = 4; /** Specifies the hardware's default reference voltage. */ - int32 total_i2c_ports = 5; /** Specifies the number of hardware's I2C ports (i2cPorts[]). */ - - /** - * Response. Specifies if the hardware definiton is within the database. - */ - enum Response { - RESPONSE_UNSPECIFIED = 0; /** Invalid response from server */ - RESPONSE_OK = 1; /** Board found within definition index */ - RESPONSE_BOARD_NOT_FOUND = 2; /** Board not found in definition index */ - } -} - -/** -* RegistrationComplete Specifies if the device finished configuring -* its components and is ready for configuration messages. -*/ -message RegistrationComplete { - bool is_complete = 1; /** Did the device successfully configure its components? */ -} diff --git a/proto/wippersnapper/signal.proto b/proto/wippersnapper/signal.proto index 9cac5b90..3198dc0a 100644 --- a/proto/wippersnapper/signal.proto +++ b/proto/wippersnapper/signal.proto @@ -4,10 +4,8 @@ syntax = "proto3"; package wippersnapper.signal; import "nanopb/nanopb.proto"; -// TODO: Shorten all of these files to: -// wippersnapper/*.proto import "wippersnapper/analogio.proto"; -import "wippersnapper/description.proto"; +import "wippersnapper/checkin.proto"; import "wippersnapper/digitalio.proto"; import "wippersnapper/ds18x20.proto"; import "wippersnapper/error.proto"; @@ -32,8 +30,9 @@ message BrokerToDevice { // analogio.proto wippersnapper.analogio.AnalogIOAdd analogio_add = 20; wippersnapper.analogio.AnalogIOAdd analogio_remove = 21; - // description.proto - wippersnapper.description.CreateDescription create_description = 30; + // checkin.proto + wippersnapper.checkin.CheckinRequest checkin_request = 30; + wippersnapper.checkin.CheckinRequest checkin_completed = 31; // servo.proto wippersnapper.servo.ServoAdd servo_add = 40; wippersnapper.servo.ServoRemove servo_remove = 41; @@ -76,9 +75,8 @@ message DeviceToBroker { wippersnapper.digitalio.DigitalIOEvent digitalio_event = 10; // analogio.proto wippersnapper.analogio.AnalogIOEvent analogio_event = 20; - // description.proto - // NOTE: we may be able to eventually remove this - wippersnapper.description.RegistrationComplete registration_complete = 30; + // checkin.proto + wippersnapper.checkin.CheckinResponse checkin_response = 30; // servo.proto wippersnapper.servo.ServoAdded servo_added = 40; // pwm.proto From 30fe4cea9cc2003e85c453d25624b9e93f64dc4f Mon Sep 17 00:00:00 2001 From: brentru Date: Thu, 29 Feb 2024 16:36:39 -0500 Subject: [PATCH 043/188] add comments --- proto/wippersnapper/checkin.proto | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/proto/wippersnapper/checkin.proto b/proto/wippersnapper/checkin.proto index 55d119a3..1d7e3a4a 100644 --- a/proto/wippersnapper/checkin.proto +++ b/proto/wippersnapper/checkin.proto @@ -4,10 +4,16 @@ syntax = "proto3"; package wippersnapper.checkin; +/** +* CheckinRequest notifies the MQTT broker that a new/existing device is requesting to connect. +*/ message CheckinRequest { string hardware_uid = 1; /** Identifies the client's physical hardware (board name + last 3 of NIC's MAC address). */ } +/** +* CheckinResponse sends a broker response to the client's CheckinRequest. +*/ message CheckinResponse { Response response = 1; /** Specifies if the hardware definition exists on the server. */ int32 total_gpio_pins = 2; /** Specifies the number of GPIO pins on the device. */ @@ -25,6 +31,9 @@ message CheckinResponse { } } +/** +* CheckinResponse sends the broker a message signaling the device's sync process has fully completed. +*/ message CheckinCompleted { bool is_complete = 1; /** Specifies if the device has completed the checkin process. */ } From 98e6155a050f824ef0ffa8532493b856a0cb97e9 Mon Sep 17 00:00:00 2001 From: brentru Date: Fri, 1 Mar 2024 11:02:11 -0500 Subject: [PATCH 044/188] send firmware version upon checkin --- proto/wippersnapper/checkin.options | 3 ++- proto/wippersnapper/checkin.proto | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/proto/wippersnapper/checkin.options b/proto/wippersnapper/checkin.options index 0df23f21..f17e951e 100644 --- a/proto/wippersnapper/checkin.options +++ b/proto/wippersnapper/checkin.options @@ -1,2 +1,3 @@ # description.options -*.CheckInRequest.hardware_uid max_size:64 \ No newline at end of file +*.CheckInRequest.hardware_uid max_size:64 +*.CheckInRequest.firmware_version max_size:25 \ No newline at end of file diff --git a/proto/wippersnapper/checkin.proto b/proto/wippersnapper/checkin.proto index 1d7e3a4a..c41b455c 100644 --- a/proto/wippersnapper/checkin.proto +++ b/proto/wippersnapper/checkin.proto @@ -9,6 +9,7 @@ package wippersnapper.checkin; */ message CheckinRequest { string hardware_uid = 1; /** Identifies the client's physical hardware (board name + last 3 of NIC's MAC address). */ + string firmware_version = 2; /** Identifies the client's firmware version. */ } /** From a6629b743705594fde4c7fc8a87e20543c09d223 Mon Sep 17 00:00:00 2001 From: brentru Date: Fri, 1 Mar 2024 12:37:12 -0500 Subject: [PATCH 045/188] remove checkin completed --- proto/wippersnapper/checkin.proto | 7 ------- proto/wippersnapper/signal.proto | 1 - 2 files changed, 8 deletions(-) diff --git a/proto/wippersnapper/checkin.proto b/proto/wippersnapper/checkin.proto index c41b455c..d168991b 100644 --- a/proto/wippersnapper/checkin.proto +++ b/proto/wippersnapper/checkin.proto @@ -32,10 +32,3 @@ message CheckinResponse { } } -/** -* CheckinResponse sends the broker a message signaling the device's sync process has fully completed. -*/ -message CheckinCompleted { - bool is_complete = 1; /** Specifies if the device has completed the checkin process. */ -} - diff --git a/proto/wippersnapper/signal.proto b/proto/wippersnapper/signal.proto index 3198dc0a..61347106 100644 --- a/proto/wippersnapper/signal.proto +++ b/proto/wippersnapper/signal.proto @@ -32,7 +32,6 @@ message BrokerToDevice { wippersnapper.analogio.AnalogIOAdd analogio_remove = 21; // checkin.proto wippersnapper.checkin.CheckinRequest checkin_request = 30; - wippersnapper.checkin.CheckinRequest checkin_completed = 31; // servo.proto wippersnapper.servo.ServoAdd servo_add = 40; wippersnapper.servo.ServoRemove servo_remove = 41; From f8b9a479f0dcbb0be4c1b8b1e68f0d193bce2593 Mon Sep 17 00:00:00 2001 From: brentru Date: Fri, 1 Mar 2024 15:44:13 -0500 Subject: [PATCH 046/188] give every .proto documentation in .md format --- proto/wippersnapper/analogio.md | 1 + proto/wippersnapper/checkin.md | 1 + proto/wippersnapper/digitalio.md | 1 + proto/wippersnapper/error.md | 1 + proto/wippersnapper/i2c.md | 1 + proto/wippersnapper/sensor.md | 1 + proto/wippersnapper/signal.md | 1 + 7 files changed, 7 insertions(+) create mode 100644 proto/wippersnapper/analogio.md create mode 100644 proto/wippersnapper/checkin.md create mode 100644 proto/wippersnapper/digitalio.md create mode 100644 proto/wippersnapper/error.md create mode 100644 proto/wippersnapper/i2c.md create mode 100644 proto/wippersnapper/sensor.md create mode 100644 proto/wippersnapper/signal.md diff --git a/proto/wippersnapper/analogio.md b/proto/wippersnapper/analogio.md new file mode 100644 index 00000000..a3c39771 --- /dev/null +++ b/proto/wippersnapper/analogio.md @@ -0,0 +1 @@ +# TODO! \ No newline at end of file diff --git a/proto/wippersnapper/checkin.md b/proto/wippersnapper/checkin.md new file mode 100644 index 00000000..a3c39771 --- /dev/null +++ b/proto/wippersnapper/checkin.md @@ -0,0 +1 @@ +# TODO! \ No newline at end of file diff --git a/proto/wippersnapper/digitalio.md b/proto/wippersnapper/digitalio.md new file mode 100644 index 00000000..a3c39771 --- /dev/null +++ b/proto/wippersnapper/digitalio.md @@ -0,0 +1 @@ +# TODO! \ No newline at end of file diff --git a/proto/wippersnapper/error.md b/proto/wippersnapper/error.md new file mode 100644 index 00000000..f87f5c14 --- /dev/null +++ b/proto/wippersnapper/error.md @@ -0,0 +1 @@ +# TODO \ No newline at end of file diff --git a/proto/wippersnapper/i2c.md b/proto/wippersnapper/i2c.md new file mode 100644 index 00000000..f87f5c14 --- /dev/null +++ b/proto/wippersnapper/i2c.md @@ -0,0 +1 @@ +# TODO \ No newline at end of file diff --git a/proto/wippersnapper/sensor.md b/proto/wippersnapper/sensor.md new file mode 100644 index 00000000..f87f5c14 --- /dev/null +++ b/proto/wippersnapper/sensor.md @@ -0,0 +1 @@ +# TODO \ No newline at end of file diff --git a/proto/wippersnapper/signal.md b/proto/wippersnapper/signal.md new file mode 100644 index 00000000..f87f5c14 --- /dev/null +++ b/proto/wippersnapper/signal.md @@ -0,0 +1 @@ +# TODO \ No newline at end of file From a916c40d1fb6e4d5a9a4380bfeb98d4bf4260f2a Mon Sep 17 00:00:00 2001 From: brentru Date: Mon, 4 Mar 2024 13:24:25 -0500 Subject: [PATCH 047/188] add one for checkin --- proto/wippersnapper/checkin.md | 80 +++++++++++++++++++++++++++++++++- 1 file changed, 79 insertions(+), 1 deletion(-) diff --git a/proto/wippersnapper/checkin.md b/proto/wippersnapper/checkin.md index a3c39771..f1ed5776 100644 --- a/proto/wippersnapper/checkin.md +++ b/proto/wippersnapper/checkin.md @@ -1 +1,79 @@ -# TODO! \ No newline at end of file + +# checkin.proto + +This file details connecting a new or existing hardware to the Adafruit IO MQTT broker. + +## WipperSnapper Components + + + +The following WipperSnapper components utilize `servo.proto`: +* [Generic Servo](https://github.com/adafruit/Wippersnapper_Components/tree/main/components/servo/servo) + + +## Sequence Diagrams + + + +### Create: Servo + +```mermaid +sequenceDiagram +autonumber +IO-->>Device: ServoAttachRequest +Note over IO, Device: Contains:
`servo_pin` from form
`servo_freq` of 50Hz
`min_pulse_width` from form
`max_pulse_width` from form + +Device->>IO: ServoAttachResponse +Note over IO, Device: Contains: Success code and servo's pin +``` + +### Write: Servo + +```mermaid +sequenceDiagram +autonumber + +IO->>Device: ServoWriteRequest +Note over IO, Device: Position is sent from Adafruit IO as a pulse width
between 500uS and 2500uS.
The client application must convert pulse width to duty cycle
with fixed freq of 50Hz prior to writing to the servo pin. +``` + + + +### Update: Servo + +```mermaid +sequenceDiagram +autonumber + +IO->>Device: ServoDetachRequest +Note over IO, Device: Deinits servo object, releases gpio pin +IO-->>Device: ServoAttachRequest +Note over IO, Device: Contains:
`servo_pin` from form
`servo_freq` of 50Hz
`min_pulse_width` from form
`max_pulse_width` from form +Device->>IO: ServoAttachResponse +Note over IO, Device: Contains: Success code and servo's pin +``` + + + +### Delete: Servo + +```mermaid +sequenceDiagram +autonumber +IO->>Device: ServoDetachRequest +Note over IO, Device: Contains:
`servo_pin` from DB. +``` + + + +### Sync: Servo + +```mermaid +sequenceDiagram +autonumber +IO-->>Device: ServoAttachRequest +Note over IO, Device: Contains:
`servo_pin` from form
`servo_freq` of 50Hz
`min_pulse_width` from form
`max_pulse_width` from form + +Device->>IO: ServoAttachResponse +Note over IO, Device: Contains: Success code and servo's pin +``` \ No newline at end of file From a50b4e999be9494710e4b60bb5097d0338c44be8 Mon Sep 17 00:00:00 2001 From: brentru Date: Tue, 5 Mar 2024 13:10:07 -0500 Subject: [PATCH 048/188] move documentation into docs folder to keep wippersnapper/ folder flat --- proto/wippersnapper/{ => docs}/analogio.md | 0 proto/wippersnapper/{ => docs}/checkin.md | 0 proto/wippersnapper/{description/v1 => docs}/description.md | 0 proto/wippersnapper/{ => docs}/digitalio.md | 0 proto/wippersnapper/{ds18x20/v1 => docs}/ds18x20.md | 0 proto/wippersnapper/{ => docs}/error.md | 0 proto/wippersnapper/{i2c/v1 => docs}/i2c.md | 0 proto/wippersnapper/{ => docs}/pixels.md | 0 proto/wippersnapper/{ => docs}/pwm.md | 0 proto/wippersnapper/{ => docs}/sensor.md | 0 proto/wippersnapper/{ => docs}/servo.md | 0 proto/wippersnapper/{signal/v1 => docs}/signal.md | 0 proto/wippersnapper/{ => docs}/uart.md | 0 proto/wippersnapper/i2c.md | 1 - proto/wippersnapper/signal.md | 1 - 15 files changed, 2 deletions(-) rename proto/wippersnapper/{ => docs}/analogio.md (100%) rename proto/wippersnapper/{ => docs}/checkin.md (100%) rename proto/wippersnapper/{description/v1 => docs}/description.md (100%) rename proto/wippersnapper/{ => docs}/digitalio.md (100%) rename proto/wippersnapper/{ds18x20/v1 => docs}/ds18x20.md (100%) rename proto/wippersnapper/{ => docs}/error.md (100%) rename proto/wippersnapper/{i2c/v1 => docs}/i2c.md (100%) rename proto/wippersnapper/{ => docs}/pixels.md (100%) rename proto/wippersnapper/{ => docs}/pwm.md (100%) rename proto/wippersnapper/{ => docs}/sensor.md (100%) rename proto/wippersnapper/{ => docs}/servo.md (100%) rename proto/wippersnapper/{signal/v1 => docs}/signal.md (100%) rename proto/wippersnapper/{ => docs}/uart.md (100%) delete mode 100644 proto/wippersnapper/i2c.md delete mode 100644 proto/wippersnapper/signal.md diff --git a/proto/wippersnapper/analogio.md b/proto/wippersnapper/docs/analogio.md similarity index 100% rename from proto/wippersnapper/analogio.md rename to proto/wippersnapper/docs/analogio.md diff --git a/proto/wippersnapper/checkin.md b/proto/wippersnapper/docs/checkin.md similarity index 100% rename from proto/wippersnapper/checkin.md rename to proto/wippersnapper/docs/checkin.md diff --git a/proto/wippersnapper/description/v1/description.md b/proto/wippersnapper/docs/description.md similarity index 100% rename from proto/wippersnapper/description/v1/description.md rename to proto/wippersnapper/docs/description.md diff --git a/proto/wippersnapper/digitalio.md b/proto/wippersnapper/docs/digitalio.md similarity index 100% rename from proto/wippersnapper/digitalio.md rename to proto/wippersnapper/docs/digitalio.md diff --git a/proto/wippersnapper/ds18x20/v1/ds18x20.md b/proto/wippersnapper/docs/ds18x20.md similarity index 100% rename from proto/wippersnapper/ds18x20/v1/ds18x20.md rename to proto/wippersnapper/docs/ds18x20.md diff --git a/proto/wippersnapper/error.md b/proto/wippersnapper/docs/error.md similarity index 100% rename from proto/wippersnapper/error.md rename to proto/wippersnapper/docs/error.md diff --git a/proto/wippersnapper/i2c/v1/i2c.md b/proto/wippersnapper/docs/i2c.md similarity index 100% rename from proto/wippersnapper/i2c/v1/i2c.md rename to proto/wippersnapper/docs/i2c.md diff --git a/proto/wippersnapper/pixels.md b/proto/wippersnapper/docs/pixels.md similarity index 100% rename from proto/wippersnapper/pixels.md rename to proto/wippersnapper/docs/pixels.md diff --git a/proto/wippersnapper/pwm.md b/proto/wippersnapper/docs/pwm.md similarity index 100% rename from proto/wippersnapper/pwm.md rename to proto/wippersnapper/docs/pwm.md diff --git a/proto/wippersnapper/sensor.md b/proto/wippersnapper/docs/sensor.md similarity index 100% rename from proto/wippersnapper/sensor.md rename to proto/wippersnapper/docs/sensor.md diff --git a/proto/wippersnapper/servo.md b/proto/wippersnapper/docs/servo.md similarity index 100% rename from proto/wippersnapper/servo.md rename to proto/wippersnapper/docs/servo.md diff --git a/proto/wippersnapper/signal/v1/signal.md b/proto/wippersnapper/docs/signal.md similarity index 100% rename from proto/wippersnapper/signal/v1/signal.md rename to proto/wippersnapper/docs/signal.md diff --git a/proto/wippersnapper/uart.md b/proto/wippersnapper/docs/uart.md similarity index 100% rename from proto/wippersnapper/uart.md rename to proto/wippersnapper/docs/uart.md diff --git a/proto/wippersnapper/i2c.md b/proto/wippersnapper/i2c.md deleted file mode 100644 index f87f5c14..00000000 --- a/proto/wippersnapper/i2c.md +++ /dev/null @@ -1 +0,0 @@ -# TODO \ No newline at end of file diff --git a/proto/wippersnapper/signal.md b/proto/wippersnapper/signal.md deleted file mode 100644 index f87f5c14..00000000 --- a/proto/wippersnapper/signal.md +++ /dev/null @@ -1 +0,0 @@ -# TODO \ No newline at end of file From 6650b70fc6394bfe1cd974f578f16d6e3c20097d Mon Sep 17 00:00:00 2001 From: brentru Date: Tue, 5 Mar 2024 13:41:33 -0500 Subject: [PATCH 049/188] add updated signal documentation --- proto/wippersnapper/docs/signal.md | 39 ++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/proto/wippersnapper/docs/signal.md b/proto/wippersnapper/docs/signal.md index 3550ebd7..d7f910a5 100644 --- a/proto/wippersnapper/docs/signal.md +++ b/proto/wippersnapper/docs/signal.md @@ -1,20 +1,43 @@ - # signal.proto -This file details the `signal.proto` message used to communicate between WipperSnapper clients. The signal file contains high-level `oneof` messages that "wrap" the following protocol buffer APIs: `pin.proto`, `i2c.proto`, `servo.proto`, `pwm.proto`, `ds18x20.proto`, `pixels .proto`, `uart.proto`. +This file details the `signal.proto` message used to communicate between WipperSnapper clients. + +## Message Format +The signal file contains two messages. Both messages contain `oneof` "payload" message, which is a union of all the possible messages that can be sent from a device to the broker (and visa-versa) + +### Payload Message Naming Conventions + +Message fields within `signal.proto` generally follow the naming convention: +* `_add`: Message contains a command payload for configuring and adding a component to a device. + * `_added`: Message contains a response payload from an `_add` message +* `_remove`: Message contains a payload for releasing a component's resources and "removing" it from the device. + * `_removed`: Message contains a response payload from an `_remove` message +* `_write`: Message contains a payload for transmitting or "writing" data to a component connected to a device. + * Within `pwm.proto`, there are multiple types of `_write` such as `_write_duty`, `_write_freq`, etc... +* `_event`: Message is a payload containing sensor data and metadata. Data may be "packed", containing multiple sensor events. + +Some message fields do not follow this naming convention because their API is more involved than the general fields above: +* `_scan`: Message contains a command payload for performing a scan of I2C components connected to a device +* `_response`: Message contains a response payload for an action not compatible with any of the above field names. + ## Sequence Diagrams -### Generalized `msgRequest` and `msgResponse` +### High-Level Operation -Within `signal.proto`, each `.proto` API contains both a `request` and `response` message. The `request` message is a command sent from the broker to a device. The `response` message is a command sent from the device to the broker. +When a message is sent from a broker to a device, the `BrokerToDevice` message is utilized. When a message is sent from a device to a broker, the `DeviceToBroker` message is sent. ```mermaid sequenceDiagram autonumber -IO->>Device: msgRequest -Note over IO,Device: Device unpacks`payload` message. -Device->>IO: msgResponse -Note over Device,IO: Broker unpacks `payload` message +IO Broker->>Device Client: BrokerToDevice +Device Client->>App: BrokerToDevice +App->>Dispatcher Class: BrokerToDevice +Dispatcher Class->>Component Class: Payload, in serialized form +Component Class->>Dispatcher Class: DeviceToBroker payload +Dispatcher Class->>App: Serialized DeviceToBroker msg +App->>Device Client: DeviceToBroker +Device Client->>IO Broker: DeviceToBroker + ``` \ No newline at end of file From ad0562c0390f17d7c4f4625a89324f2af17867b7 Mon Sep 17 00:00:00 2001 From: brentru Date: Tue, 5 Mar 2024 14:19:43 -0500 Subject: [PATCH 050/188] match v1 signal diagram --- proto/wippersnapper/docs/signal.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/proto/wippersnapper/docs/signal.md b/proto/wippersnapper/docs/signal.md index d7f910a5..9f3296ae 100644 --- a/proto/wippersnapper/docs/signal.md +++ b/proto/wippersnapper/docs/signal.md @@ -32,12 +32,13 @@ sequenceDiagram autonumber IO Broker->>Device Client: BrokerToDevice +Note over IO Broker,Device Client: /:username/wprsnpr/:clientId Device Client->>App: BrokerToDevice -App->>Dispatcher Class: BrokerToDevice -Dispatcher Class->>Component Class: Payload, in serialized form -Component Class->>Dispatcher Class: DeviceToBroker payload -Dispatcher Class->>App: Serialized DeviceToBroker msg +App->>(nanopb) Encoder/Decoder: BrokerToDevice +(nanopb) Encoder/Decoder->>Component Class: ServoAdd +Component Class->>(nanopb) Encoder/Decoder: Result of ServoAdd, servo_added +(nanopb) Encoder/Decoder->>App: DeviceToBroker App->>Device Client: DeviceToBroker Device Client->>IO Broker: DeviceToBroker - +Note over IO Broker,Device Client: /:username/wprsnpr/:clientId ``` \ No newline at end of file From 465b38c67e0692bd1ea2b7b6504aef8c0ae84721 Mon Sep 17 00:00:00 2001 From: brentru Date: Tue, 5 Mar 2024 16:25:41 -0500 Subject: [PATCH 051/188] document v2 check-in --- proto/wippersnapper/docs/checkin.md | 75 ++++++++--------------------- 1 file changed, 19 insertions(+), 56 deletions(-) diff --git a/proto/wippersnapper/docs/checkin.md b/proto/wippersnapper/docs/checkin.md index f1ed5776..c41f7a82 100644 --- a/proto/wippersnapper/docs/checkin.md +++ b/proto/wippersnapper/docs/checkin.md @@ -1,79 +1,42 @@ -# checkin.proto +# description.proto -This file details connecting a new or existing hardware to the Adafruit IO MQTT broker. +This file details how WipperSnapper firmware. registers a new or checks-in an existing board with the Adafruit IO MQTT broker. -## WipperSnapper Components - - - -The following WipperSnapper components utilize `servo.proto`: -* [Generic Servo](https://github.com/adafruit/Wippersnapper_Components/tree/main/components/servo/servo) - ## Sequence Diagrams - + +### Process: Check in -### Create: Servo +WipperSnapper's check in process involves a board sending its hardware identifier, MAC address and library version to the MQTT Broker. The broker verifies if the hardware's "digital twin" definition exists within the [WipperSnapper_Boards](https://github.com/adafruit/Wippersnapper_Boards) repository. -```mermaid -sequenceDiagram -autonumber -IO-->>Device: ServoAttachRequest -Note over IO, Device: Contains:
`servo_pin` from form
`servo_freq` of 50Hz
`min_pulse_width` from form
`max_pulse_width` from form - -Device->>IO: ServoAttachResponse -Note over IO, Device: Contains: Success code and servo's pin -``` - -### Write: Servo +Then, the broker sends a message back to the board with `OK` if found within the repo. If the board was not found within the repo, the `NOT_FOUND` response is sent and the board should disconnect from the broker and halt. ```mermaid -sequenceDiagram -autonumber - -IO->>Device: ServoWriteRequest -Note over IO, Device: Position is sent from Adafruit IO as a pulse width
between 500uS and 2500uS.
The client application must convert pulse width to duty cycle
with fixed freq of 50Hz prior to writing to the servo pin. -``` - - -### Update: Servo - -```mermaid sequenceDiagram + autonumber -IO->>Device: ServoDetachRequest -Note over IO, Device: Deinits servo object, releases gpio pin -IO-->>Device: ServoAttachRequest -Note over IO, Device: Contains:
`servo_pin` from form
`servo_freq` of 50Hz
`min_pulse_width` from form
`max_pulse_width` from form -Device->>IO: ServoAttachResponse -Note over IO, Device: Contains: Success code and servo's pin +Device-->>IO: CheckinRequest +Note over Device,IO: This message is sent over the general MQTT
topic: /:user/wprsnpr/status +IO->>Storage (DB): Check if machine_name
exists as a JSON definition
within the Boards repo +Storage (DB)->>IO: Return RESPONSE_OK
or RESPONSE_BOARD_NOT_FOUND +IO-->>Device: CheckinResponse +Note over IO,Device: Contains metadata about the physical hardware
from the JSON definition file. ``` - - -### Delete: Servo -```mermaid -sequenceDiagram -autonumber -IO->>Device: ServoDetachRequest -Note over IO, Device: Contains:
`servo_pin` from DB. -``` +### Process: Hardware Configuration +Where it can, the WipperSnapper firmware avoids dynamic allocation. If the `CheckinResponse` message contains a valid response( `RESPONSE_OK` ), fields from the `CheckinResponse` message are parsed and used to configure some hardware-specific classes: - -### Sync: Servo - ```mermaid sequenceDiagram autonumber -IO-->>Device: ServoAttachRequest -Note over IO, Device: Contains:
`servo_pin` from form
`servo_freq` of 50Hz
`min_pulse_width` from form
`max_pulse_width` from form - -Device->>IO: ServoAttachResponse -Note over IO, Device: Contains: Success code and servo's pin +Device->>App: Parse CheckinResponse +App->>Digital IO Class: Configure total_gpio_pins +App->>Analog IO Class: Configure total_analog_pins and reference_voltage +App->>I2C Class: Configure total_i2c_ports ``` \ No newline at end of file From ac90d7ab770be56bb5c322e7698b50548e6b194e Mon Sep 17 00:00:00 2001 From: brentru Date: Tue, 5 Mar 2024 16:25:57 -0500 Subject: [PATCH 052/188] remove description.md in v2 --- proto/wippersnapper/docs/description.md | 60 ------------------------- 1 file changed, 60 deletions(-) delete mode 100644 proto/wippersnapper/docs/description.md diff --git a/proto/wippersnapper/docs/description.md b/proto/wippersnapper/docs/description.md deleted file mode 100644 index 5c60801f..00000000 --- a/proto/wippersnapper/docs/description.md +++ /dev/null @@ -1,60 +0,0 @@ - -# description.proto - -This file details how WipperSnapper firmware. registers a new or checks-in an existing board with the Adafruit IO MQTT broker. - - -## Sequence Diagrams - - -### Process: Check in - -WipperSnapper's check in process involves a board sending its hardware identifier, MAC address and library version to the MQTT Broker. The broker verifies if the hardware's "digital twin" definition exists within the [WipperSnapper_Boards](https://github.com/adafruit/Wippersnapper_Boards) repository. - -Then, the broker sends a message back to the board with `OK` if found within the repo. If the board was not found within the repo, the `NOT_FOUND` response is sent and the board should disconnect from the broker and halt. - -```mermaid - -sequenceDiagram - -autonumber - -Device-->>IO: CreateDescriptionRequest -Note over Device,IO: This message is sent over the general MQTT
topic: /:user/wprsnpr/status -IO->>Storage (DB): Check if machine_name
exists as a JSON definition
within the Boards repo -Storage (DB)->>IO: Return RESPONSE_OK
or RESPONSE_BOARD_NOT_FOUND -IO-->>Device: CreateDescriptionResponse -Note over IO,Device: Contains metadata about the physical hardware
from the JSON definition file. -``` - - -### Process: Hardware Configuration - -Where it can, the WipperSnapper firmware avoids dynamic allocation. If the `CreateDescriptionResponse` message contains a valid response( `RESPONSE_OK` ), fields from the `CreateDescriptionResponse` message are parsed and used to configure some hardware-specific classes: - -```mermaid -sequenceDiagram -autonumber -Device->>App: Parse CreateDescriptionResponse -App->>Digital IO Class: Configure total_gpio_pins -App->>Analog IO Class: Configure total_analog_pins and reference_voltage -App->>I2C Class: Configure total_i2c_ports -``` - -### Process: Hardware Sync - -The hardware sync process described by this API is outdated and will be depreciated in a future API version. It only exists for use with the Digital IO class. - -After the broker sends the `CreateDescriptionResponse` message, it sends the values and states for any digital IO pins configured on the device. Then, it waits for a `RegistrationComplete` response from the device. The `RegistrationComplete` message confirms that the hardware has completed configuring its state and values. - -```mermaid -sequenceDiagram -autonumber -IO-->>Device: CreateDescriptionResponse -IO-->>Device: ConfigurePinRequests -Note over IO,Device: This message contains a list of
ConfigurePinRequest messages, one per
digital GPIO pin. -Device-->>DigitalGPIO: Decode and configure
each ConfigurePinRequest message -Device-->>IO: RegistrationComplete -Note over Device,IO: After the ConfigurePinRequests have completed,
tell the broker that the device
is ready to accept MQTT commands. -``` - From a0390755b76dd630960898585ba0145ad658755a Mon Sep 17 00:00:00 2001 From: brentru Date: Tue, 5 Mar 2024 16:40:29 -0500 Subject: [PATCH 053/188] add boolean sensor value type to allow digitalio expansion --- proto/wippersnapper/docs/digitalio.md | 75 ++++++++++++++++++++++++++- proto/wippersnapper/sensor.proto | 2 + 2 files changed, 76 insertions(+), 1 deletion(-) diff --git a/proto/wippersnapper/docs/digitalio.md b/proto/wippersnapper/docs/digitalio.md index a3c39771..3f344553 100644 --- a/proto/wippersnapper/docs/digitalio.md +++ b/proto/wippersnapper/docs/digitalio.md @@ -1 +1,74 @@ -# TODO! \ No newline at end of file + +# digitalio.proto + + This file details the WipperSnapper messaging API for interfacing with digital I/O pins. + +## WipperSnapper Components + +The following WipperSnapper components utilize `servo.proto`: +* [pin](https://github.com/adafruit/Wippersnapper_Components/tree/main/components/pin) + + +## Sequence Diagrams + +### Add a Digital Pin + +```mermaid +sequenceDiagram +autonumber +IO->>Device: DeviceToBroker +Device->>App: DeviceToBroker +App->>Encoder/Decoder: DeviceToBroker +Encoder/Decoder->>Digital IO Class: DigitalIOAdd +``` + +### Remove a Digital Pin + +```mermaid +sequenceDiagram +autonumber + +IO->>Device: ServoWriteRequest +Note over IO, Device: Position is sent from Adafruit IO as a pulse width
between 500uS and 2500uS.
The client application must convert pulse width to duty cycle
with fixed freq of 50Hz prior to writing to the servo pin. +``` + + + +### Update: Servo + +```mermaid +sequenceDiagram +autonumber + +IO->>Device: ServoDetachRequest +Note over IO, Device: Deinits servo object, releases gpio pin +IO-->>Device: ServoAttachRequest +Note over IO, Device: Contains:
`servo_pin` from form
`servo_freq` of 50Hz
`min_pulse_width` from form
`max_pulse_width` from form +Device->>IO: ServoAttachResponse +Note over IO, Device: Contains: Success code and servo's pin +``` + + + +### Delete: Servo + +```mermaid +sequenceDiagram +autonumber +IO->>Device: ServoDetachRequest +Note over IO, Device: Contains:
`servo_pin` from DB. +``` + + + +### Sync: Servo + +```mermaid +sequenceDiagram +autonumber +IO-->>Device: ServoAttachRequest +Note over IO, Device: Contains:
`servo_pin` from form
`servo_freq` of 50Hz
`min_pulse_width` from form
`max_pulse_width` from form + +Device->>IO: ServoAttachResponse +Note over IO, Device: Contains: Success code and servo's pin +``` \ No newline at end of file diff --git a/proto/wippersnapper/sensor.proto b/proto/wippersnapper/sensor.proto index 6ebcadcd..b67f061b 100644 --- a/proto/wippersnapper/sensor.proto +++ b/proto/wippersnapper/sensor.proto @@ -44,6 +44,7 @@ enum SensorType { SENSOR_TYPE_NOX_INDEX = 34; /** Values are an index from 1-500 with 100 being normal, "${$v} NOx".*/ SENSOR_TYPE_TVOC = 35; /** Values are in parts per billion (ppb), "${$v} ppb". */ SENSOR_TYPE_BYTES = 36; /** Values are in bytes, "${$v} bytes". */ + SENSOR_TYPE_BOOLEAN = 37; /** Values are boolean, "Boolean Value: ${$v}". */ } /** @@ -65,6 +66,7 @@ message SensorEvent { SensorEvent3DVector vector_value = 4; /** The sensor's 3D vector values, as floats. */ SensorEventOrientation orientation_value = 5; /** The sensor's orientation values, as floats. */ SensorEventColor color_value = 6; /** The sensor's color values, as floats. */ + bool bool_value = 7; /** The sensor's value, as a boolean. */ } /** From 4597768113d47a150548ed7de16ba689f6ae5907 Mon Sep 17 00:00:00 2001 From: brentru Date: Tue, 5 Mar 2024 16:42:08 -0500 Subject: [PATCH 054/188] expand digitalio to allow it to utilize sensor.proto --- proto/wippersnapper/digitalio.proto | 15 ++++++++------- proto/wippersnapper/i2c.proto | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/proto/wippersnapper/digitalio.proto b/proto/wippersnapper/digitalio.proto index 8ae0a240..8035a2c3 100644 --- a/proto/wippersnapper/digitalio.proto +++ b/proto/wippersnapper/digitalio.proto @@ -1,7 +1,8 @@ -// SPDX-FileCopyrightText: 2023 Brent Rubell, Loren Norman, Tyeth Gundry for Adafruit Industries +// SPDX-FileCopyrightText: 2024 Brent Rubell, Loren Norman, Tyeth Gundry for Adafruit Industries // SPDX-License-Identifier: MIT syntax = "proto3"; package wippersnapper.digitalio; +import "wippersnapper/sensor.proto"; /** * DigitalIOSampleMode specifies the pin's sample mode. @@ -16,10 +17,10 @@ enum DigitalIOSampleMode { * DigitalIODirection specifies the pin's direction, INPUT/INPUT_PULL_UP/OUTPUT. */ enum DigitalIODirection { - DIGITAL_IO_DIRECTION_UNSPECIFIED = 0; /** Invalid Direction from Broker. */ - DIGITAL_IO_DIRECTION_INPUT = 1; /** Set the pin to behave as an input. */ + DIGITAL_IO_DIRECTION_UNSPECIFIED = 0; /** Invalid Direction from Broker. */ + DIGITAL_IO_DIRECTION_INPUT = 1; /** Set the pin to behave as an input. */ DIGITAL_IO_DIRECTION_INPUT_PULL_UP = 2; /** Set the pin to behave as an input. */ - DIGITAL_IO_DIRECTION_OUTPUT = 3; /** Set the pin to behave as an output. */ + DIGITAL_IO_DIRECTION_OUTPUT = 3; /** Set the pin to behave as an output. */ } /** @@ -37,14 +38,14 @@ message DigitalIOAdd { * DigitalIORemove removes a digital pin from the device. */ message DigitalIORemove { - int32 gpio_num = 1; // correlates with `name` in the JSON + int32 gpio_num = 1; /** The pin's GPIO number. */ } /** * DigitalIOEvent is sent from the device to the broker when a digital pin's value changes. */ message DigitalIOEvent { - int32 gpio_num = 1; // correlates with `name` in the JSON - bool value = 2; // correlates with `value` in the JSON + int32 gpio_num = 1; /** The pin's GPIO number. */ + wippersnapper.sensor.SensorEvent value = 2; /** The pin's value. */ } diff --git a/proto/wippersnapper/i2c.proto b/proto/wippersnapper/i2c.proto index d3dee68f..6904e2ad 100644 --- a/proto/wippersnapper/i2c.proto +++ b/proto/wippersnapper/i2c.proto @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2021-2023 Brent Rubell for Adafruit Industries +// SPDX-FileCopyrightText: 2021-2024 Brent Rubell for Adafruit Industries // SPDX-License-Identifier: MIT syntax = "proto3"; package wippersnapper.i2c; From 9ff9a0020f7c42f38b979a10cb1582983a63194f Mon Sep 17 00:00:00 2001 From: brentru Date: Wed, 6 Mar 2024 14:28:46 -0500 Subject: [PATCH 055/188] Remove I2C sensor properties, enforce sensortype instead, refactoring around analog/digital pins to use sensor api and string pin name --- proto/wippersnapper/analogio.proto | 21 +++++---------------- proto/wippersnapper/digitalio.proto | 6 +++--- proto/wippersnapper/ds18x20.proto | 7 ++++--- proto/wippersnapper/i2c.proto | 12 ++---------- proto/wippersnapper/sensor.proto | 8 -------- 5 files changed, 14 insertions(+), 40 deletions(-) diff --git a/proto/wippersnapper/analogio.proto b/proto/wippersnapper/analogio.proto index f9bd883f..2adbb5c5 100644 --- a/proto/wippersnapper/analogio.proto +++ b/proto/wippersnapper/analogio.proto @@ -4,31 +4,20 @@ syntax = "proto3"; package wippersnapper.analogio; import "wippersnapper/sensor.proto"; -/** -* Selects the type of value read by an analog pin. -* PIN_VALUE: Raw ADC reading. -* PIN_VOLTAGE: Calculated voltage reading. -*/ -enum AnalogReadMode { - ANALOG_READ_MODE_UNSPECIFIED = 0; // Default value. - ANALOG_READ_MODE_PIN_VALUE = 1; // Raw ADC reading. - ANALOG_READ_MODE_PIN_VOLTAGE = 2; // Calculated voltage reading. -} - /** * AnalogIOAdd adds an analog pin to the device. */ message AnalogIOAdd { - int32 gpio_num = 1; // Correlates with `name` in the JSON definition - float period = 2; // Period is in seconds - AnalogReadMode read_mode = 3; // Type of value read by an analog pin. + string pin_name = 1; /** Name of the pin. */ + float period = 2; /** Time between reads, in seconds. */ + wippersnapper.sensor.SensorType read_mode = 3; /** Desired read mode for the pin. */ } /** * AnalogIORemove removes an analog pin from the device. */ message AnalogIORemove { - int32 gpio_num = 1; // correlates with `name` in the JSON + string pin_name = 1; /** Name of the pin. */ } @@ -36,6 +25,6 @@ message AnalogIORemove { * AnalogIOEvent is contains a value, sent when an analog pin is read. */ message AnalogIOEvent { - int32 gpio_num = 1; // correlates with `name` in the JSON + string pin_name = 1; /** Name of the pin. */ wippersnapper.sensor.SensorEvent sensor_event = 2; /** Reading(s) from an analog pin. */ } diff --git a/proto/wippersnapper/digitalio.proto b/proto/wippersnapper/digitalio.proto index 8035a2c3..76d16e29 100644 --- a/proto/wippersnapper/digitalio.proto +++ b/proto/wippersnapper/digitalio.proto @@ -27,7 +27,7 @@ enum DigitalIODirection { * DigitalIOAdd adds a digital pin to the device. */ message DigitalIOAdd { - int32 gpio_num = 1; /** The pin's GPIO number. */ + string pin_name = 1; /** The pin's name. */ DigitalIODirection gpio_direction = 2; /** The pin's direction. */ DigitalIOSampleMode sample_mode = 3; /** Specifies the pin's sample mode. */ float period = 4; /** Time between measurements in seconds, if MODE_TIMER. */ @@ -38,14 +38,14 @@ message DigitalIOAdd { * DigitalIORemove removes a digital pin from the device. */ message DigitalIORemove { - int32 gpio_num = 1; /** The pin's GPIO number. */ + string pin_name = 1; /** The pin's name. */ } /** * DigitalIOEvent is sent from the device to the broker when a digital pin's value changes. */ message DigitalIOEvent { - int32 gpio_num = 1; /** The pin's GPIO number. */ + string pin_name = 1; /** The pin's name. */ wippersnapper.sensor.SensorEvent value = 2; /** The pin's value. */ } diff --git a/proto/wippersnapper/ds18x20.proto b/proto/wippersnapper/ds18x20.proto index dfc5c13d..6a1e19be 100644 --- a/proto/wippersnapper/ds18x20.proto +++ b/proto/wippersnapper/ds18x20.proto @@ -11,9 +11,10 @@ import "wippersnapper/sensor.proto"; * NOTE: This API currently only supports ONE device per OneWire bus. */ message Ds18x20Add { - string onewire_pin = 1; /** The desired pin to use as a OneWire bus. */ - int32 sensor_resolution = 2; /** The desired sensor resolution (9, 10, 11, or 12 bits). */ - repeated wippersnapper.sensor.SensorProperties sensor_properties = 3; /** Properties for the DS18x20 sensor. */ + string onewire_pin = 1; /** The desired pin to use as a OneWire bus. */ + int32 sensor_resolution = 2; /** The desired sensor resolution (9, 10, 11, or 12 bits). */ + float period = 3; /** The desired period to read the sensor, in seconds. */ + repeated wippersnapper.sensor.SensorType sensor_types = 4; /** SI types used by the DS18x20 sensor. */ } /** diff --git a/proto/wippersnapper/i2c.proto b/proto/wippersnapper/i2c.proto index 6904e2ad..2de170db 100644 --- a/proto/wippersnapper/i2c.proto +++ b/proto/wippersnapper/i2c.proto @@ -56,15 +56,6 @@ message I2CScanResponse { BusResponse bus_response = 2; /** The I2C bus' status. **/ } -/** -* I2CSensorProperties contains -* the properties of an I2C device's sensor such as -* its type and period. -*/ -message I2CSensorProperties { - wippersnapper.sensor.SensorType sensor_type = 1; /** The type of I2C sensor. **/ -} - /** * I2CInit is a wrapper message for * an I2C device initialization . @@ -75,7 +66,8 @@ message I2CInit { uint32 i2c_device_address = 3; /** The 7-bit I2C address of the device on the bus. */ string i2c_device_name = 4; /** The I2C device's name, MUST MATCH the name on the JSON definition file on https://github.com/adafruit/Wippersnapper_Components. */ - repeated wippersnapper.sensor.SensorProperties sensor_properties = 5; /** Properties of each sensor on the I2C device. */ + float i2c_device_period = 5; /** The desired period to update the I2C device's sensor(s), in seconds. */ + repeated wippersnapper.sensor.SensorType i2c_device_sensor_types = 6; /** SI Types for each sensor on the I2C device. */ } /** diff --git a/proto/wippersnapper/sensor.proto b/proto/wippersnapper/sensor.proto index b67f061b..a0fc2392 100644 --- a/proto/wippersnapper/sensor.proto +++ b/proto/wippersnapper/sensor.proto @@ -47,14 +47,6 @@ enum SensorType { SENSOR_TYPE_BOOLEAN = 37; /** Values are boolean, "Boolean Value: ${$v}". */ } -/** -* SensorProperties is used to define the sensor's type and period. -*/ -message SensorProperties { - SensorType sensor_type = 1; /** The sensor's type. */ - uint32 sensor_period = 2; /** The sensor's period, in milliseconds. */ -} - /** * SensorEvent is used to return the sensor's value and type. */ From eaf41c6bac28f2643e8cbdd0c4351b488ae0a2a7 Mon Sep 17 00:00:00 2001 From: brentru Date: Wed, 6 Mar 2024 15:23:09 -0500 Subject: [PATCH 056/188] add documentation for ds18x, i2c, pixels, pwm, servo --- proto/wippersnapper/docs/digitalio.md | 51 -------------------------- proto/wippersnapper/docs/ds18x20.md | 8 ++--- proto/wippersnapper/docs/i2c.md | 35 +++++++++--------- proto/wippersnapper/docs/pixels.md | 40 ++++++++++----------- proto/wippersnapper/docs/pwm.md | 52 +++++++++++++-------------- proto/wippersnapper/docs/servo.md | 23 +++++------- proto/wippersnapper/servo.proto | 2 +- 7 files changed, 77 insertions(+), 134 deletions(-) diff --git a/proto/wippersnapper/docs/digitalio.md b/proto/wippersnapper/docs/digitalio.md index 3f344553..d2037505 100644 --- a/proto/wippersnapper/docs/digitalio.md +++ b/proto/wippersnapper/docs/digitalio.md @@ -21,54 +21,3 @@ Device->>App: DeviceToBroker App->>Encoder/Decoder: DeviceToBroker Encoder/Decoder->>Digital IO Class: DigitalIOAdd ``` - -### Remove a Digital Pin - -```mermaid -sequenceDiagram -autonumber - -IO->>Device: ServoWriteRequest -Note over IO, Device: Position is sent from Adafruit IO as a pulse width
between 500uS and 2500uS.
The client application must convert pulse width to duty cycle
with fixed freq of 50Hz prior to writing to the servo pin. -``` - - - -### Update: Servo - -```mermaid -sequenceDiagram -autonumber - -IO->>Device: ServoDetachRequest -Note over IO, Device: Deinits servo object, releases gpio pin -IO-->>Device: ServoAttachRequest -Note over IO, Device: Contains:
`servo_pin` from form
`servo_freq` of 50Hz
`min_pulse_width` from form
`max_pulse_width` from form -Device->>IO: ServoAttachResponse -Note over IO, Device: Contains: Success code and servo's pin -``` - - - -### Delete: Servo - -```mermaid -sequenceDiagram -autonumber -IO->>Device: ServoDetachRequest -Note over IO, Device: Contains:
`servo_pin` from DB. -``` - - - -### Sync: Servo - -```mermaid -sequenceDiagram -autonumber -IO-->>Device: ServoAttachRequest -Note over IO, Device: Contains:
`servo_pin` from form
`servo_freq` of 50Hz
`min_pulse_width` from form
`max_pulse_width` from form - -Device->>IO: ServoAttachResponse -Note over IO, Device: Contains: Success code and servo's pin -``` \ No newline at end of file diff --git a/proto/wippersnapper/docs/ds18x20.md b/proto/wippersnapper/docs/ds18x20.md index 7627f842..5cac421d 100644 --- a/proto/wippersnapper/docs/ds18x20.md +++ b/proto/wippersnapper/docs/ds18x20.md @@ -24,8 +24,8 @@ sequenceDiagram autonumber -IO-->>Device: Ds18x20InitRequest -Device->>IO: Ds18x20InitResponse +IO-->>Device: Ds18x20Add +Device->>IO: Ds18x20Added ``` ### Delete: DS18x20 @@ -40,7 +40,7 @@ sequenceDiagram autonumber -IO->>Device: Ds18x20DeInitRequest +IO->>Device: Ds18x20Remove ``` ### Sensor Event: DS18x20 @@ -53,6 +53,6 @@ sequenceDiagram autonumber -Device->>IO: Ds18x20DeviceEvent +Device->>IO: Ds18x20Event Note over Device,IO: This message contains i2c.SensorEvent,
which contains the sensor's value unit.
Since a device may have >1DS18X20
sensor, it also contains the sensor's pin
for addressing ``` diff --git a/proto/wippersnapper/docs/i2c.md b/proto/wippersnapper/docs/i2c.md index 8b11e123..4d65c7b9 100644 --- a/proto/wippersnapper/docs/i2c.md +++ b/proto/wippersnapper/docs/i2c.md @@ -40,15 +40,15 @@ Device->>IO: I2CBusScanResponse sequenceDiagram autonumber -IO->>Device: I2CDeviceInitRequest
(contains I2CBusInitRequest) +IO->>Device: I2CInit
(contains I2CBusInitRequest) Device->>App: I2CBusInitRequest -App->>Device: BusResponse -Device->>App: I2CDeviceInitRequest -App->>I2C Class: i2c_device_address, i2c_device_name,
i2c_device_properties -Note over App,I2C Class: At this point, the I2C sensor is configured
and ready to send data to Adafruit IO. -I2C Class->>App: I2CDeviceInitResponse -App->>Device: I2CDeviceInitResponse -Device->>IO: I2CDeviceInitResponse +App->>I2C Class: I2CBusInitRequest +Device->>App: I2CInit +App->>I2C Class: i2c_device_address, i2c_device_name,
i2c_device_period, i2c_device_sensor_types +Note over App,I2C Class: At this point, the I2C sensor is configured
and ready to send data back to Adafruit IO. +I2C Class->>App: I2CAdded +App->>Device: I2CAdded +Device->>IO: I2CAdded ``` ### Update an existing I2C device @@ -57,13 +57,12 @@ Device->>IO: I2CDeviceInitResponse sequenceDiagram autonumber -IO->>Device: I2CDeviceUpdateRequest -Device->>App: I2CDeviceUpdateRequest -App->>I2C Class: I2CDeviceUpdateRequest -Note over App,I2C Class: Update the properties of the "sub-sensors"
specified within i2c_device_properties array. -I2C Class->>App: I2CDeviceUpdateResponse -App->>Device: I2CDeviceUpdateResponse -Device->>IO: I2CDeviceUpdateResponse +IO->>Device: I2CInit +Device->>App: I2CInit +App->>I2C Class: I2CInit +I2C Class->>App: I2CUpdateResponse +App->>Device: I2CUpdateResponse +Device->>IO: I2CUpdateResponse ``` ### Sending data from an I2C component @@ -76,7 +75,7 @@ While the sequence diagram for this type of message looks simple, the process in sequenceDiagram autonumber -Device->>IO: I2CDeviceEvent +Device->>IO: I2CEvent ``` @@ -88,8 +87,8 @@ The process of deleting an I2C device is straightforward and only requires the d sequenceDiagram autonumber -IO->>Device: I2CDeviceDeinitRequest -Device->>IO: I2CDeviceDeinitResponse +IO->>Device: I2CRemove +Device->>IO: I2CRemoved ``` diff --git a/proto/wippersnapper/docs/pixels.md b/proto/wippersnapper/docs/pixels.md index 8cf851b3..b2d3331c 100644 --- a/proto/wippersnapper/docs/pixels.md +++ b/proto/wippersnapper/docs/pixels.md @@ -15,9 +15,9 @@ The following component definitions reference `pixels.proto`: ```mermaid sequenceDiagram autonumber -IO-->>Device: PixelsCreateRequest +IO-->>Device: PixelsAdd Note over IO, Device: Contains:
`pixels_type` of PIXELS_TYPE_NEOPIXEL
`pixels_num` according to form
`pixels_ordering` according to form
`pixels_brightness` according to form
`pixels_pin_neopixel` according to form
`pixels_pin_dotstar_data` is unused
`pixels_pin_dotstar_clock` is unused -Device->>IO: PixelsCreateResponse +Device->>IO: PixelsAdded Note over Device,IO: `is_success`, true if init'd OK ``` @@ -26,7 +26,7 @@ Note over Device,IO: `is_success`, true if init'd OK ```mermaid sequenceDiagram autonumber -IO->>Device: PixelsWriteRequest +IO->>Device: PixelsWrite Note over IO, Device: Contains
`pixels_type` of PIXELS_TYPE_NEOPIXEL
`pixels_pin_data` according to DB
`pixels_color` according to picker
``` @@ -35,11 +35,11 @@ Note over IO, Device: Contains
`pixels_type` of PIXELS_TYPE_NEOPIXEL
`pix ```mermaid sequenceDiagram autonumber -IO->>Device: PixelsDeleteRequest +IO->>Device: PixelsRemove Note over IO, Device: Contains
`pixels_type` of PIXELS_TYPE_NEOPIXEL
pixels_pin_data according to DB -IO-->>Device: PixelsCreateRequest +IO-->>Device: PixelsAdd Note over IO, Device: Contains:
`pixels_type` of PIXELS_TYPE_NEOPIXEL
`pixels_num` according to form
`pixels_ordering` according to form
`pixels_brightness` of 0
`pixels_pin_neopixel` according to form
`pixels_pin_dotstar_data` is unused
`pixels_pin_dotstar_clock` is unused -Device->>IO: PixelsCreateResponse +Device->>IO: PixelsAdded Note over Device,IO: `is_success`, true if init'd OK ``` @@ -48,7 +48,7 @@ Note over Device,IO: `is_success`, true if init'd OK ```mermaid sequenceDiagram autonumber -IO->>Device: PixelsDeleteRequest +IO->>Device: PixelsRemove Note over IO, Device: Contains
`pixels_type` of PIXELS_TYPE_NEOPIXEL
`pixels_pin_data` according to DB ``` @@ -56,11 +56,11 @@ Note over IO, Device: Contains
`pixels_type` of PIXELS_TYPE_NEOPIXEL
`pix ```mermaid sequenceDiagram autonumber -IO-->>Device: PixelsCreateRequest +IO-->>Device: PixelsAdd Note over IO, Device: Contains:
`pixels_type` of PIXELS_TYPE_NEOPIXEL
`pixels_num` according to form
`pixels_ordering` according to form
`pixels_brightness` according to form
`pixels_pin_neopixel` according to form
`pixels_pin_dotstar_data` is unused
`pixels_pin_dotstar_clock` is unused -Device->>IO: PixelsCreateResponse +Device->>IO: PixelsAdded Note over Device,IO: `is_success`, true if init'd OK -IO->>Device: PixelsWriteRequest +IO->>Device: PixelsWrite Note over IO, Device: Contains
`pixels_type` of PIXELS_TYPE_NEOPIXEL
`pixels_pin_data` according to DB
`pixels_color` according to feed's last_value
``` @@ -70,9 +70,9 @@ Note over IO, Device: Contains
`pixels_type` of PIXELS_TYPE_NEOPIXEL
`pix ```mermaid sequenceDiagram autonumber -IO-->>Device: PixelsCreateRequest +IO-->>Device: PixelsAdd Note over IO, Device: Contains:
`pixels_type` of PIXELS_TYPE_DOTSTAR
`pixels_num` according to form
`pixels_ordering` according to form
`pixels_brightness` according to form
`pixels_pin_neopixel` unused
`pixels_pin_dotstar_data` according to form
`pixels_pin_dotstar_clock` according to form -Device->>IO: PixelsCreateResponse +Device->>IO: PixelsAdded Note over Device,IO: `is_success`, true if init'd OK ``` @@ -81,7 +81,7 @@ Note over Device,IO: `is_success`, true if init'd OK ```mermaid sequenceDiagram autonumber -IO->>Device: PixelsWriteRequest +IO->>Device: PixelsWrite Note over IO, Device: Contains
`pixels_type` of PIXELS_TYPE_DOTSTAR
`pixels_pin_data` according to DB
`pixels_color` according to picker
``` @@ -90,11 +90,11 @@ Note over IO, Device: Contains
`pixels_type` of PIXELS_TYPE_DOTSTAR
`pixe ```mermaid sequenceDiagram autonumber -IO->>Device: PixelsDeleteRequest +IO->>Device: PixelsRemove Note over IO, Device: Contains
`pixels_type` of PIXELS_TYPE_DOTSTAR
pixels_pin_data according to DB -IO-->>Device: PixelsCreateRequest +IO-->>Device: PixelsAdd Note over IO, Device: Contains:
`pixels_type` of PIXELS_TYPE_DOTSTAR
`pixels_num` according to form
`pixels_ordering` according to form
`pixels_brightness` of 0
`pixels_pin_neopixel` is unused
`pixels_pin_dotstar_data` according to form
`pixels_pin_dotstar_clock` according to form -Device->>IO: PixelsCreateResponse +Device->>IO: PixelsAdded Note over Device,IO: `is_success`, true if init'd OK ``` @@ -103,7 +103,7 @@ Note over Device,IO: `is_success`, true if init'd OK ```mermaid sequenceDiagram autonumber -IO->>Device: PixelsDeleteRequest +IO->>Device: PixelsRemove Note over IO, Device: Contains
`pixels_type` of PIXELS_TYPE_DOTSTAR
`pixels_pin_data` according to DB ``` @@ -111,10 +111,10 @@ Note over IO, Device: Contains
`pixels_type` of PIXELS_TYPE_DOTSTAR
`pixe ```mermaid sequenceDiagram autonumber -IO-->>Device: PixelsCreateRequest +IO-->>Device: PixelsAdd Note over IO, Device: Contains:
`pixels_type` of PIXELS_TYPE_DOTSTAR
`pixels_num` according to form
`pixels_ordering` according to form
`pixels_brightness` according to form
`pixels_pin_neopixel` is unused
`pixels_pin_dotstar_data` according to form
`pixels_pin_dotstar_clock` according to form -Device->>IO: PixelsCreateResponse +Device->>IO: PixelsAdded Note over Device,IO: `is_success`, true if init'd OK -IO->>Device: PixelsWriteRequest +IO->>Device: PixelsWrite Note over IO, Device: Contains
`pixels_type` of PIXELS_TYPE_NEOPIXEL
`pixels_pin_data` according to DB
`pixels_color` according to feed's last_value
``` diff --git a/proto/wippersnapper/docs/pwm.md b/proto/wippersnapper/docs/pwm.md index 206de648..3d869e6c 100644 --- a/proto/wippersnapper/docs/pwm.md +++ b/proto/wippersnapper/docs/pwm.md @@ -22,11 +22,11 @@ The following WipperSnapper components utilize `pwm.proto`: sequenceDiagram autonumber -IO-->>Device: PWMAttachRequest +IO-->>Device: PWMAdd Note over IO, Device: Contains:
`pin` according to form
`frequency` of 5000Hz
`resolution` of 12 bits -Device->>IO: PWMAttachResponse -Note over IO, Device: Contains:
`pin` from
corresponding PWMAttachRequest msg.
`did_attach` True if attached. +Device->>IO: PWMAdded +Note over IO, Device: Contains:
`pin` from
corresponding PWMAdd msg.
`did_attach` True if attached. ``` @@ -34,7 +34,7 @@ Note over IO, Device: Contains:
`pin` from
corresponding PWMAttachReques ```mermaid sequenceDiagram autonumber -IO->>Device: PWMWriteDutyCycleRequest +IO->>Device: PWMWriteDutyCycle Note over IO, Device: The duty_cycle (0->255) from the
IO slider widget is written to the `pin`. ``` @@ -42,21 +42,21 @@ Note over IO, Device: The duty_cycle (0->255) from the
IO slider widget is w ```mermaid sequenceDiagram autonumber -IO->>Device: PWMDetachRequest +IO->>Device: PWMRemove Note over IO, Device: Detaches GPIO pin from a timer -IO-->>Device: PWMAttachRequest +IO-->>Device: PWMAdd Note over IO, Device: Contains:
`pin` according to form
`frequency` of 5000Hz
`resolution` of 12 bits -Device->>IO: PWMAttachResponse -Note over IO, Device: Contains:
`pin` from
corresponding PWMAttachRequest msg.
`did_attach` True if attached. +Device->>IO: PWMAdded +Note over IO, Device: Contains:
`pin` from
corresponding PWMAdd msg.
`did_attach` True if attached. ``` ### Delete: Dimmable LED ```mermaid sequenceDiagram autonumber -IO->>Device: PWMDetachRequest +IO->>Device: PWMRemove Note over IO, Device: Detaches GPIO pin from a timer ``` @@ -65,13 +65,13 @@ Note over IO, Device: Detaches GPIO pin from a timer sequenceDiagram autonumber -IO-->>Device: PWMAttachRequest +IO-->>Device: PWMAdd Note over IO, Device: Contains:
`pin` according to DB
`frequency` of 5000Hz
`resolution` of 12 bits -Device->>IO: PWMAttachResponse -Note over IO, Device: Contains:
`pin` from
corresponding PWMAttachRequest msg.
`did_attach` True if attached. +Device->>IO: PWMAdded +Note over IO, Device: Contains:
`pin` from
corresponding PWMAdd msg.
`did_attach` True if attached. -IO->>Device: PWMWriteDutyCycleRequest +IO->>Device: PWMWriteDutyCycle Note over IO, Device: duty_cycle (0->255) from IO feed's last_value. ``` @@ -81,11 +81,11 @@ Note over IO, Device: duty_cycle (0->255) from IO feed's last_value. sequenceDiagram autonumber -IO-->>Device: PWMAttachRequest +IO-->>Device: PWMAdd Note over IO, Device: Contains:
`pin` according to form
`frequency` of 1000Hz
`resolution` of 12 bits -Device->>IO: PWMAttachResponse -Note over IO, Device: Contains:
`pin` from
corresponding PWMAttachRequest msg.
`did_attach` True if attached. +Device->>IO: PWMAdded +Note over IO, Device: Contains:
`pin` from
corresponding PWMAdd msg.
`did_attach` True if attached. ``` @@ -93,7 +93,7 @@ Note over IO, Device: Contains:
`pin` from
corresponding PWMAttachReques ```mermaid sequenceDiagram autonumber -IO->>Device: PWMWriteFrequencyRequest +IO->>Device: PWMWriteFrequency Note over IO, Device: Any frequency > 0Hz to play a tone, 0Hz to turn off ``` @@ -101,21 +101,21 @@ Note over IO, Device: Any frequency > 0Hz to play a tone, 0Hz to turn off ```mermaid sequenceDiagram autonumber -IO->>Device: PWMDetachRequest +IO->>Device: PWMRemove Note over IO, Device: Detaches GPIO pin from a timer -IO-->>Device: PWMAttachRequest +IO-->>Device: PWMAdd Note over IO, Device: Contains:
`pin` according to form
`frequency` of 1000Hz
`resolution` of 12 bits -Device->>IO: PWMAttachResponse -Note over IO, Device: Contains:
`pin` from
corresponding PWMAttachRequest msg.
`did_attach` True if attached. +Device->>IO: PWMAdded +Note over IO, Device: Contains:
`pin` from
corresponding PWMAdd msg.
`did_attach` True if attached. ``` ### Delete: Piezo Buzzer ```mermaid sequenceDiagram autonumber -IO->>Device: PWMDetachRequest +IO->>Device: PWMRemove Note over IO, Device: Detaches GPIO pin from a timer ``` @@ -124,12 +124,12 @@ Note over IO, Device: Detaches GPIO pin from a timer sequenceDiagram autonumber -IO-->>Device: PWMAttachRequest +IO-->>Device: PWMAdd Note over IO, Device: Contains:
`pin` according to DB
`frequency` of 1000Hz
`resolution` of 12 bits -Device->>IO: PWMAttachResponse -Note over IO, Device: Contains:
`pin` from
corresponding PWMAttachRequest msg.
`did_attach` True if attached. +Device->>IO: PWMAdded +Note over IO, Device: Contains:
`pin` from
corresponding PWMAdd msg.
`did_attach` True if attached. -IO->>Device: PWMWriteFrequencyRequest +IO->>Device: PWMWriteFrequency Note over IO, Device: frequency, in Hz, from IO feed's last_value. ``` diff --git a/proto/wippersnapper/docs/servo.md b/proto/wippersnapper/docs/servo.md index a828f027..73e53480 100644 --- a/proto/wippersnapper/docs/servo.md +++ b/proto/wippersnapper/docs/servo.md @@ -1,29 +1,24 @@ - # servo.proto This file details the WipperSnapper messaging API for interfacing with servo output components. ## WipperSnapper Components - - The following WipperSnapper components utilize `servo.proto`: * [Generic Servo](https://github.com/adafruit/Wippersnapper_Components/tree/main/components/servo/servo) ## Sequence Diagrams - - ### Create: Servo ```mermaid sequenceDiagram autonumber -IO-->>Device: ServoAttachRequest +IO-->>Device: ServoAdd Note over IO, Device: Contains:
`servo_pin` from form
`servo_freq` of 50Hz
`min_pulse_width` from form
`max_pulse_width` from form -Device->>IO: ServoAttachResponse +Device->>IO: ServoAdded Note over IO, Device: Contains: Success code and servo's pin ``` @@ -33,7 +28,7 @@ Note over IO, Device: Contains: Success code and servo's pin sequenceDiagram autonumber -IO->>Device: ServoWriteRequest +IO->>Device: ServoWrite Note over IO, Device: Position is sent from Adafruit IO as a pulse width
between 500uS and 2500uS.
The client application must convert pulse width to duty cycle
with fixed freq of 50Hz prior to writing to the servo pin. ``` @@ -45,11 +40,11 @@ Note over IO, Device: Position is sent from Adafruit IO as a pulse width
bet sequenceDiagram autonumber -IO->>Device: ServoDetachRequest +IO->>Device: ServoRemove Note over IO, Device: Deinits servo object, releases gpio pin -IO-->>Device: ServoAttachRequest +IO-->>Device: ServoAdd Note over IO, Device: Contains:
`servo_pin` from form
`servo_freq` of 50Hz
`min_pulse_width` from form
`max_pulse_width` from form -Device->>IO: ServoAttachResponse +Device->>IO: ServoAdded Note over IO, Device: Contains: Success code and servo's pin ``` @@ -60,7 +55,7 @@ Note over IO, Device: Contains: Success code and servo's pin ```mermaid sequenceDiagram autonumber -IO->>Device: ServoDetachRequest +IO->>Device: ServoRemove Note over IO, Device: Contains:
`servo_pin` from DB. ``` @@ -71,9 +66,9 @@ Note over IO, Device: Contains:
`servo_pin` from DB. ```mermaid sequenceDiagram autonumber -IO-->>Device: ServoAttachRequest +IO-->>Device: ServoAdd Note over IO, Device: Contains:
`servo_pin` from form
`servo_freq` of 50Hz
`min_pulse_width` from form
`max_pulse_width` from form -Device->>IO: ServoAttachResponse +Device->>IO: ServoAdded Note over IO, Device: Contains: Success code and servo's pin ``` \ No newline at end of file diff --git a/proto/wippersnapper/servo.proto b/proto/wippersnapper/servo.proto index 7eeb1554..f8439a3c 100644 --- a/proto/wippersnapper/servo.proto +++ b/proto/wippersnapper/servo.proto @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2022-2023 Brent Rubell for Adafruit Industries +// SPDX-FileCopyrightText: 2022-2024 Brent Rubell for Adafruit Industries // SPDX-License-Identifier: MIT syntax = "proto3"; package wippersnapper.servo; From 5c16874b9f777840f2978e4c9ea439c0bfbfd5b5 Mon Sep 17 00:00:00 2001 From: brentru Date: Wed, 6 Mar 2024 15:27:39 -0500 Subject: [PATCH 057/188] uart diff --- proto/wippersnapper/docs/uart.md | 10 +++++----- proto/wippersnapper/uart.proto | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/proto/wippersnapper/docs/uart.md b/proto/wippersnapper/docs/uart.md index 768d60ba..4c6254f5 100644 --- a/proto/wippersnapper/docs/uart.md +++ b/proto/wippersnapper/docs/uart.md @@ -19,9 +19,9 @@ The following WipperSnapper components utilize `uart.proto`: sequenceDiagram autonumber -IO-->>WS Device: UARTDeviceAttachRequest +IO-->>WS Device: UARTAdd -WS Device-->>WS Device Decoder: UARTDeviceAttachRequest +WS Device-->>WS Device Decoder: UARTAdd WS Device Decoder-->>WS Device UART: UARTBusData Note over WS Device Decoder, WS Device UART: Initialize UART bus using configuration (UARTBusData). @@ -29,9 +29,9 @@ Note over WS Device Decoder, WS Device UART: Initialize UART bus using configura WS Device Decoder-->>WS Device UART: device_id, polling_interval Note over WS Device Decoder, WS Device UART: Initialize UART device on the UART bus and associate it with a driver and a polling period. -WS Device UART-->>WS Device: UARTDeviceAttachResponse +WS Device UART-->>WS Device: UARTAdded -WS Device-->>IO: UARTDeviceAttachResponse +WS Device-->>IO: UARTAdded Note over WS Device, IO: Returns true if successful, False if not. ``` @@ -41,7 +41,7 @@ Note over WS Device, IO: Returns true if successful, False if not. sequenceDiagram autonumber -Device-->>IO Broker: UARTDeviceEvent +Device-->>IO Broker: UARTEvent IO Broker -->>IO Backend: Parse out repeated sensor_event into apropriate feeds for device_id ``` diff --git a/proto/wippersnapper/uart.proto b/proto/wippersnapper/uart.proto index 6b6e2e52..d1a7c4e9 100644 --- a/proto/wippersnapper/uart.proto +++ b/proto/wippersnapper/uart.proto @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2023 Brent Rubell for Adafruit Industries +// SPDX-FileCopyrightText: 2023-2024 Brent Rubell for Adafruit Industries // SPDX-License-Identifier: MIT syntax = "proto3"; package wippersnapper.uart; From 0e9c582c9d43758259b3cda4159df19d7455015d Mon Sep 17 00:00:00 2001 From: brentru Date: Thu, 7 Mar 2024 09:47:52 -0500 Subject: [PATCH 058/188] clean docs --- proto/wippersnapper/docs/error.md | 1 - proto/wippersnapper/docs/sensor.md | 1 - 2 files changed, 2 deletions(-) delete mode 100644 proto/wippersnapper/docs/error.md delete mode 100644 proto/wippersnapper/docs/sensor.md diff --git a/proto/wippersnapper/docs/error.md b/proto/wippersnapper/docs/error.md deleted file mode 100644 index f87f5c14..00000000 --- a/proto/wippersnapper/docs/error.md +++ /dev/null @@ -1 +0,0 @@ -# TODO \ No newline at end of file diff --git a/proto/wippersnapper/docs/sensor.md b/proto/wippersnapper/docs/sensor.md deleted file mode 100644 index f87f5c14..00000000 --- a/proto/wippersnapper/docs/sensor.md +++ /dev/null @@ -1 +0,0 @@ -# TODO \ No newline at end of file From f36e4864165028ea245bb241948e0f579f179256 Mon Sep 17 00:00:00 2001 From: brentru Date: Wed, 13 Mar 2024 14:20:28 -0400 Subject: [PATCH 059/188] modify import statements --- proto/wippersnapper/analogio.proto | 2 +- proto/wippersnapper/digitalio.proto | 9 +++++- proto/wippersnapper/ds18x20.proto | 2 +- proto/wippersnapper/error.proto | 2 +- proto/wippersnapper/i2c.proto | 2 +- proto/{nanopb => wippersnapper}/nanopb.proto | 0 proto/wippersnapper/signal.proto | 30 ++++++++++---------- proto/wippersnapper/signal/v1/signal.md | 26 ----------------- proto/wippersnapper/uart.proto | 2 +- 9 files changed, 28 insertions(+), 47 deletions(-) rename proto/{nanopb => wippersnapper}/nanopb.proto (100%) delete mode 100644 proto/wippersnapper/signal/v1/signal.md diff --git a/proto/wippersnapper/analogio.proto b/proto/wippersnapper/analogio.proto index 2adbb5c5..6abc7df2 100644 --- a/proto/wippersnapper/analogio.proto +++ b/proto/wippersnapper/analogio.proto @@ -2,7 +2,7 @@ // SPDX-License-Identifier: MIT syntax = "proto3"; package wippersnapper.analogio; -import "wippersnapper/sensor.proto"; +import "sensor.proto"; /** * AnalogIOAdd adds an analog pin to the device. diff --git a/proto/wippersnapper/digitalio.proto b/proto/wippersnapper/digitalio.proto index 76d16e29..118d995b 100644 --- a/proto/wippersnapper/digitalio.proto +++ b/proto/wippersnapper/digitalio.proto @@ -2,7 +2,7 @@ // SPDX-License-Identifier: MIT syntax = "proto3"; package wippersnapper.digitalio; -import "wippersnapper/sensor.proto"; +import "sensor.proto"; /** * DigitalIOSampleMode specifies the pin's sample mode. @@ -49,3 +49,10 @@ message DigitalIOEvent { wippersnapper.sensor.SensorEvent value = 2; /** The pin's value. */ } +/** +* DigitalIOWrite writes a boolean value to a digital pin. +*/ +message DigitalIOWrite { + string pin_name = 1; /** The pin's name. */ + wippersnapper.sensor.SensorEvent value = 2; /** The pin's value. */ +} \ No newline at end of file diff --git a/proto/wippersnapper/ds18x20.proto b/proto/wippersnapper/ds18x20.proto index 6a1e19be..4f35d662 100644 --- a/proto/wippersnapper/ds18x20.proto +++ b/proto/wippersnapper/ds18x20.proto @@ -3,7 +3,7 @@ // WipperSnapper's Protobuf communication API for DS18X20 Maxim Temperature ICs syntax = "proto3"; package wippersnapper.ds18x20; -import "wippersnapper/sensor.proto"; +import "sensor.proto"; /** * Ds18x20Add represents a to initialize diff --git a/proto/wippersnapper/error.proto b/proto/wippersnapper/error.proto index ad710bca..9cb03ed9 100644 --- a/proto/wippersnapper/error.proto +++ b/proto/wippersnapper/error.proto @@ -2,7 +2,7 @@ // SPDX-License-Identifier: MIT syntax = "proto3"; package wippersnapper.error; -import "nanopb/nanopb.proto"; +import "nanopb.proto"; // TODO: Add error handling on the device-side to parse error // message and either delay on throttle, or disconnect + exponential retry+jitter diff --git a/proto/wippersnapper/i2c.proto b/proto/wippersnapper/i2c.proto index 2de170db..187ad4ba 100644 --- a/proto/wippersnapper/i2c.proto +++ b/proto/wippersnapper/i2c.proto @@ -2,7 +2,7 @@ // SPDX-License-Identifier: MIT syntax = "proto3"; package wippersnapper.i2c; -import "wippersnapper/sensor.proto"; +import "sensor.proto"; /** * BusResponse represents the state of the I2C bus, from a device. diff --git a/proto/nanopb/nanopb.proto b/proto/wippersnapper/nanopb.proto similarity index 100% rename from proto/nanopb/nanopb.proto rename to proto/wippersnapper/nanopb.proto diff --git a/proto/wippersnapper/signal.proto b/proto/wippersnapper/signal.proto index 61347106..15349454 100644 --- a/proto/wippersnapper/signal.proto +++ b/proto/wippersnapper/signal.proto @@ -1,19 +1,18 @@ -// SPDX-FileCopyrightText: 2020-2023 Brent Rubell, Loren Norman for Adafruit Industries +// SPDX-FileCopyrightText: 2020-2024 Brent Rubell, Loren Norman for Adafruit Industries // SPDX-License-Identifier: MIT syntax = "proto3"; package wippersnapper.signal; -import "nanopb/nanopb.proto"; - -import "wippersnapper/analogio.proto"; -import "wippersnapper/checkin.proto"; -import "wippersnapper/digitalio.proto"; -import "wippersnapper/ds18x20.proto"; -import "wippersnapper/error.proto"; -import "wippersnapper/i2c.proto"; -import "wippersnapper/pixels.proto"; -import "wippersnapper/pwm.proto"; -import "wippersnapper/servo.proto"; -import "wippersnapper/uart.proto"; +import "nanopb.proto"; +import "analogio.proto"; +import "checkin.proto"; +import "digitalio.proto"; +import "ds18x20.proto"; +import "error.proto"; +import "i2c.proto"; +import "pixels.proto"; +import "pwm.proto"; +import "servo.proto"; +import "uart.proto"; /* * BrokerToDevice @@ -27,11 +26,12 @@ message BrokerToDevice { wippersnapper.digitalio.DigitalIOAdd digitalio_add = 10; wippersnapper.digitalio.DigitalIORemove digitalio_remove = 11; wippersnapper.digitalio.DigitalIOEvent digitalio_event = 12; + wippersnapper.digitalio.DigitalIOWrite digitalio_write = 13; // analogio.proto wippersnapper.analogio.AnalogIOAdd analogio_add = 20; wippersnapper.analogio.AnalogIOAdd analogio_remove = 21; // checkin.proto - wippersnapper.checkin.CheckinRequest checkin_request = 30; + wippersnapper.checkin.CheckinResponse checkin_response = 30; // servo.proto wippersnapper.servo.ServoAdd servo_add = 40; wippersnapper.servo.ServoRemove servo_remove = 41; @@ -75,7 +75,7 @@ message DeviceToBroker { // analogio.proto wippersnapper.analogio.AnalogIOEvent analogio_event = 20; // checkin.proto - wippersnapper.checkin.CheckinResponse checkin_response = 30; + wippersnapper.checkin.CheckinRequest checkin_request = 30; // servo.proto wippersnapper.servo.ServoAdded servo_added = 40; // pwm.proto diff --git a/proto/wippersnapper/signal/v1/signal.md b/proto/wippersnapper/signal/v1/signal.md deleted file mode 100644 index bc137c85..00000000 --- a/proto/wippersnapper/signal/v1/signal.md +++ /dev/null @@ -1,26 +0,0 @@ - -# signal.proto - -This file details the `signal.proto` message used to communicate between WipperSnapper clients. The signal file contains high-level `oneof` messages that "wrap" the following protocol buffer APIs: `pin.proto`, `i2c.proto`, `servo.proto`, `pwm.proto`, `ds18x20.proto`, `pixels .proto`, `uart.proto`. - -## Sequence Diagrams - -### Generalized `msgRequest` and `msgResponse` - -Within `signal.proto`, each `.proto` API contains both a `request` and `response` message. The `request` message is a command sent from the broker to a device. The `response` message is a command sent from the device to the broker. - -```mermaid -sequenceDiagram -autonumber - -IO Broker->>Device Client: ServoRequest -Note over IO Broker,Device Client: /:username/wprsnpr/:clientId/signals/device/servo -Device Client->>App: ServoRequest -App->>(nanopb) Encoder/Decoder: ServoRequest -(nanopb) Encoder/Decoder->>Component Class: ServoAttachRequest -Component Class->>(nanopb) Encoder/Decoder: Result of ServoAttachRequest -(nanopb) Encoder/Decoder->>App: ServoResponse -App->>Device Client: ServoResponse -Device Client->>IO Broker: ServoResponse -Note over Device Client,IO Broker: /:username/wprsnpr/:clientId/signals/broker/servo -``` diff --git a/proto/wippersnapper/uart.proto b/proto/wippersnapper/uart.proto index d1a7c4e9..e2e6b5a7 100644 --- a/proto/wippersnapper/uart.proto +++ b/proto/wippersnapper/uart.proto @@ -2,7 +2,7 @@ // SPDX-License-Identifier: MIT syntax = "proto3"; package wippersnapper.uart; -import "wippersnapper/sensor.proto"; +import "sensor.proto"; /** * UARTBusData represents a message to configure a UART bus for communication with a device. From e251bde117777975f591e152c1f2d667be286541 Mon Sep 17 00:00:00 2001 From: brentru Date: Wed, 13 Mar 2024 15:30:57 -0400 Subject: [PATCH 060/188] fix two wrappers --- .github/workflows/generate-local-python-artifacts.yml | 2 +- .github/workflows/protoc-wrapper-generation.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/generate-local-python-artifacts.yml b/.github/workflows/generate-local-python-artifacts.yml index 9cbe73e8..c891f218 100644 --- a/.github/workflows/generate-local-python-artifacts.yml +++ b/.github/workflows/generate-local-python-artifacts.yml @@ -30,7 +30,7 @@ jobs: run: | mkdir ./python_out mkdir ./python_nanopb_out - protoc --proto_path=./protobuf-checkout/proto ./protobuf-checkout/proto/wippersnapper/*.proto --python_out=./python_out + protoc --proto_path=./protobuf-checkout/proto/wippersnapper --python_out=./python_out ./protobuf-checkout/proto/wippersnapper/*.proto protoc ./protobuf-checkout/nanopb/generator/proto/nanopb.proto --python_out=./python_nanopb_out - uses: actions/upload-artifact@v3 with: diff --git a/.github/workflows/protoc-wrapper-generation.yml b/.github/workflows/protoc-wrapper-generation.yml index bbd94535..78d1069d 100644 --- a/.github/workflows/protoc-wrapper-generation.yml +++ b/.github/workflows/protoc-wrapper-generation.yml @@ -43,7 +43,7 @@ jobs: mkdir ./python_out mkdir ./python_nanopb_out mkdir ./js_out - protoc --proto_path=./protobuf-checkout/proto ./protobuf-checkout/proto/wippersnapper/*.proto --js_out=import_style=commonjs,binary:js_out --python_out=./python_out + protoc --proto_path=./protobuf-checkout/proto/wippersnapper ./protobuf-checkout/proto/wippersnapper/*.proto --js_out=import_style=commonjs,binary:js_out --python_out=./python_out protoc ./protobuf-checkout/nanopb/generator/proto/nanopb.proto --js_out=import_style=commonjs,binary:js_out --python_out=./python_nanopb_out - name: Checkout Python Repo uses: actions/checkout@v2 From 70a62e8d3dd3f11e59ebbeade506b50f96e1661c Mon Sep 17 00:00:00 2001 From: brentru Date: Wed, 13 Mar 2024 15:32:46 -0400 Subject: [PATCH 061/188] fix arduino --- .github/workflows/protoc-wrapper-generation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/protoc-wrapper-generation.yml b/.github/workflows/protoc-wrapper-generation.yml index 78d1069d..ca3f359f 100644 --- a/.github/workflows/protoc-wrapper-generation.yml +++ b/.github/workflows/protoc-wrapper-generation.yml @@ -75,7 +75,7 @@ jobs: PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION: python run: | mkdir ./arduino_out - protoc --plugin=protobuf-checkout/nanopb/generator/protoc-gen-nanopb -Iprotobuf-checkout/nanopb/generator/proto --proto_path=./protobuf-checkout/proto ./protobuf-checkout/proto/wippersnapper/*.proto --nanopb_out=./arduino_out --nanopb_opt=-I./protobuf-checkout/proto --nanopb_opt=-t + protoc --plugin=protobuf-checkout/nanopb/generator/protoc-gen-nanopb -Iprotobuf-checkout/nanopb/generator/proto --proto_path=./protobuf-checkout/proto/wippersnapper ./protobuf-checkout/proto/wippersnapper/*.proto --nanopb_out=./arduino_out --nanopb_opt=-I./protobuf-checkout/proto --nanopb_opt=-t # Local (non-CI) build command: # protoc --plugin=nanopb/generator/protoc-gen-nanopb -Inanopb/generator/proto --proto_path=./proto ./proto/wippersnapper/*.proto --nanopb_out=./arduino_out --nanopb_opt=-I./proto --nanopb_opt=-t - name: Checkout Arduino Repo From 4a1eb8329a76794a3971a4738562104c866dab6f Mon Sep 17 00:00:00 2001 From: brentru Date: Wed, 13 Mar 2024 15:34:21 -0400 Subject: [PATCH 062/188] sort imports --- proto/wippersnapper/signal.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proto/wippersnapper/signal.proto b/proto/wippersnapper/signal.proto index 15349454..66c0da0f 100644 --- a/proto/wippersnapper/signal.proto +++ b/proto/wippersnapper/signal.proto @@ -2,13 +2,13 @@ // SPDX-License-Identifier: MIT syntax = "proto3"; package wippersnapper.signal; -import "nanopb.proto"; import "analogio.proto"; import "checkin.proto"; import "digitalio.proto"; import "ds18x20.proto"; import "error.proto"; import "i2c.proto"; +import "nanopb.proto"; import "pixels.proto"; import "pwm.proto"; import "servo.proto"; From 254324851e06ac81ec74009dccaeb8e242fe7cc2 Mon Sep 17 00:00:00 2001 From: brentru Date: Wed, 13 Mar 2024 15:36:43 -0400 Subject: [PATCH 063/188] run wrapper gen --- .github/workflows/protoc-wrapper-generation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/protoc-wrapper-generation.yml b/.github/workflows/protoc-wrapper-generation.yml index ca3f359f..9d99feea 100644 --- a/.github/workflows/protoc-wrapper-generation.yml +++ b/.github/workflows/protoc-wrapper-generation.yml @@ -76,7 +76,7 @@ jobs: run: | mkdir ./arduino_out protoc --plugin=protobuf-checkout/nanopb/generator/protoc-gen-nanopb -Iprotobuf-checkout/nanopb/generator/proto --proto_path=./protobuf-checkout/proto/wippersnapper ./protobuf-checkout/proto/wippersnapper/*.proto --nanopb_out=./arduino_out --nanopb_opt=-I./protobuf-checkout/proto --nanopb_opt=-t - # Local (non-CI) build command: + # Local (non-CI) build command is commented out below: # protoc --plugin=nanopb/generator/protoc-gen-nanopb -Inanopb/generator/proto --proto_path=./proto ./proto/wippersnapper/*.proto --nanopb_out=./arduino_out --nanopb_opt=-I./proto --nanopb_opt=-t - name: Checkout Arduino Repo uses: actions/checkout@v2 From 242e1029af036e1d9d23b4f21a5bf9eb771be08f Mon Sep 17 00:00:00 2001 From: Brent Rubell Date: Wed, 13 Mar 2024 15:37:33 -0400 Subject: [PATCH 064/188] Update test-wrapper-arduino.yml --- .github/workflows/test-wrapper-arduino.yml | 142 +++++++++++++++++++-- 1 file changed, 132 insertions(+), 10 deletions(-) diff --git a/.github/workflows/test-wrapper-arduino.yml b/.github/workflows/test-wrapper-arduino.yml index c2201896..9d99feea 100644 --- a/.github/workflows/test-wrapper-arduino.yml +++ b/.github/workflows/test-wrapper-arduino.yml @@ -1,22 +1,34 @@ -name: Generate new proto wrapper files and upload artifacts -on: [ pull_request ] +name: Generate .proto Wrapper Files +on: + push: + branches: master + +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: write + pages: write + id-token: write + jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/setup-python@v4 + + # Setup + - uses: actions/setup-python@v2 with: python-version: '3.x' - name: Install Protoc uses: arduino/setup-protoc@v1 with: version: '3.13.0' + repo-token: ${{ secrets.GITHUB_TOKEN }} - name: Install Python dependencies run : | python -m pip install --upgrade pip - pip3 install scons protobuf grpcio-tools + pip install protobuf setuptools - name: Self Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v2 with: path: protobuf-checkout submodules: true @@ -24,15 +36,125 @@ jobs: run: | git config --global user.name adafruitio git config --global user.email adafruitio@adafruit.com + + # Python Wrappers + - name: Generate Python and JS Wrapper Files from .proto Files + run: | + mkdir ./python_out + mkdir ./python_nanopb_out + mkdir ./js_out + protoc --proto_path=./protobuf-checkout/proto/wippersnapper ./protobuf-checkout/proto/wippersnapper/*.proto --js_out=import_style=commonjs,binary:js_out --python_out=./python_out + protoc ./protobuf-checkout/nanopb/generator/proto/nanopb.proto --js_out=import_style=commonjs,binary:js_out --python_out=./python_nanopb_out + - name: Checkout Python Repo + uses: actions/checkout@v2 + with: + repository: adafruit/Adafruit_Wippersnapper_Python + token: ${{ secrets.IO_BOT_PAT }} + path: python-checkout + - name: Copy Python Files + run: | + rm -rf ./python-checkout/src/Adafruit_Wippersnapper_Python/proto + cp -r ./python_out/ ./python-checkout/src/Adafruit_Wippersnapper_Python/proto/ + mv ./python_nanopb_out/protobuf_checkout/nanopb/generator/proto/nanopb_pb2.py ./python-checkout/src/Adafruit_Wippersnapper_Python/proto/nanopb_pb2.py + - name: Open Python Pull Request + env: + GITHUB_USER: adafruitio + GITHUB_TOKEN: ${{ secrets.IO_BOT_PAT }} + PROTOBUF_BRANCH_NAME: protobuf-update + run: | + cd python-checkout + git checkout -b $PROTOBUF_BRANCH_NAME-$GITHUB_SHA + git add adafruit_wippersnapper + git commit -m "Updating protobuf wrappers" || exit 0 # quit cleanly if nothing to commit + hub push origin $PROTOBUF_BRANCH_NAME-$GITHUB_SHA + hub pull-request --message ".proto file wrappers updated" --message "Auto-generated by [GitHub Actions on Protobuf Repo][1]" --message "[1]: https://github.com/adafruit/Wippersnapper_Protobuf/blob/master/.github/workflows/protoc-wrapper-generation.yml" + + # Arduino Wrappers - name: Generate Arduino files from .proto Files env: PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION: python run: | mkdir ./arduino_out - protoc --plugin=protobuf-checkout/nanopb/generator/protoc-gen-nanopb -Iprotobuf-checkout/nanopb/generator/proto --proto_path=./protobuf-checkout/proto ./protobuf-checkout/proto/wippersnapper/*.proto --nanopb_out=./arduino_out --nanopb_opt=-I./protobuf-checkout/proto --nanopb_opt=-t - # Local (non-CI) build command: + protoc --plugin=protobuf-checkout/nanopb/generator/protoc-gen-nanopb -Iprotobuf-checkout/nanopb/generator/proto --proto_path=./protobuf-checkout/proto/wippersnapper ./protobuf-checkout/proto/wippersnapper/*.proto --nanopb_out=./arduino_out --nanopb_opt=-I./protobuf-checkout/proto --nanopb_opt=-t + # Local (non-CI) build command is commented out below: # protoc --plugin=nanopb/generator/protoc-gen-nanopb -Inanopb/generator/proto --proto_path=./proto ./proto/wippersnapper/*.proto --nanopb_out=./arduino_out --nanopb_opt=-I./proto --nanopb_opt=-t - - uses: actions/upload-artifact@v3 + - name: Checkout Arduino Repo + uses: actions/checkout@v2 + with: + repository: adafruit/Adafruit_Wippersnapper_Arduino + token: ${{ secrets.IO_BOT_PAT }} + path: arduino-checkout + - name: Copy Generated Arduino Files to Arduino Repo + run: | + rm -rf ./arduino-checkout/src/wippersnapper/ + mkdir ./arduino-checkout/src/wippersnapper/ + cp -a ./arduino_out/. ./arduino-checkout/src/ + - name: Open Arduino Pull Request + env: + GITHUB_USER: adafruitio + GITHUB_TOKEN: ${{ secrets.IO_BOT_PAT }} + PROTOBUF_BRANCH_NAME: protobuf-update + run: | + cd arduino-checkout + git checkout -b $PROTOBUF_BRANCH_NAME-$GITHUB_SHA + git status + git add src + git commit -m "Updating protobuf wrappers" || exit 0 # quit cleanly if nothing to commit + hub push origin $PROTOBUF_BRANCH_NAME-$GITHUB_SHA + hub pull-request --base main --message ".proto file wrappers updated" --message "Auto-generated by [GitHub Actions on Protobuf Repo][1]" --message "[1]: https://github.com/adafruit/Wippersnapper_Protobuf/blob/master/.github/workflows/protoc-wrapper-generation.yml" + + # NodeJS wrappers for the mqtt broker + - name: Generate JS Wrapper Files from .proto Files + run: | + mkdir ./js_out + protoc --proto_path=./protobuf-checkout/proto ./protobuf-checkout/proto/wippersnapper/*/*/*.proto --js_out=import_style=commonjs,binary:js_out + protoc ./protobuf-checkout/nanopb/generator/proto/nanopb.proto --js_out=import_style=commonjs,binary:js_out + - name: Checkout io-node Repo + uses: actions/checkout@v2 + with: + repository: AdafruitInternalDev/io-node + token: ${{ secrets.IO_BOT_PAT }} + path: js-checkout + ref: main + - name: Copy JS Files + run: | + rm -rf ./js-checkout/lib/wprsnpr/protobufs/wippersnapper/ + cp -r ./js_out/wippersnapper/ ./js-checkout/lib/wprsnpr/protobufs/wippersnapper/ + rm -rf ./js-checkout/lib/wprsnpr/protobufs/nanopb/ + mkdir ./js-checkout/lib/wprsnpr/protobufs/nanopb/ + mv ./js_out/protobuf-checkout/nanopb/generator/proto/nanopb_pb.js ./js-checkout/lib/wprsnpr/protobufs/nanopb/nanopb_pb.js + - name: Open Node Pull Request + env: + GITHUB_USER: adafruitio + GITHUB_TOKEN: ${{ secrets.IO_BOT_PAT }} + PROTOBUF_BRANCH_NAME: protobuf-update + run: | + cd js-checkout + git checkout -b $PROTOBUF_BRANCH_NAME-$GITHUB_SHA + git add lib/wprsnpr/protobufs/ + git commit -m "Updating protobuf wrappers" || exit 0 # quit cleanly if nothing to commit + hub push origin $PROTOBUF_BRANCH_NAME-$GITHUB_SHA + hub pull-request --base main --message ".proto file wrappers updated" --message "Auto-generated by [GitHub Actions on Protobuf Repo][1]" --message "[1]: https://github.com/adafruit/Wippersnapper_Protobuf/blob/master/.github/workflows/protoc-wrapper-generation.yml" + + # Docs + - name: Checkout doc branch + uses: actions/checkout@v2 + with: + ref: gh-pages + path: protobuf-docs-checkout + - name: Commit and push generated HTML Docs file + run: | + cd protobuf-docs-checkout + cp -r ../doc ./doc + git add doc/ + git commit -m "Add generated HTML documentation for $GITHUB_SHA" || exit 0 # quit cleanly if nothing to commit + git push + - name: Setup Pages + uses: actions/configure-pages@v3 + - name: Upload artifact + uses: actions/upload-pages-artifact@v2 with: - name: build-artifact-arduino-wrapper - path: ./arduino_out \ No newline at end of file + path: 'protobuf-docs-checkout/doc' + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v2 From 97ea1855c57816a43b75ff416d9ad8282116d120 Mon Sep 17 00:00:00 2001 From: brentru Date: Thu, 4 Apr 2024 10:59:09 -0400 Subject: [PATCH 065/188] fix analogio_remove --- proto/wippersnapper/signal.proto | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/proto/wippersnapper/signal.proto b/proto/wippersnapper/signal.proto index 66c0da0f..d0238da9 100644 --- a/proto/wippersnapper/signal.proto +++ b/proto/wippersnapper/signal.proto @@ -23,38 +23,38 @@ import "uart.proto"; message BrokerToDevice { oneof payload { // digitalio.proto - wippersnapper.digitalio.DigitalIOAdd digitalio_add = 10; + wippersnapper.digitalio.DigitalIOAdd digitalio_add = 10; wippersnapper.digitalio.DigitalIORemove digitalio_remove = 11; - wippersnapper.digitalio.DigitalIOEvent digitalio_event = 12; - wippersnapper.digitalio.DigitalIOWrite digitalio_write = 13; + wippersnapper.digitalio.DigitalIOEvent digitalio_event = 12; + wippersnapper.digitalio.DigitalIOWrite digitalio_write = 13; // analogio.proto - wippersnapper.analogio.AnalogIOAdd analogio_add = 20; - wippersnapper.analogio.AnalogIOAdd analogio_remove = 21; + wippersnapper.analogio.AnalogIOAdd analogio_add = 20; + wippersnapper.analogio.AnalogIORemove analogio_remove = 21; // checkin.proto wippersnapper.checkin.CheckinResponse checkin_response = 30; // servo.proto - wippersnapper.servo.ServoAdd servo_add = 40; + wippersnapper.servo.ServoAdd servo_add = 40; wippersnapper.servo.ServoRemove servo_remove = 41; wippersnapper.servo.ServoWrite servo_write = 42; // pwm.proto - wippersnapper.pwm.PWMAdd pwm_add = 50; + wippersnapper.pwm.PWMAdd pwm_add = 50; wippersnapper.pwm.PWMRemove pwm_remove = 51; wippersnapper.pwm.PWMWriteDutyCycle pwm_write_duty = 52; wippersnapper.pwm.PWMWriteDutyCycleMulti pwm_write_duty_multi = 53; wippersnapper.pwm.PWMWriteFrequency pwm_write_freq = 54; // pixels.proto - wippersnapper.pixels.PixelsAdd pixels_add = 60; + wippersnapper.pixels.PixelsAdd pixels_add = 60; wippersnapper.pixels.PixelsRemove pixels_remove = 61; wippersnapper.pixels.PixelsWrite pixels_write = 62; // ds18x20.proto - wippersnapper.ds18x20.Ds18x20Add ds18x20_add = 70; + wippersnapper.ds18x20.Ds18x20Add ds18x20_add = 70; wippersnapper.ds18x20.Ds18x20Remove ds18x20_remove = 71; // uart.proto - wippersnapper.uart.UARTAdd uart_add = 80; + wippersnapper.uart.UARTAdd uart_add = 80; wippersnapper.uart.UARTRemove uart_remove = 81; // i2c.proto - wippersnapper.i2c.I2CScan i2c_scan = 90; - wippersnapper.i2c.I2CInit i2c_add = 91; + wippersnapper.i2c.I2CScan i2c_scan = 90; + wippersnapper.i2c.I2CInit i2c_add = 91; wippersnapper.i2c.I2CRemove i2c_remove = 92; // error.proto wippersnapper.error.Error error = 100; @@ -90,8 +90,8 @@ message DeviceToBroker { wippersnapper.uart.UARTEvent uart_event = 100; // i2c.proto wippersnapper.i2c.I2CScanResponse resp_i2c_scan = 110; - wippersnapper.i2c.I2CAdded i2c_added = 111; - wippersnapper.i2c.I2CRemoved i2c_removed = 112; - wippersnapper.i2c.I2CEvent i2c_event = 113; + wippersnapper.i2c.I2CAdded i2c_added = 111; + wippersnapper.i2c.I2CRemoved i2c_removed = 112; + wippersnapper.i2c.I2CEvent i2c_event = 113; } } \ No newline at end of file From dae03b81d7cbffe9cd15c096a590fd30071eed77 Mon Sep 17 00:00:00 2001 From: brentru Date: Thu, 4 Apr 2024 11:15:41 -0400 Subject: [PATCH 066/188] new workflow --- .github/workflows/generate-local-python-artifacts.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/generate-local-python-artifacts.yml b/.github/workflows/generate-local-python-artifacts.yml index c891f218..4d954f41 100644 --- a/.github/workflows/generate-local-python-artifacts.yml +++ b/.github/workflows/generate-local-python-artifacts.yml @@ -10,7 +10,7 @@ jobs: - name: Install Protoc uses: arduino/setup-protoc@v1 with: - version: '3.13.0' + version: '24.4.0' - name: Install Python dependencies run : | python -m pip install --upgrade pip From 3e0c8953e4fb3b34ba49ea7bbc45f539675513ef Mon Sep 17 00:00:00 2001 From: brentru Date: Thu, 4 Apr 2024 11:17:45 -0400 Subject: [PATCH 067/188] 24.x? --- .github/workflows/generate-local-python-artifacts.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/generate-local-python-artifacts.yml b/.github/workflows/generate-local-python-artifacts.yml index 4d954f41..c2b05471 100644 --- a/.github/workflows/generate-local-python-artifacts.yml +++ b/.github/workflows/generate-local-python-artifacts.yml @@ -10,7 +10,7 @@ jobs: - name: Install Protoc uses: arduino/setup-protoc@v1 with: - version: '24.4.0' + version: '24.x' - name: Install Python dependencies run : | python -m pip install --upgrade pip From 76686afc2f204cd2c277c0238061523b2bcccfed Mon Sep 17 00:00:00 2001 From: brentru Date: Thu, 4 Apr 2024 11:18:42 -0400 Subject: [PATCH 068/188] 23.x --- .github/workflows/generate-local-python-artifacts.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/generate-local-python-artifacts.yml b/.github/workflows/generate-local-python-artifacts.yml index c2b05471..ce91effc 100644 --- a/.github/workflows/generate-local-python-artifacts.yml +++ b/.github/workflows/generate-local-python-artifacts.yml @@ -10,7 +10,7 @@ jobs: - name: Install Protoc uses: arduino/setup-protoc@v1 with: - version: '24.x' + version: '23.x' - name: Install Python dependencies run : | python -m pip install --upgrade pip From ec9f83da14b9b460030304f9f796ac977457fbfc Mon Sep 17 00:00:00 2001 From: brentru Date: Thu, 4 Apr 2024 11:20:18 -0400 Subject: [PATCH 069/188] latest --- .github/workflows/generate-local-python-artifacts.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/generate-local-python-artifacts.yml b/.github/workflows/generate-local-python-artifacts.yml index ce91effc..dc895f2e 100644 --- a/.github/workflows/generate-local-python-artifacts.yml +++ b/.github/workflows/generate-local-python-artifacts.yml @@ -9,8 +9,6 @@ jobs: python-version: '3.x' - name: Install Protoc uses: arduino/setup-protoc@v1 - with: - version: '23.x' - name: Install Python dependencies run : | python -m pip install --upgrade pip From 71f6a5ad46fc419b1922283dde99a91842badc30 Mon Sep 17 00:00:00 2001 From: brentru Date: Tue, 9 Apr 2024 15:28:26 -0400 Subject: [PATCH 070/188] support backwards-compatible scl/sda pins --- proto/wippersnapper/i2c.options | 3 +++ proto/wippersnapper/i2c.proto | 14 ++++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/proto/wippersnapper/i2c.options b/proto/wippersnapper/i2c.options index 08c3f7d3..1eeae9d3 100644 --- a/proto/wippersnapper/i2c.options +++ b/proto/wippersnapper/i2c.options @@ -1,4 +1,7 @@ # i2c.options +*.I2CBusInit.scl.scl_str max_size:15 +*.I2CBusInit.sda.sda_str max_size:15 +*.I2CInit.i2c_device_name max_size:15 *.I2CScanResponse.found_addresses max_count:120 *.I2CInit.i2c_device_name max_size:15 *.I2CInit.sensor_properties max_count:15 diff --git a/proto/wippersnapper/i2c.proto b/proto/wippersnapper/i2c.proto index 187ad4ba..f2454be4 100644 --- a/proto/wippersnapper/i2c.proto +++ b/proto/wippersnapper/i2c.proto @@ -24,10 +24,16 @@ enum BusResponse { * initialize the I2C bus from the broker. */ message I2CBusInit { - int32 i2c_pin_scl = 1; /** The desired I2C SCL pin. */ - int32 i2c_pin_sda = 2; /** The desired I2C SDA pin. */ - uint32 i2c_frequency = 3; /** The desired I2C SCL frequency, in Hz. Default is 100000Hz. */ - int32 i2c_port_number = 4; /** The I2C port number. */ + oneof scl { + int32 scl_int = 1; /** The desired I2C SCL pin. */ + string scl_str = 2; /** The desired I2C SCL pin. */ + } + oneof sda { + int32 sda_int = 3; /** The desired I2C SDA pin. */ + string sda_str = 4; /** The desired I2C SDA pin. */ + } + uint32 i2c_frequency = 5; /** The desired I2C SCL frequency, in Hz. Default is 100000Hz. */ + int32 i2c_port_number = 6; /** The I2C port number. */ } /** From 8280531e3faf75cb672beb012670511dcfb3d19c Mon Sep 17 00:00:00 2001 From: brentru Date: Thu, 11 Apr 2024 11:01:41 -0400 Subject: [PATCH 071/188] remove i2c port number and pins --- proto/wippersnapper/checkin.proto | 2 -- proto/wippersnapper/i2c.proto | 28 ++++++++-------------------- 2 files changed, 8 insertions(+), 22 deletions(-) diff --git a/proto/wippersnapper/checkin.proto b/proto/wippersnapper/checkin.proto index d168991b..40c1e5b6 100644 --- a/proto/wippersnapper/checkin.proto +++ b/proto/wippersnapper/checkin.proto @@ -20,7 +20,6 @@ message CheckinResponse { int32 total_gpio_pins = 2; /** Specifies the number of GPIO pins on the device. */ int32 total_analog_pins = 3; /** Specifies the number of analog pins on the device. */ float reference_voltage = 4; /** Specifies the hardware's default reference voltage. */ - int32 total_i2c_ports = 5; /** Specifies the number of hardware's I2C ports (i2cPorts[]). */ /** * Response. Specifies if the hardware definiton is within the database. @@ -31,4 +30,3 @@ message CheckinResponse { RESPONSE_BOARD_NOT_FOUND = 2; /** Board not found in definition index */ } } - diff --git a/proto/wippersnapper/i2c.proto b/proto/wippersnapper/i2c.proto index f2454be4..7e13d103 100644 --- a/proto/wippersnapper/i2c.proto +++ b/proto/wippersnapper/i2c.proto @@ -24,16 +24,7 @@ enum BusResponse { * initialize the I2C bus from the broker. */ message I2CBusInit { - oneof scl { - int32 scl_int = 1; /** The desired I2C SCL pin. */ - string scl_str = 2; /** The desired I2C SCL pin. */ - } - oneof sda { - int32 sda_int = 3; /** The desired I2C SDA pin. */ - string sda_str = 4; /** The desired I2C SDA pin. */ - } - uint32 i2c_frequency = 5; /** The desired I2C SCL frequency, in Hz. Default is 100000Hz. */ - int32 i2c_port_number = 6; /** The I2C port number. */ + uint32 i2c_frequency = 1; /** The desired I2C SCL frequency, in Hz. Default is 100000Hz. */ } /** @@ -49,8 +40,7 @@ message I2CBusInitResponse { * a device's I2C scan. */ message I2CScan { - int32 i2c_port_number = 1; /** The desired I2C port to scan. */ - I2CBusInit bus_init = 2; /** The I2C bus initialization . */ + I2CBusInit bus_init = 2; /** The I2C bus initialization . */ } /** @@ -67,13 +57,12 @@ message I2CScanResponse { * an I2C device initialization . */ message I2CInit { - int32 i2c_port_number = 1; /** The desired I2C port to initialize an I2C device on. */ - I2CBusInit i2c_bus_init_req = 2; /** An I2C bus initialization . */ - uint32 i2c_device_address = 3; /** The 7-bit I2C address of the device on the bus. */ - string i2c_device_name = 4; /** The I2C device's name, MUST MATCH the name on the JSON definition file on + I2CBusInit i2c_bus_init_req = 1; /** An I2C bus initialization . */ + uint32 i2c_device_address = 2; /** The 7-bit I2C address of the device on the bus. */ + string i2c_device_name = 3; /** The I2C device's name, MUST MATCH the name on the JSON definition file on https://github.com/adafruit/Wippersnapper_Components. */ - float i2c_device_period = 5; /** The desired period to update the I2C device's sensor(s), in seconds. */ - repeated wippersnapper.sensor.SensorType i2c_device_sensor_types = 6; /** SI Types for each sensor on the I2C device. */ + float i2c_device_period = 4; /** The desired period to update the I2C device's sensor(s), in seconds. */ + repeated wippersnapper.sensor.SensorType i2c_device_sensor_types = 5; /** SI Types for each sensor on the I2C device. */ } /** @@ -100,8 +89,7 @@ message I2CUpdateResponse { * a deinitialization for a specific i2c device. */ message I2CRemove { - int32 i2c_port_number = 1; /** The desired I2C port to de-initialize an I2C device on. */ - uint32 i2c_device_address = 2; /** The 7-bit I2C address of the device on the bus. */ + uint32 i2c_device_address = 1; /** The 7-bit I2C address of the device on the bus. */ } /** From f7058f94ebac3ee55e600c61effd7aced53ebaaf Mon Sep 17 00:00:00 2001 From: brentru Date: Thu, 11 Apr 2024 15:04:05 -0400 Subject: [PATCH 072/188] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Refactor=20I2C=20A?= =?UTF-8?q?PI=20per=20pair-programming=20session=20with=20Lorennorman=20to?= =?UTF-8?q?day?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Refactor over i2c.proto --- proto/wippersnapper/i2c.options | 4 +- proto/wippersnapper/i2c.proto | 106 ++++++++++++------------------- proto/wippersnapper/signal.proto | 16 ++--- 3 files changed, 51 insertions(+), 75 deletions(-) diff --git a/proto/wippersnapper/i2c.options b/proto/wippersnapper/i2c.options index 1eeae9d3..6f6d33a7 100644 --- a/proto/wippersnapper/i2c.options +++ b/proto/wippersnapper/i2c.options @@ -1,8 +1,6 @@ # i2c.options -*.I2CBusInit.scl.scl_str max_size:15 -*.I2CBusInit.sda.sda_str max_size:15 *.I2CInit.i2c_device_name max_size:15 *.I2CScanResponse.found_addresses max_count:120 *.I2CInit.i2c_device_name max_size:15 *.I2CInit.sensor_properties max_count:15 -*.I2CEvent.sensor_events max_count:15 \ No newline at end of file +*.I2CEvent.sensor_events max_count:15 diff --git a/proto/wippersnapper/i2c.proto b/proto/wippersnapper/i2c.proto index 7e13d103..0b077134 100644 --- a/proto/wippersnapper/i2c.proto +++ b/proto/wippersnapper/i2c.proto @@ -5,109 +5,87 @@ package wippersnapper.i2c; import "sensor.proto"; /** -* BusResponse represents the state of the I2C bus, from a device. +* BusResponse represents the state of a board's I2C bus */ -enum BusResponse { - BUS_RESPONSE_UNSPECIFIED = 0; /** Unspecified error occurred. **/ - BUS_RESPONSE_SUCCESS = 1; /** I2C bus successfully initialized. **/ - BUS_RESPONSE_ERROR_HANG = 2; /** I2C Bus hang, user should reset their board if this persists. **/ - BUS_RESPONSE_ERROR_PULLUPS = 3; /** I2C bus failed to initialize - SDA or SCL needs a pull up. **/ - BUS_RESPONSE_ERROR_WIRING = 4; /** I2C bus failed to communicate - Please check your wiring. **/ - BUS_RESPONSE_UNSUPPORTED_SENSOR = 5; /** WipperSnapper firmware is outdated and does not include - the sensor type - Please update your WipperSnapper firmware. **/ - BUS_RESPONSE_DEVICE_INIT_FAIL = 6; /** I2C device failed to initialize. **/ - BUS_RESPONSE_DEVICE_DEINIT_FAIL = 7; /** I2C device failed to de-initialize. **/ +enum I2CBusResponse { + I2C_BUS_RESPONSE_UNSPECIFIED = 0; /** Unspecified error occurred. **/ + I2C_BUS_RESPONSE_SUCCESS = 1; /** I2C bus successfully initialized. **/ + I2C_BUS_RESPONSE_ERROR_HANG = 2; /** I2C Bus hang, user should reset their board if this persists. **/ + I2C_BUS_RESPONSE_ERROR_PULLUPS = 3; /** I2C bus failed to initialize - SDA or SCL needs a pull up. **/ + I2C_BUS_RESPONSE_ERROR_WIRING = 4; /** I2C bus failed to communicate - Please check your wiring. **/ } /** -* I2CBusInit represents a to -* initialize the I2C bus from the broker. +* I2CDeviceResponse represents the state of an I2C device/peripheral */ -message I2CBusInit { - uint32 i2c_frequency = 1; /** The desired I2C SCL frequency, in Hz. Default is 100000Hz. */ +enum I2CDeviceResponse { +I2C_DEVICE_RESPONSE_UNSPECIFIED = 0; /** Unspecified error occurred. **/ +I2C_DEVICE_RESPONSE_SUCCESS = 1; /** I2C device successfully initialized. **/ +I2C_DEVICE_RESPONSE_FAIL_INIT = 2; /** I2C device failed to initialize. **/ +I2C_DEVICE_RESPONSE_FAIL_DEINIT = 3; /** I2C device failed to deinitialize. **/ +I2C_DEVICE_RESPONSE_FAIL_UNSUPPORTED_SENSOR = 4; /** WipperSnapper version is outdated and does not include this device. **/ +I2C_DEVICE_NOT_FOUND = 5; /** I2C device not found on the bus. **/ } /** -* I2CBusInitResponse represents a response to I2CBusInit +* I2CBusScan represents a command for a device to perform an i2c scan. It is an empty message. */ -message I2CBusInitResponse { - BusResponse bus_response = 1; /** Whether the I2C bus initialized properly or failed. **/ -} - - -/** -* I2CScan represents the parameters required to execute -* a device's I2C scan. -*/ -message I2CScan { - I2CBusInit bus_init = 2; /** The I2C bus initialization . */ +message I2CBusScan { } /** -* I2CScanResponse represents a list of I2C addresses +* I2CBusScanResponse represents a list of I2C addresses * found on the bus after I2CScan has executed. */ -message I2CScanResponse { +message I2CBusScanResponse { repeated uint32 found_addresses = 1 [packed=true]; /** The 7-bit addresses of the I2C devices found on the bus, empty if not found. */ BusResponse bus_response = 2; /** The I2C bus' status. **/ } -/** -* I2CInit is a wrapper message for -* an I2C device initialization . -*/ -message I2CInit { - I2CBusInit i2c_bus_init_req = 1; /** An I2C bus initialization . */ - uint32 i2c_device_address = 2; /** The 7-bit I2C address of the device on the bus. */ - string i2c_device_name = 3; /** The I2C device's name, MUST MATCH the name on the JSON definition file on - https://github.com/adafruit/Wippersnapper_Components. */ - float i2c_device_period = 4; /** The desired period to update the I2C device's sensor(s), in seconds. */ - repeated wippersnapper.sensor.SensorType i2c_device_sensor_types = 5; /** SI Types for each sensor on the I2C device. */ -} +// DEVICE COMMANDS /** -* I2CAdded contains the response from a -* device after processing a I2CInit message. +* I2CDeviceAddOrReplace is a message for initializing (or replacing/updating) an i2c device. */ -message I2CAdded { - uint32 i2c_device_address = 1; /** The 7-bit I2C address of the device on the bus. */ - BusResponse bus_response = 2; /** The I2C bus' status. **/ +message I2CDeviceAddOrReplace { + uint32 address = 1; /** The 7-bit I2C address of the device on the bus. */ + string name = 2; /** The I2C device's name, MUST MATCH the name on the JSON definition file on + https://github.com/adafruit/Wippersnapper_Components. */ + float period = 3; /** The desired period to update the I2C device's sensor(s), in seconds. */ + repeated wippersnapper.sensor.SensorType sensor_types = 4; /** SI Types for each sensor on the I2C device. */ } - /** -* I2CUpdateResponse represents if an I2C device's -* sensor(s) is/are successfully updated. +* I2CDeviceAddedOrReplaced contains the response from a device after processing a I2CDeviceAddOrReplace message. */ -message I2CUpdateResponse { - uint32 i2c_device_address = 1; /** The 7-bit I2C address of the device which was updated. */ - BusResponse bus_response = 2; /** The I2C bus' status. **/ +message I2CDeviceAddedOrReplaced { + uint32 i2c_device_address = 1; /** The 7-bit I2C address of the device on the bus. */ + I2CBusResponse bus_response = 2; /** The I2C bus' status. **/ + I2CDeviceResponse device_response = 3; /** The I2C device's status. **/ } /** -* I2CRemove is a wrapper message containing -* a deinitialization for a specific i2c device. +* I2CDeviceRemove represents a request to de-init an i2c device. */ -message I2CRemove { +message I2CDeviceRemove { uint32 i2c_device_address = 1; /** The 7-bit I2C address of the device on the bus. */ } /** -* I2CRemoved represents if an I2C device's -* sensor(s) is/are successfully de-initialized. +* I2CDeviceRemoved represents a response to a I2CDeviceRemove message. */ -message I2CRemoved { - uint32 i2c_device_address = 1; /** The 7-bit I2C address of the device which was initialized. */ - BusResponse bus_response = 2; /** The I2C bus' status. **/ +message I2CDeviceRemoved { + uint32 i2c_device_address = 1; /** The 7-bit I2C address of the device which was initialized. */ + I2CBusResponse bus_response = 2; /** The I2C bus' status. **/ + I2CDeviceResponse device_response = 3; /** The I2C device's status. **/ } - /** -* Each I2CEvent represents data from **one** I2C sensor. -* NOTE: An I2CEvent can have multiple sensor events if +* Each I2CDeviceEvent represents data from **one** I2C sensor. +* NOTE: An I2CDeviceEvent can have multiple sensor events if * the I2C device contains > 1 sensor. */ -message I2CEvent { +message I2CDeviceEvent { uint32 sensor_address = 1; /** The 7-bit I2C address of the I2C device. */ repeated wippersnapper.sensor.SensorEvent sensor_events = 2; /** A, optionally repeated, SensorEvent from a sensor. */ } diff --git a/proto/wippersnapper/signal.proto b/proto/wippersnapper/signal.proto index d0238da9..672e9813 100644 --- a/proto/wippersnapper/signal.proto +++ b/proto/wippersnapper/signal.proto @@ -53,9 +53,9 @@ message BrokerToDevice { wippersnapper.uart.UARTAdd uart_add = 80; wippersnapper.uart.UARTRemove uart_remove = 81; // i2c.proto - wippersnapper.i2c.I2CScan i2c_scan = 90; - wippersnapper.i2c.I2CInit i2c_add = 91; - wippersnapper.i2c.I2CRemove i2c_remove = 92; + wippersnapper.i2c.I2CBusScan i2c_bus_scan = 90; + wippersnapper.i2c.I2CDeviceAddOrReplace i2c_device_add_replace = 91; + wippersnapper.i2c.I2CDeviceRemove i2c_device_remove = 92; // error.proto wippersnapper.error.Error error = 100; } @@ -89,9 +89,9 @@ message DeviceToBroker { wippersnapper.uart.UARTAdded uart_added = 90; wippersnapper.uart.UARTEvent uart_event = 100; // i2c.proto - wippersnapper.i2c.I2CScanResponse resp_i2c_scan = 110; - wippersnapper.i2c.I2CAdded i2c_added = 111; - wippersnapper.i2c.I2CRemoved i2c_removed = 112; - wippersnapper.i2c.I2CEvent i2c_event = 113; + wippersnapper.i2c.I2CBusScanResponse i2c_bus_scan_resp = 110; + wippersnapper.i2c.I2CDeviceAddedOrReplaced i2c_device_added_replaced = 111; + wippersnapper.i2c.I2CDeviceRemoved i2c_device_removed = 112; + wippersnapper.i2c.I2CDeviceEvent i2c_device_event = 113; } -} \ No newline at end of file +} From 99d95062e25df911562eac8225fc1fc9e38d0a5c Mon Sep 17 00:00:00 2001 From: brentru Date: Thu, 11 Apr 2024 15:05:59 -0400 Subject: [PATCH 073/188] =?UTF-8?q?=F0=9F=90=9B=20Fix=20I2C.proto=20compil?= =?UTF-8?q?e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove outdated reference to BusResponse --- proto/wippersnapper/i2c.proto | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/proto/wippersnapper/i2c.proto b/proto/wippersnapper/i2c.proto index 0b077134..58804f6d 100644 --- a/proto/wippersnapper/i2c.proto +++ b/proto/wippersnapper/i2c.proto @@ -5,7 +5,7 @@ package wippersnapper.i2c; import "sensor.proto"; /** -* BusResponse represents the state of a board's I2C bus +* I2CBusResponse represents the state of a board's I2C bus */ enum I2CBusResponse { I2C_BUS_RESPONSE_UNSPECIFIED = 0; /** Unspecified error occurred. **/ @@ -38,8 +38,8 @@ message I2CBusScan { * found on the bus after I2CScan has executed. */ message I2CBusScanResponse { - repeated uint32 found_addresses = 1 [packed=true]; /** The 7-bit addresses of the I2C devices found on the bus, empty if not found. */ - BusResponse bus_response = 2; /** The I2C bus' status. **/ + repeated uint32 found_addresses = 1 [packed=true]; /** The 7-bit addresses of the I2C devices found on the bus, empty if not found. */ + I2CBusResponse bus_response = 2; /** The I2C bus' status. **/ } // DEVICE COMMANDS From dd2f23d9514e9ae3fdc0557601e2ac249ec1a35e Mon Sep 17 00:00:00 2001 From: brentru Date: Thu, 11 Apr 2024 15:09:43 -0400 Subject: [PATCH 074/188] =?UTF-8?q?=F0=9F=A6=BA=20Protolint?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Address protolinter --- proto/wippersnapper/i2c.proto | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/proto/wippersnapper/i2c.proto b/proto/wippersnapper/i2c.proto index 58804f6d..1404e0d5 100644 --- a/proto/wippersnapper/i2c.proto +++ b/proto/wippersnapper/i2c.proto @@ -5,9 +5,9 @@ package wippersnapper.i2c; import "sensor.proto"; /** -* I2CBusResponse represents the state of a board's I2C bus +* I2CBusResp represents the state of a board's I2C bus */ -enum I2CBusResponse { +enum I2CBusResp { I2C_BUS_RESPONSE_UNSPECIFIED = 0; /** Unspecified error occurred. **/ I2C_BUS_RESPONSE_SUCCESS = 1; /** I2C bus successfully initialized. **/ I2C_BUS_RESPONSE_ERROR_HANG = 2; /** I2C Bus hang, user should reset their board if this persists. **/ @@ -16,15 +16,15 @@ enum I2CBusResponse { } /** -* I2CDeviceResponse represents the state of an I2C device/peripheral +* I2CDeviceResp represents the state of an I2C device/peripheral */ -enum I2CDeviceResponse { -I2C_DEVICE_RESPONSE_UNSPECIFIED = 0; /** Unspecified error occurred. **/ -I2C_DEVICE_RESPONSE_SUCCESS = 1; /** I2C device successfully initialized. **/ -I2C_DEVICE_RESPONSE_FAIL_INIT = 2; /** I2C device failed to initialize. **/ -I2C_DEVICE_RESPONSE_FAIL_DEINIT = 3; /** I2C device failed to deinitialize. **/ -I2C_DEVICE_RESPONSE_FAIL_UNSUPPORTED_SENSOR = 4; /** WipperSnapper version is outdated and does not include this device. **/ -I2C_DEVICE_NOT_FOUND = 5; /** I2C device not found on the bus. **/ +enum I2CDeviceResp { + I2C_DEVICE_RESPONSE_UNSPECIFIED = 0; /** Unspecified error occurred. **/ + I2C_DEVICE_RESPONSE_SUCCESS = 1; /** I2C device successfully initialized. **/ + I2C_DEVICE_RESPONSE_FAIL_INIT = 2; /** I2C device failed to initialize. **/ + I2C_DEVICE_RESPONSE_FAIL_DEINIT = 3; /** I2C device failed to deinitialize. **/ + I2C_DEVICE_RESPONSE_FAIL_UNSUPPORTED_SENSOR = 4; /** WipperSnapper version is outdated and does not include this device. **/ + I2C_DEVICE_NOT_FOUND = 5; /** I2C device not found on the bus. **/ } /** @@ -39,7 +39,7 @@ message I2CBusScan { */ message I2CBusScanResponse { repeated uint32 found_addresses = 1 [packed=true]; /** The 7-bit addresses of the I2C devices found on the bus, empty if not found. */ - I2CBusResponse bus_response = 2; /** The I2C bus' status. **/ + I2CBusResp bus_response = 2; /** The I2C bus' status. **/ } // DEVICE COMMANDS @@ -60,8 +60,8 @@ message I2CDeviceAddOrReplace { */ message I2CDeviceAddedOrReplaced { uint32 i2c_device_address = 1; /** The 7-bit I2C address of the device on the bus. */ - I2CBusResponse bus_response = 2; /** The I2C bus' status. **/ - I2CDeviceResponse device_response = 3; /** The I2C device's status. **/ + I2CBusResp bus_response = 2; /** The I2C bus' status. **/ + I2CDeviceResp device_response = 3; /** The I2C device's status. **/ } /** @@ -76,8 +76,8 @@ message I2CDeviceRemove { */ message I2CDeviceRemoved { uint32 i2c_device_address = 1; /** The 7-bit I2C address of the device which was initialized. */ - I2CBusResponse bus_response = 2; /** The I2C bus' status. **/ - I2CDeviceResponse device_response = 3; /** The I2C device's status. **/ + I2CBusResp bus_response = 2; /** The I2C bus' status. **/ + I2CDeviceResp device_response = 3; /** The I2C device's status. **/ } /** From 9572a1458ccc9c40e61e4c966bd88701823ad642 Mon Sep 17 00:00:00 2001 From: brentru Date: Thu, 11 Apr 2024 15:17:02 -0400 Subject: [PATCH 075/188] take correct resp prefix --- proto/wippersnapper/i2c.proto | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/proto/wippersnapper/i2c.proto b/proto/wippersnapper/i2c.proto index 1404e0d5..b1e5b5dc 100644 --- a/proto/wippersnapper/i2c.proto +++ b/proto/wippersnapper/i2c.proto @@ -8,23 +8,23 @@ import "sensor.proto"; * I2CBusResp represents the state of a board's I2C bus */ enum I2CBusResp { - I2C_BUS_RESPONSE_UNSPECIFIED = 0; /** Unspecified error occurred. **/ - I2C_BUS_RESPONSE_SUCCESS = 1; /** I2C bus successfully initialized. **/ - I2C_BUS_RESPONSE_ERROR_HANG = 2; /** I2C Bus hang, user should reset their board if this persists. **/ - I2C_BUS_RESPONSE_ERROR_PULLUPS = 3; /** I2C bus failed to initialize - SDA or SCL needs a pull up. **/ - I2C_BUS_RESPONSE_ERROR_WIRING = 4; /** I2C bus failed to communicate - Please check your wiring. **/ + I2C_BUS_RESP_UNSPECIFIED = 0; /** Unspecified error occurred. **/ + I2C_BUS_RESP_SUCCESS = 1; /** I2C bus successfully initialized. **/ + I2C_BUS_RESP_ERROR_HANG = 2; /** I2C Bus hang, user should reset their board if this persists. **/ + I2C_BUS_RESP_ERROR_PULLUPS = 3; /** I2C bus failed to initialize - SDA or SCL needs a pull up. **/ + I2C_BUS_RESP_ERROR_WIRING = 4; /** I2C bus failed to communicate - Please check your wiring. **/ } /** * I2CDeviceResp represents the state of an I2C device/peripheral */ enum I2CDeviceResp { - I2C_DEVICE_RESPONSE_UNSPECIFIED = 0; /** Unspecified error occurred. **/ - I2C_DEVICE_RESPONSE_SUCCESS = 1; /** I2C device successfully initialized. **/ - I2C_DEVICE_RESPONSE_FAIL_INIT = 2; /** I2C device failed to initialize. **/ - I2C_DEVICE_RESPONSE_FAIL_DEINIT = 3; /** I2C device failed to deinitialize. **/ - I2C_DEVICE_RESPONSE_FAIL_UNSUPPORTED_SENSOR = 4; /** WipperSnapper version is outdated and does not include this device. **/ - I2C_DEVICE_NOT_FOUND = 5; /** I2C device not found on the bus. **/ + I2C_DEVICE_RESP_UNSPECIFIED = 0; /** Unspecified error occurred. **/ + I2C_DEVICE_RESP_SUCCESS = 1; /** I2C device successfully initialized. **/ + I2C_DEVICE_RESP_FAIL_INIT = 2; /** I2C device failed to initialize. **/ + I2C_DEVICE_RESP_FAIL_DEINIT = 3; /** I2C device failed to deinitialize. **/ + I2C_DEVICE_RESP_FAIL_UNSUPPORTED_SENSOR = 4; /** WipperSnapper version is outdated and does not include this device. **/ + I2C_DEVICE_RESP_NOT_FOUND = 5; /** I2C device not found on the bus. **/ } /** From 005ca9ed404c252bf5970021e3dd0a6f3b7c0e95 Mon Sep 17 00:00:00 2001 From: brentru Date: Thu, 11 Apr 2024 15:22:40 -0400 Subject: [PATCH 076/188] fix protolint --- proto/wippersnapper/i2c.proto | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/proto/wippersnapper/i2c.proto b/proto/wippersnapper/i2c.proto index b1e5b5dc..7a28f3bf 100644 --- a/proto/wippersnapper/i2c.proto +++ b/proto/wippersnapper/i2c.proto @@ -5,9 +5,9 @@ package wippersnapper.i2c; import "sensor.proto"; /** -* I2CBusResp represents the state of a board's I2C bus +* I2cBusResp represents the state of a board's I2C bus */ -enum I2CBusResp { +enum I2cBusResp { I2C_BUS_RESP_UNSPECIFIED = 0; /** Unspecified error occurred. **/ I2C_BUS_RESP_SUCCESS = 1; /** I2C bus successfully initialized. **/ I2C_BUS_RESP_ERROR_HANG = 2; /** I2C Bus hang, user should reset their board if this persists. **/ @@ -16,9 +16,9 @@ enum I2CBusResp { } /** -* I2CDeviceResp represents the state of an I2C device/peripheral +* I2cDeviceResp represents the state of an I2C device/peripheral */ -enum I2CDeviceResp { +enum I2cDeviceResp { I2C_DEVICE_RESP_UNSPECIFIED = 0; /** Unspecified error occurred. **/ I2C_DEVICE_RESP_SUCCESS = 1; /** I2C device successfully initialized. **/ I2C_DEVICE_RESP_FAIL_INIT = 2; /** I2C device failed to initialize. **/ @@ -39,7 +39,7 @@ message I2CBusScan { */ message I2CBusScanResponse { repeated uint32 found_addresses = 1 [packed=true]; /** The 7-bit addresses of the I2C devices found on the bus, empty if not found. */ - I2CBusResp bus_response = 2; /** The I2C bus' status. **/ + I2cBusResp bus_response = 2; /** The I2C bus' status. **/ } // DEVICE COMMANDS @@ -60,8 +60,8 @@ message I2CDeviceAddOrReplace { */ message I2CDeviceAddedOrReplaced { uint32 i2c_device_address = 1; /** The 7-bit I2C address of the device on the bus. */ - I2CBusResp bus_response = 2; /** The I2C bus' status. **/ - I2CDeviceResp device_response = 3; /** The I2C device's status. **/ + I2cBusResp bus_response = 2; /** The I2C bus' status. **/ + I2cDeviceResp device_response = 3; /** The I2C device's status. **/ } /** @@ -76,8 +76,8 @@ message I2CDeviceRemove { */ message I2CDeviceRemoved { uint32 i2c_device_address = 1; /** The 7-bit I2C address of the device which was initialized. */ - I2CBusResp bus_response = 2; /** The I2C bus' status. **/ - I2CDeviceResp device_response = 3; /** The I2C device's status. **/ + I2cBusResp bus_response = 2; /** The I2C bus' status. **/ + I2cDeviceResp device_response = 3; /** The I2C device's status. **/ } /** From 1f21e4539e48c98edafde128daad76141eed1d39 Mon Sep 17 00:00:00 2001 From: brentru Date: Thu, 11 Apr 2024 15:37:04 -0400 Subject: [PATCH 077/188] long response --- proto/wippersnapper/i2c.proto | 40 +++++++++++++++++------------------ 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/proto/wippersnapper/i2c.proto b/proto/wippersnapper/i2c.proto index 7a28f3bf..ed8127ff 100644 --- a/proto/wippersnapper/i2c.proto +++ b/proto/wippersnapper/i2c.proto @@ -5,26 +5,26 @@ package wippersnapper.i2c; import "sensor.proto"; /** -* I2cBusResp represents the state of a board's I2C bus +* I2cBusResponse represents the state of a board's I2C bus */ -enum I2cBusResp { - I2C_BUS_RESP_UNSPECIFIED = 0; /** Unspecified error occurred. **/ - I2C_BUS_RESP_SUCCESS = 1; /** I2C bus successfully initialized. **/ - I2C_BUS_RESP_ERROR_HANG = 2; /** I2C Bus hang, user should reset their board if this persists. **/ - I2C_BUS_RESP_ERROR_PULLUPS = 3; /** I2C bus failed to initialize - SDA or SCL needs a pull up. **/ - I2C_BUS_RESP_ERROR_WIRING = 4; /** I2C bus failed to communicate - Please check your wiring. **/ +enum I2cBusResponse { + I2C_BUS_RESPONSE_UNSPECIFIED = 0; /** Unspecified error occurred. **/ + I2C_BUS_RESPONSE_SUCCESS = 1; /** I2C bus successfully initialized. **/ + I2C_BUS_RESPONSE_ERROR_HANG = 2; /** I2C Bus hang, user should reset their board if this persists. **/ + I2C_BUS_RESPONSE_ERROR_PULLUPS = 3; /** I2C bus failed to initialize - SDA or SCL needs a pull up. **/ + I2C_BUS_RESPONSE_ERROR_WIRING = 4; /** I2C bus failed to communicate - Please check your wiring. **/ } /** -* I2cDeviceResp represents the state of an I2C device/peripheral +* I2cDeviceResponse represents the state of an I2C device/peripheral */ -enum I2cDeviceResp { - I2C_DEVICE_RESP_UNSPECIFIED = 0; /** Unspecified error occurred. **/ - I2C_DEVICE_RESP_SUCCESS = 1; /** I2C device successfully initialized. **/ - I2C_DEVICE_RESP_FAIL_INIT = 2; /** I2C device failed to initialize. **/ - I2C_DEVICE_RESP_FAIL_DEINIT = 3; /** I2C device failed to deinitialize. **/ - I2C_DEVICE_RESP_FAIL_UNSUPPORTED_SENSOR = 4; /** WipperSnapper version is outdated and does not include this device. **/ - I2C_DEVICE_RESP_NOT_FOUND = 5; /** I2C device not found on the bus. **/ +enum I2cDeviceResponse { + I2C_DEVICE_RESPONSE_UNSPECIFIED = 0; /** Unspecified error occurred. **/ + I2C_DEVICE_RESPONSE_SUCCESS = 1; /** I2C device successfully initialized. **/ + I2C_DEVICE_RESPONSE_FAIL_INIT = 2; /** I2C device failed to initialize. **/ + I2C_DEVICE_RESPONSE_FAIL_DEINIT = 3; /** I2C device failed to deinitialize. **/ + I2C_DEVICE_RESPONSE_FAIL_UNSUPPORTED_SENSOR = 4; /** WipperSnapper version is outdated and does not include this device. **/ + I2C_DEVICE_RESPONSE_NOT_FOUND = 5; /** I2C device not found on the bus. **/ } /** @@ -39,7 +39,7 @@ message I2CBusScan { */ message I2CBusScanResponse { repeated uint32 found_addresses = 1 [packed=true]; /** The 7-bit addresses of the I2C devices found on the bus, empty if not found. */ - I2cBusResp bus_response = 2; /** The I2C bus' status. **/ + I2cBusResponse bus_response = 2; /** The I2C bus' status. **/ } // DEVICE COMMANDS @@ -60,8 +60,8 @@ message I2CDeviceAddOrReplace { */ message I2CDeviceAddedOrReplaced { uint32 i2c_device_address = 1; /** The 7-bit I2C address of the device on the bus. */ - I2cBusResp bus_response = 2; /** The I2C bus' status. **/ - I2cDeviceResp device_response = 3; /** The I2C device's status. **/ + I2cBusResponse bus_response = 2; /** The I2C bus' status. **/ + I2cDeviceResponse device_response = 3; /** The I2C device's status. **/ } /** @@ -76,8 +76,8 @@ message I2CDeviceRemove { */ message I2CDeviceRemoved { uint32 i2c_device_address = 1; /** The 7-bit I2C address of the device which was initialized. */ - I2cBusResp bus_response = 2; /** The I2C bus' status. **/ - I2cDeviceResp device_response = 3; /** The I2C device's status. **/ + I2cBusResponse bus_response = 2; /** The I2C bus' status. **/ + I2cDeviceResponse device_response = 3; /** The I2C device's status. **/ } /** From cc68216852e78757eda9b436b2bafb2e5a10fe8d Mon Sep 17 00:00:00 2001 From: brentru Date: Thu, 11 Apr 2024 15:47:13 -0400 Subject: [PATCH 078/188] use i2c_device prefix when required --- proto/wippersnapper/i2c.proto | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/proto/wippersnapper/i2c.proto b/proto/wippersnapper/i2c.proto index ed8127ff..2e8cda48 100644 --- a/proto/wippersnapper/i2c.proto +++ b/proto/wippersnapper/i2c.proto @@ -48,20 +48,20 @@ message I2CBusScanResponse { * I2CDeviceAddOrReplace is a message for initializing (or replacing/updating) an i2c device. */ message I2CDeviceAddOrReplace { - uint32 address = 1; /** The 7-bit I2C address of the device on the bus. */ - string name = 2; /** The I2C device's name, MUST MATCH the name on the JSON definition file on + uint32 i2c_device_address = 1; /** The 7-bit I2C address of the device on the bus. */ + string i2c_device_name = 2; /** The I2C device's name, MUST MATCH the name on the JSON definition file on https://github.com/adafruit/Wippersnapper_Components. */ - float period = 3; /** The desired period to update the I2C device's sensor(s), in seconds. */ - repeated wippersnapper.sensor.SensorType sensor_types = 4; /** SI Types for each sensor on the I2C device. */ + float i2c_device_period = 3; /** The desired period to update the I2C device's sensor(s), in seconds. */ + repeated wippersnapper.sensor.SensorType i2c_device_sensor_types = 4; /** SI Types for each sensor on the I2C device. */ } /** * I2CDeviceAddedOrReplaced contains the response from a device after processing a I2CDeviceAddOrReplace message. */ message I2CDeviceAddedOrReplaced { - uint32 i2c_device_address = 1; /** The 7-bit I2C address of the device on the bus. */ - I2cBusResponse bus_response = 2; /** The I2C bus' status. **/ - I2cDeviceResponse device_response = 3; /** The I2C device's status. **/ + uint32 i2c_device_address = 1; /** The 7-bit I2C address of the device on the bus. */ + I2cBusResponse i2c_bus_response = 2; /** The I2C bus' status. **/ + I2cDeviceResponse i2c_device_response = 3; /** The I2C device's status. **/ } /** @@ -75,9 +75,9 @@ message I2CDeviceRemove { * I2CDeviceRemoved represents a response to a I2CDeviceRemove message. */ message I2CDeviceRemoved { - uint32 i2c_device_address = 1; /** The 7-bit I2C address of the device which was initialized. */ - I2cBusResponse bus_response = 2; /** The I2C bus' status. **/ - I2cDeviceResponse device_response = 3; /** The I2C device's status. **/ + uint32 i2c_device_address = 1; /** The 7-bit I2C address of the device which was initialized. */ + I2cBusResponse i2c_bus_response = 2; /** The I2C bus' status. **/ + I2cDeviceResponse i2c_device_response = 3; /** The I2C device's status. **/ } /** @@ -86,6 +86,6 @@ message I2CDeviceRemoved { * the I2C device contains > 1 sensor. */ message I2CDeviceEvent { - uint32 sensor_address = 1; /** The 7-bit I2C address of the I2C device. */ - repeated wippersnapper.sensor.SensorEvent sensor_events = 2; /** A, optionally repeated, SensorEvent from a sensor. */ + uint32 i2c_device_address = 1; /** The 7-bit I2C address of the I2C device. */ + repeated wippersnapper.sensor.SensorEvent i2c_device_events = 2; /** A, optionally repeated, SensorEvent from a sensor. */ } From 55bfedbcf95ed876ac2297858a4471d5fbfb944c Mon Sep 17 00:00:00 2001 From: brentru Date: Thu, 11 Apr 2024 15:47:59 -0400 Subject: [PATCH 079/188] add one more prefix --- proto/wippersnapper/i2c.proto | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/proto/wippersnapper/i2c.proto b/proto/wippersnapper/i2c.proto index 2e8cda48..24ff0306 100644 --- a/proto/wippersnapper/i2c.proto +++ b/proto/wippersnapper/i2c.proto @@ -38,8 +38,8 @@ message I2CBusScan { * found on the bus after I2CScan has executed. */ message I2CBusScanResponse { - repeated uint32 found_addresses = 1 [packed=true]; /** The 7-bit addresses of the I2C devices found on the bus, empty if not found. */ - I2cBusResponse bus_response = 2; /** The I2C bus' status. **/ + repeated uint32 i2c_bus_found_addresses = 1 [packed=true]; /** The 7-bit addresses of the I2C devices found on the bus, empty if not found. */ + I2cBusResponse i2c_bus_response = 2; /** The I2C bus' status. **/ } // DEVICE COMMANDS From de9a2ab405d1e3933dbc1758f08ebd3054df0f14 Mon Sep 17 00:00:00 2001 From: brentru Date: Thu, 11 Apr 2024 15:53:20 -0400 Subject: [PATCH 080/188] response-:>status --- proto/wippersnapper/i2c.proto | 44 +++++++++++++++++------------------ 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/proto/wippersnapper/i2c.proto b/proto/wippersnapper/i2c.proto index 24ff0306..c2bf3fc6 100644 --- a/proto/wippersnapper/i2c.proto +++ b/proto/wippersnapper/i2c.proto @@ -5,26 +5,26 @@ package wippersnapper.i2c; import "sensor.proto"; /** -* I2cBusResponse represents the state of a board's I2C bus +* I2cBusStatus represents the status of a board's I2C bus */ -enum I2cBusResponse { - I2C_BUS_RESPONSE_UNSPECIFIED = 0; /** Unspecified error occurred. **/ - I2C_BUS_RESPONSE_SUCCESS = 1; /** I2C bus successfully initialized. **/ - I2C_BUS_RESPONSE_ERROR_HANG = 2; /** I2C Bus hang, user should reset their board if this persists. **/ - I2C_BUS_RESPONSE_ERROR_PULLUPS = 3; /** I2C bus failed to initialize - SDA or SCL needs a pull up. **/ - I2C_BUS_RESPONSE_ERROR_WIRING = 4; /** I2C bus failed to communicate - Please check your wiring. **/ +enum I2cBusStatus { + I2C_BUS_STATUS_UNSPECIFIED = 0; /** Unspecified error occurred. **/ + I2C_BUS_STATUS_SUCCESS = 1; /** I2C bus successfully initialized. **/ + I2C_BUS_STATUS_ERROR_HANG = 2; /** I2C Bus hang, user should reset their board if this persists. **/ + I2C_BUS_STATUS_ERROR_PULLUPS = 3; /** I2C bus failed to initialize - SDA or SCL needs a pull up. **/ + I2C_BUS_STATUS_ERROR_WIRING = 4; /** I2C bus failed to communicate - Please check your wiring. **/ } /** -* I2cDeviceResponse represents the state of an I2C device/peripheral +* I2cDeviceStatus represents the state of an I2C device/peripheral */ -enum I2cDeviceResponse { - I2C_DEVICE_RESPONSE_UNSPECIFIED = 0; /** Unspecified error occurred. **/ - I2C_DEVICE_RESPONSE_SUCCESS = 1; /** I2C device successfully initialized. **/ - I2C_DEVICE_RESPONSE_FAIL_INIT = 2; /** I2C device failed to initialize. **/ - I2C_DEVICE_RESPONSE_FAIL_DEINIT = 3; /** I2C device failed to deinitialize. **/ - I2C_DEVICE_RESPONSE_FAIL_UNSUPPORTED_SENSOR = 4; /** WipperSnapper version is outdated and does not include this device. **/ - I2C_DEVICE_RESPONSE_NOT_FOUND = 5; /** I2C device not found on the bus. **/ +enum I2cDeviceStatus { + I2C_DEVICE_STATUS_UNSPECIFIED = 0; /** Unspecified error occurred. **/ + I2C_DEVICE_STATUS_SUCCESS = 1; /** I2C device successfully initialized. **/ + I2C_DEVICE_STATUS_FAIL_INIT = 2; /** I2C device failed to initialize. **/ + I2C_DEVICE_STATUS_FAIL_DEINIT = 3; /** I2C device failed to deinitialize. **/ + I2C_DEVICE_STATUS_FAIL_UNSUPPORTED_SENSOR = 4; /** WipperSnapper version is outdated and does not include this device. **/ + I2C_DEVICE_STATUS_NOT_FOUND = 5; /** I2C device not found on the bus. **/ } /** @@ -39,7 +39,7 @@ message I2CBusScan { */ message I2CBusScanResponse { repeated uint32 i2c_bus_found_addresses = 1 [packed=true]; /** The 7-bit addresses of the I2C devices found on the bus, empty if not found. */ - I2cBusResponse i2c_bus_response = 2; /** The I2C bus' status. **/ + I2cBusStatus i2c_bus_status = 2; /** The I2C bus' status. **/ } // DEVICE COMMANDS @@ -59,9 +59,9 @@ message I2CDeviceAddOrReplace { * I2CDeviceAddedOrReplaced contains the response from a device after processing a I2CDeviceAddOrReplace message. */ message I2CDeviceAddedOrReplaced { - uint32 i2c_device_address = 1; /** The 7-bit I2C address of the device on the bus. */ - I2cBusResponse i2c_bus_response = 2; /** The I2C bus' status. **/ - I2cDeviceResponse i2c_device_response = 3; /** The I2C device's status. **/ + uint32 i2c_device_address = 1; /** The 7-bit I2C address of the device on the bus. */ + I2cBusStatus i2c_bus_status = 2; /** The I2C bus' status. **/ + I2cDeviceStatus i2c_device_status = 3; /** The I2C device's status. **/ } /** @@ -75,9 +75,9 @@ message I2CDeviceRemove { * I2CDeviceRemoved represents a response to a I2CDeviceRemove message. */ message I2CDeviceRemoved { - uint32 i2c_device_address = 1; /** The 7-bit I2C address of the device which was initialized. */ - I2cBusResponse i2c_bus_response = 2; /** The I2C bus' status. **/ - I2cDeviceResponse i2c_device_response = 3; /** The I2C device's status. **/ + uint32 i2c_device_address = 1; /** The 7-bit I2C address of the device which was initialized. */ + I2cBusStatus i2c_bus_status = 2; /** The I2C bus' status. **/ + I2cDeviceStatus i2c_device_status = 3; /** The I2C device's status. **/ } /** From c8fb3ee82251a7e3e99d9c76dab113dc84c9e919 Mon Sep 17 00:00:00 2001 From: brentru Date: Thu, 11 Apr 2024 15:54:35 -0400 Subject: [PATCH 081/188] scan->scanned --- proto/wippersnapper/i2c.proto | 4 ++-- proto/wippersnapper/signal.proto | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/proto/wippersnapper/i2c.proto b/proto/wippersnapper/i2c.proto index c2bf3fc6..211fea4d 100644 --- a/proto/wippersnapper/i2c.proto +++ b/proto/wippersnapper/i2c.proto @@ -34,10 +34,10 @@ message I2CBusScan { } /** -* I2CBusScanResponse represents a list of I2C addresses +* I2CBusScanned represents a list of I2C addresses * found on the bus after I2CScan has executed. */ -message I2CBusScanResponse { +message I2CBusScanned { repeated uint32 i2c_bus_found_addresses = 1 [packed=true]; /** The 7-bit addresses of the I2C devices found on the bus, empty if not found. */ I2cBusStatus i2c_bus_status = 2; /** The I2C bus' status. **/ } diff --git a/proto/wippersnapper/signal.proto b/proto/wippersnapper/signal.proto index 672e9813..33bd3370 100644 --- a/proto/wippersnapper/signal.proto +++ b/proto/wippersnapper/signal.proto @@ -89,7 +89,7 @@ message DeviceToBroker { wippersnapper.uart.UARTAdded uart_added = 90; wippersnapper.uart.UARTEvent uart_event = 100; // i2c.proto - wippersnapper.i2c.I2CBusScanResponse i2c_bus_scan_resp = 110; + wippersnapper.i2c.I2CBusScanned i2c_bus_scanned = 110; wippersnapper.i2c.I2CDeviceAddedOrReplaced i2c_device_added_replaced = 111; wippersnapper.i2c.I2CDeviceRemoved i2c_device_removed = 112; wippersnapper.i2c.I2CDeviceEvent i2c_device_event = 113; From 780e0be92e7907c63d92c7c650397f4eb517b908 Mon Sep 17 00:00:00 2001 From: brentru Date: Thu, 11 Apr 2024 16:00:14 -0400 Subject: [PATCH 082/188] Correct to I2c --- proto/wippersnapper/i2c.proto | 62 ++++++++++++++++---------------- proto/wippersnapper/signal.proto | 14 ++++---- 2 files changed, 38 insertions(+), 38 deletions(-) diff --git a/proto/wippersnapper/i2c.proto b/proto/wippersnapper/i2c.proto index 211fea4d..7b820bae 100644 --- a/proto/wippersnapper/i2c.proto +++ b/proto/wippersnapper/i2c.proto @@ -28,64 +28,64 @@ enum I2cDeviceStatus { } /** -* I2CBusScan represents a command for a device to perform an i2c scan. It is an empty message. +* I2cBusScan represents a command for a device to perform an i2c scan. It is an empty message. */ -message I2CBusScan { +message I2cBusScan { } /** -* I2CBusScanned represents a list of I2C addresses -* found on the bus after I2CScan has executed. +* I2cBusScanned represents a list of I2c addresses +* found on the bus after I2cScan has executed. */ -message I2CBusScanned { - repeated uint32 i2c_bus_found_addresses = 1 [packed=true]; /** The 7-bit addresses of the I2C devices found on the bus, empty if not found. */ - I2cBusStatus i2c_bus_status = 2; /** The I2C bus' status. **/ +message I2cBusScanned { + repeated uint32 i2c_bus_found_addresses = 1 [packed=true]; /** The 7-bit addresses of the I2c devices found on the bus, empty if not found. */ + I2cBusStatus i2c_bus_status = 2; /** The I2c bus' status. **/ } // DEVICE COMMANDS /** -* I2CDeviceAddOrReplace is a message for initializing (or replacing/updating) an i2c device. +* I2cDeviceAddOrReplace is a message for initializing (or replacing/updating) an i2c device. */ -message I2CDeviceAddOrReplace { - uint32 i2c_device_address = 1; /** The 7-bit I2C address of the device on the bus. */ - string i2c_device_name = 2; /** The I2C device's name, MUST MATCH the name on the JSON definition file on +message I2cDeviceAddOrReplace { + uint32 i2c_device_address = 1; /** The 7-bit I2c address of the device on the bus. */ + string i2c_device_name = 2; /** The I2c device's name, MUST MATCH the name on the JSON definition file on https://github.com/adafruit/Wippersnapper_Components. */ - float i2c_device_period = 3; /** The desired period to update the I2C device's sensor(s), in seconds. */ - repeated wippersnapper.sensor.SensorType i2c_device_sensor_types = 4; /** SI Types for each sensor on the I2C device. */ + float i2c_device_period = 3; /** The desired period to update the I2c device's sensor(s), in seconds. */ + repeated wippersnapper.sensor.SensorType i2c_device_sensor_types = 4; /** SI Types for each sensor on the I2c device. */ } /** -* I2CDeviceAddedOrReplaced contains the response from a device after processing a I2CDeviceAddOrReplace message. +* I2cDeviceAddedOrReplaced contains the response from a device after processing a I2cDeviceAddOrReplace message. */ -message I2CDeviceAddedOrReplaced { - uint32 i2c_device_address = 1; /** The 7-bit I2C address of the device on the bus. */ - I2cBusStatus i2c_bus_status = 2; /** The I2C bus' status. **/ - I2cDeviceStatus i2c_device_status = 3; /** The I2C device's status. **/ +message I2cDeviceAddedOrReplaced { + uint32 i2c_device_address = 1; /** The 7-bit I2c address of the device on the bus. */ + I2cBusStatus i2c_bus_status = 2; /** The I2c bus' status. **/ + I2cDeviceStatus i2c_device_status = 3; /** The I2c device's status. **/ } /** -* I2CDeviceRemove represents a request to de-init an i2c device. +* I2cDeviceRemove represents a request to de-init an i2c device. */ -message I2CDeviceRemove { - uint32 i2c_device_address = 1; /** The 7-bit I2C address of the device on the bus. */ +message I2cDeviceRemove { + uint32 i2c_device_address = 1; /** The 7-bit I2c address of the device on the bus. */ } /** -* I2CDeviceRemoved represents a response to a I2CDeviceRemove message. +* I2cDeviceRemoved represents a response to a I2cDeviceRemove message. */ -message I2CDeviceRemoved { - uint32 i2c_device_address = 1; /** The 7-bit I2C address of the device which was initialized. */ - I2cBusStatus i2c_bus_status = 2; /** The I2C bus' status. **/ - I2cDeviceStatus i2c_device_status = 3; /** The I2C device's status. **/ +message I2cDeviceRemoved { + uint32 i2c_device_address = 1; /** The 7-bit I2c address of the device which was initialized. */ + I2cBusStatus i2c_bus_status = 2; /** The I2c bus' status. **/ + I2cDeviceStatus i2c_device_status = 3; /** The I2c device's status. **/ } /** -* Each I2CDeviceEvent represents data from **one** I2C sensor. -* NOTE: An I2CDeviceEvent can have multiple sensor events if -* the I2C device contains > 1 sensor. +* Each I2cDeviceEvent represents data from **one** I2c sensor. +* NOTE: An I2cDeviceEvent can have multiple sensor events if +* the I2c device contains > 1 sensor. */ -message I2CDeviceEvent { - uint32 i2c_device_address = 1; /** The 7-bit I2C address of the I2C device. */ +message I2cDeviceEvent { + uint32 i2c_device_address = 1; /** The 7-bit I2c address of the I2c device. */ repeated wippersnapper.sensor.SensorEvent i2c_device_events = 2; /** A, optionally repeated, SensorEvent from a sensor. */ } diff --git a/proto/wippersnapper/signal.proto b/proto/wippersnapper/signal.proto index 33bd3370..b4ba39f3 100644 --- a/proto/wippersnapper/signal.proto +++ b/proto/wippersnapper/signal.proto @@ -53,9 +53,9 @@ message BrokerToDevice { wippersnapper.uart.UARTAdd uart_add = 80; wippersnapper.uart.UARTRemove uart_remove = 81; // i2c.proto - wippersnapper.i2c.I2CBusScan i2c_bus_scan = 90; - wippersnapper.i2c.I2CDeviceAddOrReplace i2c_device_add_replace = 91; - wippersnapper.i2c.I2CDeviceRemove i2c_device_remove = 92; + wippersnapper.i2c.I2cBusScan i2c_bus_scan = 90; + wippersnapper.i2c.I2cDeviceAddOrReplace i2c_device_add_replace = 91; + wippersnapper.i2c.I2cDeviceRemove i2c_device_remove = 92; // error.proto wippersnapper.error.Error error = 100; } @@ -89,9 +89,9 @@ message DeviceToBroker { wippersnapper.uart.UARTAdded uart_added = 90; wippersnapper.uart.UARTEvent uart_event = 100; // i2c.proto - wippersnapper.i2c.I2CBusScanned i2c_bus_scanned = 110; - wippersnapper.i2c.I2CDeviceAddedOrReplaced i2c_device_added_replaced = 111; - wippersnapper.i2c.I2CDeviceRemoved i2c_device_removed = 112; - wippersnapper.i2c.I2CDeviceEvent i2c_device_event = 113; + wippersnapper.i2c.I2cBusScanned i2c_bus_scanned = 110; + wippersnapper.i2c.I2cDeviceAddedOrReplaced i2c_device_added_replaced = 111; + wippersnapper.i2c.I2cDeviceRemoved i2c_device_removed = 112; + wippersnapper.i2c.I2cDeviceEvent i2c_device_event = 113; } } From 88298aa64119b5ea88907902bd6dee5f3c12674a Mon Sep 17 00:00:00 2001 From: brentru Date: Thu, 11 Apr 2024 16:21:29 -0400 Subject: [PATCH 083/188] fix spacing --- proto/wippersnapper/i2c.proto | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/proto/wippersnapper/i2c.proto b/proto/wippersnapper/i2c.proto index 7b820bae..e7063f0d 100644 --- a/proto/wippersnapper/i2c.proto +++ b/proto/wippersnapper/i2c.proto @@ -19,12 +19,12 @@ enum I2cBusStatus { * I2cDeviceStatus represents the state of an I2C device/peripheral */ enum I2cDeviceStatus { - I2C_DEVICE_STATUS_UNSPECIFIED = 0; /** Unspecified error occurred. **/ - I2C_DEVICE_STATUS_SUCCESS = 1; /** I2C device successfully initialized. **/ - I2C_DEVICE_STATUS_FAIL_INIT = 2; /** I2C device failed to initialize. **/ - I2C_DEVICE_STATUS_FAIL_DEINIT = 3; /** I2C device failed to deinitialize. **/ + I2C_DEVICE_STATUS_UNSPECIFIED = 0; /** Unspecified error occurred. **/ + I2C_DEVICE_STATUS_SUCCESS = 1; /** I2C device successfully initialized. **/ + I2C_DEVICE_STATUS_FAIL_INIT = 2; /** I2C device failed to initialize. **/ + I2C_DEVICE_STATUS_FAIL_DEINIT = 3; /** I2C device failed to deinitialize. **/ I2C_DEVICE_STATUS_FAIL_UNSUPPORTED_SENSOR = 4; /** WipperSnapper version is outdated and does not include this device. **/ - I2C_DEVICE_STATUS_NOT_FOUND = 5; /** I2C device not found on the bus. **/ + I2C_DEVICE_STATUS_NOT_FOUND = 5; /** I2C device not found on the bus. **/ } /** @@ -75,8 +75,8 @@ message I2cDeviceRemove { * I2cDeviceRemoved represents a response to a I2cDeviceRemove message. */ message I2cDeviceRemoved { - uint32 i2c_device_address = 1; /** The 7-bit I2c address of the device which was initialized. */ - I2cBusStatus i2c_bus_status = 2; /** The I2c bus' status. **/ + uint32 i2c_device_address = 1; /** The 7-bit I2c address of the device which was initialized. */ + I2cBusStatus i2c_bus_status = 2; /** The I2c bus' status. **/ I2cDeviceStatus i2c_device_status = 3; /** The I2c device's status. **/ } @@ -86,6 +86,6 @@ message I2cDeviceRemoved { * the I2c device contains > 1 sensor. */ message I2cDeviceEvent { - uint32 i2c_device_address = 1; /** The 7-bit I2c address of the I2c device. */ + uint32 i2c_device_address = 1; /** The 7-bit I2c address of the I2c device. */ repeated wippersnapper.sensor.SensorEvent i2c_device_events = 2; /** A, optionally repeated, SensorEvent from a sensor. */ } From 5b872510c4f0988eaabc8ebd8df403acad3c8ac0 Mon Sep 17 00:00:00 2001 From: brentru Date: Thu, 11 Apr 2024 16:22:05 -0400 Subject: [PATCH 084/188] fix spacing again --- proto/wippersnapper/signal.proto | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/proto/wippersnapper/signal.proto b/proto/wippersnapper/signal.proto index b4ba39f3..3fd92fdc 100644 --- a/proto/wippersnapper/signal.proto +++ b/proto/wippersnapper/signal.proto @@ -53,9 +53,9 @@ message BrokerToDevice { wippersnapper.uart.UARTAdd uart_add = 80; wippersnapper.uart.UARTRemove uart_remove = 81; // i2c.proto - wippersnapper.i2c.I2cBusScan i2c_bus_scan = 90; + wippersnapper.i2c.I2cBusScan i2c_bus_scan = 90; wippersnapper.i2c.I2cDeviceAddOrReplace i2c_device_add_replace = 91; - wippersnapper.i2c.I2cDeviceRemove i2c_device_remove = 92; + wippersnapper.i2c.I2cDeviceRemove i2c_device_remove = 92; // error.proto wippersnapper.error.Error error = 100; } @@ -89,9 +89,9 @@ message DeviceToBroker { wippersnapper.uart.UARTAdded uart_added = 90; wippersnapper.uart.UARTEvent uart_event = 100; // i2c.proto - wippersnapper.i2c.I2cBusScanned i2c_bus_scanned = 110; + wippersnapper.i2c.I2cBusScanned i2c_bus_scanned = 110; wippersnapper.i2c.I2cDeviceAddedOrReplaced i2c_device_added_replaced = 111; - wippersnapper.i2c.I2cDeviceRemoved i2c_device_removed = 112; - wippersnapper.i2c.I2cDeviceEvent i2c_device_event = 113; + wippersnapper.i2c.I2cDeviceRemoved i2c_device_removed = 112; + wippersnapper.i2c.I2cDeviceEvent i2c_device_event = 113; } } From 61c374d1547af19b18817fb4f5db6921c5a3cf24 Mon Sep 17 00:00:00 2001 From: brentru Date: Mon, 13 May 2024 12:32:48 -0400 Subject: [PATCH 085/188] first draft of mux impl. --- proto/wippersnapper/i2c.proto | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/proto/wippersnapper/i2c.proto b/proto/wippersnapper/i2c.proto index e7063f0d..f3277313 100644 --- a/proto/wippersnapper/i2c.proto +++ b/proto/wippersnapper/i2c.proto @@ -13,6 +13,7 @@ enum I2cBusStatus { I2C_BUS_STATUS_ERROR_HANG = 2; /** I2C Bus hang, user should reset their board if this persists. **/ I2C_BUS_STATUS_ERROR_PULLUPS = 3; /** I2C bus failed to initialize - SDA or SCL needs a pull up. **/ I2C_BUS_STATUS_ERROR_WIRING = 4; /** I2C bus failed to communicate - Please check your wiring. **/ + I2C_MUX_STATUS_ERROR_INVALID_CHANNEL = 5; /** I2C MUX failed - Output channel must be within range 0-7. **/ } /** @@ -44,11 +45,21 @@ message I2cBusScanned { // DEVICE COMMANDS +/** +* I2cDeviceDescriptor represents the I2c device's address and related metadata. +*/ +message I2cDeviceDescriptor { + uint32 i2c_bus_number = 1; /** The hardware's I2C bus to address.**/ + uint32 i2c_mux_address = 2; /** (Optional) The address of the I2C mux, from 0x70-0x77.**/ + uint32 i2c_mux_channel = 3; /** (Optional) The I2C mux's output channel, from 0-7.**/ + uint32 i2c_device_address = 4; /** The 7-bit address of the i2c device. **/ +} + /** * I2cDeviceAddOrReplace is a message for initializing (or replacing/updating) an i2c device. */ message I2cDeviceAddOrReplace { - uint32 i2c_device_address = 1; /** The 7-bit I2c address of the device on the bus. */ + I2cDeviceDescriptor i2c_device_description = 1; /** The I2c device's address and metadata. */ string i2c_device_name = 2; /** The I2c device's name, MUST MATCH the name on the JSON definition file on https://github.com/adafruit/Wippersnapper_Components. */ float i2c_device_period = 3; /** The desired period to update the I2c device's sensor(s), in seconds. */ @@ -59,25 +70,25 @@ message I2cDeviceAddOrReplace { * I2cDeviceAddedOrReplaced contains the response from a device after processing a I2cDeviceAddOrReplace message. */ message I2cDeviceAddedOrReplaced { - uint32 i2c_device_address = 1; /** The 7-bit I2c address of the device on the bus. */ - I2cBusStatus i2c_bus_status = 2; /** The I2c bus' status. **/ - I2cDeviceStatus i2c_device_status = 3; /** The I2c device's status. **/ + I2cDeviceDescriptor i2c_device_description = 1; /** The I2c device's address and metadata. */ + I2cBusStatus i2c_bus_status = 2; /** The I2c bus' status. **/ + I2cDeviceStatus i2c_device_status = 3; /** The I2c device's status. **/ } /** * I2cDeviceRemove represents a request to de-init an i2c device. */ message I2cDeviceRemove { - uint32 i2c_device_address = 1; /** The 7-bit I2c address of the device on the bus. */ + I2cDeviceDescriptor i2c_device_description = 1; /** The I2c device's address and metadata. */ } /** * I2cDeviceRemoved represents a response to a I2cDeviceRemove message. */ message I2cDeviceRemoved { - uint32 i2c_device_address = 1; /** The 7-bit I2c address of the device which was initialized. */ - I2cBusStatus i2c_bus_status = 2; /** The I2c bus' status. **/ - I2cDeviceStatus i2c_device_status = 3; /** The I2c device's status. **/ + I2cDeviceDescriptor i2c_device_description = 1; /** The I2c device's address and metadata. */ + I2cBusStatus i2c_bus_status = 2; /** The I2c bus' status. **/ + I2cDeviceStatus i2c_device_status = 3; /** The I2c device's status. **/ } /** @@ -86,6 +97,6 @@ message I2cDeviceRemoved { * the I2c device contains > 1 sensor. */ message I2cDeviceEvent { - uint32 i2c_device_address = 1; /** The 7-bit I2c address of the I2c device. */ + I2cDeviceDescriptor i2c_device_description = 1; /** The I2c device's address and metadata. */ repeated wippersnapper.sensor.SensorEvent i2c_device_events = 2; /** A, optionally repeated, SensorEvent from a sensor. */ } From b3e7a065d98544ffd45edc4523a14e4741ae38fb Mon Sep 17 00:00:00 2001 From: brentru Date: Tue, 14 May 2024 11:38:30 -0400 Subject: [PATCH 086/188] rev2 for i2c muxing --- proto/wippersnapper/i2c.options | 10 +++++----- proto/wippersnapper/i2c.proto | 11 +++++------ 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/proto/wippersnapper/i2c.options b/proto/wippersnapper/i2c.options index 6f6d33a7..94031902 100644 --- a/proto/wippersnapper/i2c.options +++ b/proto/wippersnapper/i2c.options @@ -1,6 +1,6 @@ # i2c.options -*.I2CInit.i2c_device_name max_size:15 -*.I2CScanResponse.found_addresses max_count:120 -*.I2CInit.i2c_device_name max_size:15 -*.I2CInit.sensor_properties max_count:15 -*.I2CEvent.sensor_events max_count:15 +*.I2CInit.i2c_device_name max_size:15 +*.I2CScanResponse.i2c_bus_found_devices max_count:120 +*.I2CInit.i2c_device_name max_size:15 +*.I2CInit.sensor_properties max_count:15 +*.I2CEvent.sensor_events max_count:15 diff --git a/proto/wippersnapper/i2c.proto b/proto/wippersnapper/i2c.proto index f3277313..ff6f99b3 100644 --- a/proto/wippersnapper/i2c.proto +++ b/proto/wippersnapper/i2c.proto @@ -39,8 +39,8 @@ message I2cBusScan { * found on the bus after I2cScan has executed. */ message I2cBusScanned { - repeated uint32 i2c_bus_found_addresses = 1 [packed=true]; /** The 7-bit addresses of the I2c devices found on the bus, empty if not found. */ - I2cBusStatus i2c_bus_status = 2; /** The I2c bus' status. **/ + repeated I2cDeviceDescriptor i2c_bus_found_devices = 1 [packed=true]; /** The 7-bit addresses of the I2c devices found on the bus, empty if not found. */ + I2cBusStatus i2c_bus_status = 2; /** The I2c bus' status. **/ } // DEVICE COMMANDS @@ -49,10 +49,9 @@ message I2cBusScanned { * I2cDeviceDescriptor represents the I2c device's address and related metadata. */ message I2cDeviceDescriptor { - uint32 i2c_bus_number = 1; /** The hardware's I2C bus to address.**/ - uint32 i2c_mux_address = 2; /** (Optional) The address of the I2C mux, from 0x70-0x77.**/ - uint32 i2c_mux_channel = 3; /** (Optional) The I2C mux's output channel, from 0-7.**/ - uint32 i2c_device_address = 4; /** The 7-bit address of the i2c device. **/ + uint32 i2c_bus = 1; /** The desired i2c bus to address.**/ + uint32 i2c_device_mux_address = 2; /** The desired address of the I2C device or (optionally) the I2C MUX address.**/ + uint32 i2c_mux_channel = 3; /** (Optional) The desired I2C mux's output channel, from 0-7.**/ } /** From f7dc28f7f4e476f614dd59bf86bb76ba559196a9 Mon Sep 17 00:00:00 2001 From: brentru Date: Tue, 14 May 2024 11:41:06 -0400 Subject: [PATCH 087/188] packed true dir --- proto/wippersnapper/i2c.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proto/wippersnapper/i2c.proto b/proto/wippersnapper/i2c.proto index ff6f99b3..ea85854b 100644 --- a/proto/wippersnapper/i2c.proto +++ b/proto/wippersnapper/i2c.proto @@ -39,7 +39,7 @@ message I2cBusScan { * found on the bus after I2cScan has executed. */ message I2cBusScanned { - repeated I2cDeviceDescriptor i2c_bus_found_devices = 1 [packed=true]; /** The 7-bit addresses of the I2c devices found on the bus, empty if not found. */ + repeated I2cDeviceDescriptor i2c_bus_found_devices = 1; /** The 7-bit addresses of the I2c devices found on the bus, empty if not found. */ I2cBusStatus i2c_bus_status = 2; /** The I2c bus' status. **/ } From 92a4ec0976169638cb5637648190cd9360265946 Mon Sep 17 00:00:00 2001 From: brentru Date: Tue, 14 May 2024 11:42:25 -0400 Subject: [PATCH 088/188] lint --- proto/wippersnapper/i2c.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proto/wippersnapper/i2c.proto b/proto/wippersnapper/i2c.proto index ea85854b..4f3a64f7 100644 --- a/proto/wippersnapper/i2c.proto +++ b/proto/wippersnapper/i2c.proto @@ -13,7 +13,7 @@ enum I2cBusStatus { I2C_BUS_STATUS_ERROR_HANG = 2; /** I2C Bus hang, user should reset their board if this persists. **/ I2C_BUS_STATUS_ERROR_PULLUPS = 3; /** I2C bus failed to initialize - SDA or SCL needs a pull up. **/ I2C_BUS_STATUS_ERROR_WIRING = 4; /** I2C bus failed to communicate - Please check your wiring. **/ - I2C_MUX_STATUS_ERROR_INVALID_CHANNEL = 5; /** I2C MUX failed - Output channel must be within range 0-7. **/ + I2C_BUS_STATUS_ERROR_INVALID_CHANNEL = 5; /** I2C MUX failed - Output channel must be within range 0-7. **/ } /** From f25d0b308e9d0ff1f933b300b33ae5dd7a428cb2 Mon Sep 17 00:00:00 2001 From: brentru Date: Wed, 22 May 2024 12:22:04 -0400 Subject: [PATCH 089/188] make neopixel data pin explicitly defined --- proto/wippersnapper/pixels.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proto/wippersnapper/pixels.proto b/proto/wippersnapper/pixels.proto index f993f28b..5f663fcc 100644 --- a/proto/wippersnapper/pixels.proto +++ b/proto/wippersnapper/pixels.proto @@ -38,7 +38,7 @@ message PixelsAdd { uint32 pixels_num = 2; /** Number of pixels attached to strand. */ PixelsOrder pixels_ordering = 3; /** Defines the pixel strand's color ordering. */ uint32 pixels_brightness = 4; /** Strand brightness, 0 to 255 */ - string pixels_pin_neopixel = 5; /** Generic pin a NeoPixel strand is connected to. */ + string pixels_pin_neopixel_data = 5; /** Data pin a NeoPixel strand is connected to. */ string pixels_pin_dotstar_data = 6; /** Data pin a DotStar strand is connected to. */ string pixels_pin_dotstar_clock = 7; /** Clock pin a DotStar strand is connected to. */ } From b3e7376c99b75e8882de6be5efb644165a8627e3 Mon Sep 17 00:00:00 2001 From: brentru Date: Wed, 22 May 2024 12:22:54 -0400 Subject: [PATCH 090/188] use one data pin in pixelsAdd --- proto/wippersnapper/pixels.proto | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/proto/wippersnapper/pixels.proto b/proto/wippersnapper/pixels.proto index 5f663fcc..2d96db39 100644 --- a/proto/wippersnapper/pixels.proto +++ b/proto/wippersnapper/pixels.proto @@ -38,9 +38,8 @@ message PixelsAdd { uint32 pixels_num = 2; /** Number of pixels attached to strand. */ PixelsOrder pixels_ordering = 3; /** Defines the pixel strand's color ordering. */ uint32 pixels_brightness = 4; /** Strand brightness, 0 to 255 */ - string pixels_pin_neopixel_data = 5; /** Data pin a NeoPixel strand is connected to. */ - string pixels_pin_dotstar_data = 6; /** Data pin a DotStar strand is connected to. */ - string pixels_pin_dotstar_clock = 7; /** Clock pin a DotStar strand is connected to. */ + string pixels_pin_data = 5; /** Data pin a NeoPixel or DotStar strand is connected to. */ + string pixels_pin_dotstar_clock = 6; /** Clock pin a DotStar strand is connected to. */ } /** From c2a03c39b766198ebebcb84d5c0cf3c686836055 Mon Sep 17 00:00:00 2001 From: brentru Date: Wed, 22 May 2024 15:08:41 -0400 Subject: [PATCH 091/188] we dont need to know the pixel's type every write --- proto/wippersnapper/pixels.proto | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/proto/wippersnapper/pixels.proto b/proto/wippersnapper/pixels.proto index 2d96db39..e673e114 100644 --- a/proto/wippersnapper/pixels.proto +++ b/proto/wippersnapper/pixels.proto @@ -56,8 +56,7 @@ message PixelsAdded { * Removes a strand of addressable pixels and release the resources and pin. */ message PixelsRemove { - PixelsType pixels_type = 1; /** Defines the model/type of pixel strand */ - string pixels_pin_data = 2; /** Data pin a strand is connected to. */ + string pixels_pin_data = 1; /** Data pin the pixel strand is connected to. */ } /** @@ -65,8 +64,7 @@ message PixelsRemove { * Writes to a strand of pixels. */ message PixelsWrite { - PixelsType pixels_type = 1; /** Defines the model/type of pixel strand */ - string pixels_pin_data = 2; /** Data pin a strand is connected to. */ - uint32 pixels_color = 3; /* 32-bit color value. Most significant byte is white (for RGBW pixels) or ignored (for RGB pixels), + string pixels_pin_data = 1; /** Data pin a strand is connected to. */ + uint32 pixels_color = 2; /* 32-bit color value. Most significant byte is white (for RGBW pixels) or ignored (for RGB pixels), next is red, then green, and least significant byte is blue. */ } From 2161c986bc04e1ceea9f9a2aa9a92b5d9400f4c2 Mon Sep 17 00:00:00 2001 From: Brent Rubell Date: Fri, 26 Jul 2024 12:01:41 -0400 Subject: [PATCH 092/188] Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index aed9575c..e82dfd4b 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,8 @@ If you would like to request a component or feature to be added into WipperSnapp This repository includes an automated script for generating the required protocol buffer wrapper messages. -Nanopb header files for Arduino may also be generated by installing `protoc`, cloning this repository, and invoking: +Nanopb header files for Arduino may also be generated by installing `protoc`, cloning this repository, and invoking + ``` git submodule init git submodule update From 1a9a526fdfaaf90179bcb5e01938d19155dd6280 Mon Sep 17 00:00:00 2001 From: Brent Rubell Date: Fri, 26 Jul 2024 12:03:29 -0400 Subject: [PATCH 093/188] Update protoc-wrapper-generation.yml --- .github/workflows/protoc-wrapper-generation.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/protoc-wrapper-generation.yml b/.github/workflows/protoc-wrapper-generation.yml index 9d99feea..51085347 100644 --- a/.github/workflows/protoc-wrapper-generation.yml +++ b/.github/workflows/protoc-wrapper-generation.yml @@ -1,7 +1,5 @@ name: Generate .proto Wrapper Files -on: - push: - branches: master +on: [ pull_request ] # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages permissions: From 6cfd5683c83741d34ca496c6c8909a83bae0460e Mon Sep 17 00:00:00 2001 From: Brent Rubell Date: Fri, 26 Jul 2024 12:03:41 -0400 Subject: [PATCH 094/188] Update test-wrapper-arduino.yml --- .github/workflows/test-wrapper-arduino.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/test-wrapper-arduino.yml b/.github/workflows/test-wrapper-arduino.yml index 9d99feea..51085347 100644 --- a/.github/workflows/test-wrapper-arduino.yml +++ b/.github/workflows/test-wrapper-arduino.yml @@ -1,7 +1,5 @@ name: Generate .proto Wrapper Files -on: - push: - branches: master +on: [ pull_request ] # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages permissions: From 6f48b50fd84158979bcb8f736b9da0c1d185215c Mon Sep 17 00:00:00 2001 From: Brent Rubell Date: Fri, 26 Jul 2024 12:12:22 -0400 Subject: [PATCH 095/188] Create generate-local-arduino-artifacts.yml --- .../generate-local-arduino-artifacts.yml | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .github/workflows/generate-local-arduino-artifacts.yml diff --git a/.github/workflows/generate-local-arduino-artifacts.yml b/.github/workflows/generate-local-arduino-artifacts.yml new file mode 100644 index 00000000..77cbfff5 --- /dev/null +++ b/.github/workflows/generate-local-arduino-artifacts.yml @@ -0,0 +1,44 @@ +name: Generate new Arduino Protocol Buffer wrapper files and upload them as artifacts +on: [ pull_request ] +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/setup-python@v4 + with: + python-version: '3.x' + - name: Install Protoc + uses: arduino/setup-protoc@v1 + with: + version: '3.13.0' + repo-token: ${{ secrets.GITHUB_TOKEN }} + - name: Install Python dependencies + run : | + python -m pip install --upgrade pip + pip3 install scons protobuf grpcio-tools + - name: Self Checkout + uses: actions/checkout@v3 + with: + path: protobuf-checkout + submodules: true + - name: Configure Git + run: | + git config --global user.name adafruitio + git config --global user.email adafruitio@adafruit.com + - name: Generate Arduino files from .proto Files + env: + PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION: python + run: | + mkdir ./arduino_out + protoc --plugin=protobuf-checkout/nanopb/generator/protoc-gen-nanopb -Iprotobuf-checkout/nanopb/generator/proto --proto_path=./protobuf-checkout/proto/wippersnapper ./protobuf-checkout/proto/wippersnapper/*.proto --nanopb_out=./arduino_out --nanopb_opt=-I./protobuf-checkout/proto --nanopb_opt=-t + # Local (non-CI) build command is commented out below: + # protoc --plugin=nanopb/generator/protoc-gen-nanopb -Inanopb/generator/proto --proto_path=./proto ./proto/wippersnapper/*.proto --nanopb_out=./arduino_out --nanopb_opt=-I./proto --nanopb_opt=-t + - name: Checkout Arduino Repo + - uses: actions/upload-artifact@v3 + with: + name: build-arduino-wrappers + path: ./arduino_out + - uses: actions/upload-artifact@v3 + with: + name: build-arduino-nanopb-out + path: ./arduino_out From 91827068a91a2ee1461a21293976b812826ea1c7 Mon Sep 17 00:00:00 2001 From: Brent Rubell Date: Fri, 26 Jul 2024 12:13:23 -0400 Subject: [PATCH 096/188] Update test-wrapper-arduino.yml --- .github/workflows/test-wrapper-arduino.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-wrapper-arduino.yml b/.github/workflows/test-wrapper-arduino.yml index 51085347..9d99feea 100644 --- a/.github/workflows/test-wrapper-arduino.yml +++ b/.github/workflows/test-wrapper-arduino.yml @@ -1,5 +1,7 @@ name: Generate .proto Wrapper Files -on: [ pull_request ] +on: + push: + branches: master # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages permissions: From 1740a0b14eefd82afbe491db74694b283df8e51e Mon Sep 17 00:00:00 2001 From: Brent Rubell Date: Fri, 26 Jul 2024 12:13:49 -0400 Subject: [PATCH 097/188] Update protoc-wrapper-generation.yml --- .github/workflows/protoc-wrapper-generation.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/protoc-wrapper-generation.yml b/.github/workflows/protoc-wrapper-generation.yml index 51085347..9d99feea 100644 --- a/.github/workflows/protoc-wrapper-generation.yml +++ b/.github/workflows/protoc-wrapper-generation.yml @@ -1,5 +1,7 @@ name: Generate .proto Wrapper Files -on: [ pull_request ] +on: + push: + branches: master # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages permissions: From 9502b6411fedb079dd5e9a5f675a305e5908825c Mon Sep 17 00:00:00 2001 From: Brent Rubell Date: Fri, 26 Jul 2024 12:17:54 -0400 Subject: [PATCH 098/188] Update generate-local-arduino-artifacts.yml --- .github/workflows/generate-local-arduino-artifacts.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/generate-local-arduino-artifacts.yml b/.github/workflows/generate-local-arduino-artifacts.yml index 77cbfff5..27961af5 100644 --- a/.github/workflows/generate-local-arduino-artifacts.yml +++ b/.github/workflows/generate-local-arduino-artifacts.yml @@ -1,5 +1,5 @@ name: Generate new Arduino Protocol Buffer wrapper files and upload them as artifacts -on: [ pull_request ] +on: [pull_request] jobs: build: runs-on: ubuntu-latest From 4f73190f0fe8d97e05cd61800b8eb0d715fa05e9 Mon Sep 17 00:00:00 2001 From: Brent Rubell Date: Fri, 26 Jul 2024 12:19:24 -0400 Subject: [PATCH 099/188] Update generate-local-arduino-artifacts.yml --- .../generate-local-arduino-artifacts.yml | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/.github/workflows/generate-local-arduino-artifacts.yml b/.github/workflows/generate-local-arduino-artifacts.yml index 27961af5..bb46d2e8 100644 --- a/.github/workflows/generate-local-arduino-artifacts.yml +++ b/.github/workflows/generate-local-arduino-artifacts.yml @@ -1,5 +1,7 @@ name: Generate new Arduino Protocol Buffer wrapper files and upload them as artifacts + on: [pull_request] + jobs: build: runs-on: ubuntu-latest @@ -13,7 +15,7 @@ jobs: version: '3.13.0' repo-token: ${{ secrets.GITHUB_TOKEN }} - name: Install Python dependencies - run : | + run: | python -m pip install --upgrade pip pip3 install scons protobuf grpcio-tools - name: Self Checkout @@ -34,11 +36,16 @@ jobs: # Local (non-CI) build command is commented out below: # protoc --plugin=nanopb/generator/protoc-gen-nanopb -Inanopb/generator/proto --proto_path=./proto ./proto/wippersnapper/*.proto --nanopb_out=./arduino_out --nanopb_opt=-I./proto --nanopb_opt=-t - name: Checkout Arduino Repo - - uses: actions/upload-artifact@v3 + uses: actions/checkout@v3 + with: + path: arduino-repo + - name: Upload Arduino Wrappers Artifact + uses: actions/upload-artifact@v3 with: - name: build-arduino-wrappers - path: ./arduino_out - - uses: actions/upload-artifact@v3 + name: build-arduino-wrappers + path: ./arduino_out + - name: Upload Arduino Nanopb Out Artifact + uses: actions/upload-artifact@v3 with: - name: build-arduino-nanopb-out - path: ./arduino_out + name: build-arduino-nanopb-out + path: ./arduino_out From c3419f23c707d9fe9d9c1d825c721dfcc1c57720 Mon Sep 17 00:00:00 2001 From: Brent Rubell Date: Fri, 26 Jul 2024 12:22:13 -0400 Subject: [PATCH 100/188] Update generate-local-arduino-artifacts.yml --- .github/workflows/generate-local-arduino-artifacts.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/generate-local-arduino-artifacts.yml b/.github/workflows/generate-local-arduino-artifacts.yml index bb46d2e8..05a30b55 100644 --- a/.github/workflows/generate-local-arduino-artifacts.yml +++ b/.github/workflows/generate-local-arduino-artifacts.yml @@ -32,9 +32,10 @@ jobs: PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION: python run: | mkdir ./arduino_out - protoc --plugin=protobuf-checkout/nanopb/generator/protoc-gen-nanopb -Iprotobuf-checkout/nanopb/generator/proto --proto_path=./protobuf-checkout/proto/wippersnapper ./protobuf-checkout/proto/wippersnapper/*.proto --nanopb_out=./arduino_out --nanopb_opt=-I./protobuf-checkout/proto --nanopb_opt=-t + #protoc --plugin=protobuf-checkout/nanopb/generator/protoc-gen-nanopb -Iprotobuf-checkout/nanopb/generator/proto --proto_path=./protobuf-checkout/proto/wippersnapper ./protobuf-checkout/proto/wippersnapper/*.proto --nanopb_out=./arduino_out --nanopb_opt=-I./protobuf-checkout/proto --nanopb_opt=-t + protoc --proto_path=./protobuf-checkout/nanopb/generator/proto --proto_path=./protobuf-checkout --python_out=./output ./protobuf-checkout/proto/wippersnapper/nanopb.proto # Local (non-CI) build command is commented out below: - # protoc --plugin=nanopb/generator/protoc-gen-nanopb -Inanopb/generator/proto --proto_path=./proto ./proto/wippersnapper/*.proto --nanopb_out=./arduino_out --nanopb_opt=-I./proto --nanopb_opt=-t + # protoc --plugin=nanopb/generator/protoc-gen-nanopb -Inanopb/generator/proto --proto_path=./proto ./proto/*.proto --nanopb_out=./arduino_out --nanopb_opt=-I./proto --nanopb_opt=-t - name: Checkout Arduino Repo uses: actions/checkout@v3 with: From 1039c9a41c9f0a697efe868f82cb90b51180febd Mon Sep 17 00:00:00 2001 From: Brent Rubell Date: Fri, 26 Jul 2024 12:23:46 -0400 Subject: [PATCH 101/188] Update generate-local-arduino-artifacts.yml --- .github/workflows/generate-local-arduino-artifacts.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/generate-local-arduino-artifacts.yml b/.github/workflows/generate-local-arduino-artifacts.yml index 05a30b55..809a9eca 100644 --- a/.github/workflows/generate-local-arduino-artifacts.yml +++ b/.github/workflows/generate-local-arduino-artifacts.yml @@ -32,6 +32,7 @@ jobs: PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION: python run: | mkdir ./arduino_out + mkdir ./output #protoc --plugin=protobuf-checkout/nanopb/generator/protoc-gen-nanopb -Iprotobuf-checkout/nanopb/generator/proto --proto_path=./protobuf-checkout/proto/wippersnapper ./protobuf-checkout/proto/wippersnapper/*.proto --nanopb_out=./arduino_out --nanopb_opt=-I./protobuf-checkout/proto --nanopb_opt=-t protoc --proto_path=./protobuf-checkout/nanopb/generator/proto --proto_path=./protobuf-checkout --python_out=./output ./protobuf-checkout/proto/wippersnapper/nanopb.proto # Local (non-CI) build command is commented out below: From be8529dd48c5220c53fd9776130a81f59a663bab Mon Sep 17 00:00:00 2001 From: brentru Date: Fri, 26 Jul 2024 14:32:04 -0400 Subject: [PATCH 102/188] update commands in yml --- .../generate-local-arduino-artifacts.yml | 83 +++++++++---------- .gitignore | 2 + 2 files changed, 40 insertions(+), 45 deletions(-) diff --git a/.github/workflows/generate-local-arduino-artifacts.yml b/.github/workflows/generate-local-arduino-artifacts.yml index 809a9eca..84d6adaa 100644 --- a/.github/workflows/generate-local-arduino-artifacts.yml +++ b/.github/workflows/generate-local-arduino-artifacts.yml @@ -6,48 +6,41 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/setup-python@v4 - with: - python-version: '3.x' - - name: Install Protoc - uses: arduino/setup-protoc@v1 - with: - version: '3.13.0' - repo-token: ${{ secrets.GITHUB_TOKEN }} - - name: Install Python dependencies - run: | - python -m pip install --upgrade pip - pip3 install scons protobuf grpcio-tools - - name: Self Checkout - uses: actions/checkout@v3 - with: - path: protobuf-checkout - submodules: true - - name: Configure Git - run: | - git config --global user.name adafruitio - git config --global user.email adafruitio@adafruit.com - - name: Generate Arduino files from .proto Files - env: - PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION: python - run: | - mkdir ./arduino_out - mkdir ./output - #protoc --plugin=protobuf-checkout/nanopb/generator/protoc-gen-nanopb -Iprotobuf-checkout/nanopb/generator/proto --proto_path=./protobuf-checkout/proto/wippersnapper ./protobuf-checkout/proto/wippersnapper/*.proto --nanopb_out=./arduino_out --nanopb_opt=-I./protobuf-checkout/proto --nanopb_opt=-t - protoc --proto_path=./protobuf-checkout/nanopb/generator/proto --proto_path=./protobuf-checkout --python_out=./output ./protobuf-checkout/proto/wippersnapper/nanopb.proto - # Local (non-CI) build command is commented out below: - # protoc --plugin=nanopb/generator/protoc-gen-nanopb -Inanopb/generator/proto --proto_path=./proto ./proto/*.proto --nanopb_out=./arduino_out --nanopb_opt=-I./proto --nanopb_opt=-t - - name: Checkout Arduino Repo - uses: actions/checkout@v3 - with: - path: arduino-repo - - name: Upload Arduino Wrappers Artifact - uses: actions/upload-artifact@v3 - with: - name: build-arduino-wrappers - path: ./arduino_out - - name: Upload Arduino Nanopb Out Artifact - uses: actions/upload-artifact@v3 - with: - name: build-arduino-nanopb-out - path: ./arduino_out + - uses: actions/setup-python@v4 + with: + python-version: "3.x" + - name: Install Protoc + uses: arduino/setup-protoc@v1 + with: + version: "3.13.0" + repo-token: ${{ secrets.GITHUB_TOKEN }} + - name: Install Python dependencies + run: | + python -m pip install --upgrade pip + pip3 install scons protobuf grpcio-tools + - name: Self Checkout + uses: actions/checkout@v3 + with: + path: protobuf-checkout + submodules: true + - name: Configure Git + run: | + git config --global user.name adafruitio + git config --global user.email adafruitio@adafruit.com + - name: Generate Arduino files from .proto Files + env: + PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION: python + run: | + mkdir ./arduino_out + protoc --plugin=protobuf-checkout/nanopb/generator/protoc-gen-nanopb --proto_path=./protobuf-checkout/proto/wippersnapper --proto_path=nanopb/generator/proto ./protobuf-checkout/proto/wippersnapper/*.proto --nanopb_out=./arduino_out --nanopb_opt=-I./proto --nanopb_opt=-t + # Local (non-CI) build command is commented out below, use this to compile on your machine: + # protoc --plugin=nanopb/generator/protoc-gen-nanopb --proto_path=./proto/wippersnapper --proto_path=nanopb/generator/proto ./proto/wippersnapper/*.proto --nanopb_out=./arduino_out --nanopb_opt=-I./proto --nanopb_opt=-t + - name: Checkout Arduino Repo + uses: actions/checkout@v3 + with: + path: arduino-repo + - name: Upload Arduino Wrappers Artifact + uses: actions/upload-artifact@v3 + with: + name: build-arduino-wrappers + path: ./arduino_out diff --git a/.gitignore b/.gitignore index 05d52a65..06c99313 100644 --- a/.gitignore +++ b/.gitignore @@ -141,3 +141,5 @@ dmypy.json cython_debug/ arduino_out/ + +nanopb/ From 606da6879114c4533dc607fe2dc1cddb8b962f6e Mon Sep 17 00:00:00 2001 From: brentru Date: Fri, 26 Jul 2024 14:35:15 -0400 Subject: [PATCH 103/188] update deprecated action vers, bump --- .github/workflows/generate-local-arduino-artifacts.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/generate-local-arduino-artifacts.yml b/.github/workflows/generate-local-arduino-artifacts.yml index 84d6adaa..4d9eaf0c 100644 --- a/.github/workflows/generate-local-arduino-artifacts.yml +++ b/.github/workflows/generate-local-arduino-artifacts.yml @@ -6,7 +6,7 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 with: python-version: "3.x" - name: Install Protoc @@ -19,7 +19,7 @@ jobs: python -m pip install --upgrade pip pip3 install scons protobuf grpcio-tools - name: Self Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: path: protobuf-checkout submodules: true @@ -36,11 +36,11 @@ jobs: # Local (non-CI) build command is commented out below, use this to compile on your machine: # protoc --plugin=nanopb/generator/protoc-gen-nanopb --proto_path=./proto/wippersnapper --proto_path=nanopb/generator/proto ./proto/wippersnapper/*.proto --nanopb_out=./arduino_out --nanopb_opt=-I./proto --nanopb_opt=-t - name: Checkout Arduino Repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: path: arduino-repo - name: Upload Arduino Wrappers Artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: build-arduino-wrappers path: ./arduino_out From 20de6848f9135a3e9a7e664739a2115148ee1f54 Mon Sep 17 00:00:00 2001 From: brentru Date: Fri, 26 Jul 2024 14:46:10 -0400 Subject: [PATCH 104/188] bump setup-protoc semver --- .github/workflows/generate-local-arduino-artifacts.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/generate-local-arduino-artifacts.yml b/.github/workflows/generate-local-arduino-artifacts.yml index 4d9eaf0c..87f3d72b 100644 --- a/.github/workflows/generate-local-arduino-artifacts.yml +++ b/.github/workflows/generate-local-arduino-artifacts.yml @@ -10,7 +10,7 @@ jobs: with: python-version: "3.x" - name: Install Protoc - uses: arduino/setup-protoc@v1 + uses: arduino/setup-protoc@v3 with: version: "3.13.0" repo-token: ${{ secrets.GITHUB_TOKEN }} From 735ee97eaf928be54a8a89cbba9f5c9dfa209b06 Mon Sep 17 00:00:00 2001 From: brentru Date: Fri, 26 Jul 2024 14:47:59 -0400 Subject: [PATCH 105/188] drop ver down? --- .github/workflows/generate-local-arduino-artifacts.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/generate-local-arduino-artifacts.yml b/.github/workflows/generate-local-arduino-artifacts.yml index 87f3d72b..4d9eaf0c 100644 --- a/.github/workflows/generate-local-arduino-artifacts.yml +++ b/.github/workflows/generate-local-arduino-artifacts.yml @@ -10,7 +10,7 @@ jobs: with: python-version: "3.x" - name: Install Protoc - uses: arduino/setup-protoc@v3 + uses: arduino/setup-protoc@v1 with: version: "3.13.0" repo-token: ${{ secrets.GITHUB_TOKEN }} From 4b755bb84e0072bf6d010e8f5dbbb39ef86b5eeb Mon Sep 17 00:00:00 2001 From: brentru Date: Fri, 26 Jul 2024 15:45:04 -0400 Subject: [PATCH 106/188] bring the two other workflows in-line with how we're generating arduino for v2 --- .../workflows/protoc-wrapper-generation.yml | 281 +++++++++--------- .github/workflows/test-wrapper-arduino.yml | 281 +++++++++--------- 2 files changed, 280 insertions(+), 282 deletions(-) diff --git a/.github/workflows/protoc-wrapper-generation.yml b/.github/workflows/protoc-wrapper-generation.yml index 9d99feea..697a18cc 100644 --- a/.github/workflows/protoc-wrapper-generation.yml +++ b/.github/workflows/protoc-wrapper-generation.yml @@ -13,148 +13,147 @@ jobs: build: runs-on: ubuntu-latest steps: + # Setup + - uses: actions/setup-python@v5 + with: + python-version: "3.x" + - name: Install Protoc + uses: arduino/setup-protoc@v1 + with: + version: "3.13.0" + repo-token: ${{ secrets.GITHUB_TOKEN }} + - name: Install Python dependencies + run: | + python -m pip install --upgrade pip + pip install protobuf setuptools + - name: Self Checkout + uses: actions/checkout@v4 + with: + path: protobuf-checkout + submodules: true + - name: Configure Git + run: | + git config --global user.name adafruitio + git config --global user.email adafruitio@adafruit.com - # Setup - - uses: actions/setup-python@v2 - with: - python-version: '3.x' - - name: Install Protoc - uses: arduino/setup-protoc@v1 - with: - version: '3.13.0' - repo-token: ${{ secrets.GITHUB_TOKEN }} - - name: Install Python dependencies - run : | - python -m pip install --upgrade pip - pip install protobuf setuptools - - name: Self Checkout - uses: actions/checkout@v2 - with: - path: protobuf-checkout - submodules: true - - name: Configure Git - run: | - git config --global user.name adafruitio - git config --global user.email adafruitio@adafruit.com + # Python Wrappers + - name: Generate Python and JS Wrapper Files from .proto Files + run: | + mkdir ./python_out + mkdir ./python_nanopb_out + mkdir ./js_out + protoc --proto_path=./protobuf-checkout/proto/wippersnapper ./protobuf-checkout/proto/wippersnapper/*.proto --js_out=import_style=commonjs,binary:js_out --python_out=./python_out + protoc ./protobuf-checkout/nanopb/generator/proto/nanopb.proto --js_out=import_style=commonjs,binary:js_out --python_out=./python_nanopb_out + - name: Checkout Python Repo + uses: actions/checkout@v4 + with: + repository: adafruit/Adafruit_Wippersnapper_Python + token: ${{ secrets.IO_BOT_PAT }} + path: python-checkout + - name: Copy Python Files + run: | + rm -rf ./python-checkout/src/Adafruit_Wippersnapper_Python/proto + cp -r ./python_out/ ./python-checkout/src/Adafruit_Wippersnapper_Python/proto/ + mv ./python_nanopb_out/protobuf_checkout/nanopb/generator/proto/nanopb_pb2.py ./python-checkout/src/Adafruit_Wippersnapper_Python/proto/nanopb_pb2.py + - name: Open Python Pull Request + env: + GITHUB_USER: adafruitio + GITHUB_TOKEN: ${{ secrets.IO_BOT_PAT }} + PROTOBUF_BRANCH_NAME: protobuf-update + run: | + cd python-checkout + git checkout -b $PROTOBUF_BRANCH_NAME-$GITHUB_SHA + git add adafruit_wippersnapper + git commit -m "Updating protobuf wrappers" || exit 0 # quit cleanly if nothing to commit + hub push origin $PROTOBUF_BRANCH_NAME-$GITHUB_SHA + hub pull-request --message ".proto file wrappers updated" --message "Auto-generated by [GitHub Actions on Protobuf Repo][1]" --message "[1]: https://github.com/adafruit/Wippersnapper_Protobuf/blob/master/.github/workflows/protoc-wrapper-generation.yml" - # Python Wrappers - - name: Generate Python and JS Wrapper Files from .proto Files - run: | - mkdir ./python_out - mkdir ./python_nanopb_out - mkdir ./js_out - protoc --proto_path=./protobuf-checkout/proto/wippersnapper ./protobuf-checkout/proto/wippersnapper/*.proto --js_out=import_style=commonjs,binary:js_out --python_out=./python_out - protoc ./protobuf-checkout/nanopb/generator/proto/nanopb.proto --js_out=import_style=commonjs,binary:js_out --python_out=./python_nanopb_out - - name: Checkout Python Repo - uses: actions/checkout@v2 - with: - repository: adafruit/Adafruit_Wippersnapper_Python - token: ${{ secrets.IO_BOT_PAT }} - path: python-checkout - - name: Copy Python Files - run: | - rm -rf ./python-checkout/src/Adafruit_Wippersnapper_Python/proto - cp -r ./python_out/ ./python-checkout/src/Adafruit_Wippersnapper_Python/proto/ - mv ./python_nanopb_out/protobuf_checkout/nanopb/generator/proto/nanopb_pb2.py ./python-checkout/src/Adafruit_Wippersnapper_Python/proto/nanopb_pb2.py - - name: Open Python Pull Request - env: - GITHUB_USER: adafruitio - GITHUB_TOKEN: ${{ secrets.IO_BOT_PAT }} - PROTOBUF_BRANCH_NAME: protobuf-update - run: | - cd python-checkout - git checkout -b $PROTOBUF_BRANCH_NAME-$GITHUB_SHA - git add adafruit_wippersnapper - git commit -m "Updating protobuf wrappers" || exit 0 # quit cleanly if nothing to commit - hub push origin $PROTOBUF_BRANCH_NAME-$GITHUB_SHA - hub pull-request --message ".proto file wrappers updated" --message "Auto-generated by [GitHub Actions on Protobuf Repo][1]" --message "[1]: https://github.com/adafruit/Wippersnapper_Protobuf/blob/master/.github/workflows/protoc-wrapper-generation.yml" + # Arduino Wrappers + - name: Generate Arduino files from .proto Files + env: + PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION: python + run: | + mkdir ./arduino_out + protoc --plugin=protobuf-checkout/nanopb/generator/protoc-gen-nanopb --proto_path=./protobuf-checkout/proto/wippersnapper --proto_path=nanopb/generator/proto ./protobuf-checkout/proto/wippersnapper/*.proto --nanopb_out=./arduino_out --nanopb_opt=-I./proto --nanopb_opt=-t + # Local (non-CI) build command is commented out below, use this to compile on your machine: + # protoc --plugin=nanopb/generator/protoc-gen-nanopb --proto_path=./proto/wippersnapper --proto_path=nanopb/generator/proto ./proto/wippersnapper/*.proto --nanopb_out=./arduino_out --nanopb_opt=-I./proto --nanopb_opt=-t + - name: Checkout Arduino Repo + uses: actions/checkout@v4 + with: + repository: adafruit/Adafruit_Wippersnapper_Arduino + token: ${{ secrets.IO_BOT_PAT }} + path: arduino-checkout + - name: Copy Generated Arduino Files to Arduino Repo + run: | + rm -rf ./arduino-checkout/src/wippersnapper/ + mkdir ./arduino-checkout/src/wippersnapper/ + cp -a ./arduino_out/. ./arduino-checkout/src/ + - name: Open Arduino Pull Request + env: + GITHUB_USER: adafruitio + GITHUB_TOKEN: ${{ secrets.IO_BOT_PAT }} + PROTOBUF_BRANCH_NAME: protobuf-update + run: | + cd arduino-checkout + git checkout -b $PROTOBUF_BRANCH_NAME-$GITHUB_SHA + git status + git add src + git commit -m "Updating protobuf wrappers" || exit 0 # quit cleanly if nothing to commit + hub push origin $PROTOBUF_BRANCH_NAME-$GITHUB_SHA + hub pull-request --base main --message ".proto file wrappers updated" --message "Auto-generated by [GitHub Actions on Protobuf Repo][1]" --message "[1]: https://github.com/adafruit/Wippersnapper_Protobuf/blob/master/.github/workflows/protoc-wrapper-generation.yml" - # Arduino Wrappers - - name: Generate Arduino files from .proto Files - env: - PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION: python - run: | - mkdir ./arduino_out - protoc --plugin=protobuf-checkout/nanopb/generator/protoc-gen-nanopb -Iprotobuf-checkout/nanopb/generator/proto --proto_path=./protobuf-checkout/proto/wippersnapper ./protobuf-checkout/proto/wippersnapper/*.proto --nanopb_out=./arduino_out --nanopb_opt=-I./protobuf-checkout/proto --nanopb_opt=-t - # Local (non-CI) build command is commented out below: - # protoc --plugin=nanopb/generator/protoc-gen-nanopb -Inanopb/generator/proto --proto_path=./proto ./proto/wippersnapper/*.proto --nanopb_out=./arduino_out --nanopb_opt=-I./proto --nanopb_opt=-t - - name: Checkout Arduino Repo - uses: actions/checkout@v2 - with: - repository: adafruit/Adafruit_Wippersnapper_Arduino - token: ${{ secrets.IO_BOT_PAT }} - path: arduino-checkout - - name: Copy Generated Arduino Files to Arduino Repo - run: | - rm -rf ./arduino-checkout/src/wippersnapper/ - mkdir ./arduino-checkout/src/wippersnapper/ - cp -a ./arduino_out/. ./arduino-checkout/src/ - - name: Open Arduino Pull Request - env: - GITHUB_USER: adafruitio - GITHUB_TOKEN: ${{ secrets.IO_BOT_PAT }} - PROTOBUF_BRANCH_NAME: protobuf-update - run: | - cd arduino-checkout - git checkout -b $PROTOBUF_BRANCH_NAME-$GITHUB_SHA - git status - git add src - git commit -m "Updating protobuf wrappers" || exit 0 # quit cleanly if nothing to commit - hub push origin $PROTOBUF_BRANCH_NAME-$GITHUB_SHA - hub pull-request --base main --message ".proto file wrappers updated" --message "Auto-generated by [GitHub Actions on Protobuf Repo][1]" --message "[1]: https://github.com/adafruit/Wippersnapper_Protobuf/blob/master/.github/workflows/protoc-wrapper-generation.yml" + # NodeJS wrappers for the mqtt broker + - name: Generate JS Wrapper Files from .proto Files + run: | + mkdir ./js_out + protoc --proto_path=./protobuf-checkout/proto ./protobuf-checkout/proto/wippersnapper/*/*/*.proto --js_out=import_style=commonjs,binary:js_out + protoc ./protobuf-checkout/nanopb/generator/proto/nanopb.proto --js_out=import_style=commonjs,binary:js_out + - name: Checkout io-node Repo + uses: actions/checkout@v4 + with: + repository: AdafruitInternalDev/io-node + token: ${{ secrets.IO_BOT_PAT }} + path: js-checkout + ref: main + - name: Copy JS Files + run: | + rm -rf ./js-checkout/lib/wprsnpr/protobufs/wippersnapper/ + cp -r ./js_out/wippersnapper/ ./js-checkout/lib/wprsnpr/protobufs/wippersnapper/ + rm -rf ./js-checkout/lib/wprsnpr/protobufs/nanopb/ + mkdir ./js-checkout/lib/wprsnpr/protobufs/nanopb/ + mv ./js_out/protobuf-checkout/nanopb/generator/proto/nanopb_pb.js ./js-checkout/lib/wprsnpr/protobufs/nanopb/nanopb_pb.js + - name: Open Node Pull Request + env: + GITHUB_USER: adafruitio + GITHUB_TOKEN: ${{ secrets.IO_BOT_PAT }} + PROTOBUF_BRANCH_NAME: protobuf-update + run: | + cd js-checkout + git checkout -b $PROTOBUF_BRANCH_NAME-$GITHUB_SHA + git add lib/wprsnpr/protobufs/ + git commit -m "Updating protobuf wrappers" || exit 0 # quit cleanly if nothing to commit + hub push origin $PROTOBUF_BRANCH_NAME-$GITHUB_SHA + hub pull-request --base main --message ".proto file wrappers updated" --message "Auto-generated by [GitHub Actions on Protobuf Repo][1]" --message "[1]: https://github.com/adafruit/Wippersnapper_Protobuf/blob/master/.github/workflows/protoc-wrapper-generation.yml" - # NodeJS wrappers for the mqtt broker - - name: Generate JS Wrapper Files from .proto Files - run: | - mkdir ./js_out - protoc --proto_path=./protobuf-checkout/proto ./protobuf-checkout/proto/wippersnapper/*/*/*.proto --js_out=import_style=commonjs,binary:js_out - protoc ./protobuf-checkout/nanopb/generator/proto/nanopb.proto --js_out=import_style=commonjs,binary:js_out - - name: Checkout io-node Repo - uses: actions/checkout@v2 - with: - repository: AdafruitInternalDev/io-node - token: ${{ secrets.IO_BOT_PAT }} - path: js-checkout - ref: main - - name: Copy JS Files - run: | - rm -rf ./js-checkout/lib/wprsnpr/protobufs/wippersnapper/ - cp -r ./js_out/wippersnapper/ ./js-checkout/lib/wprsnpr/protobufs/wippersnapper/ - rm -rf ./js-checkout/lib/wprsnpr/protobufs/nanopb/ - mkdir ./js-checkout/lib/wprsnpr/protobufs/nanopb/ - mv ./js_out/protobuf-checkout/nanopb/generator/proto/nanopb_pb.js ./js-checkout/lib/wprsnpr/protobufs/nanopb/nanopb_pb.js - - name: Open Node Pull Request - env: - GITHUB_USER: adafruitio - GITHUB_TOKEN: ${{ secrets.IO_BOT_PAT }} - PROTOBUF_BRANCH_NAME: protobuf-update - run: | - cd js-checkout - git checkout -b $PROTOBUF_BRANCH_NAME-$GITHUB_SHA - git add lib/wprsnpr/protobufs/ - git commit -m "Updating protobuf wrappers" || exit 0 # quit cleanly if nothing to commit - hub push origin $PROTOBUF_BRANCH_NAME-$GITHUB_SHA - hub pull-request --base main --message ".proto file wrappers updated" --message "Auto-generated by [GitHub Actions on Protobuf Repo][1]" --message "[1]: https://github.com/adafruit/Wippersnapper_Protobuf/blob/master/.github/workflows/protoc-wrapper-generation.yml" - - # Docs - - name: Checkout doc branch - uses: actions/checkout@v2 - with: - ref: gh-pages - path: protobuf-docs-checkout - - name: Commit and push generated HTML Docs file - run: | - cd protobuf-docs-checkout - cp -r ../doc ./doc - git add doc/ - git commit -m "Add generated HTML documentation for $GITHUB_SHA" || exit 0 # quit cleanly if nothing to commit - git push - - name: Setup Pages - uses: actions/configure-pages@v3 - - name: Upload artifact - uses: actions/upload-pages-artifact@v2 - with: - path: 'protobuf-docs-checkout/doc' - - name: Deploy to GitHub Pages - id: deployment - uses: actions/deploy-pages@v2 + # Docs + - name: Checkout doc branch + uses: actions/checkout@v4 + with: + ref: gh-pages + path: protobuf-docs-checkout + - name: Commit and push generated HTML Docs file + run: | + cd protobuf-docs-checkout + cp -r ../doc ./doc + git add doc/ + git commit -m "Add generated HTML documentation for $GITHUB_SHA" || exit 0 # quit cleanly if nothing to commit + git push + - name: Setup Pages + uses: actions/configure-pages@v3 + - name: Upload artifact + uses: actions/upload-pages-artifact@v2 + with: + path: "protobuf-docs-checkout/doc" + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v2 diff --git a/.github/workflows/test-wrapper-arduino.yml b/.github/workflows/test-wrapper-arduino.yml index 9d99feea..87b13b2b 100644 --- a/.github/workflows/test-wrapper-arduino.yml +++ b/.github/workflows/test-wrapper-arduino.yml @@ -13,148 +13,147 @@ jobs: build: runs-on: ubuntu-latest steps: + # Setup + - uses: actions/setup-python@v3 + with: + python-version: "3.x" + - name: Install Protoc + uses: arduino/setup-protoc@v1 + with: + version: "3.13.0" + repo-token: ${{ secrets.GITHUB_TOKEN }} + - name: Install Python dependencies + run: | + python -m pip install --upgrade pip + pip install protobuf setuptools + - name: Self Checkout + uses: actions/checkout@v4 + with: + path: protobuf-checkout + submodules: true + - name: Configure Git + run: | + git config --global user.name adafruitio + git config --global user.email adafruitio@adafruit.com - # Setup - - uses: actions/setup-python@v2 - with: - python-version: '3.x' - - name: Install Protoc - uses: arduino/setup-protoc@v1 - with: - version: '3.13.0' - repo-token: ${{ secrets.GITHUB_TOKEN }} - - name: Install Python dependencies - run : | - python -m pip install --upgrade pip - pip install protobuf setuptools - - name: Self Checkout - uses: actions/checkout@v2 - with: - path: protobuf-checkout - submodules: true - - name: Configure Git - run: | - git config --global user.name adafruitio - git config --global user.email adafruitio@adafruit.com + # Python Wrappers + - name: Generate Python and JS Wrapper Files from .proto Files + run: | + mkdir ./python_out + mkdir ./python_nanopb_out + mkdir ./js_out + protoc --proto_path=./protobuf-checkout/proto/wippersnapper ./protobuf-checkout/proto/wippersnapper/*.proto --js_out=import_style=commonjs,binary:js_out --python_out=./python_out + protoc ./protobuf-checkout/nanopb/generator/proto/nanopb.proto --js_out=import_style=commonjs,binary:js_out --python_out=./python_nanopb_out + - name: Checkout Python Repo + uses: actions/checkout@v4 + with: + repository: adafruit/Adafruit_Wippersnapper_Python + token: ${{ secrets.IO_BOT_PAT }} + path: python-checkout + - name: Copy Python Files + run: | + rm -rf ./python-checkout/src/Adafruit_Wippersnapper_Python/proto + cp -r ./python_out/ ./python-checkout/src/Adafruit_Wippersnapper_Python/proto/ + mv ./python_nanopb_out/protobuf_checkout/nanopb/generator/proto/nanopb_pb2.py ./python-checkout/src/Adafruit_Wippersnapper_Python/proto/nanopb_pb2.py + - name: Open Python Pull Request + env: + GITHUB_USER: adafruitio + GITHUB_TOKEN: ${{ secrets.IO_BOT_PAT }} + PROTOBUF_BRANCH_NAME: protobuf-update + run: | + cd python-checkout + git checkout -b $PROTOBUF_BRANCH_NAME-$GITHUB_SHA + git add adafruit_wippersnapper + git commit -m "Updating protobuf wrappers" || exit 0 # quit cleanly if nothing to commit + hub push origin $PROTOBUF_BRANCH_NAME-$GITHUB_SHA + hub pull-request --message ".proto file wrappers updated" --message "Auto-generated by [GitHub Actions on Protobuf Repo][1]" --message "[1]: https://github.com/adafruit/Wippersnapper_Protobuf/blob/master/.github/workflows/protoc-wrapper-generation.yml" - # Python Wrappers - - name: Generate Python and JS Wrapper Files from .proto Files - run: | - mkdir ./python_out - mkdir ./python_nanopb_out - mkdir ./js_out - protoc --proto_path=./protobuf-checkout/proto/wippersnapper ./protobuf-checkout/proto/wippersnapper/*.proto --js_out=import_style=commonjs,binary:js_out --python_out=./python_out - protoc ./protobuf-checkout/nanopb/generator/proto/nanopb.proto --js_out=import_style=commonjs,binary:js_out --python_out=./python_nanopb_out - - name: Checkout Python Repo - uses: actions/checkout@v2 - with: - repository: adafruit/Adafruit_Wippersnapper_Python - token: ${{ secrets.IO_BOT_PAT }} - path: python-checkout - - name: Copy Python Files - run: | - rm -rf ./python-checkout/src/Adafruit_Wippersnapper_Python/proto - cp -r ./python_out/ ./python-checkout/src/Adafruit_Wippersnapper_Python/proto/ - mv ./python_nanopb_out/protobuf_checkout/nanopb/generator/proto/nanopb_pb2.py ./python-checkout/src/Adafruit_Wippersnapper_Python/proto/nanopb_pb2.py - - name: Open Python Pull Request - env: - GITHUB_USER: adafruitio - GITHUB_TOKEN: ${{ secrets.IO_BOT_PAT }} - PROTOBUF_BRANCH_NAME: protobuf-update - run: | - cd python-checkout - git checkout -b $PROTOBUF_BRANCH_NAME-$GITHUB_SHA - git add adafruit_wippersnapper - git commit -m "Updating protobuf wrappers" || exit 0 # quit cleanly if nothing to commit - hub push origin $PROTOBUF_BRANCH_NAME-$GITHUB_SHA - hub pull-request --message ".proto file wrappers updated" --message "Auto-generated by [GitHub Actions on Protobuf Repo][1]" --message "[1]: https://github.com/adafruit/Wippersnapper_Protobuf/blob/master/.github/workflows/protoc-wrapper-generation.yml" + # Arduino Wrappers + - name: Generate Arduino files from .proto Files + env: + PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION: python + run: | + mkdir ./arduino_out + protoc --plugin=protobuf-checkout/nanopb/generator/protoc-gen-nanopb --proto_path=./protobuf-checkout/proto/wippersnapper --proto_path=nanopb/generator/proto ./protobuf-checkout/proto/wippersnapper/*.proto --nanopb_out=./arduino_out --nanopb_opt=-I./proto --nanopb_opt=-t + # Local (non-CI) build command is commented out below, use this to compile on your machine: + # protoc --plugin=nanopb/generator/protoc-gen-nanopb --proto_path=./proto/wippersnapper --proto_path=nanopb/generator/proto ./proto/wippersnapper/*.proto --nanopb_out=./arduino_out --nanopb_opt=-I./proto --nanopb_opt=-t + - name: Checkout Arduino Repo + uses: actions/checkout@v4 + with: + repository: adafruit/Adafruit_Wippersnapper_Arduino + token: ${{ secrets.IO_BOT_PAT }} + path: arduino-checkout + - name: Copy Generated Arduino Files to Arduino Repo + run: | + rm -rf ./arduino-checkout/src/wippersnapper/ + mkdir ./arduino-checkout/src/wippersnapper/ + cp -a ./arduino_out/. ./arduino-checkout/src/ + - name: Open Arduino Pull Request + env: + GITHUB_USER: adafruitio + GITHUB_TOKEN: ${{ secrets.IO_BOT_PAT }} + PROTOBUF_BRANCH_NAME: protobuf-update + run: | + cd arduino-checkout + git checkout -b $PROTOBUF_BRANCH_NAME-$GITHUB_SHA + git status + git add src + git commit -m "Updating protobuf wrappers" || exit 0 # quit cleanly if nothing to commit + hub push origin $PROTOBUF_BRANCH_NAME-$GITHUB_SHA + hub pull-request --base main --message ".proto file wrappers updated" --message "Auto-generated by [GitHub Actions on Protobuf Repo][1]" --message "[1]: https://github.com/adafruit/Wippersnapper_Protobuf/blob/master/.github/workflows/protoc-wrapper-generation.yml" - # Arduino Wrappers - - name: Generate Arduino files from .proto Files - env: - PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION: python - run: | - mkdir ./arduino_out - protoc --plugin=protobuf-checkout/nanopb/generator/protoc-gen-nanopb -Iprotobuf-checkout/nanopb/generator/proto --proto_path=./protobuf-checkout/proto/wippersnapper ./protobuf-checkout/proto/wippersnapper/*.proto --nanopb_out=./arduino_out --nanopb_opt=-I./protobuf-checkout/proto --nanopb_opt=-t - # Local (non-CI) build command is commented out below: - # protoc --plugin=nanopb/generator/protoc-gen-nanopb -Inanopb/generator/proto --proto_path=./proto ./proto/wippersnapper/*.proto --nanopb_out=./arduino_out --nanopb_opt=-I./proto --nanopb_opt=-t - - name: Checkout Arduino Repo - uses: actions/checkout@v2 - with: - repository: adafruit/Adafruit_Wippersnapper_Arduino - token: ${{ secrets.IO_BOT_PAT }} - path: arduino-checkout - - name: Copy Generated Arduino Files to Arduino Repo - run: | - rm -rf ./arduino-checkout/src/wippersnapper/ - mkdir ./arduino-checkout/src/wippersnapper/ - cp -a ./arduino_out/. ./arduino-checkout/src/ - - name: Open Arduino Pull Request - env: - GITHUB_USER: adafruitio - GITHUB_TOKEN: ${{ secrets.IO_BOT_PAT }} - PROTOBUF_BRANCH_NAME: protobuf-update - run: | - cd arduino-checkout - git checkout -b $PROTOBUF_BRANCH_NAME-$GITHUB_SHA - git status - git add src - git commit -m "Updating protobuf wrappers" || exit 0 # quit cleanly if nothing to commit - hub push origin $PROTOBUF_BRANCH_NAME-$GITHUB_SHA - hub pull-request --base main --message ".proto file wrappers updated" --message "Auto-generated by [GitHub Actions on Protobuf Repo][1]" --message "[1]: https://github.com/adafruit/Wippersnapper_Protobuf/blob/master/.github/workflows/protoc-wrapper-generation.yml" + # NodeJS wrappers for the mqtt broker + - name: Generate JS Wrapper Files from .proto Files + run: | + mkdir ./js_out + protoc --proto_path=./protobuf-checkout/proto ./protobuf-checkout/proto/wippersnapper/*/*/*.proto --js_out=import_style=commonjs,binary:js_out + protoc ./protobuf-checkout/nanopb/generator/proto/nanopb.proto --js_out=import_style=commonjs,binary:js_out + - name: Checkout io-node Repo + uses: actions/checkout@v4 + with: + repository: AdafruitInternalDev/io-node + token: ${{ secrets.IO_BOT_PAT }} + path: js-checkout + ref: main + - name: Copy JS Files + run: | + rm -rf ./js-checkout/lib/wprsnpr/protobufs/wippersnapper/ + cp -r ./js_out/wippersnapper/ ./js-checkout/lib/wprsnpr/protobufs/wippersnapper/ + rm -rf ./js-checkout/lib/wprsnpr/protobufs/nanopb/ + mkdir ./js-checkout/lib/wprsnpr/protobufs/nanopb/ + mv ./js_out/protobuf-checkout/nanopb/generator/proto/nanopb_pb.js ./js-checkout/lib/wprsnpr/protobufs/nanopb/nanopb_pb.js + - name: Open Node Pull Request + env: + GITHUB_USER: adafruitio + GITHUB_TOKEN: ${{ secrets.IO_BOT_PAT }} + PROTOBUF_BRANCH_NAME: protobuf-update + run: | + cd js-checkout + git checkout -b $PROTOBUF_BRANCH_NAME-$GITHUB_SHA + git add lib/wprsnpr/protobufs/ + git commit -m "Updating protobuf wrappers" || exit 0 # quit cleanly if nothing to commit + hub push origin $PROTOBUF_BRANCH_NAME-$GITHUB_SHA + hub pull-request --base main --message ".proto file wrappers updated" --message "Auto-generated by [GitHub Actions on Protobuf Repo][1]" --message "[1]: https://github.com/adafruit/Wippersnapper_Protobuf/blob/master/.github/workflows/protoc-wrapper-generation.yml" - # NodeJS wrappers for the mqtt broker - - name: Generate JS Wrapper Files from .proto Files - run: | - mkdir ./js_out - protoc --proto_path=./protobuf-checkout/proto ./protobuf-checkout/proto/wippersnapper/*/*/*.proto --js_out=import_style=commonjs,binary:js_out - protoc ./protobuf-checkout/nanopb/generator/proto/nanopb.proto --js_out=import_style=commonjs,binary:js_out - - name: Checkout io-node Repo - uses: actions/checkout@v2 - with: - repository: AdafruitInternalDev/io-node - token: ${{ secrets.IO_BOT_PAT }} - path: js-checkout - ref: main - - name: Copy JS Files - run: | - rm -rf ./js-checkout/lib/wprsnpr/protobufs/wippersnapper/ - cp -r ./js_out/wippersnapper/ ./js-checkout/lib/wprsnpr/protobufs/wippersnapper/ - rm -rf ./js-checkout/lib/wprsnpr/protobufs/nanopb/ - mkdir ./js-checkout/lib/wprsnpr/protobufs/nanopb/ - mv ./js_out/protobuf-checkout/nanopb/generator/proto/nanopb_pb.js ./js-checkout/lib/wprsnpr/protobufs/nanopb/nanopb_pb.js - - name: Open Node Pull Request - env: - GITHUB_USER: adafruitio - GITHUB_TOKEN: ${{ secrets.IO_BOT_PAT }} - PROTOBUF_BRANCH_NAME: protobuf-update - run: | - cd js-checkout - git checkout -b $PROTOBUF_BRANCH_NAME-$GITHUB_SHA - git add lib/wprsnpr/protobufs/ - git commit -m "Updating protobuf wrappers" || exit 0 # quit cleanly if nothing to commit - hub push origin $PROTOBUF_BRANCH_NAME-$GITHUB_SHA - hub pull-request --base main --message ".proto file wrappers updated" --message "Auto-generated by [GitHub Actions on Protobuf Repo][1]" --message "[1]: https://github.com/adafruit/Wippersnapper_Protobuf/blob/master/.github/workflows/protoc-wrapper-generation.yml" - - # Docs - - name: Checkout doc branch - uses: actions/checkout@v2 - with: - ref: gh-pages - path: protobuf-docs-checkout - - name: Commit and push generated HTML Docs file - run: | - cd protobuf-docs-checkout - cp -r ../doc ./doc - git add doc/ - git commit -m "Add generated HTML documentation for $GITHUB_SHA" || exit 0 # quit cleanly if nothing to commit - git push - - name: Setup Pages - uses: actions/configure-pages@v3 - - name: Upload artifact - uses: actions/upload-pages-artifact@v2 - with: - path: 'protobuf-docs-checkout/doc' - - name: Deploy to GitHub Pages - id: deployment - uses: actions/deploy-pages@v2 + # Docs + - name: Checkout doc branch + uses: actions/checkout@v4 + with: + ref: gh-pages + path: protobuf-docs-checkout + - name: Commit and push generated HTML Docs file + run: | + cd protobuf-docs-checkout + cp -r ../doc ./doc + git add doc/ + git commit -m "Add generated HTML documentation for $GITHUB_SHA" || exit 0 # quit cleanly if nothing to commit + git push + - name: Setup Pages + uses: actions/configure-pages@v3 + - name: Upload artifact + uses: actions/upload-pages-artifact@v2 + with: + path: "protobuf-docs-checkout/doc" + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v2 From 05965d93421dd315b4ee7e40ae971333c0d5f490 Mon Sep 17 00:00:00 2001 From: brentru Date: Wed, 21 Aug 2024 12:30:19 -0400 Subject: [PATCH 107/188] force options files to use absolute names rather than wildcard'ing the message fields --- .gitignore | 2 ++ proto/wippersnapper/checkin.options | 6 +++--- proto/wippersnapper/ds18x20.options | 5 ++++- proto/wippersnapper/i2c.options | 10 +++++----- proto/wippersnapper/pixels.options | 11 +++++++---- proto/wippersnapper/pwm.options | 8 ++++++-- proto/wippersnapper/servo.options | 5 ++++- proto/wippersnapper/signal.options | 4 ++-- proto/wippersnapper/uart.options | 11 +++++++---- 9 files changed, 40 insertions(+), 22 deletions(-) diff --git a/.gitignore b/.gitignore index 06c99313..484374e1 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,8 @@ __pycache__/ *$py.class .DS_Store +.vscode/ + # C extensions *.so diff --git a/proto/wippersnapper/checkin.options b/proto/wippersnapper/checkin.options index f17e951e..bf5e0f31 100644 --- a/proto/wippersnapper/checkin.options +++ b/proto/wippersnapper/checkin.options @@ -1,3 +1,3 @@ -# description.options -*.CheckInRequest.hardware_uid max_size:64 -*.CheckInRequest.firmware_version max_size:25 \ No newline at end of file +# checkin.options +wippersnapper.checkin.CheckinRequest.hardware_uid max_size: 64 +wippersnapper.checkin.CheckinRequest.firmware_version max_size: 25 \ No newline at end of file diff --git a/proto/wippersnapper/ds18x20.options b/proto/wippersnapper/ds18x20.options index fb6879c0..9ea9af50 100644 --- a/proto/wippersnapper/ds18x20.options +++ b/proto/wippersnapper/ds18x20.options @@ -1,4 +1,7 @@ # ds18x20.options -*.ds18x20*.onewire_pin max_size:5 +wippersnapper.ds18x20.Ds18x20Add.onewire_pin max_size:5 +wippersnapper.ds18x20.Ds18x20Added.onewire_pin max_size:5 +wippersnapper.ds18x20.Ds18x20Remove.onewire_pin max_size:5 +wippersnapper.ds18x20.onewire_pin.onewire_pin max_size:5 wippersnapper.ds18x20.Ds18x20Add.sensor_properties max_count:2 wippersnapper.ds18x20.Ds18x20Event.sensor_events max_count:2 \ No newline at end of file diff --git a/proto/wippersnapper/i2c.options b/proto/wippersnapper/i2c.options index 94031902..bacfe5ed 100644 --- a/proto/wippersnapper/i2c.options +++ b/proto/wippersnapper/i2c.options @@ -1,6 +1,6 @@ # i2c.options -*.I2CInit.i2c_device_name max_size:15 -*.I2CScanResponse.i2c_bus_found_devices max_count:120 -*.I2CInit.i2c_device_name max_size:15 -*.I2CInit.sensor_properties max_count:15 -*.I2CEvent.sensor_events max_count:15 +wippersnapper.i2c.I2CInit.i2c_device_name max_size:15 +wippersnapper.i2c.I2CScanResponse.i2c_bus_found_devices max_count:120 +wippersnapper.i2c.I2CInit.i2c_device_name max_size:15 +wippersnapper.i2c.I2CInit.sensor_properties max_count:15 +wippersnapper.i2c.I2CEvent.sensor_events max_count:15 diff --git a/proto/wippersnapper/pixels.options b/proto/wippersnapper/pixels.options index 0b3bb75d..b310e06e 100644 --- a/proto/wippersnapper/pixels.options +++ b/proto/wippersnapper/pixels.options @@ -1,5 +1,8 @@ # pixels.options -*.Pixels*.pixels_pin_data max_size: 6 -*.PixelsAdd.pixels_pin_neopixel max_size:6 -*.PixelsAdd.pixels_pin_dotstar_data max_size:6 -*.PixelsAdd.pixels_pin_dotstar_clock max_size:6 +wippersnapper.pixels.PixelsAdd.pixels_pin_data max_size: 6 +wippersnapper.pixels.PixelsAdded.pixels_pin_data max_size: 6 +wippersnapper.pixels.PixelsRemove.pixels_pin_data max_size: 6 +wippersnapper.pixels.PixelsWrite.pixels_pin_data max_size: 6 +wippersnapper.pixels.PixelsAdd.pixels_pin_neopixel max_size:6 +wippersnapper.pixels.PixelsAdd.pixels_pin_dotstar_data max_size:6 +wippersnapper.pixels.PixelsAdd.pixels_pin_dotstar_clock max_size:6 diff --git a/proto/wippersnapper/pwm.options b/proto/wippersnapper/pwm.options index cf991d16..1669e1b9 100644 --- a/proto/wippersnapper/pwm.options +++ b/proto/wippersnapper/pwm.options @@ -1,3 +1,7 @@ # pwm.options -*.PWM*.pin max_size:6 -*.PWMWriteDutyCycleMulti.write_duty_cycle_reqs max_count:4 \ No newline at end of file +wippersnapper.pwm.PWMAdd.pin max_size:6 +wippersnapper.pwm.PWMAdded.pin max_size:6 +wippersnapper.pwm.PWMRemove.pin max_size:6 +wippersnapper.pwm.PWMWriteDutyCycle.pin max_size:6 +wippersnapper.pwm.PWMWriteFrequency.pin max_size:6 +wippersnapper.pwm.PWMWriteDutyCycleMulti.write_duty_cycle_reqs max_count:4 \ No newline at end of file diff --git a/proto/wippersnapper/servo.options b/proto/wippersnapper/servo.options index 6e46a0c1..ad266f82 100644 --- a/proto/wippersnapper/servo.options +++ b/proto/wippersnapper/servo.options @@ -1,2 +1,5 @@ # servo.options -*.servo*.servo_pin max_size:6 \ No newline at end of file +wippersnapper.servo.ServoAdd.servo_pin max_size:6 +wippersnapper.servo.ServoAdded.servo_pin max_size:6 +wippersnapper.servo.ServoRemove.servo_pin max_size:6 +wippersnapper.servo.ServoWrite.servo_pin max_size:6 \ No newline at end of file diff --git a/proto/wippersnapper/signal.options b/proto/wippersnapper/signal.options index d2b378b7..c7decfb7 100644 --- a/proto/wippersnapper/signal.options +++ b/proto/wippersnapper/signal.options @@ -1,3 +1,3 @@ # signal.options -*.BrokerToDevice submsg_callback:true -*.DeviceToBroker submsg_callback:true \ No newline at end of file +wippersnapper.signal.BrokerToDevice submsg_callback:true +wippersnapper.signal.DeviceToBroker submsg_callback:true \ No newline at end of file diff --git a/proto/wippersnapper/uart.options b/proto/wippersnapper/uart.options index ac76df50..39c19489 100644 --- a/proto/wippersnapper/uart.options +++ b/proto/wippersnapper/uart.options @@ -1,5 +1,8 @@ # uart.options -*.UART*.device_id max_count:15 -*.UARTBusData.pin_rx max_size:6 -*.UARTBusData.pin_tx max_size:6 -*.UARTEvent.sensor_events max_size:2 \ No newline at end of file +wippersnapper.uart.UARTAdd.device_id max_count:15 +wippersnapper.uart.UARTAdded.device_id max_count:15 +wippersnapper.uart.UARTRemove.device_id max_count:15 +wippersnapper.uart.UARTEvent.device_id max_count:15 +wippersnapper.uart.UARTBusData.pin_rx max_size:6 +wippersnapper.uart.UARTBusData.pin_tx max_size:6 +wippersnapper.uart.UARTEvent.sensor_events max_size:2 \ No newline at end of file From 520f2fa01a6d4462ae95ae0f72e2f238883c2ab8 Mon Sep 17 00:00:00 2001 From: brentru Date: Wed, 21 Aug 2024 12:34:02 -0400 Subject: [PATCH 108/188] fix ds18x20 opts --- proto/wippersnapper/ds18x20.options | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proto/wippersnapper/ds18x20.options b/proto/wippersnapper/ds18x20.options index 9ea9af50..b6fc511b 100644 --- a/proto/wippersnapper/ds18x20.options +++ b/proto/wippersnapper/ds18x20.options @@ -2,6 +2,6 @@ wippersnapper.ds18x20.Ds18x20Add.onewire_pin max_size:5 wippersnapper.ds18x20.Ds18x20Added.onewire_pin max_size:5 wippersnapper.ds18x20.Ds18x20Remove.onewire_pin max_size:5 -wippersnapper.ds18x20.onewire_pin.onewire_pin max_size:5 +wippersnapper.ds18x20.Ds18x20Event.onewire_pin max_size:5 wippersnapper.ds18x20.Ds18x20Add.sensor_properties max_count:2 wippersnapper.ds18x20.Ds18x20Event.sensor_events max_count:2 \ No newline at end of file From 54a1aaa64ac43b543502b41b1ca16955c42c6abf Mon Sep 17 00:00:00 2001 From: brentru Date: Wed, 21 Aug 2024 12:39:41 -0400 Subject: [PATCH 109/188] fix warning errors in options --- proto/wippersnapper/ds18x20.options | 12 ++++++------ proto/wippersnapper/i2c.options | 9 ++++----- proto/wippersnapper/pixels.options | 4 +--- 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/proto/wippersnapper/ds18x20.options b/proto/wippersnapper/ds18x20.options index b6fc511b..70d9bfdf 100644 --- a/proto/wippersnapper/ds18x20.options +++ b/proto/wippersnapper/ds18x20.options @@ -1,7 +1,7 @@ # ds18x20.options -wippersnapper.ds18x20.Ds18x20Add.onewire_pin max_size:5 -wippersnapper.ds18x20.Ds18x20Added.onewire_pin max_size:5 -wippersnapper.ds18x20.Ds18x20Remove.onewire_pin max_size:5 -wippersnapper.ds18x20.Ds18x20Event.onewire_pin max_size:5 -wippersnapper.ds18x20.Ds18x20Add.sensor_properties max_count:2 -wippersnapper.ds18x20.Ds18x20Event.sensor_events max_count:2 \ No newline at end of file +wippersnapper.ds18x20.Ds18x20Add.onewire_pin max_size:5 +wippersnapper.ds18x20.Ds18x20Added.onewire_pin max_size:5 +wippersnapper.ds18x20.Ds18x20Remove.onewire_pin max_size:5 +wippersnapper.ds18x20.Ds18x20Event.onewire_pin max_size:5 +wippersnapper.ds18x20.Ds18x20Add.sensor_types max_count:2 +wippersnapper.ds18x20.Ds18x20Event.sensor_events max_count:2 \ No newline at end of file diff --git a/proto/wippersnapper/i2c.options b/proto/wippersnapper/i2c.options index bacfe5ed..4d017db0 100644 --- a/proto/wippersnapper/i2c.options +++ b/proto/wippersnapper/i2c.options @@ -1,6 +1,5 @@ # i2c.options -wippersnapper.i2c.I2CInit.i2c_device_name max_size:15 -wippersnapper.i2c.I2CScanResponse.i2c_bus_found_devices max_count:120 -wippersnapper.i2c.I2CInit.i2c_device_name max_size:15 -wippersnapper.i2c.I2CInit.sensor_properties max_count:15 -wippersnapper.i2c.I2CEvent.sensor_events max_count:15 +wippersnapper.i2c.I2cBusScanned.i2c_bus_found_devices max_count:120 +wippersnapper.i2c.I2cDeviceAddOrReplace.i2c_device_name max_size:15 +wippersnapper.i2c.I2cDeviceAddOrReplace.i2c_device_sensor_types max_count:15 +wippersnapper.i2c.I2cDeviceEvent.i2c_device_events max_count:15 diff --git a/proto/wippersnapper/pixels.options b/proto/wippersnapper/pixels.options index b310e06e..53e2abb9 100644 --- a/proto/wippersnapper/pixels.options +++ b/proto/wippersnapper/pixels.options @@ -1,8 +1,6 @@ # pixels.options wippersnapper.pixels.PixelsAdd.pixels_pin_data max_size: 6 +wippersnapper.pixels.PixelsAdd.pixels_pin_dotstar_clock max_size:6 wippersnapper.pixels.PixelsAdded.pixels_pin_data max_size: 6 wippersnapper.pixels.PixelsRemove.pixels_pin_data max_size: 6 wippersnapper.pixels.PixelsWrite.pixels_pin_data max_size: 6 -wippersnapper.pixels.PixelsAdd.pixels_pin_neopixel max_size:6 -wippersnapper.pixels.PixelsAdd.pixels_pin_dotstar_data max_size:6 -wippersnapper.pixels.PixelsAdd.pixels_pin_dotstar_clock max_size:6 From 0e4a90cca9eb41ecd50c861835991902510d191f Mon Sep 17 00:00:00 2001 From: brentru Date: Wed, 21 Aug 2024 14:29:33 -0400 Subject: [PATCH 110/188] Update scripts to detect .options file --- .github/workflows/generate-local-arduino-artifacts.yml | 4 ++-- .github/workflows/protoc-wrapper-generation.yml | 4 ++-- .github/workflows/test-wrapper-arduino.yml | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/generate-local-arduino-artifacts.yml b/.github/workflows/generate-local-arduino-artifacts.yml index 4d9eaf0c..125e8750 100644 --- a/.github/workflows/generate-local-arduino-artifacts.yml +++ b/.github/workflows/generate-local-arduino-artifacts.yml @@ -32,9 +32,9 @@ jobs: PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION: python run: | mkdir ./arduino_out - protoc --plugin=protobuf-checkout/nanopb/generator/protoc-gen-nanopb --proto_path=./protobuf-checkout/proto/wippersnapper --proto_path=nanopb/generator/proto ./protobuf-checkout/proto/wippersnapper/*.proto --nanopb_out=./arduino_out --nanopb_opt=-I./proto --nanopb_opt=-t + protoc --plugin=protobuf-checkout/nanopb/generator/protoc-gen-nanopb --proto_path=./protobuf-checkout/proto/wippersnapper --proto_path=nanopb/generator/proto ./protobuf-checkout/proto/wippersnapper/*.proto --nanopb_out=./arduino_out --nanopb_opt=-I./proto/wippersnapper --nanopb_opt=-t # Local (non-CI) build command is commented out below, use this to compile on your machine: - # protoc --plugin=nanopb/generator/protoc-gen-nanopb --proto_path=./proto/wippersnapper --proto_path=nanopb/generator/proto ./proto/wippersnapper/*.proto --nanopb_out=./arduino_out --nanopb_opt=-I./proto --nanopb_opt=-t + # protoc --plugin=nanopb/generator/protoc-gen-nanopb --proto_path=./proto/wippersnapper --proto_path=nanopb/generator/proto ./proto/wippersnapper/*.proto --nanopb_out=./arduino_out --nanopb_opt=-I./proto/wippersnapper --nanopb_opt=-t - name: Checkout Arduino Repo uses: actions/checkout@v4 with: diff --git a/.github/workflows/protoc-wrapper-generation.yml b/.github/workflows/protoc-wrapper-generation.yml index 697a18cc..64d6468f 100644 --- a/.github/workflows/protoc-wrapper-generation.yml +++ b/.github/workflows/protoc-wrapper-generation.yml @@ -74,9 +74,9 @@ jobs: PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION: python run: | mkdir ./arduino_out - protoc --plugin=protobuf-checkout/nanopb/generator/protoc-gen-nanopb --proto_path=./protobuf-checkout/proto/wippersnapper --proto_path=nanopb/generator/proto ./protobuf-checkout/proto/wippersnapper/*.proto --nanopb_out=./arduino_out --nanopb_opt=-I./proto --nanopb_opt=-t + protoc --plugin=protobuf-checkout/nanopb/generator/protoc-gen-nanopb --proto_path=./protobuf-checkout/proto/wippersnapper --proto_path=nanopb/generator/proto ./protobuf-checkout/proto/wippersnapper/*.proto --nanopb_out=./arduino_out --nanopb_opt=-I./proto/wippersnapper --nanopb_opt=-t # Local (non-CI) build command is commented out below, use this to compile on your machine: - # protoc --plugin=nanopb/generator/protoc-gen-nanopb --proto_path=./proto/wippersnapper --proto_path=nanopb/generator/proto ./proto/wippersnapper/*.proto --nanopb_out=./arduino_out --nanopb_opt=-I./proto --nanopb_opt=-t + # protoc --plugin=nanopb/generator/protoc-gen-nanopb --proto_path=./proto/wippersnapper --proto_path=nanopb/generator/proto ./proto/wippersnapper/*.proto --nanopb_out=./arduino_out --nanopb_opt=-I./proto/wippersnapper --nanopb_opt=-t - name: Checkout Arduino Repo uses: actions/checkout@v4 with: diff --git a/.github/workflows/test-wrapper-arduino.yml b/.github/workflows/test-wrapper-arduino.yml index 87b13b2b..dc492442 100644 --- a/.github/workflows/test-wrapper-arduino.yml +++ b/.github/workflows/test-wrapper-arduino.yml @@ -74,9 +74,9 @@ jobs: PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION: python run: | mkdir ./arduino_out - protoc --plugin=protobuf-checkout/nanopb/generator/protoc-gen-nanopb --proto_path=./protobuf-checkout/proto/wippersnapper --proto_path=nanopb/generator/proto ./protobuf-checkout/proto/wippersnapper/*.proto --nanopb_out=./arduino_out --nanopb_opt=-I./proto --nanopb_opt=-t + protoc --plugin=protobuf-checkout/nanopb/generator/protoc-gen-nanopb --proto_path=./protobuf-checkout/proto/wippersnapper --proto_path=nanopb/generator/proto ./protobuf-checkout/proto/wippersnapper/*.proto --nanopb_out=./arduino_out --nanopb_opt=-I./proto/wippersnapper --nanopb_opt=-t # Local (non-CI) build command is commented out below, use this to compile on your machine: - # protoc --plugin=nanopb/generator/protoc-gen-nanopb --proto_path=./proto/wippersnapper --proto_path=nanopb/generator/proto ./proto/wippersnapper/*.proto --nanopb_out=./arduino_out --nanopb_opt=-I./proto --nanopb_opt=-t + # protoc --plugin=nanopb/generator/protoc-gen-nanopb --proto_path=./proto/wippersnapper --proto_path=nanopb/generator/proto ./proto/wippersnapper/*.proto --nanopb_out=./arduino_out --nanopb_opt=-I./proto/wippersnapper --nanopb_opt=-t - name: Checkout Arduino Repo uses: actions/checkout@v4 with: From 5a549ccbc31c283d8cd5bb820d16e4a77c2e5542 Mon Sep 17 00:00:00 2001 From: brentru Date: Wed, 21 Aug 2024 14:40:14 -0400 Subject: [PATCH 111/188] verbose log enable --- .github/workflows/generate-local-arduino-artifacts.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/generate-local-arduino-artifacts.yml b/.github/workflows/generate-local-arduino-artifacts.yml index 125e8750..7f0db285 100644 --- a/.github/workflows/generate-local-arduino-artifacts.yml +++ b/.github/workflows/generate-local-arduino-artifacts.yml @@ -32,7 +32,7 @@ jobs: PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION: python run: | mkdir ./arduino_out - protoc --plugin=protobuf-checkout/nanopb/generator/protoc-gen-nanopb --proto_path=./protobuf-checkout/proto/wippersnapper --proto_path=nanopb/generator/proto ./protobuf-checkout/proto/wippersnapper/*.proto --nanopb_out=./arduino_out --nanopb_opt=-I./proto/wippersnapper --nanopb_opt=-t + protoc --plugin=protobuf-checkout/nanopb/generator/protoc-gen-nanopb --proto_path=./protobuf-checkout/proto/wippersnapper --proto_path=nanopb/generator/proto ./protobuf-checkout/proto/wippersnapper/*.proto --nanopb_out=./arduino_out --nanopb_opt=-I./proto/wippersnapper --nanopb_opt=-v # Local (non-CI) build command is commented out below, use this to compile on your machine: # protoc --plugin=nanopb/generator/protoc-gen-nanopb --proto_path=./proto/wippersnapper --proto_path=nanopb/generator/proto ./proto/wippersnapper/*.proto --nanopb_out=./arduino_out --nanopb_opt=-I./proto/wippersnapper --nanopb_opt=-t - name: Checkout Arduino Repo From 9671307c297dd70db6051dfea3af54f14730f319 Mon Sep 17 00:00:00 2001 From: brentru Date: Wed, 21 Aug 2024 14:48:29 -0400 Subject: [PATCH 112/188] list and tree --- .github/workflows/generate-local-arduino-artifacts.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/generate-local-arduino-artifacts.yml b/.github/workflows/generate-local-arduino-artifacts.yml index 7f0db285..59e1827e 100644 --- a/.github/workflows/generate-local-arduino-artifacts.yml +++ b/.github/workflows/generate-local-arduino-artifacts.yml @@ -32,6 +32,8 @@ jobs: PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION: python run: | mkdir ./arduino_out + ls -la + tree protoc --plugin=protobuf-checkout/nanopb/generator/protoc-gen-nanopb --proto_path=./protobuf-checkout/proto/wippersnapper --proto_path=nanopb/generator/proto ./protobuf-checkout/proto/wippersnapper/*.proto --nanopb_out=./arduino_out --nanopb_opt=-I./proto/wippersnapper --nanopb_opt=-v # Local (non-CI) build command is commented out below, use this to compile on your machine: # protoc --plugin=nanopb/generator/protoc-gen-nanopb --proto_path=./proto/wippersnapper --proto_path=nanopb/generator/proto ./proto/wippersnapper/*.proto --nanopb_out=./arduino_out --nanopb_opt=-I./proto/wippersnapper --nanopb_opt=-t From b63eb4929a66adc358a30fee9ca31f22a08c76b1 Mon Sep 17 00:00:00 2001 From: brentru Date: Wed, 21 Aug 2024 14:51:58 -0400 Subject: [PATCH 113/188] change dir lower --- .github/workflows/generate-local-arduino-artifacts.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/generate-local-arduino-artifacts.yml b/.github/workflows/generate-local-arduino-artifacts.yml index 59e1827e..4009f84d 100644 --- a/.github/workflows/generate-local-arduino-artifacts.yml +++ b/.github/workflows/generate-local-arduino-artifacts.yml @@ -32,9 +32,8 @@ jobs: PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION: python run: | mkdir ./arduino_out - ls -la - tree - protoc --plugin=protobuf-checkout/nanopb/generator/protoc-gen-nanopb --proto_path=./protobuf-checkout/proto/wippersnapper --proto_path=nanopb/generator/proto ./protobuf-checkout/proto/wippersnapper/*.proto --nanopb_out=./arduino_out --nanopb_opt=-I./proto/wippersnapper --nanopb_opt=-v + cd protobuf-checkout/ + protoc --plugin=nanopb/generator/protoc-gen-nanopb --proto_path=./proto/wippersnapper --proto_path=nanopb/generator/proto ./protobuf-checkout/wippersnapper/*.proto --nanopb_out=./arduino_out --nanopb_opt=-I./proto/wippersnapper --nanopb_opt=-v # Local (non-CI) build command is commented out below, use this to compile on your machine: # protoc --plugin=nanopb/generator/protoc-gen-nanopb --proto_path=./proto/wippersnapper --proto_path=nanopb/generator/proto ./proto/wippersnapper/*.proto --nanopb_out=./arduino_out --nanopb_opt=-I./proto/wippersnapper --nanopb_opt=-t - name: Checkout Arduino Repo From 70e154e0fbb20f2ad7d37480eb239d9dab70d115 Mon Sep 17 00:00:00 2001 From: brentru Date: Wed, 21 Aug 2024 14:53:38 -0400 Subject: [PATCH 114/188] fix a path --- .github/workflows/generate-local-arduino-artifacts.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/generate-local-arduino-artifacts.yml b/.github/workflows/generate-local-arduino-artifacts.yml index 4009f84d..92905024 100644 --- a/.github/workflows/generate-local-arduino-artifacts.yml +++ b/.github/workflows/generate-local-arduino-artifacts.yml @@ -33,7 +33,7 @@ jobs: run: | mkdir ./arduino_out cd protobuf-checkout/ - protoc --plugin=nanopb/generator/protoc-gen-nanopb --proto_path=./proto/wippersnapper --proto_path=nanopb/generator/proto ./protobuf-checkout/wippersnapper/*.proto --nanopb_out=./arduino_out --nanopb_opt=-I./proto/wippersnapper --nanopb_opt=-v + protoc --plugin=nanopb/generator/protoc-gen-nanopb --proto_path=./proto/wippersnapper --proto_path=nanopb/generator/proto ./proto/wippersnapper/*.proto --nanopb_out=./arduino_out --nanopb_opt=-I./proto/wippersnapper --nanopb_opt=-v # Local (non-CI) build command is commented out below, use this to compile on your machine: # protoc --plugin=nanopb/generator/protoc-gen-nanopb --proto_path=./proto/wippersnapper --proto_path=nanopb/generator/proto ./proto/wippersnapper/*.proto --nanopb_out=./arduino_out --nanopb_opt=-I./proto/wippersnapper --nanopb_opt=-t - name: Checkout Arduino Repo From e6f84dd4202626a72e290b6d67d565208399fc15 Mon Sep 17 00:00:00 2001 From: brentru Date: Wed, 21 Aug 2024 14:58:40 -0400 Subject: [PATCH 115/188] put arduino_out/ in the new path --- .github/workflows/generate-local-arduino-artifacts.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/generate-local-arduino-artifacts.yml b/.github/workflows/generate-local-arduino-artifacts.yml index 92905024..50d475b4 100644 --- a/.github/workflows/generate-local-arduino-artifacts.yml +++ b/.github/workflows/generate-local-arduino-artifacts.yml @@ -31,8 +31,8 @@ jobs: env: PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION: python run: | - mkdir ./arduino_out cd protobuf-checkout/ + mkdir ./arduino_out protoc --plugin=nanopb/generator/protoc-gen-nanopb --proto_path=./proto/wippersnapper --proto_path=nanopb/generator/proto ./proto/wippersnapper/*.proto --nanopb_out=./arduino_out --nanopb_opt=-I./proto/wippersnapper --nanopb_opt=-v # Local (non-CI) build command is commented out below, use this to compile on your machine: # protoc --plugin=nanopb/generator/protoc-gen-nanopb --proto_path=./proto/wippersnapper --proto_path=nanopb/generator/proto ./proto/wippersnapper/*.proto --nanopb_out=./arduino_out --nanopb_opt=-I./proto/wippersnapper --nanopb_opt=-t From 7d3cca713b9f853917e599ba9e5ff913aab3f30e Mon Sep 17 00:00:00 2001 From: brentru Date: Wed, 21 Aug 2024 15:13:28 -0400 Subject: [PATCH 116/188] fix upload artifact pathing --- .github/workflows/generate-local-arduino-artifacts.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/generate-local-arduino-artifacts.yml b/.github/workflows/generate-local-arduino-artifacts.yml index 50d475b4..ab043c22 100644 --- a/.github/workflows/generate-local-arduino-artifacts.yml +++ b/.github/workflows/generate-local-arduino-artifacts.yml @@ -44,4 +44,4 @@ jobs: uses: actions/upload-artifact@v4 with: name: build-arduino-wrappers - path: ./arduino_out + path: ./protobuf-checkout/arduino_out From 7ae93ddabf35dce044be3816620d16e020251258 Mon Sep 17 00:00:00 2001 From: brentru Date: Tue, 3 Sep 2024 16:27:02 -0400 Subject: [PATCH 117/188] add options file for digitalio.proto --- proto/wippersnapper/digitalio.options | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 proto/wippersnapper/digitalio.options diff --git a/proto/wippersnapper/digitalio.options b/proto/wippersnapper/digitalio.options new file mode 100644 index 00000000..635086ed --- /dev/null +++ b/proto/wippersnapper/digitalio.options @@ -0,0 +1,5 @@ +# digitalio.options +wippersnapper.digitalio.DigitalIOAdd.pin_name max_size: 64 +wippersnapper.digitalio.DigitalIORemove.pin_name max_size: 64 +wippersnapper.digitalio.DigitalIOEvent.pin_name max_size: 64 +wippersnapper.digitalio.DigitalIOWrite.pin_name max_size: 64 \ No newline at end of file From ee1df09fb542fd9ba27271cfa5aebc75bd9842a3 Mon Sep 17 00:00:00 2001 From: brentru Date: Tue, 1 Oct 2024 11:31:09 -0400 Subject: [PATCH 118/188] generate options for analogio proto file --- proto/wippersnapper/analogio.options | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 proto/wippersnapper/analogio.options diff --git a/proto/wippersnapper/analogio.options b/proto/wippersnapper/analogio.options new file mode 100644 index 00000000..ab905030 --- /dev/null +++ b/proto/wippersnapper/analogio.options @@ -0,0 +1,4 @@ +# analogio.options +wippersnapper.analogio.AnalogIOAdd.pin_name max_size: 64 +wippersnapper.digitalio.AnalogIORemove.pin_name max_size: 64 +wippersnapper.digitalio.AnalogIOEvent.pin_name max_size: 64 \ No newline at end of file From 7dd0fe6441f55bef77ab8df91cb6013729c2618f Mon Sep 17 00:00:00 2001 From: brentru Date: Tue, 1 Oct 2024 11:38:57 -0400 Subject: [PATCH 119/188] generate analogio remove, event --- proto/wippersnapper/analogio.options | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/proto/wippersnapper/analogio.options b/proto/wippersnapper/analogio.options index ab905030..26bdf683 100644 --- a/proto/wippersnapper/analogio.options +++ b/proto/wippersnapper/analogio.options @@ -1,4 +1,4 @@ # analogio.options wippersnapper.analogio.AnalogIOAdd.pin_name max_size: 64 -wippersnapper.digitalio.AnalogIORemove.pin_name max_size: 64 -wippersnapper.digitalio.AnalogIOEvent.pin_name max_size: 64 \ No newline at end of file +wippersnapper.analogio.AnalogIORemove.pin_name max_size: 64 +wippersnapper.analogio.AnalogIOEvent.pin_name max_size: 64 \ No newline at end of file From 10060314ca8f3e2d4f7f21de96e7521c58655a22 Mon Sep 17 00:00:00 2001 From: brentru Date: Tue, 21 Jan 2025 16:18:36 -0500 Subject: [PATCH 120/188] Modify I2cDeviceDescriptor to work with i2c muxes, add mux address to I2cDeviceDescriptor --- proto/wippersnapper/i2c.proto | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/proto/wippersnapper/i2c.proto b/proto/wippersnapper/i2c.proto index 4f3a64f7..e0f65bf4 100644 --- a/proto/wippersnapper/i2c.proto +++ b/proto/wippersnapper/i2c.proto @@ -28,6 +28,16 @@ enum I2cDeviceStatus { I2C_DEVICE_STATUS_NOT_FOUND = 5; /** I2C device not found on the bus. **/ } +/** +* I2cDeviceDescriptor represents the I2c device's address and related metadata. +*/ +message I2cDeviceDescriptor { + uint32 i2c_bus = 1; /** The desired I2C bus to address.**/ + uint32 i2c_device_address = 2; /** I2C Device's Address. **/ + uint32 i2c_mux_address = 3; /** Optional I2C multiplexer address. **/ + uint32 i2c_mux_channel = 4; /** Optional I2C multiplexer channel. **/ +} + /** * I2cBusScan represents a command for a device to perform an i2c scan. It is an empty message. */ @@ -45,15 +55,6 @@ message I2cBusScanned { // DEVICE COMMANDS -/** -* I2cDeviceDescriptor represents the I2c device's address and related metadata. -*/ -message I2cDeviceDescriptor { - uint32 i2c_bus = 1; /** The desired i2c bus to address.**/ - uint32 i2c_device_mux_address = 2; /** The desired address of the I2C device or (optionally) the I2C MUX address.**/ - uint32 i2c_mux_channel = 3; /** (Optional) The desired I2C mux's output channel, from 0-7.**/ -} - /** * I2cDeviceAddOrReplace is a message for initializing (or replacing/updating) an i2c device. */ From bed8b12f6f5faec6c5604e204b44a8528e35607a Mon Sep 17 00:00:00 2001 From: brentru Date: Wed, 22 Jan 2025 15:33:44 -0500 Subject: [PATCH 121/188] Modify I2cDeviceDescriptor to support > 1 I2C bus --- proto/wippersnapper/i2c.options | 2 ++ proto/wippersnapper/i2c.proto | 9 +++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/proto/wippersnapper/i2c.options b/proto/wippersnapper/i2c.options index 4d017db0..957d2d8e 100644 --- a/proto/wippersnapper/i2c.options +++ b/proto/wippersnapper/i2c.options @@ -3,3 +3,5 @@ wippersnapper.i2c.I2cBusScanned.i2c_bus_found_devices max_count:120 wippersnapper.i2c.I2cDeviceAddOrReplace.i2c_device_name max_size:15 wippersnapper.i2c.I2cDeviceAddOrReplace.i2c_device_sensor_types max_count:15 wippersnapper.i2c.I2cDeviceEvent.i2c_device_events max_count:15 +wippersnapper.i2c.I2cDeviceDescriptor.i2c_bus_sda max_size:15 +wippersnapper.i2c.I2cDeviceDescriptor.i2c_bus_scl max_size:15 \ No newline at end of file diff --git a/proto/wippersnapper/i2c.proto b/proto/wippersnapper/i2c.proto index e0f65bf4..6ef01ecb 100644 --- a/proto/wippersnapper/i2c.proto +++ b/proto/wippersnapper/i2c.proto @@ -32,10 +32,11 @@ enum I2cDeviceStatus { * I2cDeviceDescriptor represents the I2c device's address and related metadata. */ message I2cDeviceDescriptor { - uint32 i2c_bus = 1; /** The desired I2C bus to address.**/ - uint32 i2c_device_address = 2; /** I2C Device's Address. **/ - uint32 i2c_mux_address = 3; /** Optional I2C multiplexer address. **/ - uint32 i2c_mux_channel = 4; /** Optional I2C multiplexer channel. **/ + string i2c_bus_sda = 1; /** Optional SDA pin for an alt. i2c bus.**/ + string i2c_bus_scl = 2; /** Optional SCL pin for an alt. i2c bus.**/ + uint32 i2c_device_address = 3; /** I2C Device's Address. **/ + uint32 i2c_mux_address = 4; /** Optional I2C multiplexer address. **/ + uint32 i2c_mux_channel = 5; /** Optional I2C multiplexer channel. **/ } /** From e9aedfc2ec7ad5a751ecc2dc8e63d7777ada83d3 Mon Sep 17 00:00:00 2001 From: brentru Date: Wed, 12 Mar 2025 11:02:03 -0400 Subject: [PATCH 122/188] add bus_sda, bus_scl to I2cBusScan message --- proto/wippersnapper/i2c.options | 4 +++- proto/wippersnapper/i2c.proto | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/proto/wippersnapper/i2c.options b/proto/wippersnapper/i2c.options index 957d2d8e..8d130bf6 100644 --- a/proto/wippersnapper/i2c.options +++ b/proto/wippersnapper/i2c.options @@ -4,4 +4,6 @@ wippersnapper.i2c.I2cDeviceAddOrReplace.i2c_device_name max_size:15 wippersnapper.i2c.I2cDeviceAddOrReplace.i2c_device_sensor_types max_count:15 wippersnapper.i2c.I2cDeviceEvent.i2c_device_events max_count:15 wippersnapper.i2c.I2cDeviceDescriptor.i2c_bus_sda max_size:15 -wippersnapper.i2c.I2cDeviceDescriptor.i2c_bus_scl max_size:15 \ No newline at end of file +wippersnapper.i2c.I2cDeviceDescriptor.i2c_bus_scl max_size:15 +wippersnapper.i2c.I2cBusScan.i2c_bus_sda max_size:15 +wippersnapper.i2c.I2cBusScan.i2c_bus_scl max_size:15 \ No newline at end of file diff --git a/proto/wippersnapper/i2c.proto b/proto/wippersnapper/i2c.proto index 6ef01ecb..fc13f941 100644 --- a/proto/wippersnapper/i2c.proto +++ b/proto/wippersnapper/i2c.proto @@ -43,6 +43,8 @@ message I2cDeviceDescriptor { * I2cBusScan represents a command for a device to perform an i2c scan. It is an empty message. */ message I2cBusScan { + string i2c_bus_sda = 1; /** Optional SDA pin for an alt. i2c bus.**/ + string i2c_bus_scl = 2; /** Optional SCL pin for an alt. i2c bus.**/ } /** From d2788d20ba04d3c822fa33f82c3b79f7b41e705e Mon Sep 17 00:00:00 2001 From: brentru Date: Wed, 12 Mar 2025 11:04:12 -0400 Subject: [PATCH 123/188] Update upload-artifact to v4 --- .github/workflows/generate-local-python-artifacts.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/generate-local-python-artifacts.yml b/.github/workflows/generate-local-python-artifacts.yml index dc895f2e..f1c6963c 100644 --- a/.github/workflows/generate-local-python-artifacts.yml +++ b/.github/workflows/generate-local-python-artifacts.yml @@ -30,11 +30,11 @@ jobs: mkdir ./python_nanopb_out protoc --proto_path=./protobuf-checkout/proto/wippersnapper --python_out=./python_out ./protobuf-checkout/proto/wippersnapper/*.proto protoc ./protobuf-checkout/nanopb/generator/proto/nanopb.proto --python_out=./python_nanopb_out - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: build-python-wrappers path: ./python_out - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: build-python-nanopb-out path: ./python_nanopb_out \ No newline at end of file From 6ccf0b0b50bd457fdb5fe056e31ffb0dab92123d Mon Sep 17 00:00:00 2001 From: brentru Date: Wed, 12 Mar 2025 11:52:31 -0400 Subject: [PATCH 124/188] Refactor i2cBusScan again to account for alt bus, mux and devicedesc --- proto/wippersnapper/i2c.options | 4 +--- proto/wippersnapper/i2c.proto | 7 ++++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/proto/wippersnapper/i2c.options b/proto/wippersnapper/i2c.options index 8d130bf6..957d2d8e 100644 --- a/proto/wippersnapper/i2c.options +++ b/proto/wippersnapper/i2c.options @@ -4,6 +4,4 @@ wippersnapper.i2c.I2cDeviceAddOrReplace.i2c_device_name max_size:15 wippersnapper.i2c.I2cDeviceAddOrReplace.i2c_device_sensor_types max_count:15 wippersnapper.i2c.I2cDeviceEvent.i2c_device_events max_count:15 wippersnapper.i2c.I2cDeviceDescriptor.i2c_bus_sda max_size:15 -wippersnapper.i2c.I2cDeviceDescriptor.i2c_bus_scl max_size:15 -wippersnapper.i2c.I2cBusScan.i2c_bus_sda max_size:15 -wippersnapper.i2c.I2cBusScan.i2c_bus_scl max_size:15 \ No newline at end of file +wippersnapper.i2c.I2cDeviceDescriptor.i2c_bus_scl max_size:15 \ No newline at end of file diff --git a/proto/wippersnapper/i2c.proto b/proto/wippersnapper/i2c.proto index fc13f941..b030497b 100644 --- a/proto/wippersnapper/i2c.proto +++ b/proto/wippersnapper/i2c.proto @@ -40,11 +40,12 @@ message I2cDeviceDescriptor { } /** -* I2cBusScan represents a command for a device to perform an i2c scan. It is an empty message. +* I2cBusScan represents a command for a device to perform an i2c scan. */ message I2cBusScan { - string i2c_bus_sda = 1; /** Optional SDA pin for an alt. i2c bus.**/ - string i2c_bus_scl = 2; /** Optional SCL pin for an alt. i2c bus.**/ + bool scan_default_bus = 1; /** If true, linearly scan across the default hardware I2C bus. If false, linear scan across alt. hardware I2C bus. **/ + bool scan_mux = 2; /** If true, request a scan on an I2C multiplexer connected to a bus. If false or not marked, ignore. **/ + I2cDeviceDescriptor i2c_device_description = 3; /** Optional I2C bus metadata. **/ } /** From 52c4252a7336cda1274b61cdd5292f580ef4dd3d Mon Sep 17 00:00:00 2001 From: brentru Date: Wed, 12 Mar 2025 14:49:32 -0400 Subject: [PATCH 125/188] add to I2cBusScan --- proto/wippersnapper/i2c.options | 5 ++++- proto/wippersnapper/i2c.proto | 25 ++++++++++++++++++++++--- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/proto/wippersnapper/i2c.options b/proto/wippersnapper/i2c.options index 957d2d8e..21a128de 100644 --- a/proto/wippersnapper/i2c.options +++ b/proto/wippersnapper/i2c.options @@ -4,4 +4,7 @@ wippersnapper.i2c.I2cDeviceAddOrReplace.i2c_device_name max_size:15 wippersnapper.i2c.I2cDeviceAddOrReplace.i2c_device_sensor_types max_count:15 wippersnapper.i2c.I2cDeviceEvent.i2c_device_events max_count:15 wippersnapper.i2c.I2cDeviceDescriptor.i2c_bus_sda max_size:15 -wippersnapper.i2c.I2cDeviceDescriptor.i2c_bus_scl max_size:15 \ No newline at end of file +wippersnapper.i2c.I2cDeviceDescriptor.i2c_bus_scl max_size:15 +wippersnapper.i2c.I2cBusScan.i2c_mux_descriptors max_count: 2 +wippersnapper.i2c.I2cBusDescriptor.i2c_bus_sda max_size:15 +wippersnapper.i2c.I2cBusDescriptor.i2c_bus_scl max_size:15 \ No newline at end of file diff --git a/proto/wippersnapper/i2c.proto b/proto/wippersnapper/i2c.proto index b030497b..85720587 100644 --- a/proto/wippersnapper/i2c.proto +++ b/proto/wippersnapper/i2c.proto @@ -39,13 +39,32 @@ message I2cDeviceDescriptor { uint32 i2c_mux_channel = 5; /** Optional I2C multiplexer channel. **/ } +/** +* I2cMuxDescriptor represents the I2c multiplexer's address and related metadata. +*/ +message I2cMuxDescriptor { + bool use_default_bus = 1; /** True if the mux is on the default I2C bus, False otherwise. **/ + uint32 i2c_mux_address = 2; /** I2C multiplexer address. **/ + uint32 i2c_mux_channel = 3; /** I2C multiplexer channel. **/ +} + +/** +* I2cBusDescriptor represents the I2c bus' SDA and SCL pins. +*/ +message I2cBusDescriptor { + string i2c_bus_sda = 1; /** SDA pin for an i2c bus.**/ + string i2c_bus_scl = 2; /** SCL pin for an i2c bus.**/ +} + /** * I2cBusScan represents a command for a device to perform an i2c scan. */ message I2cBusScan { - bool scan_default_bus = 1; /** If true, linearly scan across the default hardware I2C bus. If false, linear scan across alt. hardware I2C bus. **/ - bool scan_mux = 2; /** If true, request a scan on an I2C multiplexer connected to a bus. If false or not marked, ignore. **/ - I2cDeviceDescriptor i2c_device_description = 3; /** Optional I2C bus metadata. **/ + bool scan_default_bus = 1; /** Default - Scan for i2c devices on the hardware's default I2C bus.**/ + bool scan_alt_bus = 2; /** Optional - Scan for i2c devices on an alternative I2C bus.**/ + I2cBusDescriptor i2c_alt_bus_descriptor = 3; /** Optional - Metadata to optionally initialize (if not already init'd) an alt. i2c bus.**/ + bool scan_muxes = 4; /** Optional - Scan 1+ I2C multiplexers connected to an I2C bus. **/ + repeated I2cMuxDescriptor i2c_mux_descriptors = 5; /** Optional - I2C multiplexer addresses and channels. **/ } /** From 3f629fbbc79d6782fcb054694d3b73af7766750d Mon Sep 17 00:00:00 2001 From: brentru Date: Wed, 12 Mar 2025 16:17:58 -0400 Subject: [PATCH 126/188] rm channel --- proto/wippersnapper/i2c.proto | 1 - 1 file changed, 1 deletion(-) diff --git a/proto/wippersnapper/i2c.proto b/proto/wippersnapper/i2c.proto index 85720587..151b3271 100644 --- a/proto/wippersnapper/i2c.proto +++ b/proto/wippersnapper/i2c.proto @@ -45,7 +45,6 @@ message I2cDeviceDescriptor { message I2cMuxDescriptor { bool use_default_bus = 1; /** True if the mux is on the default I2C bus, False otherwise. **/ uint32 i2c_mux_address = 2; /** I2C multiplexer address. **/ - uint32 i2c_mux_channel = 3; /** I2C multiplexer channel. **/ } /** From 218793e0f76761812f80fc9400377386d145d457 Mon Sep 17 00:00:00 2001 From: brentru Date: Thu, 13 Mar 2025 10:45:05 -0400 Subject: [PATCH 127/188] simplify mux info within scanrequest --- proto/wippersnapper/i2c.proto | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/proto/wippersnapper/i2c.proto b/proto/wippersnapper/i2c.proto index 151b3271..6e9342e0 100644 --- a/proto/wippersnapper/i2c.proto +++ b/proto/wippersnapper/i2c.proto @@ -39,14 +39,6 @@ message I2cDeviceDescriptor { uint32 i2c_mux_channel = 5; /** Optional I2C multiplexer channel. **/ } -/** -* I2cMuxDescriptor represents the I2c multiplexer's address and related metadata. -*/ -message I2cMuxDescriptor { - bool use_default_bus = 1; /** True if the mux is on the default I2C bus, False otherwise. **/ - uint32 i2c_mux_address = 2; /** I2C multiplexer address. **/ -} - /** * I2cBusDescriptor represents the I2c bus' SDA and SCL pins. */ @@ -62,8 +54,8 @@ message I2cBusScan { bool scan_default_bus = 1; /** Default - Scan for i2c devices on the hardware's default I2C bus.**/ bool scan_alt_bus = 2; /** Optional - Scan for i2c devices on an alternative I2C bus.**/ I2cBusDescriptor i2c_alt_bus_descriptor = 3; /** Optional - Metadata to optionally initialize (if not already init'd) an alt. i2c bus.**/ - bool scan_muxes = 4; /** Optional - Scan 1+ I2C multiplexers connected to an I2C bus. **/ - repeated I2cMuxDescriptor i2c_mux_descriptors = 5; /** Optional - I2C multiplexer addresses and channels. **/ + bool scan_default_bus_mux = 4; /** Optional - Scan for i2c devices on the default I2C bus with a multiplexer.**/ + bool scan_alt_bus_mux = 5; /** Optional - Scan for i2c devices on an alternative I2C bus with a multiplexer.**/ } /** From 26510b32370b85b28821432303252aecb60354b7 Mon Sep 17 00:00:00 2001 From: brentru Date: Thu, 13 Mar 2025 14:08:31 -0400 Subject: [PATCH 128/188] add remove --- proto/wippersnapper/i2c.proto | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/proto/wippersnapper/i2c.proto b/proto/wippersnapper/i2c.proto index 6e9342e0..4853bf1b 100644 --- a/proto/wippersnapper/i2c.proto +++ b/proto/wippersnapper/i2c.proto @@ -101,8 +101,7 @@ message I2cDeviceRemove { */ message I2cDeviceRemoved { I2cDeviceDescriptor i2c_device_description = 1; /** The I2c device's address and metadata. */ - I2cBusStatus i2c_bus_status = 2; /** The I2c bus' status. **/ - I2cDeviceStatus i2c_device_status = 3; /** The I2c device's status. **/ + bool did_remove = 2; /** True if the I2C device was successfully removed from the controller, False otherwise. **/ } /** From f06598542a0124bf3c20eade78dcbd79002fb4e3 Mon Sep 17 00:00:00 2001 From: brentru Date: Mon, 7 Apr 2025 13:25:40 -0400 Subject: [PATCH 129/188] add an option for persistent configs --- proto/wippersnapper/i2c.proto | 1 + 1 file changed, 1 insertion(+) diff --git a/proto/wippersnapper/i2c.proto b/proto/wippersnapper/i2c.proto index 4853bf1b..d38e8620 100644 --- a/proto/wippersnapper/i2c.proto +++ b/proto/wippersnapper/i2c.proto @@ -78,6 +78,7 @@ message I2cDeviceAddOrReplace { https://github.com/adafruit/Wippersnapper_Components. */ float i2c_device_period = 3; /** The desired period to update the I2c device's sensor(s), in seconds. */ repeated wippersnapper.sensor.SensorType i2c_device_sensor_types = 4; /** SI Types for each sensor on the I2c device. */ + bool is_persistent = 5; /** Offline-Mode ONLY - True if the device exits in the config file, False otherwise. **/ } /** From 9d11d0d382a67e14b3cee72fb80a79ef3428a160 Mon Sep 17 00:00:00 2001 From: brentru Date: Fri, 25 Apr 2025 11:41:56 -0400 Subject: [PATCH 130/188] Update UART.proto for v2 --- proto/wippersnapper/uart.options | 13 ++++--- proto/wippersnapper/uart.proto | 67 ++++++++++++++++++++++++-------- 2 files changed, 58 insertions(+), 22 deletions(-) diff --git a/proto/wippersnapper/uart.options b/proto/wippersnapper/uart.options index 39c19489..06643dd9 100644 --- a/proto/wippersnapper/uart.options +++ b/proto/wippersnapper/uart.options @@ -1,8 +1,9 @@ # uart.options -wippersnapper.uart.UARTAdd.device_id max_count:15 -wippersnapper.uart.UARTAdded.device_id max_count:15 -wippersnapper.uart.UARTRemove.device_id max_count:15 -wippersnapper.uart.UARTEvent.device_id max_count:15 -wippersnapper.uart.UARTBusData.pin_rx max_size:6 -wippersnapper.uart.UARTBusData.pin_tx max_size:6 +wippersnapper.uart.UARTBusData.bus_id max_count:15 +wippersnapper.uart.UARTBusData.rx_pin max_count:15 +wippersnapper.uart.UARTBusData.tx_pin max_count:15 +wippersnapper.uart.UARTAdd.driver max_count:15 +wippersnapper.uart.UARTAdded.driver max_count:15 +wippersnapper.uart.UARTRemove.driver max_count:15 +wippersnapper.uart.UARTEvent.driver max_count:15 wippersnapper.uart.UARTEvent.sensor_events max_size:2 \ No newline at end of file diff --git a/proto/wippersnapper/uart.proto b/proto/wippersnapper/uart.proto index e2e6b5a7..9cea687c 100644 --- a/proto/wippersnapper/uart.proto +++ b/proto/wippersnapper/uart.proto @@ -1,29 +1,64 @@ -// SPDX-FileCopyrightText: 2023-2024 Brent Rubell for Adafruit Industries +// SPDX-FileCopyrightText: 2023-2025 Brent Rubell for Adafruit Industries // SPDX-License-Identifier: MIT syntax = "proto3"; package wippersnapper.uart; -import "sensor.proto"; + +enum SerialConfig { + SERIAL_CONFIG_UNSPECIFIED = 0; + // DEFAULT (8 data bits, no parity, 1 stop bit) + SERIAL_CONFIG_8N1 = 1; + // (1 stop bit, no parity) + SERIAL_CONFIG_5N1 = 2; + SERIAL_CONFIG_6N1 = 3; + SERIAL_CONFIG_7N1 = 4; + // (2 stop bits, no parity) + SERIAL_CONFIG_5N2 = 5; + SERIAL_CONFIG_6N2 = 6; + SERIAL_CONFIG_7N2 = 7; + SERIAL_CONFIG_8N2 = 8; + // (1 stop bit, even parity) + SERIAL_CONFIG_5E1 = 9; + SERIAL_CONFIG_6E1 = 10; + SERIAL_CONFIG_7E1 = 11; + SERIAL_CONFIG_8E1 = 12; + // (2 stop bits, even parity) + SERIAL_CONFIG_5E2 = 13; + SERIAL_CONFIG_6E2 = 14; + SERIAL_CONFIG_7E2 = 15; + SERIAL_CONFIG_8E2 = 16; + // (1 stop bit, odd parity) + SERIAL_CONFIG_5O1 = 17; + SERIAL_CONFIG_6O1 = 18; + SERIAL_CONFIG_7O1 = 19; + SERIAL_CONFIG_8O1 = 20; + // (2 stop bits, odd parity) + SERIAL_CONFIG_5O2 = 21; + SERIAL_CONFIG_6O2 = 22; + SERIAL_CONFIG_7O2 = 23; + SERIAL_CONFIG_8O2 = 24; +} /** * UARTBusData represents a message to configure a UART bus for communication with a device. * NOTE: This message is never sent directly, it is packed inside UARTAdd. */ message UARTBusData { - int32 baudrate = 1; /** The baudrate to use for UART communication (may be a common baud rate such as: - 1200bps, 2400bps, 4800bps, 19200bps, 38400bps, 57600bps, or 115200bps). */ - string pin_rx = 2; /** The pin on which to receive UART stream data. */ - string pin_tx = 3; /** The pin on which to transmit UART stream data. */ - bool is_invert = 4; /** Inverts the UART signal on RX and TX pins. Defaults to False. */ + string bus_id = 1; /** The ID of the Serial bus (i.e: Serial, Serial1, "SoftwareSerial"). */ + uint32 baud_rate = 2; /** The desired baudrate, in bits per second. */ + SerialConfig config = 3; /** Configures the data, parity, and stop bits. */ + string rx_pin = 4; /** Optional: The pin on which to receive on. */ + string tx_pin = 5; /** Optional: The pin on which to transmit with. */ + bool invert = 6; /** Optional: Inverts the UART signal on RX and TX pins. Defaults to False. */ + float timeout = 7; /** Optional: The timeout, in milliseconds, for the UART bus. */ } /** * UARTAdd represents a message sent from IO to a device -* to configure the UART bus (if not already configured) and attach a device. +* to configure a UART bus for communication with a driver. */ message UARTAdd { - UARTBusData bus_info = 1; /** The UART bus configuration. */ - string device_id = 2; /** The unique identifier of the device to attach to the UART bus, from Adafruit_WipperSnapper_Components. */ - int32 polling_interval = 3; /** The polling interval, in milliseconds, to use for the device. */ + UARTBusData config = 1; /** The UART bus configuration. */ + string driver = 2; /** The unique identifier of the UART driver. */ } /** @@ -31,22 +66,22 @@ message UARTAdd { * confirm that a device has been attached to the UART bus. */ message UARTAdded { - string device_id = 1; /** The unique identifier of the device to attach to the UART bus, from Adafruit_WipperSnapper_Components. */ - bool is_success = 2; /** True if the UARTInit was successful, False otherwise. */ + string driver = 1; /** The unique identifier of the UART driver. */ + bool success = 2; /** True if the UART bus was successfully initialized, False otherwise. */ } /* * UARTRemove represents a message sent from IO to a device -* to detach a device from the UART bus. +* to detach a driver from the UART bus and deinitialize the bus. */ message UARTRemove { - string device_id = 1; /** The unique identifier of the device to detach from the UART bus. */ + string driver = 1; /** The unique identifier of the UART driver. */ } /** * UARTEvent represents incoming data from a UART sensor. */ message UARTEvent { - string device_id = 1; /** Unique identifier of the device to attach to the UART bus, from Adafruit_WipperSnapper_Components. */ + string driver = 1; /** Unique identifier of the device to attach to the UART bus, from Adafruit_WipperSnapper_Components. */ repeated wippersnapper.sensor.SensorEvent sensor_events = 2; /** An optionally repeated event from a sensor. */ } From d71ad53e174a2c4cd32bdcc81ae4f84c17c16258 Mon Sep 17 00:00:00 2001 From: brentru Date: Fri, 25 Apr 2025 11:48:18 -0400 Subject: [PATCH 131/188] Uart.proto - lint --- proto/wippersnapper/uart.proto | 62 ++++++++++++++++------------------ 1 file changed, 29 insertions(+), 33 deletions(-) diff --git a/proto/wippersnapper/uart.proto b/proto/wippersnapper/uart.proto index 9cea687c..ae6e47a7 100644 --- a/proto/wippersnapper/uart.proto +++ b/proto/wippersnapper/uart.proto @@ -3,39 +3,35 @@ syntax = "proto3"; package wippersnapper.uart; +/** +* SerialConfig contains the configuration (data, parity, and stop bits) for a serial bus. +*/ enum SerialConfig { - SERIAL_CONFIG_UNSPECIFIED = 0; - // DEFAULT (8 data bits, no parity, 1 stop bit) - SERIAL_CONFIG_8N1 = 1; - // (1 stop bit, no parity) - SERIAL_CONFIG_5N1 = 2; - SERIAL_CONFIG_6N1 = 3; - SERIAL_CONFIG_7N1 = 4; - // (2 stop bits, no parity) - SERIAL_CONFIG_5N2 = 5; - SERIAL_CONFIG_6N2 = 6; - SERIAL_CONFIG_7N2 = 7; - SERIAL_CONFIG_8N2 = 8; - // (1 stop bit, even parity) - SERIAL_CONFIG_5E1 = 9; - SERIAL_CONFIG_6E1 = 10; - SERIAL_CONFIG_7E1 = 11; - SERIAL_CONFIG_8E1 = 12; - // (2 stop bits, even parity) - SERIAL_CONFIG_5E2 = 13; - SERIAL_CONFIG_6E2 = 14; - SERIAL_CONFIG_7E2 = 15; - SERIAL_CONFIG_8E2 = 16; - // (1 stop bit, odd parity) - SERIAL_CONFIG_5O1 = 17; - SERIAL_CONFIG_6O1 = 18; - SERIAL_CONFIG_7O1 = 19; - SERIAL_CONFIG_8O1 = 20; - // (2 stop bits, odd parity) - SERIAL_CONFIG_5O2 = 21; - SERIAL_CONFIG_6O2 = 22; - SERIAL_CONFIG_7O2 = 23; - SERIAL_CONFIG_8O2 = 24; + SERIAL_CONFIG_UNSPECIFIED = 0; // Config was not specified by IO. + SERIAL_CONFIG_8N1 = 1; // 8 data bits, no parity, 1 stop bit + SERIAL_CONFIG_5N1 = 2; // 5 data bits, no parity, 1 stop bit + SERIAL_CONFIG_6N1 = 3; // 6 data bits, no parity, 1 stop bit + SERIAL_CONFIG_7N1 = 4; // 7 data bits, no parity, 1 stop bit + SERIAL_CONFIG_5N2 = 5; // 5 data bits, no parity, 2 stop bits + SERIAL_CONFIG_6N2 = 6; // 6 data bits, no parity, 2 stop bits + SERIAL_CONFIG_7N2 = 7; // 7 data bits, no parity, 2 stop bits + SERIAL_CONFIG_8N2 = 8; // 8 data bits, no parity, 2 stop bits + SERIAL_CONFIG_5E1 = 9; // 5 data bits, even parity, 1 stop bit + SERIAL_CONFIG_6E1 = 10; // 6 data bits, even parity, 1 stop bit + SERIAL_CONFIG_7E1 = 11; // 7 data bits, even parity, 1 stop bit + SERIAL_CONFIG_8E1 = 12; // 8 data bits, even parity, 1 stop bit + SERIAL_CONFIG_5E2 = 13; // 5 data bits, even parity, 2 stop bits + SERIAL_CONFIG_6E2 = 14; // 6 data bits, even parity, 2 stop bits + SERIAL_CONFIG_7E2 = 15; // 7 data bits, even parity, 2 stop bits + SERIAL_CONFIG_8E2 = 16; // 8 data bits, even parity, 2 stop bits + SERIAL_CONFIG_5O1 = 17; // 5 data bits, odd parity, 1 stop bit + SERIAL_CONFIG_6O1 = 18; // 6 data bits, odd parity, 1 stop bit + SERIAL_CONFIG_7O1 = 19; // 7 data bits, odd parity, 1 stop bit + SERIAL_CONFIG_8O1 = 20; // 8 data bits, odd parity, 1 stop bit + SERIAL_CONFIG_5O2 = 21; // 5 data bits, odd parity, 2 stop bits + SERIAL_CONFIG_6O2 = 22; // 6 data bits, odd parity, 2 stop bits + SERIAL_CONFIG_7O2 = 23; // 7 data bits, odd parity, 2 stop bits + SERIAL_CONFIG_8O2 = 24; // 8 data bits, odd parity, 2 stop bits } /** @@ -82,6 +78,6 @@ message UARTRemove { * UARTEvent represents incoming data from a UART sensor. */ message UARTEvent { - string driver = 1; /** Unique identifier of the device to attach to the UART bus, from Adafruit_WipperSnapper_Components. */ + string driver = 1; /** The unique identifier of the UART driver. */ repeated wippersnapper.sensor.SensorEvent sensor_events = 2; /** An optionally repeated event from a sensor. */ } From c165d947f56fbc2231601a1d8f09a917340191bf Mon Sep 17 00:00:00 2001 From: brentru Date: Fri, 25 Apr 2025 11:51:31 -0400 Subject: [PATCH 132/188] uart.proto - Include sensor.proto --- proto/wippersnapper/uart.proto | 1 + 1 file changed, 1 insertion(+) diff --git a/proto/wippersnapper/uart.proto b/proto/wippersnapper/uart.proto index ae6e47a7..49d7d695 100644 --- a/proto/wippersnapper/uart.proto +++ b/proto/wippersnapper/uart.proto @@ -2,6 +2,7 @@ // SPDX-License-Identifier: MIT syntax = "proto3"; package wippersnapper.uart; +import "sensor.proto"; /** * SerialConfig contains the configuration (data, parity, and stop bits) for a serial bus. From 370b73924c7ad0caf824e5f1a4e5ac795fb435d6 Mon Sep 17 00:00:00 2001 From: brentru Date: Fri, 25 Apr 2025 12:13:15 -0400 Subject: [PATCH 133/188] downgrade python ver --- .github/workflows/generate-local-arduino-artifacts.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/generate-local-arduino-artifacts.yml b/.github/workflows/generate-local-arduino-artifacts.yml index ab043c22..617cf735 100644 --- a/.github/workflows/generate-local-arduino-artifacts.yml +++ b/.github/workflows/generate-local-arduino-artifacts.yml @@ -8,7 +8,7 @@ jobs: steps: - uses: actions/setup-python@v5 with: - python-version: "3.x" + python-version: "3.13.2" - name: Install Protoc uses: arduino/setup-protoc@v1 with: From 5539f64cbca93576e71083c45a30180946e960f3 Mon Sep 17 00:00:00 2001 From: brentru Date: Fri, 25 Apr 2025 12:19:38 -0400 Subject: [PATCH 134/188] Workflow Arduino - Pin Protobuf to 5.29.4 --- .github/workflows/generate-local-arduino-artifacts.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/generate-local-arduino-artifacts.yml b/.github/workflows/generate-local-arduino-artifacts.yml index 617cf735..5a2a3db5 100644 --- a/.github/workflows/generate-local-arduino-artifacts.yml +++ b/.github/workflows/generate-local-arduino-artifacts.yml @@ -17,7 +17,7 @@ jobs: - name: Install Python dependencies run: | python -m pip install --upgrade pip - pip3 install scons protobuf grpcio-tools + pip3 install scons protobuf==5.29.4 grpcio-tools - name: Self Checkout uses: actions/checkout@v4 with: From ad775e4fd4878d5e9cf5e6e2aeba3ae9edc38044 Mon Sep 17 00:00:00 2001 From: brentru Date: Tue, 6 May 2025 10:42:38 -0400 Subject: [PATCH 135/188] Add I2C Output-type components --- proto/wippersnapper/i2c.proto | 16 ++++- proto/wippersnapper/i2c_output.proto | 94 ++++++++++++++++++++++++++++ proto/wippersnapper/signal.proto | 2 + 3 files changed, 110 insertions(+), 2 deletions(-) create mode 100644 proto/wippersnapper/i2c_output.proto diff --git a/proto/wippersnapper/i2c.proto b/proto/wippersnapper/i2c.proto index d38e8620..5f93165d 100644 --- a/proto/wippersnapper/i2c.proto +++ b/proto/wippersnapper/i2c.proto @@ -3,6 +3,7 @@ syntax = "proto3"; package wippersnapper.i2c; import "sensor.proto"; +import "i2c_output.proto"; /** * I2cBusStatus represents the status of a board's I2C bus @@ -78,7 +79,9 @@ message I2cDeviceAddOrReplace { https://github.com/adafruit/Wippersnapper_Components. */ float i2c_device_period = 3; /** The desired period to update the I2c device's sensor(s), in seconds. */ repeated wippersnapper.sensor.SensorType i2c_device_sensor_types = 4; /** SI Types for each sensor on the I2c device. */ - bool is_persistent = 5; /** Offline-Mode ONLY - True if the device exits in the config file, False otherwise. **/ + bool is_persistent = 5; /** Offline-Mode ONLY - True if the device exits in the config file, False otherwise. **/ + bool is_output = 6; /** Required by the device to determine if the device is an output device.**/ + wippersnapper.i2c_output.I2cOutputAdd i2c_output_add = 7; /** Optional - If the I2C device is an output device, fill this field. **/ } /** @@ -112,5 +115,14 @@ message I2cDeviceRemoved { */ message I2cDeviceEvent { I2cDeviceDescriptor i2c_device_description = 1; /** The I2c device's address and metadata. */ - repeated wippersnapper.sensor.SensorEvent i2c_device_events = 2; /** A, optionally repeated, SensorEvent from a sensor. */ + repeated wippersnapper.sensor.SensorEvent i2c_device_events = 2; /** Required, but optionally repeated, SensorEvent from a sensor. */ +} + +/** +* I2cDeviceOutputWrite represents a request to write to an I2C output device. +*/ +message I2cDeviceOutputWrite { + I2cDeviceDescriptor i2c_device_description = 1; /** Required - The I2c device's address and metadata. */ + wippersnapper.i2c_output.LedBackpackWrite led_backpack_write = 2; /** Optional - If the I2C device is a LED backpack, fill this field. **/ + wippersnapper.i2c_output.CharLCDWrite char_lcd_write = 3; /** Optional - If the I2C device is a character LCD, fill this field. **/ } diff --git a/proto/wippersnapper/i2c_output.proto b/proto/wippersnapper/i2c_output.proto new file mode 100644 index 00000000..e29bc72c --- /dev/null +++ b/proto/wippersnapper/i2c_output.proto @@ -0,0 +1,94 @@ +// SPDX-FileCopyrightText: 2025 Brent Rubell for Adafruit Industries +// SPDX-License-Identifier: MIT +syntax = "proto3"; +package wippersnapper.i2c_output; + +/** +* I2cOutputType defines the category of I2C output device. +*/ +enum I2cOutputType { + I2C_OUTPUT_TYPE_UNSPECIFIED = 0; /** Unspecified output type. **/ + I2C_OUTPUT_TYPE_LED_BACKPACK = 1; /** LED backpack output type. **/ + I2C_OUTPUT_TYPE_CHAR_LCD = 2; /** Character LCD output type. **/ +} + +/** +* LedBackpackBlinkRate represents supported, OPTIONAL, blink rates for LED backpack displays +*/ +enum LedBackpackBlinkRate { + LED_BACKPACK_BLINK_RATE_UNSPECIFIED = 0; /** No blinking. **/ + LED_BACKPACK_BLINK_RATE_OFF = 1; /** No blinking. **/ + LED_BACKPACK_BLINK_RATE_2HZ = 2; /** 2 Hz blink rate. **/ + LED_BACKPACK_BLINK_RATE_1HZ = 3; /** 1 Hz blink rate. **/ + LED_BACKPACK_BLINK_RATE_HALFHZ = 4; /** 0.5 Hz blink rate. **/ +} + +/** +* LedBackpackAlignment represents all text alignment option for LED backpack displays +*/ +enum LedBackpackAlignment { + LED_BACKPACK_ALIGNMENT_UNSPECIFIED = 0; /** Unspecified alignment option. **/ + LED_BACKPACK_ALIGNMENT_LEFT = 1; /** (Default) Left-aligned. **/ + LED_BACKPACK_ALIGNMENT_RIGHT = 2; /** Right-aligned. **/ +} + +/** +* LedBackpackConfig represents the configuration for a LED backpack display. +*/ +message LedBackpackConfig { + int32 brightness = 1; /** Desired brightness of the LED backpack, from 0 (off) to 15 (full brightness). **/ + LedBackpackAlignment alignment = 2; /** Desired text alignment for the LED backpack. **/ +} + +/** +* CharLCDConfig represents the configuration for a character LCD display. +*/ +message CharLCDConfig { + uint32 rows = 1; /** Number of rows for the character LCD. **/ + uint32 columns = 2; /** Number of columns for the character LCD. **/ + bool backlight_enable = 3; /** Backlight state for the character LCD. **/ + string backlight_color = 4; /** Backlight color for the character LCD, in Hex. **/ +} + +/** +* I2cOutputAdd represents a request from the broker to add an I2C output device to a device. +*/ +message I2cOutputAdd { + I2cOutputType type = 1; /** The type of I2C output device. **/ + oneof config { + LedBackpackConfig led_backpack_config = 2; /** Configuration for LED backpack. **/ + CharLCDConfig char_lcd_config = 3; /** Configuration for character LCD. **/ + } +} + +/** +* LedBackpackWrite represents a request from the broker to write a message to a LED backpack. +*/ +message LedBackpackWrite { + oneof message { + string text = 1; /** Text to write to the LED backpack. **/ + int32 number_int = 2; /** Number to write to the LED backpack. **/ + float number_float = 3; /** Float to write to the LED backpack. **/ + } + int32 brightness = 4; /** Optionally adjusts the brightness from 0 (off) to 15 (full brightness). **/ + LedBackpackBlinkRate blink_rate = 5; /** Optionally sets the blink rate for the LED backpack. **/ + bool enable_scroll_marquee = 6; /** Optionally enables automatic text scrolling **/ + float scroll_marquee_speed = 7; /** Speed for the scrolling marquee. **/ + bool enable_ampm_dot = 8; /** Enable AM/PM dot. **/ +} + +/** +* CharLCDWrite represents a request from the broker to write to a character LCD. +*/ +message CharLCDWrite { + oneof message { + string text = 1; /** Text to write to the character LCD. **/ + int32 number_int = 2; /** Number to write to the character LCD. **/ + float number_float = 3; /** Float to write to the character LCD. **/ + } + bool enable_backlight = 4; /** Enable backlight for the character LCD. **/ + string backlight_color = 5; /** Backlight color for the character LCD, in Hex. **/ + bool enable_scroll = 6; /** Enable automatic scrolling for the character LCD. **/ +} + + diff --git a/proto/wippersnapper/signal.proto b/proto/wippersnapper/signal.proto index 3fd92fdc..d50c786d 100644 --- a/proto/wippersnapper/signal.proto +++ b/proto/wippersnapper/signal.proto @@ -8,6 +8,7 @@ import "digitalio.proto"; import "ds18x20.proto"; import "error.proto"; import "i2c.proto"; +import "i2c_output.proto"; import "nanopb.proto"; import "pixels.proto"; import "pwm.proto"; @@ -56,6 +57,7 @@ message BrokerToDevice { wippersnapper.i2c.I2cBusScan i2c_bus_scan = 90; wippersnapper.i2c.I2cDeviceAddOrReplace i2c_device_add_replace = 91; wippersnapper.i2c.I2cDeviceRemove i2c_device_remove = 92; + wippersnapper.i2c.I2cDeviceOutputWrite i2c_device_output_write = 93; // error.proto wippersnapper.error.Error error = 100; } From 0d6a5ff3d804495d755b9bbb52193f9089d57913 Mon Sep 17 00:00:00 2001 From: brentru Date: Tue, 6 May 2025 10:47:00 -0400 Subject: [PATCH 136/188] sort imports --- proto/wippersnapper/i2c.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proto/wippersnapper/i2c.proto b/proto/wippersnapper/i2c.proto index 5f93165d..3cab359e 100644 --- a/proto/wippersnapper/i2c.proto +++ b/proto/wippersnapper/i2c.proto @@ -2,8 +2,8 @@ // SPDX-License-Identifier: MIT syntax = "proto3"; package wippersnapper.i2c; -import "sensor.proto"; import "i2c_output.proto"; +import "sensor.proto"; /** * I2cBusStatus represents the status of a board's I2C bus From 36c008cc211f967488738cf5da6e191cfe448401 Mon Sep 17 00:00:00 2001 From: brentru Date: Wed, 7 May 2025 11:56:17 -0400 Subject: [PATCH 137/188] remove type because we'll just use which_config pb_size_t to detect instead --- proto/wippersnapper/i2c_output.proto | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/proto/wippersnapper/i2c_output.proto b/proto/wippersnapper/i2c_output.proto index e29bc72c..d0dece6e 100644 --- a/proto/wippersnapper/i2c_output.proto +++ b/proto/wippersnapper/i2c_output.proto @@ -3,15 +3,6 @@ syntax = "proto3"; package wippersnapper.i2c_output; -/** -* I2cOutputType defines the category of I2C output device. -*/ -enum I2cOutputType { - I2C_OUTPUT_TYPE_UNSPECIFIED = 0; /** Unspecified output type. **/ - I2C_OUTPUT_TYPE_LED_BACKPACK = 1; /** LED backpack output type. **/ - I2C_OUTPUT_TYPE_CHAR_LCD = 2; /** Character LCD output type. **/ -} - /** * LedBackpackBlinkRate represents supported, OPTIONAL, blink rates for LED backpack displays */ @@ -54,10 +45,9 @@ message CharLCDConfig { * I2cOutputAdd represents a request from the broker to add an I2C output device to a device. */ message I2cOutputAdd { - I2cOutputType type = 1; /** The type of I2C output device. **/ oneof config { - LedBackpackConfig led_backpack_config = 2; /** Configuration for LED backpack. **/ - CharLCDConfig char_lcd_config = 3; /** Configuration for character LCD. **/ + LedBackpackConfig led_backpack_config = 1; /** Configuration for LED backpack. **/ + CharLCDConfig char_lcd_config = 2; /** Configuration for character LCD. **/ } } From 1d37ef4d76b571c670c68b33ee29c7e45021cb86 Mon Sep 17 00:00:00 2001 From: brentru Date: Wed, 7 May 2025 14:11:42 -0400 Subject: [PATCH 138/188] add i2c options --- proto/wippersnapper/i2c_output.options | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 proto/wippersnapper/i2c_output.options diff --git a/proto/wippersnapper/i2c_output.options b/proto/wippersnapper/i2c_output.options new file mode 100644 index 00000000..19b756f2 --- /dev/null +++ b/proto/wippersnapper/i2c_output.options @@ -0,0 +1,5 @@ +# i2c_output.options +wippersnapper.i2c_output.CharLCDConfig.backlight_color max_size:15 +wippersnapper.i2c_output.LedBackpackWrite.message.text max_size:20 +wippersnapper.i2c_output.CharLCDWrite.message.text max_size:20 +wippersnapper.i2c_output.CharLCDWrite.backlight_color max_size:20 \ No newline at end of file From 734dd6055a192ba2d9e64cbcb547b783925c7351 Mon Sep 17 00:00:00 2001 From: brentru Date: Wed, 7 May 2025 15:07:22 -0400 Subject: [PATCH 139/188] fix oneof options --- proto/wippersnapper/i2c_output.options | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/proto/wippersnapper/i2c_output.options b/proto/wippersnapper/i2c_output.options index 19b756f2..67f20335 100644 --- a/proto/wippersnapper/i2c_output.options +++ b/proto/wippersnapper/i2c_output.options @@ -1,5 +1,5 @@ # i2c_output.options -wippersnapper.i2c_output.CharLCDConfig.backlight_color max_size:15 -wippersnapper.i2c_output.LedBackpackWrite.message.text max_size:20 -wippersnapper.i2c_output.CharLCDWrite.message.text max_size:20 -wippersnapper.i2c_output.CharLCDWrite.backlight_color max_size:20 \ No newline at end of file +wippersnapper.i2c_output.CharLCDConfig.backlight_color max_size:15 +wippersnapper.i2c_output.LedBackpackWrite.text max_size:20 +wippersnapper.i2c_output.CharLCDWrite.text max_size:20 +wippersnapper.i2c_output.CharLCDWrite.backlight_color max_size:20 \ No newline at end of file From 2ef3b7ca267a4fcb690786120c1bcd874288165b Mon Sep 17 00:00:00 2001 From: brentru Date: Wed, 7 May 2025 15:21:06 -0400 Subject: [PATCH 140/188] add enable to adjust brightness --- proto/wippersnapper/i2c_output.proto | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/proto/wippersnapper/i2c_output.proto b/proto/wippersnapper/i2c_output.proto index d0dece6e..cba07c1e 100644 --- a/proto/wippersnapper/i2c_output.proto +++ b/proto/wippersnapper/i2c_output.proto @@ -60,11 +60,12 @@ message LedBackpackWrite { int32 number_int = 2; /** Number to write to the LED backpack. **/ float number_float = 3; /** Float to write to the LED backpack. **/ } - int32 brightness = 4; /** Optionally adjusts the brightness from 0 (off) to 15 (full brightness). **/ - LedBackpackBlinkRate blink_rate = 5; /** Optionally sets the blink rate for the LED backpack. **/ - bool enable_scroll_marquee = 6; /** Optionally enables automatic text scrolling **/ - float scroll_marquee_speed = 7; /** Speed for the scrolling marquee. **/ - bool enable_ampm_dot = 8; /** Enable AM/PM dot. **/ + bool adjust_brightness = 4; /** Optionally used to enable the brightness tag. **/ + int32 brightness = 5; /** Optionally adjusts the brightness from 0 (off) to 15 (full brightness). **/ + LedBackpackBlinkRate blink_rate = 6; /** Optionally sets the blink rate for the LED backpack. **/ + bool enable_scroll_marquee = 7; /** Optionally enables automatic text scrolling **/ + float scroll_marquee_speed = 8; /** Speed for the scrolling marquee. **/ + bool enable_ampm_dot = 9; /** Enable AM/PM dot. **/ } /** From 0a74dc96f50785d7f29d2f44b409033fd880d600 Mon Sep 17 00:00:00 2001 From: brentru Date: Thu, 8 May 2025 14:11:23 -0400 Subject: [PATCH 141/188] this'll simplify the removal subroutine --- proto/wippersnapper/i2c.proto | 1 + 1 file changed, 1 insertion(+) diff --git a/proto/wippersnapper/i2c.proto b/proto/wippersnapper/i2c.proto index 3cab359e..401d728b 100644 --- a/proto/wippersnapper/i2c.proto +++ b/proto/wippersnapper/i2c.proto @@ -98,6 +98,7 @@ message I2cDeviceAddedOrReplaced { */ message I2cDeviceRemove { I2cDeviceDescriptor i2c_device_description = 1; /** The I2c device's address and metadata. */ + bool is_output_device = 2; /** Determines if the device is an output device.**/ } /** From 9704f834c21d941afa0a3b63e48977a3a3c84d76 Mon Sep 17 00:00:00 2001 From: brentru Date: Mon, 12 May 2025 14:03:44 -0400 Subject: [PATCH 142/188] oneof the I2cDeviceOutputWrite payload --- proto/wippersnapper/i2c.proto | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/proto/wippersnapper/i2c.proto b/proto/wippersnapper/i2c.proto index 401d728b..a7af1c16 100644 --- a/proto/wippersnapper/i2c.proto +++ b/proto/wippersnapper/i2c.proto @@ -123,7 +123,9 @@ message I2cDeviceEvent { * I2cDeviceOutputWrite represents a request to write to an I2C output device. */ message I2cDeviceOutputWrite { - I2cDeviceDescriptor i2c_device_description = 1; /** Required - The I2c device's address and metadata. */ - wippersnapper.i2c_output.LedBackpackWrite led_backpack_write = 2; /** Optional - If the I2C device is a LED backpack, fill this field. **/ - wippersnapper.i2c_output.CharLCDWrite char_lcd_write = 3; /** Optional - If the I2C device is a character LCD, fill this field. **/ + I2cDeviceDescriptor i2c_device_description = 1; /** Required - The I2c device's address and metadata. */ + oneof output_msg { + wippersnapper.i2c_output.LedBackpackWrite write_led_backpack = 2; /** Optional - If the I2C device is a LED backpack, fill this field. **/ + wippersnapper.i2c_output.CharLCDWrite write_char_lcd = 3; /** Optional - If the I2C device is a character LCD, fill this field. **/ + } } From b20a5d04c064e4390f3355bdb8be3c585a8e752b Mon Sep 17 00:00:00 2001 From: brentru Date: Tue, 13 May 2025 11:25:04 -0400 Subject: [PATCH 143/188] rm unused fields from initial design --- proto/wippersnapper/i2c_output.proto | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/proto/wippersnapper/i2c_output.proto b/proto/wippersnapper/i2c_output.proto index cba07c1e..8d69ac67 100644 --- a/proto/wippersnapper/i2c_output.proto +++ b/proto/wippersnapper/i2c_output.proto @@ -37,8 +37,7 @@ message LedBackpackConfig { message CharLCDConfig { uint32 rows = 1; /** Number of rows for the character LCD. **/ uint32 columns = 2; /** Number of columns for the character LCD. **/ - bool backlight_enable = 3; /** Backlight state for the character LCD. **/ - string backlight_color = 4; /** Backlight color for the character LCD, in Hex. **/ + string backlight_color = 3; /** Optional Backlight color for the character LCD, in Hex. **/ } /** @@ -65,21 +64,15 @@ message LedBackpackWrite { LedBackpackBlinkRate blink_rate = 6; /** Optionally sets the blink rate for the LED backpack. **/ bool enable_scroll_marquee = 7; /** Optionally enables automatic text scrolling **/ float scroll_marquee_speed = 8; /** Speed for the scrolling marquee. **/ - bool enable_ampm_dot = 9; /** Enable AM/PM dot. **/ } /** * CharLCDWrite represents a request from the broker to write to a character LCD. */ message CharLCDWrite { - oneof message { - string text = 1; /** Text to write to the character LCD. **/ - int32 number_int = 2; /** Number to write to the character LCD. **/ - float number_float = 3; /** Float to write to the character LCD. **/ - } - bool enable_backlight = 4; /** Enable backlight for the character LCD. **/ - string backlight_color = 5; /** Backlight color for the character LCD, in Hex. **/ - bool enable_scroll = 6; /** Enable automatic scrolling for the character LCD. **/ + string message = 1; /** Message to write to the character LCD. **/ + string backlight_color = 2; /** Optional Backlight color for the character LCD, in Hex. **/ + bool enable_scroll = 3; /** Optional Enable automatic scrolling for the character LCD. **/ } From 31c69068576edc68473a108ee9cef3f899dc21bc Mon Sep 17 00:00:00 2001 From: brentru Date: Tue, 13 May 2025 11:33:37 -0400 Subject: [PATCH 144/188] inc. msg buffer sz --- proto/wippersnapper/i2c_output.options | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/proto/wippersnapper/i2c_output.options b/proto/wippersnapper/i2c_output.options index 67f20335..93f85177 100644 --- a/proto/wippersnapper/i2c_output.options +++ b/proto/wippersnapper/i2c_output.options @@ -2,4 +2,5 @@ wippersnapper.i2c_output.CharLCDConfig.backlight_color max_size:15 wippersnapper.i2c_output.LedBackpackWrite.text max_size:20 wippersnapper.i2c_output.CharLCDWrite.text max_size:20 -wippersnapper.i2c_output.CharLCDWrite.backlight_color max_size:20 \ No newline at end of file +wippersnapper.i2c_output.CharLCDWrite.backlight_color max_size:20 +wippersnapper.i2c_output.CharLCDWrite.message max_size:128 \ No newline at end of file From a5cadbfbac94ea28d6bfce802a654ab9b5be4d4a Mon Sep 17 00:00:00 2001 From: brentru Date: Tue, 20 May 2025 16:54:50 -0400 Subject: [PATCH 145/188] Add OLED commands, refactor towards v1 api --- proto/wippersnapper/i2c_output.options | 8 ++-- proto/wippersnapper/i2c_output.proto | 59 ++++++++++++++------------ 2 files changed, 34 insertions(+), 33 deletions(-) diff --git a/proto/wippersnapper/i2c_output.options b/proto/wippersnapper/i2c_output.options index 93f85177..f54f5b53 100644 --- a/proto/wippersnapper/i2c_output.options +++ b/proto/wippersnapper/i2c_output.options @@ -1,6 +1,4 @@ # i2c_output.options -wippersnapper.i2c_output.CharLCDConfig.backlight_color max_size:15 -wippersnapper.i2c_output.LedBackpackWrite.text max_size:20 -wippersnapper.i2c_output.CharLCDWrite.text max_size:20 -wippersnapper.i2c_output.CharLCDWrite.backlight_color max_size:20 -wippersnapper.i2c_output.CharLCDWrite.message max_size:128 \ No newline at end of file +wippersnapper.i2c_output.LedBackpackWrite.message max_size:8 +wippersnapper.i2c_output.CharLCDWrite.message max_size:100 +wippersnapper.i2c_output.OLEDWrite.message max_size:512 \ No newline at end of file diff --git a/proto/wippersnapper/i2c_output.proto b/proto/wippersnapper/i2c_output.proto index 8d69ac67..f21b9dce 100644 --- a/proto/wippersnapper/i2c_output.proto +++ b/proto/wippersnapper/i2c_output.proto @@ -3,17 +3,6 @@ syntax = "proto3"; package wippersnapper.i2c_output; -/** -* LedBackpackBlinkRate represents supported, OPTIONAL, blink rates for LED backpack displays -*/ -enum LedBackpackBlinkRate { - LED_BACKPACK_BLINK_RATE_UNSPECIFIED = 0; /** No blinking. **/ - LED_BACKPACK_BLINK_RATE_OFF = 1; /** No blinking. **/ - LED_BACKPACK_BLINK_RATE_2HZ = 2; /** 2 Hz blink rate. **/ - LED_BACKPACK_BLINK_RATE_1HZ = 3; /** 1 Hz blink rate. **/ - LED_BACKPACK_BLINK_RATE_HALFHZ = 4; /** 0.5 Hz blink rate. **/ -} - /** * LedBackpackAlignment represents all text alignment option for LED backpack displays */ @@ -23,6 +12,15 @@ enum LedBackpackAlignment { LED_BACKPACK_ALIGNMENT_RIGHT = 2; /** Right-aligned. **/ } +/** +* Desired OLED display text 'magnification' size. +*/ +enum OledTextSize { + OLED_TEXT_SIZE_UNSPECIFIED = 0; /** Unspecified text size. **/ + OLED_TEXT_SIZE_DEFAULT = 1; /** Default text size, 6x8px. **/ + OLED_TEXT_SIZE_LARGE = 2; /** Larger text size option, 12x16px. **/ +} + /** * LedBackpackConfig represents the configuration for a LED backpack display. */ @@ -37,16 +35,26 @@ message LedBackpackConfig { message CharLCDConfig { uint32 rows = 1; /** Number of rows for the character LCD. **/ uint32 columns = 2; /** Number of columns for the character LCD. **/ - string backlight_color = 3; /** Optional Backlight color for the character LCD, in Hex. **/ } +/** +* OledConfig represents the configuration for a OLED display. +*/ +message OledConfig { + uint32 width = 1; /** Width of the OLED display in pixels. **/ + uint32 height = 2; /** Height of the OLED display in pixels. **/ + OledTextSize font_size = 3; /** Desired font magnification for the OLED display. Defaults to OLED_TEXT_SIZE_DEFAULT. **/ +} + + /** * I2cOutputAdd represents a request from the broker to add an I2C output device to a device. */ message I2cOutputAdd { oneof config { - LedBackpackConfig led_backpack_config = 1; /** Configuration for LED backpack. **/ - CharLCDConfig char_lcd_config = 2; /** Configuration for character LCD. **/ + LedBackpackConfig led_backpack_config = 1; /** Configuration for a LED backpack. **/ + CharLCDConfig char_lcd_config = 2; /** Configuration for a character LCD. **/ + OledConfig oled_config = 3; /** Configuration for an OLED display. **/ } } @@ -54,25 +62,20 @@ message I2cOutputAdd { * LedBackpackWrite represents a request from the broker to write a message to a LED backpack. */ message LedBackpackWrite { - oneof message { - string text = 1; /** Text to write to the LED backpack. **/ - int32 number_int = 2; /** Number to write to the LED backpack. **/ - float number_float = 3; /** Float to write to the LED backpack. **/ - } - bool adjust_brightness = 4; /** Optionally used to enable the brightness tag. **/ - int32 brightness = 5; /** Optionally adjusts the brightness from 0 (off) to 15 (full brightness). **/ - LedBackpackBlinkRate blink_rate = 6; /** Optionally sets the blink rate for the LED backpack. **/ - bool enable_scroll_marquee = 7; /** Optionally enables automatic text scrolling **/ - float scroll_marquee_speed = 8; /** Speed for the scrolling marquee. **/ + string message = 1; /** Message to write to the LED backpack. **/ } /** * CharLCDWrite represents a request from the broker to write to a character LCD. */ message CharLCDWrite { - string message = 1; /** Message to write to the character LCD. **/ - string backlight_color = 2; /** Optional Backlight color for the character LCD, in Hex. **/ - bool enable_scroll = 3; /** Optional Enable automatic scrolling for the character LCD. **/ + string message = 1; /** Message to write to the character LCD. **/ + bool enable_backlight = 2; /** Whether to enable the backlight. Defaults to True. **/ } - +/** +* OLEDWrite represents a request from the broker to write to a OLED display. +*/ +message OLEDWrite { + string message = 1; /** Message to write to an OLED display. **/ +} \ No newline at end of file From ed54f4d7964fb6edd3a8f330b8ed612529d4bbd4 Mon Sep 17 00:00:00 2001 From: brentru Date: Wed, 21 May 2025 13:17:13 -0400 Subject: [PATCH 146/188] add OLEDWrite submsg --- proto/wippersnapper/i2c.proto | 1 + 1 file changed, 1 insertion(+) diff --git a/proto/wippersnapper/i2c.proto b/proto/wippersnapper/i2c.proto index a7af1c16..d7aecbfa 100644 --- a/proto/wippersnapper/i2c.proto +++ b/proto/wippersnapper/i2c.proto @@ -127,5 +127,6 @@ message I2cDeviceOutputWrite { oneof output_msg { wippersnapper.i2c_output.LedBackpackWrite write_led_backpack = 2; /** Optional - If the I2C device is a LED backpack, fill this field. **/ wippersnapper.i2c_output.CharLCDWrite write_char_lcd = 3; /** Optional - If the I2C device is a character LCD, fill this field. **/ + wippersnapper.i2c_output.OLEDWrite write_oled = 4; /** Optional - If the I2C device is an OLED display, fill this field. **/ } } From e1112c50a497f63f1370af0e61d117242adcd6d3 Mon Sep 17 00:00:00 2001 From: brentru Date: Thu, 22 May 2025 15:29:10 -0400 Subject: [PATCH 147/188] UART revisions --- proto/wippersnapper/uart.proto | 160 ++++++++++++++++++++++----------- 1 file changed, 107 insertions(+), 53 deletions(-) diff --git a/proto/wippersnapper/uart.proto b/proto/wippersnapper/uart.proto index 49d7d695..695fb153 100644 --- a/proto/wippersnapper/uart.proto +++ b/proto/wippersnapper/uart.proto @@ -2,60 +2,122 @@ // SPDX-License-Identifier: MIT syntax = "proto3"; package wippersnapper.uart; -import "sensor.proto"; /** -* SerialConfig contains the configuration (data, parity, and stop bits) for a serial bus. +* UartPacketFormat contains the configuration data, parity, and stop bits for a serial bus. */ -enum SerialConfig { - SERIAL_CONFIG_UNSPECIFIED = 0; // Config was not specified by IO. - SERIAL_CONFIG_8N1 = 1; // 8 data bits, no parity, 1 stop bit - SERIAL_CONFIG_5N1 = 2; // 5 data bits, no parity, 1 stop bit - SERIAL_CONFIG_6N1 = 3; // 6 data bits, no parity, 1 stop bit - SERIAL_CONFIG_7N1 = 4; // 7 data bits, no parity, 1 stop bit - SERIAL_CONFIG_5N2 = 5; // 5 data bits, no parity, 2 stop bits - SERIAL_CONFIG_6N2 = 6; // 6 data bits, no parity, 2 stop bits - SERIAL_CONFIG_7N2 = 7; // 7 data bits, no parity, 2 stop bits - SERIAL_CONFIG_8N2 = 8; // 8 data bits, no parity, 2 stop bits - SERIAL_CONFIG_5E1 = 9; // 5 data bits, even parity, 1 stop bit - SERIAL_CONFIG_6E1 = 10; // 6 data bits, even parity, 1 stop bit - SERIAL_CONFIG_7E1 = 11; // 7 data bits, even parity, 1 stop bit - SERIAL_CONFIG_8E1 = 12; // 8 data bits, even parity, 1 stop bit - SERIAL_CONFIG_5E2 = 13; // 5 data bits, even parity, 2 stop bits - SERIAL_CONFIG_6E2 = 14; // 6 data bits, even parity, 2 stop bits - SERIAL_CONFIG_7E2 = 15; // 7 data bits, even parity, 2 stop bits - SERIAL_CONFIG_8E2 = 16; // 8 data bits, even parity, 2 stop bits - SERIAL_CONFIG_5O1 = 17; // 5 data bits, odd parity, 1 stop bit - SERIAL_CONFIG_6O1 = 18; // 6 data bits, odd parity, 1 stop bit - SERIAL_CONFIG_7O1 = 19; // 7 data bits, odd parity, 1 stop bit - SERIAL_CONFIG_8O1 = 20; // 8 data bits, odd parity, 1 stop bit - SERIAL_CONFIG_5O2 = 21; // 5 data bits, odd parity, 2 stop bits - SERIAL_CONFIG_6O2 = 22; // 6 data bits, odd parity, 2 stop bits - SERIAL_CONFIG_7O2 = 23; // 7 data bits, odd parity, 2 stop bits - SERIAL_CONFIG_8O2 = 24; // 8 data bits, odd parity, 2 stop bits +enum UartPacketFormat { + UART_PACKET_FORMAT_UNSPECIFIED = 0; // Format was not specified by IO. + UART_PACKET_FORMAT_8N1 = 1; // 8 data bits, no parity, 1 stop bit + UART_PACKET_FORMAT_5N1 = 2; // 5 data bits, no parity, 1 stop bit + UART_PACKET_FORMAT_6N1 = 3; // 6 data bits, no parity, 1 stop bit + UART_PACKET_FORMAT_7N1 = 4; // 7 data bits, no parity, 1 stop bit + UART_PACKET_FORMAT_5N2 = 5; // 5 data bits, no parity, 2 stop bits + UART_PACKET_FORMAT_6N2 = 6; // 6 data bits, no parity, 2 stop bits + UART_PACKET_FORMAT_7N2 = 7; // 7 data bits, no parity, 2 stop bits + UART_PACKET_FORMAT_8N2 = 8; // 8 data bits, no parity, 2 stop bits + UART_PACKET_FORMAT_5E1 = 9; // 5 data bits, even parity, 1 stop bit + UART_PACKET_FORMAT_6E1 = 10; // 6 data bits, even parity, 1 stop bit + UART_PACKET_FORMAT_7E1 = 11; // 7 data bits, even parity, 1 stop bit + UART_PACKET_FORMAT_8E1 = 12; // 8 data bits, even parity, 1 stop bit + UART_PACKET_FORMAT_5E2 = 13; // 5 data bits, even parity, 2 stop bits + UART_PACKET_FORMAT_6E2 = 14; // 6 data bits, even parity, 2 stop bits + UART_PACKET_FORMAT_7E2 = 15; // 7 data bits, even parity, 2 stop bits + UART_PACKET_FORMAT_8E2 = 16; // 8 data bits, even parity, 2 stop bits + UART_PACKET_FORMAT_5O1 = 17; // 5 data bits, odd parity, 1 stop bit + UART_PACKET_FORMAT_6O1 = 18; // 6 data bits, odd parity, 1 stop bit + UART_PACKET_FORMAT_7O1 = 19; // 7 data bits, odd parity, 1 stop bit + UART_PACKET_FORMAT_8O1 = 20; // 8 data bits, odd parity, 1 stop bit + UART_PACKET_FORMAT_5O2 = 21; // 5 data bits, odd parity, 2 stop bits + UART_PACKET_FORMAT_6O2 = 22; // 6 data bits, odd parity, 2 stop bits + UART_PACKET_FORMAT_7O2 = 23; // 7 data bits, odd parity, 2 stop bits + UART_PACKET_FORMAT_8O2 = 24; // 8 data bits, odd parity, 2 stop bits } /** -* UARTBusData represents a message to configure a UART bus for communication with a device. -* NOTE: This message is never sent directly, it is packed inside UARTAdd. +* UartDeviceType represents the type of device connected to the UART bus. +* This is used to determine the driver to use for the device. */ -message UARTBusData { - string bus_id = 1; /** The ID of the Serial bus (i.e: Serial, Serial1, "SoftwareSerial"). */ - uint32 baud_rate = 2; /** The desired baudrate, in bits per second. */ - SerialConfig config = 3; /** Configures the data, parity, and stop bits. */ - string rx_pin = 4; /** Optional: The pin on which to receive on. */ - string tx_pin = 5; /** Optional: The pin on which to transmit with. */ - bool invert = 6; /** Optional: Inverts the UART signal on RX and TX pins. Defaults to False. */ - float timeout = 7; /** Optional: The timeout, in milliseconds, for the UART bus. */ +enum UartDeviceType { + UART_DEVICE_TYPE_UNSPECIFIED = 0; /** Unspecified device type. */ + UART_DEVICE_TYPE_GENERIC_INPUT = 1; /** Use UART input. */ + UART_DEVICE_TYPE_GENERIC_OUTPUT = 2; /** Use the Generic UART output driver. */ + UART_DEVICE_TYPE_GPS = 3; /** Use the GPS driver. */ + UART_DEVICE_TYPE_PM25AQI = 4; /** Use the PM2.5 driver. */ + UART_DEVICE_TYPE_TM22XX = 5; /** Use the TM22XX stepper driver. */ } /** -* UARTAdd represents a message sent from IO to a device -* to configure a UART bus for communication with a driver. +* GenericDeviceLineEnding represents the line ending used by the device. +* This is used to determine how to parse the incoming data. */ -message UARTAdd { - UARTBusData config = 1; /** The UART bus configuration. */ - string driver = 2; /** The unique identifier of the UART driver. */ +enum GenericDeviceLineEnding { + GENERIC_DEVICE_LINE_ENDING_UNSPECIFIED = 0; /** Unspecified line ending. */ + GENERIC_DEVICE_LINE_ENDING_LF = 1; /** Newline (LF). */ + GENERIC_DEVICE_LINE_ENDING_CRLF = 2; /** Carriage return (CR) and newline (LF). */ + GENERIC_DEVICE_LINE_ENDING_TIMEOUT_100MS = 3; /** 100ms timeout. */ + GENERIC_DEVICE_LINE_ENDING_TIMEOUT_1000MS = 4; /** 1s timeout. */ +} + +/** +* UartSerialConfig represents a message to configure the Serial (eg: HardwareSerial, SoftwareSerial). +* This message is never sent directly, it is packed inside UartAdd. +*/ +message UartSerialConfig { + string pin_rx = 1; /** The pin on which to receive on. */ + string pin_tx = 2; /** The pin on which to transmit with. */ + uint32 baud_rate = 3; /** The desired baudrate, in bits per second. */ + UartPacketFormat format = 4; /** The data, parity, and stop bits. */ + float timeout = 5; /** Maximum milliseconds to wait for serial data. Defaults to 1000 ms. */ + bool use_sw_serial = 6; /** Use software serial instead of hardware serial. Defaults to False. */ + bool sw_serial_invert = 7; /** Optional: Inverts the UART signal on RX and TX pins. Defaults to False. */ +} + +/** +* GenericUartInputConfig represents a message sent from IO to a device +* containing device-specific configuration info for generic UART input devices. +*/ +message GenericUartInputConfig { + string name = 1; /** The name used to identify the device. */ + GenericDeviceLineEnding line_ending = 2; /** The line ending used by the device. */ +} + +/** +* TrinamicDynamixelConfig represents a message sent from IO to a device +* containing device-specific configuration info for Trinamic stepper or DYNAMIXEL servos. +*/ +message TrinamicDynamixelConfig { + uint32 device_id = 1; /** The device identifier, used for sub-addressing (multiple servos on one UART). */ +} + +/** +* PM25AQIConfig represents a message sent from IO to a device +* containing device-specific configuration info for PM2.5 AQI sensors. +*/ +message PM25AQIConfig { + bool is_pm1006 = 1; /** True if the device is a PM1006 AQ sensor, Defaults to False. */ +} + +/** +* UartDeviceConfig represents a message sent from IO to a device +* containing device-specific configuration data. +* This message is never sent directly, it is packed inside UartAdd. +*/ +message UartDeviceConfig { + UartDeviceType device_type = 1; /** The type of device connected to the UART bus. */ + GenericUartInputConfig generic_uart_input_config = 2; /** OPTIONAL configuration for a generic UART input device. */ + TrinamicDynamixelConfig trinamic_dynamixel_config = 3; /** OPTIONAL configuration for a Trinamic stepper or DYNAMIXEL servo. */ + PM25AQIConfig pm25aqi_config = 4; /** OPTIONAL configuration for a PM2.5 AQI sensor. */ +} + +/** +* UartAdd represents a message sent from IO to a device +* to configure a device on a UART bus for communication. +*/ +message UartAdd { + string id = 1; /** The unique identifier of the UART device. */ + UartSerialConfig config = 2; /** The Serial configuration. */ + repeated string config_commands = 3; /** OPTIONAL commands to send to the device to configure it. */ } /** @@ -63,7 +125,7 @@ message UARTAdd { * confirm that a device has been attached to the UART bus. */ message UARTAdded { - string driver = 1; /** The unique identifier of the UART driver. */ + string id = 1; /** The unique identifier of the UART device. */ bool success = 2; /** True if the UART bus was successfully initialized, False otherwise. */ } @@ -72,13 +134,5 @@ message UARTAdded { * to detach a driver from the UART bus and deinitialize the bus. */ message UARTRemove { - string driver = 1; /** The unique identifier of the UART driver. */ -} - -/** -* UARTEvent represents incoming data from a UART sensor. -*/ -message UARTEvent { - string driver = 1; /** The unique identifier of the UART driver. */ - repeated wippersnapper.sensor.SensorEvent sensor_events = 2; /** An optionally repeated event from a sensor. */ + string id = 1; /** The unique identifier of the UART device. */ } From 31d646dee5d325ca590476fcf9a43b60621d2432 Mon Sep 17 00:00:00 2001 From: brentru Date: Thu, 22 May 2025 15:30:04 -0400 Subject: [PATCH 148/188] update .options and signal --- proto/wippersnapper/signal.proto | 1 - proto/wippersnapper/uart.options | 10 +--------- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/proto/wippersnapper/signal.proto b/proto/wippersnapper/signal.proto index d50c786d..7706addc 100644 --- a/proto/wippersnapper/signal.proto +++ b/proto/wippersnapper/signal.proto @@ -89,7 +89,6 @@ message DeviceToBroker { wippersnapper.ds18x20.Ds18x20Event ds18x20_event = 80; // uart.proto wippersnapper.uart.UARTAdded uart_added = 90; - wippersnapper.uart.UARTEvent uart_event = 100; // i2c.proto wippersnapper.i2c.I2cBusScanned i2c_bus_scanned = 110; wippersnapper.i2c.I2cDeviceAddedOrReplaced i2c_device_added_replaced = 111; diff --git a/proto/wippersnapper/uart.options b/proto/wippersnapper/uart.options index 06643dd9..7283df13 100644 --- a/proto/wippersnapper/uart.options +++ b/proto/wippersnapper/uart.options @@ -1,9 +1 @@ -# uart.options -wippersnapper.uart.UARTBusData.bus_id max_count:15 -wippersnapper.uart.UARTBusData.rx_pin max_count:15 -wippersnapper.uart.UARTBusData.tx_pin max_count:15 -wippersnapper.uart.UARTAdd.driver max_count:15 -wippersnapper.uart.UARTAdded.driver max_count:15 -wippersnapper.uart.UARTRemove.driver max_count:15 -wippersnapper.uart.UARTEvent.driver max_count:15 -wippersnapper.uart.UARTEvent.sensor_events max_size:2 \ No newline at end of file +# uart.options \ No newline at end of file From d12a7928982a12626fc1c65d2e31922ea234bd8a Mon Sep 17 00:00:00 2001 From: brentru Date: Thu, 22 May 2025 15:32:06 -0400 Subject: [PATCH 149/188] Fix naming in signal --- proto/wippersnapper/signal.proto | 6 +++--- proto/wippersnapper/uart.proto | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/proto/wippersnapper/signal.proto b/proto/wippersnapper/signal.proto index 7706addc..b349d34b 100644 --- a/proto/wippersnapper/signal.proto +++ b/proto/wippersnapper/signal.proto @@ -51,8 +51,8 @@ message BrokerToDevice { wippersnapper.ds18x20.Ds18x20Add ds18x20_add = 70; wippersnapper.ds18x20.Ds18x20Remove ds18x20_remove = 71; // uart.proto - wippersnapper.uart.UARTAdd uart_add = 80; - wippersnapper.uart.UARTRemove uart_remove = 81; + wippersnapper.uart.UartAdd uart_add = 80; + wippersnapper.uart.UartRemove uart_remove = 81; // i2c.proto wippersnapper.i2c.I2cBusScan i2c_bus_scan = 90; wippersnapper.i2c.I2cDeviceAddOrReplace i2c_device_add_replace = 91; @@ -88,7 +88,7 @@ message DeviceToBroker { wippersnapper.ds18x20.Ds18x20Added ds18x20_added = 70; wippersnapper.ds18x20.Ds18x20Event ds18x20_event = 80; // uart.proto - wippersnapper.uart.UARTAdded uart_added = 90; + wippersnapper.uart.UartAdded uart_added = 90; // i2c.proto wippersnapper.i2c.I2cBusScanned i2c_bus_scanned = 110; wippersnapper.i2c.I2cDeviceAddedOrReplaced i2c_device_added_replaced = 111; diff --git a/proto/wippersnapper/uart.proto b/proto/wippersnapper/uart.proto index 695fb153..c13d056f 100644 --- a/proto/wippersnapper/uart.proto +++ b/proto/wippersnapper/uart.proto @@ -121,18 +121,18 @@ message UartAdd { } /** -* UARTAdded represents a message sent from a device to IO to +* UartAdded represents a message sent from a device to IO to * confirm that a device has been attached to the UART bus. */ -message UARTAdded { +message UartAdded { string id = 1; /** The unique identifier of the UART device. */ bool success = 2; /** True if the UART bus was successfully initialized, False otherwise. */ } /* -* UARTRemove represents a message sent from IO to a device +* UartRemove represents a message sent from IO to a device * to detach a driver from the UART bus and deinitialize the bus. */ -message UARTRemove { +message UartRemove { string id = 1; /** The unique identifier of the UART device. */ } From 8d6fcab03686da1de9f9dee3cd763645017606db Mon Sep 17 00:00:00 2001 From: brentru Date: Thu, 22 May 2025 16:56:47 -0400 Subject: [PATCH 150/188] Add UARTWrite/UARTWritten req/resp --- proto/wippersnapper/signal.proto | 2 ++ proto/wippersnapper/uart.proto | 25 +++++++++++++++++++++++-- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/proto/wippersnapper/signal.proto b/proto/wippersnapper/signal.proto index b349d34b..f7c01f27 100644 --- a/proto/wippersnapper/signal.proto +++ b/proto/wippersnapper/signal.proto @@ -53,6 +53,7 @@ message BrokerToDevice { // uart.proto wippersnapper.uart.UartAdd uart_add = 80; wippersnapper.uart.UartRemove uart_remove = 81; + wippersnapper.uart.UartWrite uart_write = 82; // i2c.proto wippersnapper.i2c.I2cBusScan i2c_bus_scan = 90; wippersnapper.i2c.I2cDeviceAddOrReplace i2c_device_add_replace = 91; @@ -89,6 +90,7 @@ message DeviceToBroker { wippersnapper.ds18x20.Ds18x20Event ds18x20_event = 80; // uart.proto wippersnapper.uart.UartAdded uart_added = 90; + wippersnapper.uart.UartWritten uart_written = 91; // i2c.proto wippersnapper.i2c.I2cBusScanned i2c_bus_scanned = 110; wippersnapper.i2c.I2cDeviceAddedOrReplaced i2c_device_added_replaced = 111; diff --git a/proto/wippersnapper/uart.proto b/proto/wippersnapper/uart.proto index c13d056f..393ff29e 100644 --- a/proto/wippersnapper/uart.proto +++ b/proto/wippersnapper/uart.proto @@ -55,8 +55,8 @@ enum GenericDeviceLineEnding { GENERIC_DEVICE_LINE_ENDING_UNSPECIFIED = 0; /** Unspecified line ending. */ GENERIC_DEVICE_LINE_ENDING_LF = 1; /** Newline (LF). */ GENERIC_DEVICE_LINE_ENDING_CRLF = 2; /** Carriage return (CR) and newline (LF). */ - GENERIC_DEVICE_LINE_ENDING_TIMEOUT_100MS = 3; /** 100ms timeout. */ - GENERIC_DEVICE_LINE_ENDING_TIMEOUT_1000MS = 4; /** 1s timeout. */ + GENERIC_DEVICE_LINE_ENDING_TIMEOUT_100MS = 3; /** 100ms timeout - sensor returns every 100ms with a new Event. */ + GENERIC_DEVICE_LINE_ENDING_TIMEOUT_1000MS = 4; /** 1s timeout - device returns every 1s with a new Event. */ } /** @@ -136,3 +136,24 @@ message UartAdded { message UartRemove { string id = 1; /** The unique identifier of the UART device. */ } + +/** +* UartWrite represents a message sent from IO to a device +* to write data to a device. +*/ +message UartWrite { + string id = 1; /** The unique identifier of the UART device. */ + oneof payload { + bytes bytes_data = 2; /** Raw data to send to the device, corresponds to the Wiring API Serial.write(). */ + string text_data = 3; /** String to send to the device, corresponds to the Wiring API Serial.print(). */ + } +} + +/** +* UartWritten represents the number of bytes written to a device.enum +* This message is sent from a device to IO to confirm that data has been written to the device. +*/ +message UartWritten { + string id = 1; /** The unique identifier of the UART device. */ + uint32 bytes_written = 2; /** The number of bytes written to the device. */ +} From c6334b87f4d03461c2cd8beff4fd664fcf170808 Mon Sep 17 00:00:00 2001 From: brentru Date: Tue, 27 May 2025 15:58:40 -0400 Subject: [PATCH 151/188] Add: GPS.proto --- proto/wippersnapper/gps.proto | 51 ++++++++++++++++++++++++++++++++ proto/wippersnapper/signal.proto | 4 +++ proto/wippersnapper/uart.proto | 4 ++- 3 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 proto/wippersnapper/gps.proto diff --git a/proto/wippersnapper/gps.proto b/proto/wippersnapper/gps.proto new file mode 100644 index 00000000..5c291604 --- /dev/null +++ b/proto/wippersnapper/gps.proto @@ -0,0 +1,51 @@ +// SPDX-FileCopyrightText: 2025 Brent Rubell for Adafruit Industries +// SPDX-License-Identifier: MIT +syntax = "proto3"; +package wippersnapper.gps; + +/** + * GPSConfig represents a message containing configuration data to set up and configure a GPS. + * Since GPS devices can output lots of data, this message allows users to select which data they want to receive + * and a resulting command string to initialize the GPS device with the selected options will be generated. + */ +message GPSConfig { + string config_msg = 1; /** Initilization command (PMTK for MediaTek, or similar for other chipsets) **/ + // Baud rate is not included here as it is included in the UartAdd->UartSerialConfig message. +} + +/** GPSDateTime represents the date and time information from a GPRMC/GPGGA string **/ +message GPSDateTime { + int32 hour = 1; /** Hour of the day (0-23) **/ + int32 minute = 2; /** Minute of the hour (0-59) **/ + int32 seconds = 3; /** Seconds of the minute (0-59) **/ + int32 milliseconds = 4; /** Milliseconds (0-999) **/ + int32 day = 5; /** Day of the month (1-31) **/ + int32 month = 6; /** Month of the year (1-12) **/ + int32 year = 7; /** Year (e.g., 2023) **/ +} + +/** GPSRMCResponse represents the response from a GPS RMC (Recommended Minimum Specific GPS/Transit Data) message. **/ +message GPSRMCResponse { + GPSDateTime datetime = 1; /** Date and time of the GPS data **/ + string fix_status = 2; /** Fix status: 'A' for active **/ + string lat = 4; /** Latitude in decimal degrees **/ + string lat_dir = 5; /** Latitude direction: 'North' or 'South' **/ + string lon = 6; /** Longitude in decimal degrees **/ + string lon_dir = 7; /** Longitude direction: 'East' or 'West' **/ + string speed = 8; /** Speed, in knots **/ + string angle = 9; /** Course/heading angle, in degrees **/ +} + +/** GPGGAResponse represents the response from a GPS GGA (Global Positioning System Fix Data) message. **/ +message GPGGAResponse { + GPSDateTime datetime = 1; /** Date and time of the GPS data **/ + string lat = 4; /** Latitude in decimal degrees **/ + string lat_dir = 5; /** Latitude direction: 'N' or 'S' **/ + string lon = 6; /** Longitude in decimal degrees **/ + string lon_dir = 7; /** Longitude direction: 'E' or 'W' **/ + int32 fix_quality = 8; /** Quality of the GPS fix (0-3) **/ + int32 num_satellites = 9; /** Number of satellites in use **/ + string hdop = 10; /** HDOP- horizontal dilution of precision **/ + string altitude = 11; /** Altitude in meters above MSL **/ + string geoid_height = 12; /** Diff between geoid height and WGS84 height **/ +} \ No newline at end of file diff --git a/proto/wippersnapper/signal.proto b/proto/wippersnapper/signal.proto index f7c01f27..9182c1f1 100644 --- a/proto/wippersnapper/signal.proto +++ b/proto/wippersnapper/signal.proto @@ -14,6 +14,7 @@ import "pixels.proto"; import "pwm.proto"; import "servo.proto"; import "uart.proto"; +import "gps.proto"; /* * BrokerToDevice @@ -96,5 +97,8 @@ message DeviceToBroker { wippersnapper.i2c.I2cDeviceAddedOrReplaced i2c_device_added_replaced = 111; wippersnapper.i2c.I2cDeviceRemoved i2c_device_removed = 112; wippersnapper.i2c.I2cDeviceEvent i2c_device_event = 113; + // gps.proto + wippersnapper.gps.GPSRMCResponse gps_rmc_response = 120; + wippersnapper.gps.GPGGAResponse gps_gga_response = 121; } } diff --git a/proto/wippersnapper/uart.proto b/proto/wippersnapper/uart.proto index 393ff29e..d7417583 100644 --- a/proto/wippersnapper/uart.proto +++ b/proto/wippersnapper/uart.proto @@ -2,6 +2,7 @@ // SPDX-License-Identifier: MIT syntax = "proto3"; package wippersnapper.uart; +import "gps.proto"; /** * UartPacketFormat contains the configuration data, parity, and stop bits for a serial bus. @@ -108,6 +109,7 @@ message UartDeviceConfig { GenericUartInputConfig generic_uart_input_config = 2; /** OPTIONAL configuration for a generic UART input device. */ TrinamicDynamixelConfig trinamic_dynamixel_config = 3; /** OPTIONAL configuration for a Trinamic stepper or DYNAMIXEL servo. */ PM25AQIConfig pm25aqi_config = 4; /** OPTIONAL configuration for a PM2.5 AQI sensor. */ + wippersnapper.gps.GPSConfig gps_config = 5; /** OPTIONAL configuration for a GPS RMC response. */ } /** @@ -117,7 +119,7 @@ message UartDeviceConfig { message UartAdd { string id = 1; /** The unique identifier of the UART device. */ UartSerialConfig config = 2; /** The Serial configuration. */ - repeated string config_commands = 3; /** OPTIONAL commands to send to the device to configure it. */ + UartDeviceConfig device_config = 3; /** The device-specific configuration. */ } /** From 1a08875bcf9042543057e6f3f44d96f5fa793a2c Mon Sep 17 00:00:00 2001 From: brentru Date: Tue, 27 May 2025 16:03:13 -0400 Subject: [PATCH 152/188] Sort mports alphabetically --- proto/wippersnapper/signal.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proto/wippersnapper/signal.proto b/proto/wippersnapper/signal.proto index 9182c1f1..a87f2014 100644 --- a/proto/wippersnapper/signal.proto +++ b/proto/wippersnapper/signal.proto @@ -7,6 +7,7 @@ import "checkin.proto"; import "digitalio.proto"; import "ds18x20.proto"; import "error.proto"; +import "gps.proto"; import "i2c.proto"; import "i2c_output.proto"; import "nanopb.proto"; @@ -14,7 +15,6 @@ import "pixels.proto"; import "pwm.proto"; import "servo.proto"; import "uart.proto"; -import "gps.proto"; /* * BrokerToDevice From 2aec8f6b9e91edb088de4709be9906a45f1e7062 Mon Sep 17 00:00:00 2001 From: brentru Date: Tue, 27 May 2025 16:36:18 -0400 Subject: [PATCH 153/188] Add Options file for GPS --- proto/wippersnapper/gps.options | 16 ++++++++++++++++ proto/wippersnapper/gps.proto | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 proto/wippersnapper/gps.options diff --git a/proto/wippersnapper/gps.options b/proto/wippersnapper/gps.options new file mode 100644 index 00000000..e26c3ef8 --- /dev/null +++ b/proto/wippersnapper/gps.options @@ -0,0 +1,16 @@ +# gps.options +wippersnapper.gps.GPSConfig.config_msg max_size:256 +wippersnapper.gps.GPSRMCResponse.fix_status max_size:2 +wippersnapper.gps.GPSRMCResponse.lat max_size:12 +wippersnapper.gps.GPSRMCResponse.lat_dir max_size:6 +wippersnapper.gps.GPSRMCResponse.lon max_size:12 +wippersnapper.gps.GPSRMCResponse.lon_dir max_size:6 +wippersnapper.gps.GPSRMCResponse.speed max_size:8 +wippersnapper.gps.GPSRMCResponse.angle max_size:7 +wippersnapper.gps.GPGGAResponse.lat max_size:12 +wippersnapper.gps.GPGGAResponse.lat_dir max_size:6 +wippersnapper.gps.GPGGAResponse.lon max_size:12 +wippersnapper.gps.GPGGAResponse.lon_dir max_size:6 +wippersnapper.gps.GPGGAResponse.hdop max_size:6 +wippersnapper.gps.GPGGAResponse.altitude max_size:8 +wippersnapper.gps.GPGGAResponse.geoid_height max_size:10 \ No newline at end of file diff --git a/proto/wippersnapper/gps.proto b/proto/wippersnapper/gps.proto index 5c291604..8094fc26 100644 --- a/proto/wippersnapper/gps.proto +++ b/proto/wippersnapper/gps.proto @@ -27,7 +27,7 @@ message GPSDateTime { /** GPSRMCResponse represents the response from a GPS RMC (Recommended Minimum Specific GPS/Transit Data) message. **/ message GPSRMCResponse { GPSDateTime datetime = 1; /** Date and time of the GPS data **/ - string fix_status = 2; /** Fix status: 'A' for active **/ + string fix_status = 2; /** Fix status: 'A' for active, 'V' for void **/ string lat = 4; /** Latitude in decimal degrees **/ string lat_dir = 5; /** Latitude direction: 'North' or 'South' **/ string lon = 6; /** Longitude in decimal degrees **/ From 969a60baa45707f6f8e509192f608db9cd77c43d Mon Sep 17 00:00:00 2001 From: brentru Date: Wed, 28 May 2025 14:20:44 -0400 Subject: [PATCH 154/188] Update uart.proto, uart.options --- proto/wippersnapper/uart.options | 3 ++- proto/wippersnapper/uart.proto | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/proto/wippersnapper/uart.options b/proto/wippersnapper/uart.options index 7283df13..d37765a5 100644 --- a/proto/wippersnapper/uart.options +++ b/proto/wippersnapper/uart.options @@ -1 +1,2 @@ -# uart.options \ No newline at end of file +# uart.options +wippersnapper.UartAdd.id max_size: 32 \ No newline at end of file diff --git a/proto/wippersnapper/uart.proto b/proto/wippersnapper/uart.proto index d7417583..dce5804e 100644 --- a/proto/wippersnapper/uart.proto +++ b/proto/wippersnapper/uart.proto @@ -117,9 +117,9 @@ message UartDeviceConfig { * to configure a device on a UART bus for communication. */ message UartAdd { - string id = 1; /** The unique identifier of the UART device. */ - UartSerialConfig config = 2; /** The Serial configuration. */ - UartDeviceConfig device_config = 3; /** The device-specific configuration. */ + string id = 1; /** The unique identifier of the UART device. */ + UartSerialConfig cfg_serial = 2; /** The Serial configuration. */ + UartDeviceConfig cfg_device = 3; /** The device-specific configuration. */ } /** From e6b79ff4b165c6161a67994c217721281a20fe72 Mon Sep 17 00:00:00 2001 From: brentru Date: Wed, 28 May 2025 16:55:21 -0400 Subject: [PATCH 155/188] Update uart.options --- proto/wippersnapper/uart.options | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/proto/wippersnapper/uart.options b/proto/wippersnapper/uart.options index d37765a5..b8aa759e 100644 --- a/proto/wippersnapper/uart.options +++ b/proto/wippersnapper/uart.options @@ -1,2 +1,6 @@ # uart.options -wippersnapper.UartAdd.id max_size: 32 \ No newline at end of file +wippersnapper.uart.UartAdd.id max_size: 32 +wippersnapper.uart.UartAdded max_size: 32 +wippersnapper.uart.UartRemove max_size: 32 +wippersnapper.uart.UartSerialConfig.pin_rx max_size: 16 +wippersnapper.uart.UartSerialConfig.pin_tx max_size: 16 \ No newline at end of file From 4bd2f75e387934a968644b5cf0ca9d1d9b60b82f Mon Sep 17 00:00:00 2001 From: brentru Date: Thu, 29 May 2025 11:46:33 -0400 Subject: [PATCH 156/188] Update uart.proto - include uart_nbr --- proto/wippersnapper/uart.proto | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/proto/wippersnapper/uart.proto b/proto/wippersnapper/uart.proto index dce5804e..837521ba 100644 --- a/proto/wippersnapper/uart.proto +++ b/proto/wippersnapper/uart.proto @@ -67,11 +67,12 @@ enum GenericDeviceLineEnding { message UartSerialConfig { string pin_rx = 1; /** The pin on which to receive on. */ string pin_tx = 2; /** The pin on which to transmit with. */ - uint32 baud_rate = 3; /** The desired baudrate, in bits per second. */ - UartPacketFormat format = 4; /** The data, parity, and stop bits. */ - float timeout = 5; /** Maximum milliseconds to wait for serial data. Defaults to 1000 ms. */ - bool use_sw_serial = 6; /** Use software serial instead of hardware serial. Defaults to False. */ - bool sw_serial_invert = 7; /** Optional: Inverts the UART signal on RX and TX pins. Defaults to False. */ + uint32 uart_nbr = 3; /** The UART bus number to use, eg: 0, 1, 2, etc. */ + uint32 baud_rate = 4; /** The desired baudrate, in bits per second. */ + UartPacketFormat format = 5; /** The data, parity, and stop bits. */ + float timeout = 6; /** Maximum milliseconds to wait for serial data. Defaults to 1000 ms. */ + bool use_sw_serial = 7; /** Use software serial instead of hardware serial. Defaults to False. */ + bool sw_serial_invert = 8; /** Optional: Inverts the UART signal on RX and TX pins. Defaults to False. */ } /** From 517e1de611c1b83fc4ab69bba6f7e17b60c323e1 Mon Sep 17 00:00:00 2001 From: brentru Date: Thu, 29 May 2025 13:38:05 -0400 Subject: [PATCH 157/188] Uart.proto - Add more detailed addressing --- proto/wippersnapper/uart.options | 8 +++-- proto/wippersnapper/uart.proto | 50 ++++++++++++++++++++------------ 2 files changed, 37 insertions(+), 21 deletions(-) diff --git a/proto/wippersnapper/uart.options b/proto/wippersnapper/uart.options index b8aa759e..09f372fa 100644 --- a/proto/wippersnapper/uart.options +++ b/proto/wippersnapper/uart.options @@ -1,6 +1,8 @@ # uart.options -wippersnapper.uart.UartAdd.id max_size: 32 -wippersnapper.uart.UartAdded max_size: 32 -wippersnapper.uart.UartRemove max_size: 32 +wippersnapper.uart.UartAdd.device_id max_size: 32 +wippersnapper.uart.UartAdded.device_id max_size: 32 +wippersnapper.uart.UartRemove.device_id max_size: 32 +wippersnapper.uart.UartWrite.device_id max_size: 32 +wippersnapper.uart.UartWritten.device_id max_size: 32 wippersnapper.uart.UartSerialConfig.pin_rx max_size: 16 wippersnapper.uart.UartSerialConfig.pin_tx max_size: 16 \ No newline at end of file diff --git a/proto/wippersnapper/uart.proto b/proto/wippersnapper/uart.proto index 837521ba..134c4cc5 100644 --- a/proto/wippersnapper/uart.proto +++ b/proto/wippersnapper/uart.proto @@ -5,7 +5,7 @@ package wippersnapper.uart; import "gps.proto"; /** -* UartPacketFormat contains the configuration data, parity, and stop bits for a serial bus. +* UartPacketFormat contains the configuration data, parity, and stop bits for a serial port. */ enum UartPacketFormat { UART_PACKET_FORMAT_UNSPECIFIED = 0; // Format was not specified by IO. @@ -36,7 +36,7 @@ enum UartPacketFormat { } /** -* UartDeviceType represents the type of device connected to the UART bus. +* UartDeviceType represents the type of device connected to the UART port. * This is used to determine the driver to use for the device. */ enum UartDeviceType { @@ -67,7 +67,7 @@ enum GenericDeviceLineEnding { message UartSerialConfig { string pin_rx = 1; /** The pin on which to receive on. */ string pin_tx = 2; /** The pin on which to transmit with. */ - uint32 uart_nbr = 3; /** The UART bus number to use, eg: 0, 1, 2, etc. */ + uint32 uart_nbr = 3; /** The UART port number to use, eg: 0, 1, 2, etc. */ uint32 baud_rate = 4; /** The desired baudrate, in bits per second. */ UartPacketFormat format = 5; /** The data, parity, and stop bits. */ float timeout = 6; /** Maximum milliseconds to wait for serial data. Defaults to 1000 ms. */ @@ -106,7 +106,7 @@ message PM25AQIConfig { * This message is never sent directly, it is packed inside UartAdd. */ message UartDeviceConfig { - UartDeviceType device_type = 1; /** The type of device connected to the UART bus. */ + UartDeviceType device_type = 1; /** The type of device connected to the UART port. */ GenericUartInputConfig generic_uart_input_config = 2; /** OPTIONAL configuration for a generic UART input device. */ TrinamicDynamixelConfig trinamic_dynamixel_config = 3; /** OPTIONAL configuration for a Trinamic stepper or DYNAMIXEL servo. */ PM25AQIConfig pm25aqi_config = 4; /** OPTIONAL configuration for a PM2.5 AQI sensor. */ @@ -115,29 +115,35 @@ message UartDeviceConfig { /** * UartAdd represents a message sent from IO to a device -* to configure a device on a UART bus for communication. +* to configure a device on a UART port for communication. */ message UartAdd { - string id = 1; /** The unique identifier of the UART device. */ - UartSerialConfig cfg_serial = 2; /** The Serial configuration. */ - UartDeviceConfig cfg_device = 3; /** The device-specific configuration. */ + UartSerialConfig cfg_serial = 1; /** The Serial configuration. */ + UartDeviceConfig cfg_device = 2; /** The device-specific configuration. */ } /** * UartAdded represents a message sent from a device to IO to -* confirm that a device has been attached to the UART bus. +* confirm that a device has been attached to the UART port. */ message UartAdded { - string id = 1; /** The unique identifier of the UART device. */ - bool success = 2; /** True if the UART bus was successfully initialized, False otherwise. */ + // Addressing + uint32 uart_nbr = 1; /** The UART port number (eg: 0, 1, 2, etc.) that the device was attached to. */ + UartDeviceType type = 2; /** The category of device attached to the UART port, corresponds to its driver type. */ + string device_id = 3; /** The unique identifier string for the UART device. */ + // Payload + bool success = 4; /** True if the device on the UART port was successfully initialized, False otherwise. */ } /* * UartRemove represents a message sent from IO to a device -* to detach a driver from the UART bus and deinitialize the bus. +* to detach a driver from the UART port and deinitialize the port. */ message UartRemove { - string id = 1; /** The unique identifier of the UART device. */ + // Addressing + uint32 uart_nbr = 1; /** The UART port number (eg: 0, 1, 2, etc.) that the device is attached to. */ + UartDeviceType type = 2; /** The category of device attached to the UART port, corresponds to its driver type. */ + string device_id = 3; /** The unique identifier string for the UART device. */ } /** @@ -145,10 +151,14 @@ message UartRemove { * to write data to a device. */ message UartWrite { - string id = 1; /** The unique identifier of the UART device. */ + // Addressing + uint32 uart_nbr = 1; /** The UART port number (eg: 0, 1, 2, etc.) that the device is attached to. */ + UartDeviceType type = 2; /** The category of device attached to the UART port, corresponds to its driver type. */ + string device_id = 3; /** The unique identifier string for the UART device. */ + // Payload oneof payload { - bytes bytes_data = 2; /** Raw data to send to the device, corresponds to the Wiring API Serial.write(). */ - string text_data = 3; /** String to send to the device, corresponds to the Wiring API Serial.print(). */ + bytes bytes_data = 4; /** Raw data to send to the device, corresponds to the Wiring API Serial.write(). */ + string text_data = 5; /** String to send to the device, corresponds to the Wiring API Serial.print(). */ } } @@ -157,6 +167,10 @@ message UartWrite { * This message is sent from a device to IO to confirm that data has been written to the device. */ message UartWritten { - string id = 1; /** The unique identifier of the UART device. */ - uint32 bytes_written = 2; /** The number of bytes written to the device. */ + // Addressing + uint32 uart_nbr = 1; /** The UART port number (eg: 0, 1, 2, etc.) that the device is attached to. */ + UartDeviceType type = 2; /** The category of device attached to the UART port, corresponds to its driver type. */ + string device_id = 3; /** The unique identifier string for the UART device. */ + // Payload + uint32 bytes_written = 4; /** The number of bytes written to the device. */ } From 578f2081b97894b1cf1d2f25a407c8c434b9b873 Mon Sep 17 00:00:00 2001 From: brentru Date: Thu, 29 May 2025 16:35:15 -0400 Subject: [PATCH 158/188] Uart.proto - Added device_id to UartDeviceConfig --- proto/wippersnapper/uart.options | 15 ++++++++------- proto/wippersnapper/uart.proto | 9 +++++---- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/proto/wippersnapper/uart.options b/proto/wippersnapper/uart.options index 09f372fa..f1d686a5 100644 --- a/proto/wippersnapper/uart.options +++ b/proto/wippersnapper/uart.options @@ -1,8 +1,9 @@ # uart.options -wippersnapper.uart.UartAdd.device_id max_size: 32 -wippersnapper.uart.UartAdded.device_id max_size: 32 -wippersnapper.uart.UartRemove.device_id max_size: 32 -wippersnapper.uart.UartWrite.device_id max_size: 32 -wippersnapper.uart.UartWritten.device_id max_size: 32 -wippersnapper.uart.UartSerialConfig.pin_rx max_size: 16 -wippersnapper.uart.UartSerialConfig.pin_tx max_size: 16 \ No newline at end of file +wippersnapper.uart.UartAdd.device_id max_size: 32 +wippersnapper.uart.UartDeviceConfig.device_id max_size: 32 +wippersnapper.uart.UartAdded.device_id max_size: 32 +wippersnapper.uart.UartRemove.device_id max_size: 32 +wippersnapper.uart.UartWrite.device_id max_size: 32 +wippersnapper.uart.UartWritten.device_id max_size: 32 +wippersnapper.uart.UartSerialConfig.pin_rx max_size: 16 +wippersnapper.uart.UartSerialConfig.pin_tx max_size: 16 \ No newline at end of file diff --git a/proto/wippersnapper/uart.proto b/proto/wippersnapper/uart.proto index 134c4cc5..598e22ae 100644 --- a/proto/wippersnapper/uart.proto +++ b/proto/wippersnapper/uart.proto @@ -107,10 +107,11 @@ message PM25AQIConfig { */ message UartDeviceConfig { UartDeviceType device_type = 1; /** The type of device connected to the UART port. */ - GenericUartInputConfig generic_uart_input_config = 2; /** OPTIONAL configuration for a generic UART input device. */ - TrinamicDynamixelConfig trinamic_dynamixel_config = 3; /** OPTIONAL configuration for a Trinamic stepper or DYNAMIXEL servo. */ - PM25AQIConfig pm25aqi_config = 4; /** OPTIONAL configuration for a PM2.5 AQI sensor. */ - wippersnapper.gps.GPSConfig gps_config = 5; /** OPTIONAL configuration for a GPS RMC response. */ + string device_id = 2; /** The unique identifier string for the UART device. */ + GenericUartInputConfig generic_uart_input_config = 3; /** OPTIONAL configuration for a generic UART input device. */ + TrinamicDynamixelConfig trinamic_dynamixel_config = 4; /** OPTIONAL configuration for a Trinamic stepper or DYNAMIXEL servo. */ + PM25AQIConfig pm25aqi_config = 5; /** OPTIONAL configuration for a PM2.5 AQI sensor. */ + wippersnapper.gps.GPSConfig gps_config = 6; /** OPTIONAL configuration for a GPS RMC response. */ } /** From 627652b8149e95ffcacc0e7b5b4a4a69199b28c6 Mon Sep 17 00:00:00 2001 From: brentru Date: Fri, 30 May 2025 11:11:45 -0400 Subject: [PATCH 159/188] Uart.proto - Add period field to all inputs --- proto/wippersnapper/uart.proto | 2 ++ 1 file changed, 2 insertions(+) diff --git a/proto/wippersnapper/uart.proto b/proto/wippersnapper/uart.proto index 598e22ae..946966cd 100644 --- a/proto/wippersnapper/uart.proto +++ b/proto/wippersnapper/uart.proto @@ -82,6 +82,7 @@ message UartSerialConfig { message GenericUartInputConfig { string name = 1; /** The name used to identify the device. */ GenericDeviceLineEnding line_ending = 2; /** The line ending used by the device. */ + int32 period = 3; /** The period to poll the device, in milliseconds */ } /** @@ -98,6 +99,7 @@ message TrinamicDynamixelConfig { */ message PM25AQIConfig { bool is_pm1006 = 1; /** True if the device is a PM1006 AQ sensor, Defaults to False. */ + int32 period = 2; /** The period to poll the device, in milliseconds */ } /** From 492e3a0313c208e9a9d3cc277d4027477e11e2a0 Mon Sep 17 00:00:00 2001 From: brentru Date: Fri, 30 May 2025 12:02:55 -0400 Subject: [PATCH 160/188] uart.proto - add sensor.proto event to req/resp --- proto/wippersnapper/signal.proto | 5 +++-- proto/wippersnapper/uart.proto | 28 +++++++++++++++++++++++----- 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/proto/wippersnapper/signal.proto b/proto/wippersnapper/signal.proto index a87f2014..93d8f262 100644 --- a/proto/wippersnapper/signal.proto +++ b/proto/wippersnapper/signal.proto @@ -90,8 +90,9 @@ message DeviceToBroker { wippersnapper.ds18x20.Ds18x20Added ds18x20_added = 70; wippersnapper.ds18x20.Ds18x20Event ds18x20_event = 80; // uart.proto - wippersnapper.uart.UartAdded uart_added = 90; - wippersnapper.uart.UartWritten uart_written = 91; + wippersnapper.uart.UartAdded uart_added = 90; + wippersnapper.uart.UartWritten uart_written = 91; + wippersnapper.uart.UartInputEvent uart_input_event = 92; // i2c.proto wippersnapper.i2c.I2cBusScanned i2c_bus_scanned = 110; wippersnapper.i2c.I2cDeviceAddedOrReplaced i2c_device_added_replaced = 111; diff --git a/proto/wippersnapper/uart.proto b/proto/wippersnapper/uart.proto index 946966cd..a8066249 100644 --- a/proto/wippersnapper/uart.proto +++ b/proto/wippersnapper/uart.proto @@ -2,6 +2,7 @@ // SPDX-License-Identifier: MIT syntax = "proto3"; package wippersnapper.uart; +import "sensor.proto"; import "gps.proto"; /** @@ -80,9 +81,10 @@ message UartSerialConfig { * containing device-specific configuration info for generic UART input devices. */ message GenericUartInputConfig { - string name = 1; /** The name used to identify the device. */ - GenericDeviceLineEnding line_ending = 2; /** The line ending used by the device. */ - int32 period = 3; /** The period to poll the device, in milliseconds */ + string name = 1; /** The name used to identify the device. */ + GenericDeviceLineEnding line_ending = 2; /** The line ending used by the device. */ + int32 period = 3; /** The period to poll the device, in milliseconds */ + repeated wippersnapper.sensor.SensorType i2c_device_sensor_types = 4; /** SI Types for each sensor on the I2c device. */ } /** @@ -98,8 +100,9 @@ message TrinamicDynamixelConfig { * containing device-specific configuration info for PM2.5 AQI sensors. */ message PM25AQIConfig { - bool is_pm1006 = 1; /** True if the device is a PM1006 AQ sensor, Defaults to False. */ - int32 period = 2; /** The period to poll the device, in milliseconds */ + bool is_pm1006 = 1; /** True if the device is a PM1006 AQ sensor, Defaults to False. */ + int32 period = 2; /** The period to poll the device, in milliseconds */ + repeated wippersnapper.sensor.SensorType i2c_device_sensor_types = 3; /** SI Types for each sensor on the I2c device. */ } /** @@ -177,3 +180,18 @@ message UartWritten { // Payload uint32 bytes_written = 4; /** The number of bytes written to the device. */ } + +/** +* UartInputEvent represents a message sent from a device to IO +* containing data from a UART input device. +* This message is sent from a device to IO to report sensor data. +* It can contain multiple SensorEvents if the device has multiple sensors. +*/ +message UartInputEvent { + // Addressing + uint32 uart_nbr = 1; /** The UART port number (eg: 0, 1, 2, etc.) that the device is attached to. */ + UartDeviceType type = 2; /** The category of device attached to the UART port, corresponds to its driver type. */ + string device_id = 3; /** The unique identifier string for the UART device. */ + // Payload + repeated wippersnapper.sensor.SensorEvent events = 4; /** Required, but optionally repeated, SensorEvent from a sensor. */ +} \ No newline at end of file From 4e422346d16bee4d6c87b2853db8c1b8c8477246 Mon Sep 17 00:00:00 2001 From: brentru Date: Fri, 30 May 2025 12:21:26 -0400 Subject: [PATCH 161/188] uart.proto - sort imports --- proto/wippersnapper/uart.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proto/wippersnapper/uart.proto b/proto/wippersnapper/uart.proto index a8066249..fa135e0e 100644 --- a/proto/wippersnapper/uart.proto +++ b/proto/wippersnapper/uart.proto @@ -2,8 +2,8 @@ // SPDX-License-Identifier: MIT syntax = "proto3"; package wippersnapper.uart; -import "sensor.proto"; import "gps.proto"; +import "sensor.proto"; /** * UartPacketFormat contains the configuration data, parity, and stop bits for a serial port. From 5f3ec333882a58b3266f894206f64c896b1f3de2 Mon Sep 17 00:00:00 2001 From: brentru Date: Fri, 30 May 2025 12:52:53 -0400 Subject: [PATCH 162/188] uart.proto - constrain max_count on sensor_types --- proto/wippersnapper/uart.options | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/proto/wippersnapper/uart.options b/proto/wippersnapper/uart.options index f1d686a5..8bd18811 100644 --- a/proto/wippersnapper/uart.options +++ b/proto/wippersnapper/uart.options @@ -1,9 +1,11 @@ # uart.options -wippersnapper.uart.UartAdd.device_id max_size: 32 -wippersnapper.uart.UartDeviceConfig.device_id max_size: 32 -wippersnapper.uart.UartAdded.device_id max_size: 32 -wippersnapper.uart.UartRemove.device_id max_size: 32 -wippersnapper.uart.UartWrite.device_id max_size: 32 -wippersnapper.uart.UartWritten.device_id max_size: 32 -wippersnapper.uart.UartSerialConfig.pin_rx max_size: 16 -wippersnapper.uart.UartSerialConfig.pin_tx max_size: 16 \ No newline at end of file +wippersnapper.uart.UartAdd.device_id max_size: 32 +wippersnapper.uart.UartDeviceConfig.device_id max_size: 32 +wippersnapper.uart.UartAdded.device_id max_size: 32 +wippersnapper.uart.UartRemove.device_id max_size: 32 +wippersnapper.uart.UartWrite.device_id max_size: 32 +wippersnapper.uart.UartWritten.device_id max_size: 32 +wippersnapper.uart.UartSerialConfig.pin_rx max_size: 16 +wippersnapper.uart.UartSerialConfig.pin_tx max_size: 16 +wippersnapper.uart.GenericUartInputConfig.i2c_device_sensor_types max_count:15 +wippersnapper.uart.PM25AQIConfig.i2c_device_sensor_types max_count:15 \ No newline at end of file From cca78c82e28084b779bc5655050384d58d7b8dd4 Mon Sep 17 00:00:00 2001 From: brentru Date: Mon, 2 Jun 2025 15:15:50 -0400 Subject: [PATCH 163/188] Uart.options - Add UartInputEvent fields --- proto/wippersnapper/uart.options | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/proto/wippersnapper/uart.options b/proto/wippersnapper/uart.options index 8bd18811..454d1276 100644 --- a/proto/wippersnapper/uart.options +++ b/proto/wippersnapper/uart.options @@ -8,4 +8,6 @@ wippersnapper.uart.UartWritten.device_id max_size: 32 wippersnapper.uart.UartSerialConfig.pin_rx max_size: 16 wippersnapper.uart.UartSerialConfig.pin_tx max_size: 16 wippersnapper.uart.GenericUartInputConfig.i2c_device_sensor_types max_count:15 -wippersnapper.uart.PM25AQIConfig.i2c_device_sensor_types max_count:15 \ No newline at end of file +wippersnapper.uart.PM25AQIConfig.i2c_device_sensor_types max_count:15 +wippersnapper.uart.UartInputEvent.device_id max_size:16 +wippersnapper.uart.UartInputEvent.events max_count:15 \ No newline at end of file From 09bf58eae9a27f0abddf18868dcf60732eef6d2d Mon Sep 17 00:00:00 2001 From: brentru Date: Tue, 3 Jun 2025 14:56:07 -0400 Subject: [PATCH 164/188] uart.proto - oneof the device type --- proto/wippersnapper/uart.proto | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/proto/wippersnapper/uart.proto b/proto/wippersnapper/uart.proto index fa135e0e..c0fc2c0a 100644 --- a/proto/wippersnapper/uart.proto +++ b/proto/wippersnapper/uart.proto @@ -113,10 +113,12 @@ message PM25AQIConfig { message UartDeviceConfig { UartDeviceType device_type = 1; /** The type of device connected to the UART port. */ string device_id = 2; /** The unique identifier string for the UART device. */ - GenericUartInputConfig generic_uart_input_config = 3; /** OPTIONAL configuration for a generic UART input device. */ - TrinamicDynamixelConfig trinamic_dynamixel_config = 4; /** OPTIONAL configuration for a Trinamic stepper or DYNAMIXEL servo. */ - PM25AQIConfig pm25aqi_config = 5; /** OPTIONAL configuration for a PM2.5 AQI sensor. */ - wippersnapper.gps.GPSConfig gps_config = 6; /** OPTIONAL configuration for a GPS RMC response. */ + oneof config { + GenericUartInputConfig generic_uart_input = 3; /** OPTIONAL configuration for a generic UART input device. */ + TrinamicDynamixelConfig trinamic_dynamixel = 4; /** OPTIONAL configuration for a Trinamic stepper or DYNAMIXEL servo. */ + PM25AQIConfig pm25aqi = 5; /** OPTIONAL configuration for a PM2.5 AQI sensor. */ + wippersnapper.gps.GPSConfig gps = 6; /** OPTIONAL configuration for a GPS RMC response. */ + } } /** From be3dc9d06e862a8cc1738e077542daca82aba261 Mon Sep 17 00:00:00 2001 From: brentru Date: Fri, 13 Jun 2025 11:19:00 -0400 Subject: [PATCH 165/188] GPS.proto - Add repeated commands field --- proto/wippersnapper/gps.options | 3 ++- proto/wippersnapper/gps.proto | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/proto/wippersnapper/gps.options b/proto/wippersnapper/gps.options index e26c3ef8..0fffaf4f 100644 --- a/proto/wippersnapper/gps.options +++ b/proto/wippersnapper/gps.options @@ -1,5 +1,6 @@ # gps.options -wippersnapper.gps.GPSConfig.config_msg max_size:256 +wippersnapper.gps.GPSConfig.commands max_size:256 +wippersnapper.gps.GPSConfig.commands max_count:16 wippersnapper.gps.GPSRMCResponse.fix_status max_size:2 wippersnapper.gps.GPSRMCResponse.lat max_size:12 wippersnapper.gps.GPSRMCResponse.lat_dir max_size:6 diff --git a/proto/wippersnapper/gps.proto b/proto/wippersnapper/gps.proto index 8094fc26..54f96da7 100644 --- a/proto/wippersnapper/gps.proto +++ b/proto/wippersnapper/gps.proto @@ -9,8 +9,8 @@ package wippersnapper.gps; * and a resulting command string to initialize the GPS device with the selected options will be generated. */ message GPSConfig { - string config_msg = 1; /** Initilization command (PMTK for MediaTek, or similar for other chipsets) **/ // Baud rate is not included here as it is included in the UartAdd->UartSerialConfig message. + repeated string commands = 1; /** List of commands to configure the GPS **/ } /** GPSDateTime represents the date and time information from a GPRMC/GPGGA string **/ From 20cff9335a558c93196a37b4d0c817dd43223b9b Mon Sep 17 00:00:00 2001 From: brentru Date: Mon, 23 Jun 2025 11:40:11 -0400 Subject: [PATCH 166/188] gps NMEA max --- proto/wippersnapper/gps.options | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proto/wippersnapper/gps.options b/proto/wippersnapper/gps.options index 0fffaf4f..983d5e6a 100644 --- a/proto/wippersnapper/gps.options +++ b/proto/wippersnapper/gps.options @@ -1,5 +1,5 @@ # gps.options -wippersnapper.gps.GPSConfig.commands max_size:256 +wippersnapper.gps.GPSConfig.commands max_size:90 wippersnapper.gps.GPSConfig.commands max_count:16 wippersnapper.gps.GPSRMCResponse.fix_status max_size:2 wippersnapper.gps.GPSRMCResponse.lat max_size:12 From 0ee620d92cc6223ec7115ab5a18c8997ecbfb410 Mon Sep 17 00:00:00 2001 From: brentru Date: Tue, 24 Jun 2025 12:09:15 -0400 Subject: [PATCH 167/188] GPS - add Responses --- proto/wippersnapper/gps.options | 2 ++ proto/wippersnapper/gps.proto | 1 + 2 files changed, 3 insertions(+) diff --git a/proto/wippersnapper/gps.options b/proto/wippersnapper/gps.options index 983d5e6a..beb80f79 100644 --- a/proto/wippersnapper/gps.options +++ b/proto/wippersnapper/gps.options @@ -1,6 +1,8 @@ # gps.options wippersnapper.gps.GPSConfig.commands max_size:90 wippersnapper.gps.GPSConfig.commands max_count:16 +wippersnapper.gps.GPSConfig.responses max_size:90 +wippersnapper.gps.GPSConfig.responses max_count:16 wippersnapper.gps.GPSRMCResponse.fix_status max_size:2 wippersnapper.gps.GPSRMCResponse.lat max_size:12 wippersnapper.gps.GPSRMCResponse.lat_dir max_size:6 diff --git a/proto/wippersnapper/gps.proto b/proto/wippersnapper/gps.proto index 54f96da7..cae23713 100644 --- a/proto/wippersnapper/gps.proto +++ b/proto/wippersnapper/gps.proto @@ -11,6 +11,7 @@ package wippersnapper.gps; message GPSConfig { // Baud rate is not included here as it is included in the UartAdd->UartSerialConfig message. repeated string commands = 1; /** List of commands to configure the GPS **/ + repeated string responses = 1; /** List of corresponding responses to the commands **/ } /** GPSDateTime represents the date and time information from a GPRMC/GPGGA string **/ From 478e51b2496138dcc6fd88753645ea839929d609 Mon Sep 17 00:00:00 2001 From: brentru Date: Tue, 24 Jun 2025 12:09:43 -0400 Subject: [PATCH 168/188] GPS - fix responses error --- proto/wippersnapper/gps.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proto/wippersnapper/gps.proto b/proto/wippersnapper/gps.proto index cae23713..c95e6815 100644 --- a/proto/wippersnapper/gps.proto +++ b/proto/wippersnapper/gps.proto @@ -11,7 +11,7 @@ package wippersnapper.gps; message GPSConfig { // Baud rate is not included here as it is included in the UartAdd->UartSerialConfig message. repeated string commands = 1; /** List of commands to configure the GPS **/ - repeated string responses = 1; /** List of corresponding responses to the commands **/ + repeated string responses = 2; /** List of corresponding responses to the commands **/ } /** GPSDateTime represents the date and time information from a GPRMC/GPGGA string **/ From aee75b7f48c8e1068f1a3d380d2558f440fe9953 Mon Sep 17 00:00:00 2001 From: brentru Date: Wed, 25 Jun 2025 09:46:33 -0400 Subject: [PATCH 169/188] GPS - Responses should be calculated on-device rather than passed through --- proto/wippersnapper/gps.proto | 1 - 1 file changed, 1 deletion(-) diff --git a/proto/wippersnapper/gps.proto b/proto/wippersnapper/gps.proto index c95e6815..54f96da7 100644 --- a/proto/wippersnapper/gps.proto +++ b/proto/wippersnapper/gps.proto @@ -11,7 +11,6 @@ package wippersnapper.gps; message GPSConfig { // Baud rate is not included here as it is included in the UartAdd->UartSerialConfig message. repeated string commands = 1; /** List of commands to configure the GPS **/ - repeated string responses = 2; /** List of corresponding responses to the commands **/ } /** GPSDateTime represents the date and time information from a GPRMC/GPGGA string **/ From 607702e9e7a3628f8589e500324ce7f1933df041 Mon Sep 17 00:00:00 2001 From: brentru Date: Wed, 25 Jun 2025 09:54:11 -0400 Subject: [PATCH 170/188] GPS - remove response options --- proto/wippersnapper/gps.options | 2 -- 1 file changed, 2 deletions(-) diff --git a/proto/wippersnapper/gps.options b/proto/wippersnapper/gps.options index beb80f79..983d5e6a 100644 --- a/proto/wippersnapper/gps.options +++ b/proto/wippersnapper/gps.options @@ -1,8 +1,6 @@ # gps.options wippersnapper.gps.GPSConfig.commands max_size:90 wippersnapper.gps.GPSConfig.commands max_count:16 -wippersnapper.gps.GPSConfig.responses max_size:90 -wippersnapper.gps.GPSConfig.responses max_count:16 wippersnapper.gps.GPSRMCResponse.fix_status max_size:2 wippersnapper.gps.GPSRMCResponse.lat max_size:12 wippersnapper.gps.GPSRMCResponse.lat_dir max_size:6 From 6811f7bf77ddd92905b9f0aefbc4651523a5bbf0 Mon Sep 17 00:00:00 2001 From: brentru Date: Wed, 25 Jun 2025 14:37:41 -0400 Subject: [PATCH 171/188] GPS - Add Period for polling --- proto/wippersnapper/gps.proto | 1 + 1 file changed, 1 insertion(+) diff --git a/proto/wippersnapper/gps.proto b/proto/wippersnapper/gps.proto index 54f96da7..2943a614 100644 --- a/proto/wippersnapper/gps.proto +++ b/proto/wippersnapper/gps.proto @@ -11,6 +11,7 @@ package wippersnapper.gps; message GPSConfig { // Baud rate is not included here as it is included in the UartAdd->UartSerialConfig message. repeated string commands = 1; /** List of commands to configure the GPS **/ + int32 period = 2; /** The period to poll the GPS module, in milliseconds */ } /** GPSDateTime represents the date and time information from a GPRMC/GPGGA string **/ From 3a7d10923736f5981c946efb9b19774819e9bfea Mon Sep 17 00:00:00 2001 From: brentru Date: Fri, 27 Jun 2025 15:24:01 -0400 Subject: [PATCH 172/188] GPS - Add GPSEvent message --- proto/wippersnapper/gps.options | 4 +++- proto/wippersnapper/gps.proto | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/proto/wippersnapper/gps.options b/proto/wippersnapper/gps.options index 983d5e6a..9b0d30a7 100644 --- a/proto/wippersnapper/gps.options +++ b/proto/wippersnapper/gps.options @@ -14,4 +14,6 @@ wippersnapper.gps.GPGGAResponse.lon max_size:12 wippersnapper.gps.GPGGAResponse.lon_dir max_size:6 wippersnapper.gps.GPGGAResponse.hdop max_size:6 wippersnapper.gps.GPGGAResponse.altitude max_size:8 -wippersnapper.gps.GPGGAResponse.geoid_height max_size:10 \ No newline at end of file +wippersnapper.gps.GPGGAResponse.geoid_height max_size:10 +wippersnapper.gps.GPSEvent.rmc_responses max_size:10 +wippersnapper.gps.GPSEvent.gga_responses max_size:10 \ No newline at end of file diff --git a/proto/wippersnapper/gps.proto b/proto/wippersnapper/gps.proto index 2943a614..c23b877b 100644 --- a/proto/wippersnapper/gps.proto +++ b/proto/wippersnapper/gps.proto @@ -49,4 +49,10 @@ message GPGGAResponse { string hdop = 10; /** HDOP- horizontal dilution of precision **/ string altitude = 11; /** Altitude in meters above MSL **/ string geoid_height = 12; /** Diff between geoid height and WGS84 height **/ +} + +/** GPSEvent represents a collection of GPS event responses, including RMC and GGA data. **/ +message GPSEvent { + repeated GPSRMCResponse rmc_responses = 1; /** List of RMC responses **/ + repeated GPGGAResponse gga_responses = 2; /** List of GGA responses **/ } \ No newline at end of file From 2aad6697bc599481636a53e78d1f23d986860619 Mon Sep 17 00:00:00 2001 From: brentru Date: Fri, 27 Jun 2025 15:33:39 -0400 Subject: [PATCH 173/188] GPS - Update GPSEvent compiler directives --- proto/wippersnapper/gps.options | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/proto/wippersnapper/gps.options b/proto/wippersnapper/gps.options index 9b0d30a7..2186a0f6 100644 --- a/proto/wippersnapper/gps.options +++ b/proto/wippersnapper/gps.options @@ -15,5 +15,5 @@ wippersnapper.gps.GPGGAResponse.lon_dir max_size:6 wippersnapper.gps.GPGGAResponse.hdop max_size:6 wippersnapper.gps.GPGGAResponse.altitude max_size:8 wippersnapper.gps.GPGGAResponse.geoid_height max_size:10 -wippersnapper.gps.GPSEvent.rmc_responses max_size:10 -wippersnapper.gps.GPSEvent.gga_responses max_size:10 \ No newline at end of file +wippersnapper.gps.GPSEvent.rmc_responses max_count:10 +wippersnapper.gps.GPSEvent.gga_responses max_count:10 \ No newline at end of file From d0fbb8db7d6508637bcf18639b6c3765f73b6b1d Mon Sep 17 00:00:00 2001 From: brentru Date: Tue, 1 Jul 2025 10:54:10 -0400 Subject: [PATCH 174/188] GPS - Signal stores GPSEvent --- proto/wippersnapper/signal.proto | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/proto/wippersnapper/signal.proto b/proto/wippersnapper/signal.proto index 93d8f262..ddea45b8 100644 --- a/proto/wippersnapper/signal.proto +++ b/proto/wippersnapper/signal.proto @@ -99,7 +99,6 @@ message DeviceToBroker { wippersnapper.i2c.I2cDeviceRemoved i2c_device_removed = 112; wippersnapper.i2c.I2cDeviceEvent i2c_device_event = 113; // gps.proto - wippersnapper.gps.GPSRMCResponse gps_rmc_response = 120; - wippersnapper.gps.GPGGAResponse gps_gga_response = 121; + wippersnapper.gps.GPSEvent gps_event = 120; } } From d54396cd4d2cf2009aaa5a95e8c62093ead4ec3f Mon Sep 17 00:00:00 2001 From: brentru Date: Wed, 2 Jul 2025 11:24:18 -0400 Subject: [PATCH 175/188] I2C - Include GPS.proto --- proto/wippersnapper/i2c.proto | 3 +++ 1 file changed, 3 insertions(+) diff --git a/proto/wippersnapper/i2c.proto b/proto/wippersnapper/i2c.proto index d7aecbfa..893be00b 100644 --- a/proto/wippersnapper/i2c.proto +++ b/proto/wippersnapper/i2c.proto @@ -4,6 +4,7 @@ syntax = "proto3"; package wippersnapper.i2c; import "i2c_output.proto"; import "sensor.proto"; +import "gps.proto"; /** * I2cBusStatus represents the status of a board's I2C bus @@ -82,6 +83,8 @@ message I2cDeviceAddOrReplace { bool is_persistent = 5; /** Offline-Mode ONLY - True if the device exits in the config file, False otherwise. **/ bool is_output = 6; /** Required by the device to determine if the device is an output device.**/ wippersnapper.i2c_output.I2cOutputAdd i2c_output_add = 7; /** Optional - If the I2C device is an output device, fill this field. **/ + bool is_gps_device = 8; /** Optional - If the I2C device is a GPS driver, fill this field. **/ + wippersnapper.gps.GPSConfig gps_config = 9; /** Optional - If the I2C device is a GPS driver, fill this field with the GPS config. **/ } /** From 6b71dc3b2dd8fc13c645289fae4aafe10bb3fa43 Mon Sep 17 00:00:00 2001 From: brentru Date: Wed, 2 Jul 2025 11:26:12 -0400 Subject: [PATCH 176/188] I2c.proto - Sort Imports --- proto/wippersnapper/i2c.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proto/wippersnapper/i2c.proto b/proto/wippersnapper/i2c.proto index 893be00b..624ead54 100644 --- a/proto/wippersnapper/i2c.proto +++ b/proto/wippersnapper/i2c.proto @@ -2,9 +2,9 @@ // SPDX-License-Identifier: MIT syntax = "proto3"; package wippersnapper.i2c; +import "gps.proto"; import "i2c_output.proto"; import "sensor.proto"; -import "gps.proto"; /** * I2cBusStatus represents the status of a board's I2C bus From 4770cd7242d27bc6c1421b8c6ca3a8128af300b7 Mon Sep 17 00:00:00 2001 From: brentru Date: Wed, 2 Jul 2025 11:35:50 -0400 Subject: [PATCH 177/188] I2c - Remove redundant bool fields within I2cDeviceAddorReplace --- proto/wippersnapper/i2c.proto | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/proto/wippersnapper/i2c.proto b/proto/wippersnapper/i2c.proto index 624ead54..157dad16 100644 --- a/proto/wippersnapper/i2c.proto +++ b/proto/wippersnapper/i2c.proto @@ -81,10 +81,8 @@ message I2cDeviceAddOrReplace { float i2c_device_period = 3; /** The desired period to update the I2c device's sensor(s), in seconds. */ repeated wippersnapper.sensor.SensorType i2c_device_sensor_types = 4; /** SI Types for each sensor on the I2c device. */ bool is_persistent = 5; /** Offline-Mode ONLY - True if the device exits in the config file, False otherwise. **/ - bool is_output = 6; /** Required by the device to determine if the device is an output device.**/ - wippersnapper.i2c_output.I2cOutputAdd i2c_output_add = 7; /** Optional - If the I2C device is an output device, fill this field. **/ - bool is_gps_device = 8; /** Optional - If the I2C device is a GPS driver, fill this field. **/ - wippersnapper.gps.GPSConfig gps_config = 9; /** Optional - If the I2C device is a GPS driver, fill this field with the GPS config. **/ + wippersnapper.i2c_output.I2cOutputAdd i2c_output_add = 6; /** Optional - If the I2C device is an output device, fill this field. **/ + wippersnapper.gps.GPSConfig gps_config = 7; /** Optional - If the I2C device is a GPS driver, fill this field with the GPS config. **/ } /** From 2afb04255b8a043548a546518b0abfd4657d1cfe Mon Sep 17 00:00:00 2001 From: brentru Date: Wed, 2 Jul 2025 14:54:10 -0400 Subject: [PATCH 178/188] I2c.proto - Add back is_output, is_gps fields because they are sent by default in PMQ --- proto/wippersnapper/i2c.proto | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/proto/wippersnapper/i2c.proto b/proto/wippersnapper/i2c.proto index 157dad16..7fb1f818 100644 --- a/proto/wippersnapper/i2c.proto +++ b/proto/wippersnapper/i2c.proto @@ -81,8 +81,10 @@ message I2cDeviceAddOrReplace { float i2c_device_period = 3; /** The desired period to update the I2c device's sensor(s), in seconds. */ repeated wippersnapper.sensor.SensorType i2c_device_sensor_types = 4; /** SI Types for each sensor on the I2c device. */ bool is_persistent = 5; /** Offline-Mode ONLY - True if the device exits in the config file, False otherwise. **/ - wippersnapper.i2c_output.I2cOutputAdd i2c_output_add = 6; /** Optional - If the I2C device is an output device, fill this field. **/ - wippersnapper.gps.GPSConfig gps_config = 7; /** Optional - If the I2C device is a GPS driver, fill this field with the GPS config. **/ + bool is_output = 6; /** Required by the device to determine if the component is an output.**/ + wippersnapper.i2c_output.I2cOutputAdd i2c_output_add = 7; /** Optional - If the I2C device is an output device, fill this field. **/ + bool is_gps = 8; /** Required by the device to determine if the component is a GPS.**/ + wippersnapper.gps.GPSConfig gps_config = 9; /** Optional - If the I2C device is a GPS driver, fill this field with the GPS config. **/ } /** From 4ba1574cf9745b822569f4dc58d983fc43242315 Mon Sep 17 00:00:00 2001 From: brentru Date: Tue, 8 Jul 2025 15:46:11 -0400 Subject: [PATCH 179/188] GPS.proto - Fix invalid field numbers --- proto/wippersnapper/gps.proto | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/proto/wippersnapper/gps.proto b/proto/wippersnapper/gps.proto index c23b877b..f30f7a8f 100644 --- a/proto/wippersnapper/gps.proto +++ b/proto/wippersnapper/gps.proto @@ -29,26 +29,26 @@ message GPSDateTime { message GPSRMCResponse { GPSDateTime datetime = 1; /** Date and time of the GPS data **/ string fix_status = 2; /** Fix status: 'A' for active, 'V' for void **/ - string lat = 4; /** Latitude in decimal degrees **/ - string lat_dir = 5; /** Latitude direction: 'North' or 'South' **/ - string lon = 6; /** Longitude in decimal degrees **/ - string lon_dir = 7; /** Longitude direction: 'East' or 'West' **/ - string speed = 8; /** Speed, in knots **/ - string angle = 9; /** Course/heading angle, in degrees **/ + string lat = 3; /** Latitude in decimal degrees **/ + string lat_dir = 4; /** Latitude direction: 'North' or 'South' **/ + string lon = 5; /** Longitude in decimal degrees **/ + string lon_dir = 6; /** Longitude direction: 'East' or 'West' **/ + string speed = 7; /** Speed, in knots **/ + string angle = 8; /** Course/heading angle, in degrees **/ } /** GPGGAResponse represents the response from a GPS GGA (Global Positioning System Fix Data) message. **/ message GPGGAResponse { GPSDateTime datetime = 1; /** Date and time of the GPS data **/ - string lat = 4; /** Latitude in decimal degrees **/ - string lat_dir = 5; /** Latitude direction: 'N' or 'S' **/ - string lon = 6; /** Longitude in decimal degrees **/ - string lon_dir = 7; /** Longitude direction: 'E' or 'W' **/ - int32 fix_quality = 8; /** Quality of the GPS fix (0-3) **/ - int32 num_satellites = 9; /** Number of satellites in use **/ - string hdop = 10; /** HDOP- horizontal dilution of precision **/ - string altitude = 11; /** Altitude in meters above MSL **/ - string geoid_height = 12; /** Diff between geoid height and WGS84 height **/ + string lat = 2; /** Latitude in decimal degrees **/ + string lat_dir = 3; /** Latitude direction: 'N' or 'S' **/ + string lon = 4; /** Longitude in decimal degrees **/ + string lon_dir = 5; /** Longitude direction: 'E' or 'W' **/ + int32 fix_quality = 6; /** Quality of the GPS fix (0-3) **/ + int32 num_satellites = 7; /** Number of satellites in use **/ + string hdop = 8; /** HDOP- horizontal dilution of precision **/ + string altitude = 9; /** Altitude in meters above MSL **/ + string geoid_height = 10; /** Diff between geoid height and WGS84 height **/ } /** GPSEvent represents a collection of GPS event responses, including RMC and GGA data. **/ From 8eb4a0ac30f2d2364c0b2406f24ca708ad4ad890 Mon Sep 17 00:00:00 2001 From: brentru Date: Wed, 9 Jul 2025 14:26:54 -0400 Subject: [PATCH 180/188] GPS.proto - Update for UBX commands --- proto/wippersnapper/gps.options | 5 +++-- proto/wippersnapper/gps.proto | 7 ++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/proto/wippersnapper/gps.options b/proto/wippersnapper/gps.options index 2186a0f6..f2e43f8e 100644 --- a/proto/wippersnapper/gps.options +++ b/proto/wippersnapper/gps.options @@ -1,6 +1,7 @@ # gps.options -wippersnapper.gps.GPSConfig.commands max_size:90 -wippersnapper.gps.GPSConfig.commands max_count:16 +wippersnapper.gps.GPSConfig.commands_pmtks max_size:90 +wippersnapper.gps.GPSConfig.commands_pmtks max_count:16 +wippersnapper.gps.GPSConfig.commands_ubxes max_size:65535 wippersnapper.gps.GPSRMCResponse.fix_status max_size:2 wippersnapper.gps.GPSRMCResponse.lat max_size:12 wippersnapper.gps.GPSRMCResponse.lat_dir max_size:6 diff --git a/proto/wippersnapper/gps.proto b/proto/wippersnapper/gps.proto index f30f7a8f..a1ff04a4 100644 --- a/proto/wippersnapper/gps.proto +++ b/proto/wippersnapper/gps.proto @@ -9,9 +9,10 @@ package wippersnapper.gps; * and a resulting command string to initialize the GPS device with the selected options will be generated. */ message GPSConfig { - // Baud rate is not included here as it is included in the UartAdd->UartSerialConfig message. - repeated string commands = 1; /** List of commands to configure the GPS **/ - int32 period = 2; /** The period to poll the GPS module, in milliseconds */ + // NOTE: Baud rate is not included here as it is included in the UartAdd->UartSerialConfig message. + repeated string commands_pmtks = 1; /** List of PMTK commands in string format. **/ + repeated bytes commands_ubxes = 2; /** List of UBX commands in bytes format. **/ + int32 period = 3; /** Desired period to poll the GPS module, in milliseconds */ } /** GPSDateTime represents the date and time information from a GPRMC/GPGGA string **/ From 768d607115690dd6186576d80c9e2de48c477d2e Mon Sep 17 00:00:00 2001 From: brentru Date: Wed, 9 Jul 2025 14:31:11 -0400 Subject: [PATCH 181/188] GPS.options - Change ubx arguments --- proto/wippersnapper/gps.options | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/proto/wippersnapper/gps.options b/proto/wippersnapper/gps.options index f2e43f8e..d54dc3e9 100644 --- a/proto/wippersnapper/gps.options +++ b/proto/wippersnapper/gps.options @@ -1,7 +1,8 @@ # gps.options wippersnapper.gps.GPSConfig.commands_pmtks max_size:90 wippersnapper.gps.GPSConfig.commands_pmtks max_count:16 -wippersnapper.gps.GPSConfig.commands_ubxes max_size:65535 +wippersnapper.gps.GPSConfig.commands_ubxes max_size:512 +wippersnapper.gps.GPSConfig.commands_ubxes max_count:16 wippersnapper.gps.GPSRMCResponse.fix_status max_size:2 wippersnapper.gps.GPSRMCResponse.lat max_size:12 wippersnapper.gps.GPSRMCResponse.lat_dir max_size:6 From 9f61c41e03863587f470e398189c9abc395518d7 Mon Sep 17 00:00:00 2001 From: brentru Date: Thu, 10 Jul 2025 10:36:45 -0400 Subject: [PATCH 182/188] GPS.options - Reduce max_sz option --- proto/wippersnapper/gps.options | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/proto/wippersnapper/gps.options b/proto/wippersnapper/gps.options index d54dc3e9..8221c0bb 100644 --- a/proto/wippersnapper/gps.options +++ b/proto/wippersnapper/gps.options @@ -1,8 +1,8 @@ # gps.options wippersnapper.gps.GPSConfig.commands_pmtks max_size:90 -wippersnapper.gps.GPSConfig.commands_pmtks max_count:16 -wippersnapper.gps.GPSConfig.commands_ubxes max_size:512 -wippersnapper.gps.GPSConfig.commands_ubxes max_count:16 +wippersnapper.gps.GPSConfig.commands_pmtks max_count:8 +wippersnapper.gps.GPSConfig.commands_ubxes max_size:128 +wippersnapper.gps.GPSConfig.commands_ubxes max_count:8 wippersnapper.gps.GPSRMCResponse.fix_status max_size:2 wippersnapper.gps.GPSRMCResponse.lat max_size:12 wippersnapper.gps.GPSRMCResponse.lat_dir max_size:6 From dc4517eb205d8b405db8b08fe73943121645e76a Mon Sep 17 00:00:00 2001 From: brentru Date: Thu, 24 Jul 2025 12:27:35 -0400 Subject: [PATCH 183/188] UART.proto - Incorrectly references i2c sensor types instead of UART --- proto/wippersnapper/uart.proto | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/proto/wippersnapper/uart.proto b/proto/wippersnapper/uart.proto index c0fc2c0a..c8f366d6 100644 --- a/proto/wippersnapper/uart.proto +++ b/proto/wippersnapper/uart.proto @@ -81,10 +81,10 @@ message UartSerialConfig { * containing device-specific configuration info for generic UART input devices. */ message GenericUartInputConfig { - string name = 1; /** The name used to identify the device. */ - GenericDeviceLineEnding line_ending = 2; /** The line ending used by the device. */ - int32 period = 3; /** The period to poll the device, in milliseconds */ - repeated wippersnapper.sensor.SensorType i2c_device_sensor_types = 4; /** SI Types for each sensor on the I2c device. */ + string name = 1; /** The name used to identify the device. */ + GenericDeviceLineEnding line_ending = 2; /** The line ending used by the device. */ + int32 period = 3; /** The period to poll the device, in milliseconds */ + repeated wippersnapper.sensor.SensorType sensor_types = 4; /** SI Types for each sensor on the UART device. */ } /** From 415b3292bf2724218b642ecd22b9ec235a97507b Mon Sep 17 00:00:00 2001 From: brentru Date: Thu, 24 Jul 2025 13:41:14 -0400 Subject: [PATCH 184/188] UART.options - Fix sensor count pb_callback_t --- proto/wippersnapper/uart.options | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/proto/wippersnapper/uart.options b/proto/wippersnapper/uart.options index 454d1276..fc65d052 100644 --- a/proto/wippersnapper/uart.options +++ b/proto/wippersnapper/uart.options @@ -7,7 +7,7 @@ wippersnapper.uart.UartWrite.device_id max_size: 32 wippersnapper.uart.UartWritten.device_id max_size: 32 wippersnapper.uart.UartSerialConfig.pin_rx max_size: 16 wippersnapper.uart.UartSerialConfig.pin_tx max_size: 16 -wippersnapper.uart.GenericUartInputConfig.i2c_device_sensor_types max_count:15 -wippersnapper.uart.PM25AQIConfig.i2c_device_sensor_types max_count:15 +wippersnapper.uart.GenericUartInputConfig.sensor_types max_count:15 +wippersnapper.uart.PM25AQIConfig.sensor_types max_count:15 wippersnapper.uart.UartInputEvent.device_id max_size:16 wippersnapper.uart.UartInputEvent.events max_count:15 \ No newline at end of file From 6b6d86d9d63b09d5a47afc41d3eb53e49f2954b2 Mon Sep 17 00:00:00 2001 From: brentru Date: Thu, 24 Jul 2025 14:07:42 -0400 Subject: [PATCH 185/188] UART.proto - Fix sensor type issue in PM25AQI --- proto/wippersnapper/uart.proto | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/proto/wippersnapper/uart.proto b/proto/wippersnapper/uart.proto index c8f366d6..c5b3e1bf 100644 --- a/proto/wippersnapper/uart.proto +++ b/proto/wippersnapper/uart.proto @@ -100,9 +100,9 @@ message TrinamicDynamixelConfig { * containing device-specific configuration info for PM2.5 AQI sensors. */ message PM25AQIConfig { - bool is_pm1006 = 1; /** True if the device is a PM1006 AQ sensor, Defaults to False. */ - int32 period = 2; /** The period to poll the device, in milliseconds */ - repeated wippersnapper.sensor.SensorType i2c_device_sensor_types = 3; /** SI Types for each sensor on the I2c device. */ + bool is_pm1006 = 1; /** True if the device is a PM1006 AQ sensor, Defaults to False. */ + int32 period = 2; /** The period to poll the device, in milliseconds */ + repeated wippersnapper.sensor.SensorType sensor_types = 3; /** SI Types for each sensor on the I2c device. */ } /** From 4904d4ebd5cfeb412d9c64722d2c86cbc1702950 Mon Sep 17 00:00:00 2001 From: brentru Date: Thu, 23 Oct 2025 11:23:43 -0400 Subject: [PATCH 186/188] Changes for @lorennorman --- proto/wippersnapper/signal.proto | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/proto/wippersnapper/signal.proto b/proto/wippersnapper/signal.proto index ddea45b8..5c3d27af 100644 --- a/proto/wippersnapper/signal.proto +++ b/proto/wippersnapper/signal.proto @@ -27,8 +27,7 @@ message BrokerToDevice { // digitalio.proto wippersnapper.digitalio.DigitalIOAdd digitalio_add = 10; wippersnapper.digitalio.DigitalIORemove digitalio_remove = 11; - wippersnapper.digitalio.DigitalIOEvent digitalio_event = 12; - wippersnapper.digitalio.DigitalIOWrite digitalio_write = 13; + wippersnapper.digitalio.DigitalIOWrite digitalio_write = 12; // analogio.proto wippersnapper.analogio.AnalogIOAdd analogio_add = 20; wippersnapper.analogio.AnalogIORemove analogio_remove = 21; @@ -94,10 +93,10 @@ message DeviceToBroker { wippersnapper.uart.UartWritten uart_written = 91; wippersnapper.uart.UartInputEvent uart_input_event = 92; // i2c.proto - wippersnapper.i2c.I2cBusScanned i2c_bus_scanned = 110; - wippersnapper.i2c.I2cDeviceAddedOrReplaced i2c_device_added_replaced = 111; - wippersnapper.i2c.I2cDeviceRemoved i2c_device_removed = 112; - wippersnapper.i2c.I2cDeviceEvent i2c_device_event = 113; + wippersnapper.i2c.I2cBusScanned i2c_bus_scanned = 100; + wippersnapper.i2c.I2cDeviceAddedOrReplaced i2c_device_added_replaced = 101; + wippersnapper.i2c.I2cDeviceRemoved i2c_device_removed = 102; + wippersnapper.i2c.I2cDeviceEvent i2c_device_event = 103; // gps.proto wippersnapper.gps.GPSEvent gps_event = 120; } From 5ff730afb8acc07d185500917690ed832b438119 Mon Sep 17 00:00:00 2001 From: brentru Date: Thu, 23 Oct 2025 11:28:34 -0400 Subject: [PATCH 187/188] shift -10 --- proto/wippersnapper/signal.proto | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/proto/wippersnapper/signal.proto b/proto/wippersnapper/signal.proto index 5c3d27af..f2afbc4d 100644 --- a/proto/wippersnapper/signal.proto +++ b/proto/wippersnapper/signal.proto @@ -87,17 +87,17 @@ message DeviceToBroker { wippersnapper.pixels.PixelsAdded pixels_added = 60; // ds18x20.proto wippersnapper.ds18x20.Ds18x20Added ds18x20_added = 70; - wippersnapper.ds18x20.Ds18x20Event ds18x20_event = 80; + wippersnapper.ds18x20.Ds18x20Event ds18x20_event = 71; // uart.proto - wippersnapper.uart.UartAdded uart_added = 90; - wippersnapper.uart.UartWritten uart_written = 91; - wippersnapper.uart.UartInputEvent uart_input_event = 92; + wippersnapper.uart.UartAdded uart_added = 80; + wippersnapper.uart.UartWritten uart_written = 81; + wippersnapper.uart.UartInputEvent uart_input_event = 82; // i2c.proto - wippersnapper.i2c.I2cBusScanned i2c_bus_scanned = 100; - wippersnapper.i2c.I2cDeviceAddedOrReplaced i2c_device_added_replaced = 101; - wippersnapper.i2c.I2cDeviceRemoved i2c_device_removed = 102; - wippersnapper.i2c.I2cDeviceEvent i2c_device_event = 103; + wippersnapper.i2c.I2cBusScanned i2c_bus_scanned = 90; + wippersnapper.i2c.I2cDeviceAddedOrReplaced i2c_device_added_replaced = 91; + wippersnapper.i2c.I2cDeviceRemoved i2c_device_removed = 92; + wippersnapper.i2c.I2cDeviceEvent i2c_device_event = 93; // gps.proto - wippersnapper.gps.GPSEvent gps_event = 120; + wippersnapper.gps.GPSEvent gps_event = 100; } } From fcf755fd22edbc664016303199243c58a25a8e04 Mon Sep 17 00:00:00 2001 From: brentru Date: Mon, 27 Oct 2025 11:40:22 -0400 Subject: [PATCH 188/188] Add - Uart.proto device_name field for CPython --- proto/wippersnapper/uart.proto | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/proto/wippersnapper/uart.proto b/proto/wippersnapper/uart.proto index c5b3e1bf..a3f7f146 100644 --- a/proto/wippersnapper/uart.proto +++ b/proto/wippersnapper/uart.proto @@ -62,18 +62,19 @@ enum GenericDeviceLineEnding { } /** -* UartSerialConfig represents a message to configure the Serial (eg: HardwareSerial, SoftwareSerial). +* UartSerialConfig represents a message to configure the Serial port (eg: Hardware Serial, Software Serial). * This message is never sent directly, it is packed inside UartAdd. */ message UartSerialConfig { string pin_rx = 1; /** The pin on which to receive on. */ string pin_tx = 2; /** The pin on which to transmit with. */ - uint32 uart_nbr = 3; /** The UART port number to use, eg: 0, 1, 2, etc. */ - uint32 baud_rate = 4; /** The desired baudrate, in bits per second. */ - UartPacketFormat format = 5; /** The data, parity, and stop bits. */ - float timeout = 6; /** Maximum milliseconds to wait for serial data. Defaults to 1000 ms. */ - bool use_sw_serial = 7; /** Use software serial instead of hardware serial. Defaults to False. */ - bool sw_serial_invert = 8; /** Optional: Inverts the UART signal on RX and TX pins. Defaults to False. */ + string device_name = 3; /** (For CPython ONLY) The device name, i.e: /dev/ttyUSB0. */ + uint32 uart_nbr = 4; /** The UART port number to use, eg: 0, 1, 2, etc. */ + uint32 baud_rate = 5; /** The desired baudrate, in bits per second. */ + UartPacketFormat format = 6; /** The data, parity, and stop bits. */ + float timeout = 7; /** Maximum milliseconds to wait for serial data. Defaults to 1000 ms. */ + bool use_sw_serial = 8; /** Use software serial instead of hardware serial. Defaults to False. */ + bool sw_serial_invert = 9; /** Optional: Inverts the UART signal on RX and TX pins. Defaults to False. */ } /**