From d07ad2cd55281d32d83935fec786a0e0450eb904 Mon Sep 17 00:00:00 2001 From: Thomas Kohler Date: Mon, 15 May 2023 18:34:35 +0200 Subject: [PATCH 01/20] all: prepare for release v2.0.0 --- .chglog/CHANGELOG.gobot.md | 21 ++++++++++ .chglog/README.md | 42 ++++++++++++++++++++ .chglog/config.yml | 28 +++++++++++++ CHANGELOG.md | 80 ++++++++++++++++++++++++++++++++++++++ version.go | 2 +- 5 files changed, 172 insertions(+), 1 deletion(-) create mode 100755 .chglog/CHANGELOG.gobot.md create mode 100644 .chglog/README.md create mode 100755 .chglog/config.yml diff --git a/.chglog/CHANGELOG.gobot.md b/.chglog/CHANGELOG.gobot.md new file mode 100755 index 000000000..d227b8099 --- /dev/null +++ b/.chglog/CHANGELOG.gobot.md @@ -0,0 +1,21 @@ +{{ range .Versions }} +{{ if .Tag.Previous }}{{ .Tag.Name }}{{ else }}{{ .Tag.Name }}{{ end }} +--- +{{ range .CommitGroups -}} +* **{{ .Title }}** + + {{ range .Commits -}} +* {{ if .Scope }}**>{{ .Scope }}:<** {{ end }}{{ .Subject }} + {{ end }} +{{ end -}} + +{{- if .NoteGroups -}} +{{ range .NoteGroups -}} +### {{ .Title }} + +{{ range .Notes }} +{{ .Body }} +{{ end }} +{{ end -}} +{{ end -}} +{{ end -}} \ No newline at end of file diff --git a/.chglog/README.md b/.chglog/README.md new file mode 100644 index 000000000..e50490084 --- /dev/null +++ b/.chglog/README.md @@ -0,0 +1,42 @@ +# Creating a changelog automatically + +## Install and configure tool + +We using , so refer to this side for installation instructions. + +## Usage + +Example for a new release "v2.0.0": + +```sh +git fetch --tags +git-chglog --no-case --next-tag 2.0.0 v1.16.0.. > .chglog/chglog_tmp.md +``` + +## Compare + +If unsure about any result of running git-chglog, just use: +`git log --since=2022-05-02 --pretty="- %s` + +## Manual adjustment + +Because there is no commit style guide yet, some manual work is needed to bring the items in the correct position. +Please refer to the current CHANGELOG.md to find the correct way. In general we try to use this style: + +* titles will be converted to lower case +* titles are lexical ordered +* each platform has its own title (e.g. **raspi**) +* fixes has the title **bugfix** +* title **api**, **drivers** or **example** is used for changes below related folder +* title **core** is used for changes of common code, e.g. utilities, system +* further special titles **build**, **docs** and **test** can be used + +## Finalization + +After all work is done in the temporary changelog file, the content can be moved to the real one and the "chglog_tmp.md" +file can be removed. + +## TODO's + +* introduce a commit style guide +* convert the changelog format to a more common style, see diff --git a/.chglog/config.yml b/.chglog/config.yml new file mode 100755 index 000000000..c08f4325e --- /dev/null +++ b/.chglog/config.yml @@ -0,0 +1,28 @@ +style: github +template: CHANGELOG.gobot.md +info: + title: CHANGELOG + repository_url: https://github.com/hybridgroup/gobot +options: + commits: + # filters: + # Type: + # - feat + # - fix + # - perf + # - refactor + commit_groups: + # title_maps: + # feat: Features + # fix: Bug Fixes + # perf: Performance Improvements + # refactor: Code Refactoring + header: + pattern: "^(\\w*)(?:\\(([\\w\\$\\.\\-\\*\\s]*)\\))?\\:?\\s(.*)$" + pattern_maps: + - Type + - Scope + - Subject + notes: + keywords: + - BREAKING CHANGE \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index a3efcdfa3..9e11ec0ac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,83 @@ +2.0.0 +--- +* **bugfix** + * I2C connection-bus caching and multiple device usage + * raspi pwm cache + * new pwm behaviour of tinkerboard + * jetson nano pwm feature + * examples and gopigo3 driver + * i2c.ReadBlockData(), Read_Data() in digispark and some small other fixes + * L3GD20H full scale range usage + * TH02 wrong register usage for read heater + * MPU6050 wrong initialize and reduced temperature resolution + * I2C driver typo: change HMC8553L to HMC5883L + * HMC5883L driver returns wrong values + * ads1x15 driver not working stable when reading multiple inputs + * Adafruit1109 driver shows bad characters after Halt() + * spi.SpiConnection is not gobot.Connection: missing method Connect + * Stopping and Starting Robot with Raspberry Pi Adapter and LED Driver - LED does not toggle on restart +* **ble** + * update to TinyGo Bluetooth package v0.6.0 release +* **build** + * update appveyor for go 1.19 + * switch to new cimg with golang 1.17 + * new home path for cimg + * check examples in CI ([#884](https://github.com/hybridgroup/gobot/issues/884)) + * add tests of more platforms to CI + * add configuration file for dependabot ([#907](https://github.com/hybridgroup/gobot/issues/907)) + * add PR template +* **core** + * use base driver for all I2C devices + * rename package "sysfs" to "system" + * go.mod to 1.17 and all modules incl. code upgrades +* **dji tello** + * Halt does not terminate all the related goroutines and may wait forever when it is called multiple times +* **docs** + * README for gpio, pwm, i2c and add example + * document fields for flight data +* **drivers** + * ADXL345 use ReadBlockData() + * CCS811 use ReadBlockData() + * bmxy8z use ReadBlockData + * CCS811 use ReadBlockData() + * BMP180, BMP280 BMP388 BME280 use ReadBlockData() + * MPL115A2 use ReadBlockData(), WriteByteData() + * add generic i2c driver + * add PCF8583 i2c driver + * add PCA9501 i2c driver + * add PCA953x i2c driver + * introduce I2cBusAdaptor for composition in platforms + * introduce generic i2c.Driver with example for digispark fix missing/wrong entries in README stabilize test + * add advanced digital pin options (pull, bias, drive, debounce, event) + * add support for new character device Kernel ABI for GPIO + * analog sensor driver to prevent ReadValue() to get float64 + * add read firmware version and DHT sensors for grovepi + * SPI using GPIO's plus driver for MFRC522 +* **jetson nano** + * add Jetson Nano adpator +* **joystick** + * add Xbox-One controller + * add configuration for Nintendo Switch controllers ([#903](https://github.com/hybridgroup/gobot/issues/903)) + * add Dualsense joystick (PlayStation 5) ([#880](https://github.com/hybridgroup/gobot/issues/880)) +* **nanopi neo** + * add platform +* **piblaster** + * add unused but missing interface implementation +* **radxa rock pi 4(c+)** + * add platform ([#902](https://github.com/hybridgroup/gobot/issues/902)) +* **test** + * increase some timings to make tests a little less fragile + * skip test TestNatsAdaptorFailedConnect when flaky + * stabilize "every"-test + * stabilize flaky utils_test + * stabilize firmata tests + * fix tests with sysfs mocks, ReadBlockData, WriteBlockData + * fix keyboard tests and exclude opencv + * fix PWM related read/write tests + * add check for examples in Makefile +* **BREAKING CANGES** + * some interfaces moved, see folder system and adaptor.go + 1.16.0 --- * **bugfix** diff --git a/version.go b/version.go index 4e84dd696..c238b944b 100644 --- a/version.go +++ b/version.go @@ -1,6 +1,6 @@ package gobot -const version = "1.16.0" +const version = "2.0.0" // Version returns the current Gobot version func Version() string { From dc4b940834bee1b66d48d6ddbf4e40cb0f0ea5be Mon Sep 17 00:00:00 2001 From: Thomas Kohler Date: Mon, 29 May 2023 19:39:03 +0200 Subject: [PATCH 02/20] Build(v2): revert move to v2 subfolder (#932) (#938) * revert move to v2 subfolder * fix CI and adjust CHANGELOG --- .circleci/config.yml | 3 - .github/workflows/golangci-lint.yml | 2 +- CHANGELOG.md | 14 +++- Makefile | 78 ++++++++++++++++-- v2/adaptor.go => adaptor.go | 0 {v2/api => api}/api.go | 0 {v2/api => api}/api_test.go | 0 {v2/api => api}/basic_auth.go | 0 {v2/api => api}/basic_auth_test.go | 0 {v2/api => api}/cors.go | 0 {v2/api => api}/cors_test.go | 0 {v2/api => api}/doc.go | 0 {v2/api => api}/helpers_test.go | 0 {v2/api => api}/robeaux/robeaux.go | 0 appveyor.yml | 1 - {v2/cli => cli}/README.md | 0 {v2/cli => cli}/doc.go | 0 {v2/cli => cli}/generate.go | 0 {v2/cli => cli}/main.go | 0 v2/commander.go => commander.go | 0 v2/commander_test.go => commander_test.go | 0 v2/connection.go => connection.go | 0 v2/device.go => device.go | 0 v2/doc.go => doc.go | 0 v2/driver.go => driver.go | 0 {v2/drivers => drivers}/aio/LICENSE | 0 {v2/drivers => drivers}/aio/README.md | 0 {v2/drivers => drivers}/aio/aio.go | 0 .../aio/analog_actuator_driver.go | 0 .../aio/analog_actuator_driver_test.go | 0 .../aio/analog_sensor_driver.go | 0 .../aio/analog_sensor_driver_test.go | 0 {v2/drivers => drivers}/aio/doc.go | 0 {v2/drivers => drivers}/aio/grove_drivers.go | 0 .../aio/grove_drivers_test.go | 0 .../aio/grove_temperature_sensor_driver.go | 0 .../grove_temperature_sensor_driver_test.go | 0 {v2/drivers => drivers}/aio/helpers_test.go | 0 .../aio/temperature_sensor_driver.go | 0 .../aio/temperature_sensor_driver_test.go | 0 .../mfrc522/mfrc522_connectionwrapper.go | 0 .../common/mfrc522/mfrc522_pcd.go | 0 .../common/mfrc522/mfrc522_pcd_register.go | 0 .../common/mfrc522/mfrc522_pcd_test.go | 0 .../common/mfrc522/mfrc522_picc.go | 0 {v2/drivers => drivers}/gpio/LICENSE | 0 {v2/drivers => drivers}/gpio/README.md | 0 .../gpio/aip1640_driver.go | 0 .../gpio/aip1640_driver_test.go | 0 {v2/drivers => drivers}/gpio/button_driver.go | 0 .../gpio/button_driver_test.go | 0 {v2/drivers => drivers}/gpio/buzzer_driver.go | 0 .../gpio/buzzer_driver_test.go | 0 .../gpio/direct_pin_driver.go | 0 .../gpio/direct_pin_driver_test.go | 0 {v2/drivers => drivers}/gpio/doc.go | 0 {v2/drivers => drivers}/gpio/easy_driver.go | 0 .../gpio/easy_driver_test.go | 0 {v2/drivers => drivers}/gpio/gpio.go | 0 {v2/drivers => drivers}/gpio/grove_drivers.go | 0 .../gpio/grove_drivers_test.go | 0 .../gpio/hd44780_driver.go | 0 .../gpio/hd44780_driver_test.go | 0 {v2/drivers => drivers}/gpio/helpers_test.go | 0 {v2/drivers => drivers}/gpio/led_driver.go | 0 .../gpio/led_driver_test.go | 0 .../gpio/makey_button_driver.go | 0 .../gpio/makey_button_driver_test.go | 0 .../gpio/max7219_driver.go | 0 .../gpio/max7219_driver_test.go | 0 {v2/drivers => drivers}/gpio/motor_driver.go | 0 .../gpio/motor_driver_test.go | 0 .../gpio/pir_motion_driver.go | 0 .../gpio/pir_motion_driver_test.go | 0 {v2/drivers => drivers}/gpio/relay_driver.go | 0 .../gpio/relay_driver_test.go | 0 .../gpio/rgb_led_driver.go | 0 .../gpio/rgb_led_driver_test.go | 0 {v2/drivers => drivers}/gpio/servo_driver.go | 0 .../gpio/servo_driver_test.go | 0 .../gpio/stepper_driver.go | 0 .../gpio/stepper_driver_test.go | 0 {v2/drivers => drivers}/gpio/tm1638_driver.go | 0 .../gpio/tm1638_driver_test.go | 0 {v2/drivers => drivers}/i2c/LICENSE | 0 {v2/drivers => drivers}/i2c/README.md | 0 .../i2c/adafruit1109_driver.go | 0 .../i2c/adafruit1109_driver_test.go | 0 .../i2c/adafruit_driver.go | 0 .../i2c/adafruit_driver_test.go | 0 {v2/drivers => drivers}/i2c/ads1x15_driver.go | 0 .../i2c/ads1x15_driver_1015_test.go | 0 .../i2c/ads1x15_driver_1115_test.go | 0 .../i2c/ads1x15_driver_test.go | 0 {v2/drivers => drivers}/i2c/adxl345_driver.go | 0 .../i2c/adxl345_driver_test.go | 0 {v2/drivers => drivers}/i2c/bh1750_driver.go | 0 .../i2c/bh1750_driver_test.go | 0 {v2/drivers => drivers}/i2c/blinkm_driver.go | 0 .../i2c/blinkm_driver_test.go | 0 {v2/drivers => drivers}/i2c/bme280_driver.go | 0 .../i2c/bme280_driver_test.go | 0 {v2/drivers => drivers}/i2c/bmp180_driver.go | 0 .../i2c/bmp180_driver_test.go | 0 {v2/drivers => drivers}/i2c/bmp280_driver.go | 0 .../i2c/bmp280_driver_test.go | 0 {v2/drivers => drivers}/i2c/bmp388_driver.go | 0 .../i2c/bmp388_driver_test.go | 0 {v2/drivers => drivers}/i2c/ccs811_driver.go | 0 .../i2c/ccs811_driver_test.go | 0 {v2/drivers => drivers}/i2c/doc.go | 0 .../i2c/drv2605l_driver.go | 0 .../i2c/drv2605l_driver_test.go | 0 {v2/drivers => drivers}/i2c/generic_driver.go | 0 .../i2c/generic_driver_test.go | 0 {v2/drivers => drivers}/i2c/grove_drivers.go | 0 .../i2c/grove_drivers_test.go | 0 {v2/drivers => drivers}/i2c/grovepi_driver.go | 0 .../i2c/grovepi_driver_test.go | 0 {v2/drivers => drivers}/i2c/helpers_test.go | 0 .../i2c/hmc5883l_driver.go | 0 .../i2c/hmc5883l_driver_test.go | 0 {v2/drivers => drivers}/i2c/hmc6352_driver.go | 0 .../i2c/hmc6352_driver_test.go | 0 {v2/drivers => drivers}/i2c/i2c_config.go | 0 .../i2c/i2c_config_test.go | 0 {v2/drivers => drivers}/i2c/i2c_connection.go | 0 .../i2c/i2c_connection_test.go | 0 {v2/drivers => drivers}/i2c/i2c_driver.go | 0 .../i2c/i2c_driver_test.go | 0 {v2/drivers => drivers}/i2c/ina3221_driver.go | 0 .../i2c/ina3221_driver_test.go | 0 .../i2c/jhd1313m1_driver.go | 0 .../i2c/jhd1313m1_driver_test.go | 0 {v2/drivers => drivers}/i2c/l3gd20h_driver.go | 0 .../i2c/l3gd20h_driver_test.go | 0 .../i2c/lidarlite_driver.go | 0 .../i2c/lidarlite_driver_test.go | 0 .../i2c/mcp23017_driver.go | 0 .../i2c/mcp23017_driver_test.go | 0 {v2/drivers => drivers}/i2c/mfrc522_driver.go | 0 {v2/drivers => drivers}/i2c/mma7660_driver.go | 0 .../i2c/mma7660_driver_test.go | 0 .../i2c/mpl115a2_driver.go | 0 .../i2c/mpl115a2_driver_test.go | 0 {v2/drivers => drivers}/i2c/mpu6050_driver.go | 0 .../i2c/mpu6050_driver_test.go | 0 {v2/drivers => drivers}/i2c/pca9501_driver.go | 0 .../i2c/pca9501_driver_test.go | 0 {v2/drivers => drivers}/i2c/pca953x_driver.go | 0 .../i2c/pca953x_driver_test.go | 0 {v2/drivers => drivers}/i2c/pca9685_driver.go | 0 .../i2c/pca9685_driver_test.go | 0 {v2/drivers => drivers}/i2c/pcf8583_driver.go | 0 .../i2c/pcf8583_driver_test.go | 0 {v2/drivers => drivers}/i2c/pcf8591_driver.go | 0 .../i2c/pcf8591_driver_test.go | 0 {v2/drivers => drivers}/i2c/sht2x_driver.go | 0 .../i2c/sht2x_driver_test.go | 0 {v2/drivers => drivers}/i2c/sht3x_driver.go | 0 .../i2c/sht3x_driver_test.go | 0 {v2/drivers => drivers}/i2c/ssd1306_driver.go | 0 .../i2c/ssd1306_driver_test.go | 0 {v2/drivers => drivers}/i2c/th02_driver.go | 0 .../i2c/th02_driver_test.go | 0 {v2/drivers => drivers}/i2c/tsl2561_driver.go | 0 .../i2c/tsl2561_driver_test.go | 0 .../i2c/wiichuck_driver.go | 0 .../i2c/wiichuck_driver_test.go | 0 {v2/drivers => drivers}/i2c/yl40_driver.go | 0 .../i2c/yl40_driver_test.go | 0 {v2/drivers => drivers}/spi/README.md | 0 {v2/drivers => drivers}/spi/apa102.go | 0 {v2/drivers => drivers}/spi/apa102_test.go | 0 {v2/drivers => drivers}/spi/doc.go | 0 {v2/drivers => drivers}/spi/helpers_test.go | 0 {v2/drivers => drivers}/spi/mcp3002.go | 0 {v2/drivers => drivers}/spi/mcp3002_test.go | 0 {v2/drivers => drivers}/spi/mcp3004.go | 0 {v2/drivers => drivers}/spi/mcp3004_test.go | 0 {v2/drivers => drivers}/spi/mcp3008.go | 0 {v2/drivers => drivers}/spi/mcp3008_test.go | 0 {v2/drivers => drivers}/spi/mcp3202.go | 0 {v2/drivers => drivers}/spi/mcp3202_test.go | 0 {v2/drivers => drivers}/spi/mcp3204.go | 0 {v2/drivers => drivers}/spi/mcp3204_test.go | 0 {v2/drivers => drivers}/spi/mcp3208.go | 0 {v2/drivers => drivers}/spi/mcp3208_test.go | 0 {v2/drivers => drivers}/spi/mcp3304.go | 0 {v2/drivers => drivers}/spi/mcp3304_test.go | 0 {v2/drivers => drivers}/spi/mfrc522_driver.go | 0 .../spi/mfrc522_driver_test.go | 0 {v2/drivers => drivers}/spi/spi_config.go | 0 {v2/drivers => drivers}/spi/spi_connection.go | 0 .../spi/spi_connection_test.go | 0 {v2/drivers => drivers}/spi/spi_driver.go | 0 .../spi/spi_driver_test.go | 0 {v2/drivers => drivers}/spi/ssd1306_driver.go | 0 .../spi/ssd1306_driver_test.go | 0 v2/event.go => event.go | 0 v2/eventer.go => eventer.go | 0 v2/eventer_test.go => eventer_test.go | 0 {v2/examples => examples}/ardrone.go | 0 .../ardrone_face_tracking.go | 0 {v2/examples => examples}/ardrone_ps3.go | 0 {v2/examples => examples}/audio.go | 0 {v2/examples => examples}/batty.go | 0 {v2/examples => examples}/bb8-collision.go | 0 {v2/examples => examples}/bb8.go | 0 .../beaglebone_basic_direct_pin.go | 0 {v2/examples => examples}/beaglebone_blink.go | 0 .../beaglebone_blink_usr_led.go | 0 .../beaglebone_blinkm.go | 0 .../beaglebone_button.go | 0 .../beaglebone_direct_pin.go | 0 .../beaglebone_grove_accelerometer.go | 0 .../beaglebone_led_brightness.go | 0 ...lebone_led_brightness_with_analog_input.go | 0 .../beaglebone_makey_button.go | 0 {v2/examples => examples}/beaglebone_servo.go | 0 {v2/examples => examples}/bebop.go | 0 {v2/examples => examples}/bebop.sdp | 0 {v2/examples => examples}/bebop_ps3.go | 0 {v2/examples => examples}/bebop_ps3_video.go | 0 {v2/examples => examples}/bebop_rtp_video.go | 0 {v2/examples => examples}/ble_battery.go | 0 {v2/examples => examples}/ble_device_info.go | 0 .../ble_firmata_blink.go | 0 .../ble_firmata_curie_imu.go | 0 .../ble_generic_access.go | 0 .../ble_multiple_generic.go | 0 .../ble_multiple_info.go | 0 {v2/examples => examples}/chip_blink.go | 0 {v2/examples => examples}/chip_blinkm.go | 0 {v2/examples => examples}/chip_button.go | 0 {v2/examples => examples}/chip_button_led.go | 0 {v2/examples => examples}/chip_drv2605l.go | 0 .../chip_grove_accelerometer.go | 0 {v2/examples => examples}/chip_grove_lcd.go | 0 {v2/examples => examples}/chip_mpu6050.go | 0 {v2/examples => examples}/chip_tsl2561.go | 0 {v2/examples => examples}/chip_wiichuck.go | 0 {v2/examples => examples}/digispark_api.go | 0 {v2/examples => examples}/digispark_blink.go | 0 {v2/examples => examples}/digispark_blinkm.go | 0 {v2/examples => examples}/digispark_driver.go | 0 .../digispark_led_brightness.go | 0 .../digispark_mpl115a2.go | 0 .../digispark_pca9501.go | 0 {v2/examples => examples}/digispark_servo.go | 0 .../dragonboard_button.go | 0 {v2/examples => examples}/edison_blink.go | 0 ...dison_blink_without_all_gobot_framework.go | 0 {v2/examples => examples}/edison_blinkm.go | 0 {v2/examples => examples}/edison_bme280.go | 0 {v2/examples => examples}/edison_button.go | 0 .../edison_button_led.go | 0 .../edison_button_led_api.go | 0 .../edison_grove_accelerometer.go | 0 .../edison_grove_blink.go | 0 .../edison_grove_button.go | 0 .../edison_grove_buzzer.go | 0 {v2/examples => examples}/edison_grove_lcd.go | 0 {v2/examples => examples}/edison_grove_led.go | 0 .../edison_grove_light_sensor.go | 0 .../edison_grove_piezo_vibration.go | 0 .../edison_grove_rotary_sensor.go | 0 .../edison_grove_sound_sensor.go | 0 .../edison_grove_temperature_sensor.go | 0 .../edison_grove_touch.go | 0 .../edison_led_brightness.go | 0 ...edison_led_brightness_with_analog_input.go | 0 .../edison_miniboard_grove_accelerometer.go | 0 {v2/examples => examples}/edison_rgb_led.go | 0 {v2/examples => examples}/every_done.go | 0 {v2/examples => examples}/firmata_adxl345.go | 0 {v2/examples => examples}/firmata_aip1640.go | 0 {v2/examples => examples}/firmata_blink.go | 0 .../firmata_blink_api.go | 0 .../firmata_blink_metal.go | 0 .../firmata_blink_robot.go | 0 {v2/examples => examples}/firmata_blinkm.go | 0 {v2/examples => examples}/firmata_bme280.go | 0 {v2/examples => examples}/firmata_bmp180.go | 0 {v2/examples => examples}/firmata_bmp280.go | 0 {v2/examples => examples}/firmata_button.go | 0 {v2/examples => examples}/firmata_buzzer.go | 0 {v2/examples => examples}/firmata_cat_toy.go | 0 .../firmata_curie_imu.go | 0 .../firmata_curie_imu_shock_detect.go | 0 .../firmata_curie_imu_step_counter.go | 0 .../firmata_curie_imu_tap_detect.go | 0 .../firmata_direct_pin.go | 0 .../firmata_gpio_max7219.go | 0 .../firmata_grove_lcd.go | 0 .../firmata_grove_sound_sensor.go | 0 {v2/examples => examples}/firmata_hmc6352.go | 0 .../firmata_integration.go | 0 .../firmata_led_brightness.go | 0 ...irmata_led_brightness_with_analog_input.go | 0 .../firmata_lidarlite.go | 0 .../firmata_makey_button.go | 0 .../firmata_metal_button.go | 0 {v2/examples => examples}/firmata_mma7660.go | 0 {v2/examples => examples}/firmata_motor.go | 0 {v2/examples => examples}/firmata_mpl115a2.go | 0 {v2/examples => examples}/firmata_mpu6050.go | 0 {v2/examples => examples}/firmata_pca9685.go | 0 .../firmata_pir_motion.go | 0 {v2/examples => examples}/firmata_rgb_led.go | 0 {v2/examples => examples}/firmata_servo.go | 0 {v2/examples => examples}/firmata_ssd1306.go | 0 {v2/examples => examples}/firmata_temp36.go | 0 {v2/examples => examples}/firmata_tm1638.go | 0 {v2/examples => examples}/firmata_travis.go | 0 {v2/examples => examples}/firmata_wiichuck.go | 0 {v2/examples => examples}/gopigo3.go | 0 .../gopigo3_grove_button.go | 0 .../gopigo3_grove_lcd.go | 0 .../gopigo3_grove_light_sensor.go | 0 .../gopigo3_led_brightness.go | 0 {v2/examples => examples}/gopigo3_servo.go | 0 .../haarcascade_frontalface_alt.xml | 0 {v2/examples => examples}/hello.go | 0 {v2/examples => examples}/hello_api.go | 0 {v2/examples => examples}/hello_api_auth.go | 0 {v2/examples => examples}/hello_api_custom.go | 0 {v2/examples => examples}/hello_api_video.go | 0 {v2/examples => examples}/holystone_hs200.go | 0 .../jetson-nano_blink.go | 0 .../jetson-nano_servo.go | 0 {v2/examples => examples}/joule_blink.go | 0 {v2/examples => examples}/joule_blinkm.go | 0 {v2/examples => examples}/joule_grove_lcd.go | 0 .../joule_grove_rotary_sensor.go | 0 .../joule_led_brightness.go | 0 .../joule_led_brightness_with_analog_input.go | 0 {v2/examples => examples}/joule_leds.go | 0 {v2/examples => examples}/joule_rgb_led.go | 0 {v2/examples => examples}/joystick_ps3.go | 0 {v2/examples => examples}/joystick_ps4.go | 0 {v2/examples => examples}/joystick_ps5.go | 0 {v2/examples => examples}/joystick_xbox360.go | 0 .../joystick_xbox360_rock_band_drums.go | 0 {v2/examples => examples}/joystick_xboxone.go | 0 {v2/examples => examples}/keyboard.go | 0 {v2/examples => examples}/keyboard_mqtt.go | 0 {v2/examples => examples}/laser.mp3 | Bin {v2/examples => examples}/leap_motion.go | 0 .../leap_motion_gestures.go | 0 .../leap_motion_hands.go | 0 {v2/examples => examples}/leap_servos.go | 0 {v2/examples => examples}/leap_sphero.go | 0 {v2/examples => examples}/mavlink.go | 0 {v2/examples => examples}/megapi_motor.go | 0 {v2/examples => examples}/metal_button.go | 0 .../microbit_accelerometer.go | 0 {v2/examples => examples}/microbit_blink.go | 0 {v2/examples => examples}/microbit_buttons.go | 0 .../microbit_buttons_leds.go | 0 .../microbit_io_button.go | 0 {v2/examples => examples}/microbit_led.go | 0 .../microbit_magnetometer.go | 0 .../microbit_temperature.go | 0 {v2/examples => examples}/minidrone.go | 0 {v2/examples => examples}/minidrone_events.go | 0 .../minidrone_mambo_ps3.go | 0 {v2/examples => examples}/minidrone_ps3.go | 0 {v2/examples => examples}/mqtt_driver_ping.go | 0 .../mqtt_firmata_blink.go | 0 {v2/examples => examples}/mqtt_ping.go | 0 .../nanopi_direct_pin.go | 0 .../nanopi_direct_pin_event.go | 0 .../nanopi_led_brightness.go | 0 {v2/examples => examples}/nanopi_pca9533.go | 0 {v2/examples => examples}/nats.go | 0 {v2/examples => examples}/nats_driver_ping.go | 0 {v2/examples => examples}/neurosky.go | 0 {v2/examples => examples}/ollie.go | 0 {v2/examples => examples}/ollie_boost.go | 0 {v2/examples => examples}/ollie_crazy.go | 0 {v2/examples => examples}/ollie_mqtt.go | 0 {v2/examples => examples}/ollie_multiple.go | 0 {v2/examples => examples}/ollie_roll.go | 0 {v2/examples => examples}/ollie_spin.go | 0 .../opencv_face_detect.go | 0 {v2/examples => examples}/opencv_window.go | 0 {v2/examples => examples}/particle_api.go | 0 {v2/examples => examples}/particle_blink.go | 0 {v2/examples => examples}/particle_button.go | 0 {v2/examples => examples}/particle_events.go | 0 .../particle_function.go | 0 .../particle_led_brightness.go | 0 .../particle_variable.go | 0 {v2/examples => examples}/pebble.go | 0 .../pebble_accelerometer.go | 0 .../raspi_adafruit_dcmotor.go | 0 .../raspi_adafruit_servo.go | 0 .../raspi_adafruit_stepper.go | 0 {v2/examples => examples}/raspi_ads1015.go | 0 {v2/examples => examples}/raspi_blink.go | 0 {v2/examples => examples}/raspi_blinkm.go | 0 {v2/examples => examples}/raspi_button.go | 0 {v2/examples => examples}/raspi_ccs811.go | 0 {v2/examples => examples}/raspi_direct_pin.go | 0 .../raspi_direct_pin_event.go | 0 {v2/examples => examples}/raspi_generic.go | 0 .../raspi_grove_pi_blink.go | 0 .../raspi_grove_pi_button.go | 0 .../raspi_grove_pi_dht.go | 0 .../raspi_grove_pi_rotary.go | 0 .../raspi_grove_pi_ultrasonic.go | 0 .../raspi_grove_rotary_sensor.go | 0 {v2/examples => examples}/raspi_hmc5883l.go | 0 {v2/examples => examples}/raspi_ina3221.go | 0 .../raspi_led_brightness.go | 0 {v2/examples => examples}/raspi_mcp3008.go | 0 {v2/examples => examples}/raspi_pca9533.go | 0 {v2/examples => examples}/raspi_sht2x.go | 0 {v2/examples => examples}/raspi_sht3x.go | 0 {v2/examples => examples}/raspi_ssd1306.go | 0 {v2/examples => examples}/raspi_ssd1306spi.go | 0 .../raspi_stepper_move.go | 0 {v2/examples => examples}/sphero.go | 0 {v2/examples => examples}/sphero_api.go | 0 {v2/examples => examples}/sphero_conways.go | 0 {v2/examples => examples}/sphero_dpad.go | 0 {v2/examples => examples}/sphero_master.go | 0 {v2/examples => examples}/sphero_multiple.go | 0 {v2/examples => examples}/sprkplus.go | 0 .../sprkplus_collision.go | 0 {v2/examples => examples}/square.go | 0 {v2/examples => examples}/square_fire.go | 0 {v2/examples => examples}/tello.go | 0 .../tello_facetracker.go | 0 {v2/examples => examples}/tello_keyboard.go | 0 {v2/examples => examples}/tello_opencv.go | 0 {v2/examples => examples}/tello_ps3.go | 0 {v2/examples => examples}/tello_video.go | 0 .../tinkerboard_adafruit1109_lcd_keys.go | 0 .../tinkerboard_ads1115.go | 0 .../tinkerboard_adxl345.go | 0 .../tinkerboard_blink.go | 0 .../tinkerboard_bme280.go | 0 .../tinkerboard_bmp280.go | 0 .../tinkerboard_direct_pin.go | 0 .../tinkerboard_generic.go | 0 .../tinkerboard_grove_lcd.go | 0 .../tinkerboard_hmc5883l.go | 0 .../tinkerboard_mfcrc522gpio.go | 0 .../tinkerboard_mfcrc522spi.go | 0 .../tinkerboard_mpl115a2.go | 0 .../tinkerboard_mpu6050.go | 0 .../tinkerboard_pca9533.go | 0 .../tinkerboard_pcf8583_clock.go | 0 .../tinkerboard_pcf8583_counter.go | 0 .../tinkerboard_pcf8591.go | 0 {v2/examples => examples}/tinkerboard_yl40.go | 0 {v2/examples => examples}/up2_lcd.go | 0 {v2/examples => examples}/up2_leds.go | 0 .../wifi_firmata_analog_input.go | 0 .../wifi_firmata_blink.go | 0 v2/examples_test.go => examples_test.go | 0 v2/go.mod => go.mod | 0 v2/go.sum => go.sum | 0 go.work | 5 -- {v2/gobottest => gobottest}/gobottest.go | 0 {v2/gobottest => gobottest}/gobottest_test.go | 0 v2/helpers_test.go => helpers_test.go | 0 v2/master.go => master.go | 0 v2/master_test.go => master_test.go | 0 .../adaptors/digitalpinsadaptor.go | 0 .../adaptors/digitalpinsadaptor_test.go | 0 .../adaptors/i2cbusadaptor.go | 0 .../adaptors/i2cbusadaptor_test.go | 0 .../adaptors/options.go | 0 .../adaptors/pwmpinsadaptor.go | 0 .../adaptors/pwmpinsadaptor_test.go | 0 .../adaptors/spibusadaptor.go | 0 .../adaptors/spibusadaptor_test.go | 0 {v2/platforms => platforms}/audio/LICENSE | 0 .../audio/audio_adaptor.go | 0 .../audio/audio_adaptor_test.go | 0 .../audio/audio_driver.go | 0 .../audio/audio_driver_test.go | 0 {v2/platforms => platforms}/audio/doc.go | 0 .../beaglebone/LICENSE | 0 .../beaglebone/README.md | 0 .../beaglebone/beaglebone_adaptor.go | 0 .../beaglebone/beaglebone_adaptor_test.go | 0 .../beaglebone/black_pins.go | 0 {v2/platforms => platforms}/beaglebone/doc.go | 0 .../beaglebone/pocketbeagle_adaptor.go | 0 .../beaglebone/pocketbeagle_pins.go | 0 {v2/platforms => platforms}/ble/LICENSE | 0 {v2/platforms => platforms}/ble/README.md | 0 .../ble/battery_driver.go | 0 .../ble/battery_driver_test.go | 0 .../ble/ble_client_adaptor.go | 0 .../ble/ble_client_adaptor_test.go | 0 .../ble/device_information_driver.go | 0 .../ble/device_information_driver_test.go | 0 {v2/platforms => platforms}/ble/doc.go | 0 .../ble/generic_access_driver.go | 0 .../ble/generic_access_driver_test.go | 0 .../ble/helpers_test.go | 0 .../ble/serial_port.go | 0 .../ble/serial_port_test.go | 0 {v2/platforms => platforms}/ble/uuid.go | 0 {v2/platforms => platforms}/chip/LICENSE | 0 {v2/platforms => platforms}/chip/README.md | 0 .../chip/chip_adaptor.go | 0 .../chip/chip_adaptor_test.go | 0 .../chip/chip_pinmap.go | 0 .../chip/chippro_pinmap.go | 0 {v2/platforms => platforms}/chip/doc.go | 0 {v2/platforms => platforms}/dexter/README.md | 0 {v2/platforms => platforms}/dexter/dexter.go | 0 .../dexter/gopigo3/README.md | 0 .../dexter/gopigo3/driver.go | 0 .../dexter/gopigo3/driver_test.go | 0 {v2/platforms => platforms}/digispark/LICENSE | 0 .../digispark/README.md | 0 .../digispark/digispark_adaptor.go | 0 .../digispark/digispark_adaptor_test.go | 0 .../digispark/digispark_i2c.go | 0 .../digispark/digispark_i2c_test.go | 0 {v2/platforms => platforms}/digispark/doc.go | 0 .../digispark/littleWire.c | 0 .../digispark/littleWire.go | 0 .../digispark/littleWire.h | 0 .../digispark/littleWire_servo.c | 0 .../digispark/littleWire_servo.h | 0 .../digispark/littleWire_util.c | 0 .../digispark/littleWire_util.h | 0 .../digispark/opendevice.c | 0 .../digispark/opendevice.h | 0 {v2/platforms => platforms}/dji/README.md | 0 {v2/platforms => platforms}/dji/dji.go | 0 .../dji/tello/README.md | 0 {v2/platforms => platforms}/dji/tello/crc.go | 0 .../dji/tello/driver.go | 0 .../dji/tello/driver_test.go | 0 .../dji/tello/pitch.go | 0 .../dji/tello/pitch_test.go | 0 .../dragonboard/LICENSE | 0 .../dragonboard/README.md | 0 .../dragonboard/doc.go | 0 .../dragonboard/dragonboard_adaptor.go | 0 .../dragonboard/dragonboard_adaptor_test.go | 0 {v2/platforms => platforms}/firmata/LICENSE | 0 {v2/platforms => platforms}/firmata/README.md | 0 .../firmata/ble_firmata_adaptor.go | 0 .../firmata/ble_firmata_adaptor_test.go | 0 .../firmata/client/client.go | 0 .../firmata/client/client_test.go | 0 .../firmata/client/examples/blink.go | 0 {v2/platforms => platforms}/firmata/doc.go | 0 .../firmata/firmata_adaptor.go | 0 .../firmata/firmata_adaptor_test.go | 0 .../firmata/firmata_i2c.go | 0 .../firmata/firmata_i2c_test.go | 0 .../firmata/tcp_firmata_adaptor.go | 0 .../firmata/tcp_firmata_adaptor_test.go | 0 .../holystone/README.md | 0 .../holystone/holystone.go | 0 .../holystone/hs200/README.md | 0 .../holystone/hs200/doc.go | 0 .../holystone/hs200/hs200_driver.go | 0 .../holystone/hs200/hs200_driver_test.go | 0 {v2/platforms => platforms}/intel-iot/LICENSE | 0 .../intel-iot/README.md | 0 .../intel-iot/curie/README.md | 0 .../intel-iot/curie/doc.go | 0 .../intel-iot/curie/imu_driver.go | 0 .../intel-iot/curie/imu_driver_test.go | 0 .../intel-iot/edison/README.md | 0 .../intel-iot/edison/arduino_pinmap.go | 0 .../intel-iot/edison/doc.go | 0 .../intel-iot/edison/edison_adaptor.go | 0 .../intel-iot/edison/edison_adaptor_test.go | 0 .../intel-iot/edison/miniboard_pinmap.go | 0 .../intel-iot/edison/sparkfun_pinmap.go | 0 .../intel-iot/intel-iot.go | 0 .../intel-iot/joule/README.md | 0 .../intel-iot/joule/doc.go | 0 .../intel-iot/joule/joule_adaptor.go | 0 .../intel-iot/joule/joule_adaptor_test.go | 0 .../intel-iot/joule/tuchuck_pinmap.go | 0 {v2/platforms => platforms}/jetson/README.md | 0 {v2/platforms => platforms}/jetson/doc.go | 0 .../jetson/jetson_adaptor.go | 0 .../jetson/jetson_adaptor_test.go | 0 .../jetson/jetson_pin_map.go | 0 {v2/platforms => platforms}/jetson/pwm_pin.go | 0 .../jetson/pwm_pin_test.go | 0 {v2/platforms => platforms}/joystick/LICENSE | 0 .../joystick/README.md | 0 .../joystick/bin/scanner.go | 0 .../joystick/configs/dualsense.json | 0 .../joystick/configs/dualshock3.json | 0 .../joystick/configs/dualshock4.json | 0 .../joystick/configs/magicseer1.json | 0 .../joystick/configs/shield.json | 0 .../configs/xbox360_power_a_mini_proex.json | 0 {v2/platforms => platforms}/joystick/doc.go | 0 .../joystick/events.go | 0 .../joystick/joystick_adaptor.go | 0 .../joystick/joystick_adaptor_test.go | 0 .../joystick/joystick_driver.go | 0 .../joystick/joystick_driver_test.go | 0 .../joystick/joystick_dualsense.go | 0 .../joystick/joystick_dualshock3.go | 0 .../joystick/joystick_dualshock4.go | 0 .../joystick/joystick_nintendo_joycon.go | 0 .../joystick/joystick_shield.go | 0 .../joystick/joystick_tflight_hotas_x.go | 0 .../joystick/joystick_xbox360.go | 0 .../joystick_xbox360_rock_band_drums.go | 0 .../joystick/joystick_xboxone.go | 0 .../joystick/test_helper.go | 0 {v2/platforms => platforms}/keyboard/LICENSE | 0 .../keyboard/README.md | 0 {v2/platforms => platforms}/keyboard/doc.go | 0 .../keyboard/keyboard.go | 0 .../keyboard/keyboard_driver.go | 0 .../keyboard/keyboard_driver_test.go | 0 .../keyboard/keyboard_test.go | 0 {v2/platforms => platforms}/leap/LICENSE | 0 {v2/platforms => platforms}/leap/README.md | 0 {v2/platforms => platforms}/leap/doc.go | 0 .../leap/leap_motion_adaptor.go | 0 .../leap/leap_motion_adaptor_test.go | 0 .../leap/leap_motion_driver.go | 0 .../leap/leap_motion_driver_test.go | 0 {v2/platforms => platforms}/leap/parser.go | 0 .../leap/test/support/example_frame.json | 0 {v2/platforms => platforms}/mavlink/LICENSE | 0 {v2/platforms => platforms}/mavlink/README.md | 0 .../mavlink/common/common.go | 0 .../mavlink/common/mavlink.go | 0 .../mavlink/common/version.go | 0 {v2/platforms => platforms}/mavlink/doc.go | 0 .../mavlink/mavlink_adaptor.go | 0 .../mavlink/mavlink_adaptor_test.go | 0 .../mavlink/mavlink_driver.go | 0 .../mavlink/mavlink_driver_test.go | 0 .../mavlink/mavlink_udp_adaptor.go | 0 .../mavlink/mavlink_udp_adaptor_test.go | 0 {v2/platforms => platforms}/megapi/README.md | 0 {v2/platforms => platforms}/megapi/doc.go | 0 .../megapi/megapi_adaptor.go | 0 .../megapi/motor_driver.go | 0 {v2/platforms => platforms}/microbit/LICENSE | 0 .../microbit/README.md | 0 .../microbit/accelerometer_driver.go | 0 .../microbit/accelerometer_driver_test.go | 0 .../microbit/button_driver.go | 0 .../microbit/button_driver_test.go | 0 {v2/platforms => platforms}/microbit/doc.go | 0 .../microbit/helpers_test.go | 0 .../microbit/io_pin_driver.go | 0 .../microbit/io_pin_driver_test.go | 0 .../microbit/led_driver.go | 0 .../microbit/led_driver_test.go | 0 .../microbit/magnetometer_driver.go | 0 .../microbit/magnetometer_driver_test.go | 0 .../microbit/temperature_driver.go | 0 .../microbit/temperature_driver_test.go | 0 {v2/platforms => platforms}/mqtt/LICENSE | 0 {v2/platforms => platforms}/mqtt/README.md | 0 {v2/platforms => platforms}/mqtt/doc.go | 0 .../mqtt/mqtt_adaptor.go | 0 .../mqtt/mqtt_adaptor_test.go | 0 .../mqtt/mqtt_driver.go | 0 .../mqtt/mqtt_driver_test.go | 0 {v2/platforms => platforms}/nanopi/LICENSE | 0 {v2/platforms => platforms}/nanopi/README.md | 0 {v2/platforms => platforms}/nanopi/doc.go | 0 .../nanopi/nanopi_adaptor.go | 0 .../nanopi/nanopi_adaptor_test.go | 0 .../nanopi/nanopineo_pin_map.go | 0 {v2/platforms => platforms}/nats/README.md | 0 {v2/platforms => platforms}/nats/doc.go | 0 .../nats/nats_adaptor.go | 0 .../nats/nats_adaptor_test.go | 0 .../nats/nats_driver.go | 0 .../nats/nats_driver_test.go | 0 .../nats/test_certs/catest-key.pem | 0 .../nats/test_certs/catest.pem | 0 .../nats/test_certs/client-cert.pem | 0 .../nats/test_certs/client-key.pem | 0 .../nats/test_certs/server-cert.pem | 0 .../nats/test_certs/server-key.pem | 0 {v2/platforms => platforms}/neurosky/LICENSE | 0 .../neurosky/README.md | 0 {v2/platforms => platforms}/neurosky/doc.go | 0 .../neurosky/neurosky_adaptor.go | 0 .../neurosky/neurosky_adaptor_test.go | 0 .../neurosky/neurosky_driver.go | 0 .../neurosky/neurosky_driver_test.go | 0 {v2/platforms => platforms}/opencv/LICENSE | 0 {v2/platforms => platforms}/opencv/README.md | 0 .../opencv/camera_driver.go | 0 .../opencv/camera_driver_test.go | 0 {v2/platforms => platforms}/opencv/doc.go | 0 .../opencv/haarcascade_frontalface_alt.xml | 0 .../opencv/helpers_test.go | 0 .../opencv/lena-256x256.jpg | Bin {v2/platforms => platforms}/opencv/utils.go | 0 .../opencv/utils_test.go | 0 .../opencv/window_driver.go | 0 .../opencv/window_driver_test.go | 0 {v2/platforms => platforms}/parrot/LICENSE | 0 {v2/platforms => platforms}/parrot/README.md | 0 .../parrot/ardrone/LICENSE | 0 .../parrot/ardrone/README.md | 0 .../parrot/ardrone/ardrone_adaptor.go | 0 .../parrot/ardrone/ardrone_adaptor_test.go | 0 .../parrot/ardrone/ardrone_driver.go | 0 .../parrot/ardrone/ardrone_driver_test.go | 0 .../parrot/ardrone/doc.go | 0 .../parrot/ardrone/pitch.go | 0 .../parrot/ardrone/pitch_test.go | 0 .../parrot/ardrone/test_helper.go | 0 .../parrot/bebop/LICENSE | 0 .../parrot/bebop/README.md | 0 .../parrot/bebop/bebop_adaptor.go | 0 .../parrot/bebop/bebop_adaptor_test.go | 0 .../parrot/bebop/bebop_driver.go | 0 .../parrot/bebop/bebop_driver_test.go | 0 .../parrot/bebop/client/client.go | 0 .../parrot/bebop/client/constants.go | 0 .../parrot/bebop/client/examples/ff.conf | 0 .../parrot/bebop/client/examples/takeoff.go | 0 .../parrot/bebop/client/examples/video.go | 0 .../parrot/bebop/doc.go | 0 .../parrot/bebop/pitch.go | 0 .../parrot/bebop/pitch_test.go | 0 .../parrot/bebop/test_helper.go | 0 .../parrot/minidrone/LICENSE | 0 .../parrot/minidrone/README.md | 0 .../parrot/minidrone/doc.go | 0 .../parrot/minidrone/helpers_test.go | 0 .../parrot/minidrone/minidrone_driver.go | 0 .../parrot/minidrone/minidrone_driver_test.go | 0 .../parrot/minidrone/pitch.go | 0 .../parrot/minidrone/pitch_test.go | 0 {v2/platforms => platforms}/parrot/parrot.go | 0 {v2/platforms => platforms}/particle/LICENSE | 0 .../particle/README.md | 0 .../particle/adaptor.go | 0 .../particle/adaptor_test.go | 0 {v2/platforms => platforms}/particle/doc.go | 0 {v2/platforms => platforms}/pebble/README.md | 0 {v2/platforms => platforms}/pebble/doc.go | 0 .../pebble/pebble_adaptor.go | 0 .../pebble/pebble_adaptor_test.go | 0 .../pebble/pebble_driver.go | 0 .../pebble/pebble_driver_test.go | 0 {v2/platforms => platforms}/raspi/LICENSE | 0 {v2/platforms => platforms}/raspi/README.md | 0 {v2/platforms => platforms}/raspi/doc.go | 0 {v2/platforms => platforms}/raspi/pwm_pin.go | 0 .../raspi/pwm_pin_test.go | 0 .../raspi/raspi_adaptor.go | 0 .../raspi/raspi_adaptor_test.go | 0 .../raspi/raspi_pin_map.go | 0 {v2/platforms => platforms}/rockpi/LICENSE | 0 {v2/platforms => platforms}/rockpi/README.md | 0 {v2/platforms => platforms}/rockpi/doc.go | 0 .../rockpi/rockpi_adaptor.go | 0 .../rockpi/rockpi_adaptor_test.go | 0 .../rockpi/rockpi_pin_map.go | 0 {v2/platforms => platforms}/sphero/LICENSE | 0 {v2/platforms => platforms}/sphero/README.md | 0 .../sphero/bb8/LICENSE | 0 .../sphero/bb8/README.md | 0 .../sphero/bb8/bb8_driver.go | 0 .../sphero/bb8/bb8_driver_test.go | 0 .../sphero/bb8/bb8_packets.go | 0 {v2/platforms => platforms}/sphero/bb8/doc.go | 0 .../sphero/bb8/helpers_test.go | 0 {v2/platforms => platforms}/sphero/doc.go | 0 .../sphero/ollie/LICENSE | 0 .../sphero/ollie/README.md | 0 .../sphero/ollie/doc.go | 0 .../sphero/ollie/helpers_test.go | 0 .../sphero/ollie/ollie_driver.go | 0 .../sphero/ollie/ollie_driver_test.go | 0 .../sphero/ollie/ollie_packets.go | 0 .../sphero/sphero_adaptor.go | 0 .../sphero/sphero_adaptor_test.go | 0 .../sphero/sphero_driver.go | 0 .../sphero/sphero_driver_test.go | 0 .../sphero/sphero_packets.go | 0 .../sphero/sprkplus/LICENSE | 0 .../sphero/sprkplus/README.md | 0 .../sphero/sprkplus/doc.go | 0 .../sphero/sprkplus/helpers_test.go | 0 .../sphero/sprkplus/sprkplus_driver.go | 0 .../sphero/sprkplus/sprkplus_driver_test.go | 0 .../sphero/sprkplus/sprkplus_packets.go | 0 .../tinkerboard/LICENSE | 0 .../tinkerboard/README.md | 0 .../tinkerboard/adaptor.go | 0 .../tinkerboard/adaptor_test.go | 0 .../tinkerboard/doc.go | 0 .../tinkerboard/pin_map.go | 0 {v2/platforms => platforms}/upboard/README.md | 0 .../upboard/up2/LICENSE | 0 .../upboard/up2/README.md | 0 .../upboard/up2/adaptor.go | 0 .../upboard/up2/adaptor_test.go | 0 .../upboard/up2/doc.go | 0 .../upboard/up2/pin_map.go | 0 .../upboard/upboard.go | 0 v2/robot.go => robot.go | 0 v2/robot_test.go => robot_test.go | 0 v2/robot_work.go => robot_work.go | 0 v2/robot_work_test.go => robot_work_test.go | 0 v2/snapcraft.yaml => snapcraft.yaml | 0 {v2/system => system}/GPIO.md | 0 {v2/system => system}/I2C.md | 0 {v2/system => system}/PWM.md | 0 {v2/system => system}/README.md | 0 {v2/system => system}/digitalpin_access.go | 0 .../digitalpin_access_test.go | 0 .../digitalpin_bench_test.go | 0 {v2/system => system}/digitalpin_config.go | 0 .../digitalpin_config_test.go | 0 {v2/system => system}/digitalpin_gpiod.go | 0 .../digitalpin_gpiod_test.go | 0 {v2/system => system}/digitalpin_mock.go | 0 {v2/system => system}/digitalpin_sysfs.go | 0 .../digitalpin_sysfs_test.go | 0 {v2/system => system}/doc.go | 0 {v2/system => system}/fs.go | 0 {v2/system => system}/fs_mock.go | 0 {v2/system => system}/fs_mock_test.go | 0 {v2/system => system}/fs_test.go | 0 {v2/system => system}/i2c_device.go | 0 {v2/system => system}/i2c_device_test.go | 0 {v2/system => system}/pwmpin_sysfs.go | 0 {v2/system => system}/pwmpin_sysfs_test.go | 0 {v2/system => system}/spi_access.go | 0 {v2/system => system}/spi_access_test.go | 0 {v2/system => system}/spi_gpio.go | 0 {v2/system => system}/spi_mock.go | 0 {v2/system => system}/spi_periphio.go | 0 {v2/system => system}/syscall.go | 0 {v2/system => system}/syscall_mock.go | 0 {v2/system => system}/system.go | 0 {v2/system => system}/system_options.go | 0 {v2/system => system}/system_test.go | 0 v2/utils.go => utils.go | 0 v2/utils_test.go => utils_test.go | 0 v2/Makefile | 76 ----------------- v2/version.go => version.go | 0 859 files changed, 82 insertions(+), 97 deletions(-) rename v2/adaptor.go => adaptor.go (100%) rename {v2/api => api}/api.go (100%) rename {v2/api => api}/api_test.go (100%) rename {v2/api => api}/basic_auth.go (100%) rename {v2/api => api}/basic_auth_test.go (100%) rename {v2/api => api}/cors.go (100%) rename {v2/api => api}/cors_test.go (100%) rename {v2/api => api}/doc.go (100%) rename {v2/api => api}/helpers_test.go (100%) rename {v2/api => api}/robeaux/robeaux.go (100%) rename {v2/cli => cli}/README.md (100%) rename {v2/cli => cli}/doc.go (100%) rename {v2/cli => cli}/generate.go (100%) rename {v2/cli => cli}/main.go (100%) rename v2/commander.go => commander.go (100%) rename v2/commander_test.go => commander_test.go (100%) rename v2/connection.go => connection.go (100%) rename v2/device.go => device.go (100%) rename v2/doc.go => doc.go (100%) rename v2/driver.go => driver.go (100%) rename {v2/drivers => drivers}/aio/LICENSE (100%) rename {v2/drivers => drivers}/aio/README.md (100%) rename {v2/drivers => drivers}/aio/aio.go (100%) rename {v2/drivers => drivers}/aio/analog_actuator_driver.go (100%) rename {v2/drivers => drivers}/aio/analog_actuator_driver_test.go (100%) rename {v2/drivers => drivers}/aio/analog_sensor_driver.go (100%) rename {v2/drivers => drivers}/aio/analog_sensor_driver_test.go (100%) rename {v2/drivers => drivers}/aio/doc.go (100%) rename {v2/drivers => drivers}/aio/grove_drivers.go (100%) rename {v2/drivers => drivers}/aio/grove_drivers_test.go (100%) rename {v2/drivers => drivers}/aio/grove_temperature_sensor_driver.go (100%) rename {v2/drivers => drivers}/aio/grove_temperature_sensor_driver_test.go (100%) rename {v2/drivers => drivers}/aio/helpers_test.go (100%) rename {v2/drivers => drivers}/aio/temperature_sensor_driver.go (100%) rename {v2/drivers => drivers}/aio/temperature_sensor_driver_test.go (100%) rename {v2/drivers => drivers}/common/mfrc522/mfrc522_connectionwrapper.go (100%) rename {v2/drivers => drivers}/common/mfrc522/mfrc522_pcd.go (100%) rename {v2/drivers => drivers}/common/mfrc522/mfrc522_pcd_register.go (100%) rename {v2/drivers => drivers}/common/mfrc522/mfrc522_pcd_test.go (100%) rename {v2/drivers => drivers}/common/mfrc522/mfrc522_picc.go (100%) rename {v2/drivers => drivers}/gpio/LICENSE (100%) rename {v2/drivers => drivers}/gpio/README.md (100%) rename {v2/drivers => drivers}/gpio/aip1640_driver.go (100%) rename {v2/drivers => drivers}/gpio/aip1640_driver_test.go (100%) rename {v2/drivers => drivers}/gpio/button_driver.go (100%) rename {v2/drivers => drivers}/gpio/button_driver_test.go (100%) rename {v2/drivers => drivers}/gpio/buzzer_driver.go (100%) rename {v2/drivers => drivers}/gpio/buzzer_driver_test.go (100%) rename {v2/drivers => drivers}/gpio/direct_pin_driver.go (100%) rename {v2/drivers => drivers}/gpio/direct_pin_driver_test.go (100%) rename {v2/drivers => drivers}/gpio/doc.go (100%) rename {v2/drivers => drivers}/gpio/easy_driver.go (100%) rename {v2/drivers => drivers}/gpio/easy_driver_test.go (100%) rename {v2/drivers => drivers}/gpio/gpio.go (100%) rename {v2/drivers => drivers}/gpio/grove_drivers.go (100%) rename {v2/drivers => drivers}/gpio/grove_drivers_test.go (100%) rename {v2/drivers => drivers}/gpio/hd44780_driver.go (100%) rename {v2/drivers => drivers}/gpio/hd44780_driver_test.go (100%) rename {v2/drivers => drivers}/gpio/helpers_test.go (100%) rename {v2/drivers => drivers}/gpio/led_driver.go (100%) rename {v2/drivers => drivers}/gpio/led_driver_test.go (100%) rename {v2/drivers => drivers}/gpio/makey_button_driver.go (100%) rename {v2/drivers => drivers}/gpio/makey_button_driver_test.go (100%) rename {v2/drivers => drivers}/gpio/max7219_driver.go (100%) rename {v2/drivers => drivers}/gpio/max7219_driver_test.go (100%) rename {v2/drivers => drivers}/gpio/motor_driver.go (100%) rename {v2/drivers => drivers}/gpio/motor_driver_test.go (100%) rename {v2/drivers => drivers}/gpio/pir_motion_driver.go (100%) rename {v2/drivers => drivers}/gpio/pir_motion_driver_test.go (100%) rename {v2/drivers => drivers}/gpio/relay_driver.go (100%) rename {v2/drivers => drivers}/gpio/relay_driver_test.go (100%) rename {v2/drivers => drivers}/gpio/rgb_led_driver.go (100%) rename {v2/drivers => drivers}/gpio/rgb_led_driver_test.go (100%) rename {v2/drivers => drivers}/gpio/servo_driver.go (100%) rename {v2/drivers => drivers}/gpio/servo_driver_test.go (100%) rename {v2/drivers => drivers}/gpio/stepper_driver.go (100%) rename {v2/drivers => drivers}/gpio/stepper_driver_test.go (100%) rename {v2/drivers => drivers}/gpio/tm1638_driver.go (100%) rename {v2/drivers => drivers}/gpio/tm1638_driver_test.go (100%) rename {v2/drivers => drivers}/i2c/LICENSE (100%) rename {v2/drivers => drivers}/i2c/README.md (100%) rename {v2/drivers => drivers}/i2c/adafruit1109_driver.go (100%) rename {v2/drivers => drivers}/i2c/adafruit1109_driver_test.go (100%) rename {v2/drivers => drivers}/i2c/adafruit_driver.go (100%) rename {v2/drivers => drivers}/i2c/adafruit_driver_test.go (100%) rename {v2/drivers => drivers}/i2c/ads1x15_driver.go (100%) rename {v2/drivers => drivers}/i2c/ads1x15_driver_1015_test.go (100%) rename {v2/drivers => drivers}/i2c/ads1x15_driver_1115_test.go (100%) rename {v2/drivers => drivers}/i2c/ads1x15_driver_test.go (100%) rename {v2/drivers => drivers}/i2c/adxl345_driver.go (100%) rename {v2/drivers => drivers}/i2c/adxl345_driver_test.go (100%) rename {v2/drivers => drivers}/i2c/bh1750_driver.go (100%) rename {v2/drivers => drivers}/i2c/bh1750_driver_test.go (100%) rename {v2/drivers => drivers}/i2c/blinkm_driver.go (100%) rename {v2/drivers => drivers}/i2c/blinkm_driver_test.go (100%) rename {v2/drivers => drivers}/i2c/bme280_driver.go (100%) rename {v2/drivers => drivers}/i2c/bme280_driver_test.go (100%) rename {v2/drivers => drivers}/i2c/bmp180_driver.go (100%) rename {v2/drivers => drivers}/i2c/bmp180_driver_test.go (100%) rename {v2/drivers => drivers}/i2c/bmp280_driver.go (100%) rename {v2/drivers => drivers}/i2c/bmp280_driver_test.go (100%) rename {v2/drivers => drivers}/i2c/bmp388_driver.go (100%) rename {v2/drivers => drivers}/i2c/bmp388_driver_test.go (100%) rename {v2/drivers => drivers}/i2c/ccs811_driver.go (100%) rename {v2/drivers => drivers}/i2c/ccs811_driver_test.go (100%) rename {v2/drivers => drivers}/i2c/doc.go (100%) rename {v2/drivers => drivers}/i2c/drv2605l_driver.go (100%) rename {v2/drivers => drivers}/i2c/drv2605l_driver_test.go (100%) rename {v2/drivers => drivers}/i2c/generic_driver.go (100%) rename {v2/drivers => drivers}/i2c/generic_driver_test.go (100%) rename {v2/drivers => drivers}/i2c/grove_drivers.go (100%) rename {v2/drivers => drivers}/i2c/grove_drivers_test.go (100%) rename {v2/drivers => drivers}/i2c/grovepi_driver.go (100%) rename {v2/drivers => drivers}/i2c/grovepi_driver_test.go (100%) rename {v2/drivers => drivers}/i2c/helpers_test.go (100%) rename {v2/drivers => drivers}/i2c/hmc5883l_driver.go (100%) rename {v2/drivers => drivers}/i2c/hmc5883l_driver_test.go (100%) rename {v2/drivers => drivers}/i2c/hmc6352_driver.go (100%) rename {v2/drivers => drivers}/i2c/hmc6352_driver_test.go (100%) rename {v2/drivers => drivers}/i2c/i2c_config.go (100%) rename {v2/drivers => drivers}/i2c/i2c_config_test.go (100%) rename {v2/drivers => drivers}/i2c/i2c_connection.go (100%) rename {v2/drivers => drivers}/i2c/i2c_connection_test.go (100%) rename {v2/drivers => drivers}/i2c/i2c_driver.go (100%) rename {v2/drivers => drivers}/i2c/i2c_driver_test.go (100%) rename {v2/drivers => drivers}/i2c/ina3221_driver.go (100%) rename {v2/drivers => drivers}/i2c/ina3221_driver_test.go (100%) rename {v2/drivers => drivers}/i2c/jhd1313m1_driver.go (100%) rename {v2/drivers => drivers}/i2c/jhd1313m1_driver_test.go (100%) rename {v2/drivers => drivers}/i2c/l3gd20h_driver.go (100%) rename {v2/drivers => drivers}/i2c/l3gd20h_driver_test.go (100%) rename {v2/drivers => drivers}/i2c/lidarlite_driver.go (100%) rename {v2/drivers => drivers}/i2c/lidarlite_driver_test.go (100%) rename {v2/drivers => drivers}/i2c/mcp23017_driver.go (100%) rename {v2/drivers => drivers}/i2c/mcp23017_driver_test.go (100%) rename {v2/drivers => drivers}/i2c/mfrc522_driver.go (100%) rename {v2/drivers => drivers}/i2c/mma7660_driver.go (100%) rename {v2/drivers => drivers}/i2c/mma7660_driver_test.go (100%) rename {v2/drivers => drivers}/i2c/mpl115a2_driver.go (100%) rename {v2/drivers => drivers}/i2c/mpl115a2_driver_test.go (100%) rename {v2/drivers => drivers}/i2c/mpu6050_driver.go (100%) rename {v2/drivers => drivers}/i2c/mpu6050_driver_test.go (100%) rename {v2/drivers => drivers}/i2c/pca9501_driver.go (100%) rename {v2/drivers => drivers}/i2c/pca9501_driver_test.go (100%) rename {v2/drivers => drivers}/i2c/pca953x_driver.go (100%) rename {v2/drivers => drivers}/i2c/pca953x_driver_test.go (100%) rename {v2/drivers => drivers}/i2c/pca9685_driver.go (100%) rename {v2/drivers => drivers}/i2c/pca9685_driver_test.go (100%) rename {v2/drivers => drivers}/i2c/pcf8583_driver.go (100%) rename {v2/drivers => drivers}/i2c/pcf8583_driver_test.go (100%) rename {v2/drivers => drivers}/i2c/pcf8591_driver.go (100%) rename {v2/drivers => drivers}/i2c/pcf8591_driver_test.go (100%) rename {v2/drivers => drivers}/i2c/sht2x_driver.go (100%) rename {v2/drivers => drivers}/i2c/sht2x_driver_test.go (100%) rename {v2/drivers => drivers}/i2c/sht3x_driver.go (100%) rename {v2/drivers => drivers}/i2c/sht3x_driver_test.go (100%) rename {v2/drivers => drivers}/i2c/ssd1306_driver.go (100%) rename {v2/drivers => drivers}/i2c/ssd1306_driver_test.go (100%) rename {v2/drivers => drivers}/i2c/th02_driver.go (100%) rename {v2/drivers => drivers}/i2c/th02_driver_test.go (100%) rename {v2/drivers => drivers}/i2c/tsl2561_driver.go (100%) rename {v2/drivers => drivers}/i2c/tsl2561_driver_test.go (100%) rename {v2/drivers => drivers}/i2c/wiichuck_driver.go (100%) rename {v2/drivers => drivers}/i2c/wiichuck_driver_test.go (100%) rename {v2/drivers => drivers}/i2c/yl40_driver.go (100%) rename {v2/drivers => drivers}/i2c/yl40_driver_test.go (100%) rename {v2/drivers => drivers}/spi/README.md (100%) rename {v2/drivers => drivers}/spi/apa102.go (100%) rename {v2/drivers => drivers}/spi/apa102_test.go (100%) rename {v2/drivers => drivers}/spi/doc.go (100%) rename {v2/drivers => drivers}/spi/helpers_test.go (100%) rename {v2/drivers => drivers}/spi/mcp3002.go (100%) rename {v2/drivers => drivers}/spi/mcp3002_test.go (100%) rename {v2/drivers => drivers}/spi/mcp3004.go (100%) rename {v2/drivers => drivers}/spi/mcp3004_test.go (100%) rename {v2/drivers => drivers}/spi/mcp3008.go (100%) rename {v2/drivers => drivers}/spi/mcp3008_test.go (100%) rename {v2/drivers => drivers}/spi/mcp3202.go (100%) rename {v2/drivers => drivers}/spi/mcp3202_test.go (100%) rename {v2/drivers => drivers}/spi/mcp3204.go (100%) rename {v2/drivers => drivers}/spi/mcp3204_test.go (100%) rename {v2/drivers => drivers}/spi/mcp3208.go (100%) rename {v2/drivers => drivers}/spi/mcp3208_test.go (100%) rename {v2/drivers => drivers}/spi/mcp3304.go (100%) rename {v2/drivers => drivers}/spi/mcp3304_test.go (100%) rename {v2/drivers => drivers}/spi/mfrc522_driver.go (100%) rename {v2/drivers => drivers}/spi/mfrc522_driver_test.go (100%) rename {v2/drivers => drivers}/spi/spi_config.go (100%) rename {v2/drivers => drivers}/spi/spi_connection.go (100%) rename {v2/drivers => drivers}/spi/spi_connection_test.go (100%) rename {v2/drivers => drivers}/spi/spi_driver.go (100%) rename {v2/drivers => drivers}/spi/spi_driver_test.go (100%) rename {v2/drivers => drivers}/spi/ssd1306_driver.go (100%) rename {v2/drivers => drivers}/spi/ssd1306_driver_test.go (100%) rename v2/event.go => event.go (100%) rename v2/eventer.go => eventer.go (100%) rename v2/eventer_test.go => eventer_test.go (100%) rename {v2/examples => examples}/ardrone.go (100%) rename {v2/examples => examples}/ardrone_face_tracking.go (100%) rename {v2/examples => examples}/ardrone_ps3.go (100%) rename {v2/examples => examples}/audio.go (100%) rename {v2/examples => examples}/batty.go (100%) rename {v2/examples => examples}/bb8-collision.go (100%) rename {v2/examples => examples}/bb8.go (100%) rename {v2/examples => examples}/beaglebone_basic_direct_pin.go (100%) rename {v2/examples => examples}/beaglebone_blink.go (100%) rename {v2/examples => examples}/beaglebone_blink_usr_led.go (100%) rename {v2/examples => examples}/beaglebone_blinkm.go (100%) rename {v2/examples => examples}/beaglebone_button.go (100%) rename {v2/examples => examples}/beaglebone_direct_pin.go (100%) rename {v2/examples => examples}/beaglebone_grove_accelerometer.go (100%) rename {v2/examples => examples}/beaglebone_led_brightness.go (100%) rename {v2/examples => examples}/beaglebone_led_brightness_with_analog_input.go (100%) rename {v2/examples => examples}/beaglebone_makey_button.go (100%) rename {v2/examples => examples}/beaglebone_servo.go (100%) rename {v2/examples => examples}/bebop.go (100%) rename {v2/examples => examples}/bebop.sdp (100%) rename {v2/examples => examples}/bebop_ps3.go (100%) rename {v2/examples => examples}/bebop_ps3_video.go (100%) rename {v2/examples => examples}/bebop_rtp_video.go (100%) rename {v2/examples => examples}/ble_battery.go (100%) rename {v2/examples => examples}/ble_device_info.go (100%) rename {v2/examples => examples}/ble_firmata_blink.go (100%) rename {v2/examples => examples}/ble_firmata_curie_imu.go (100%) rename {v2/examples => examples}/ble_generic_access.go (100%) rename {v2/examples => examples}/ble_multiple_generic.go (100%) rename {v2/examples => examples}/ble_multiple_info.go (100%) rename {v2/examples => examples}/chip_blink.go (100%) rename {v2/examples => examples}/chip_blinkm.go (100%) rename {v2/examples => examples}/chip_button.go (100%) rename {v2/examples => examples}/chip_button_led.go (100%) rename {v2/examples => examples}/chip_drv2605l.go (100%) rename {v2/examples => examples}/chip_grove_accelerometer.go (100%) rename {v2/examples => examples}/chip_grove_lcd.go (100%) rename {v2/examples => examples}/chip_mpu6050.go (100%) rename {v2/examples => examples}/chip_tsl2561.go (100%) rename {v2/examples => examples}/chip_wiichuck.go (100%) rename {v2/examples => examples}/digispark_api.go (100%) rename {v2/examples => examples}/digispark_blink.go (100%) rename {v2/examples => examples}/digispark_blinkm.go (100%) rename {v2/examples => examples}/digispark_driver.go (100%) rename {v2/examples => examples}/digispark_led_brightness.go (100%) rename {v2/examples => examples}/digispark_mpl115a2.go (100%) rename {v2/examples => examples}/digispark_pca9501.go (100%) rename {v2/examples => examples}/digispark_servo.go (100%) rename {v2/examples => examples}/dragonboard_button.go (100%) rename {v2/examples => examples}/edison_blink.go (100%) rename {v2/examples => examples}/edison_blink_without_all_gobot_framework.go (100%) rename {v2/examples => examples}/edison_blinkm.go (100%) rename {v2/examples => examples}/edison_bme280.go (100%) rename {v2/examples => examples}/edison_button.go (100%) rename {v2/examples => examples}/edison_button_led.go (100%) rename {v2/examples => examples}/edison_button_led_api.go (100%) rename {v2/examples => examples}/edison_grove_accelerometer.go (100%) rename {v2/examples => examples}/edison_grove_blink.go (100%) rename {v2/examples => examples}/edison_grove_button.go (100%) rename {v2/examples => examples}/edison_grove_buzzer.go (100%) rename {v2/examples => examples}/edison_grove_lcd.go (100%) rename {v2/examples => examples}/edison_grove_led.go (100%) rename {v2/examples => examples}/edison_grove_light_sensor.go (100%) rename {v2/examples => examples}/edison_grove_piezo_vibration.go (100%) rename {v2/examples => examples}/edison_grove_rotary_sensor.go (100%) rename {v2/examples => examples}/edison_grove_sound_sensor.go (100%) rename {v2/examples => examples}/edison_grove_temperature_sensor.go (100%) rename {v2/examples => examples}/edison_grove_touch.go (100%) rename {v2/examples => examples}/edison_led_brightness.go (100%) rename {v2/examples => examples}/edison_led_brightness_with_analog_input.go (100%) rename {v2/examples => examples}/edison_miniboard_grove_accelerometer.go (100%) rename {v2/examples => examples}/edison_rgb_led.go (100%) rename {v2/examples => examples}/every_done.go (100%) rename {v2/examples => examples}/firmata_adxl345.go (100%) rename {v2/examples => examples}/firmata_aip1640.go (100%) rename {v2/examples => examples}/firmata_blink.go (100%) rename {v2/examples => examples}/firmata_blink_api.go (100%) rename {v2/examples => examples}/firmata_blink_metal.go (100%) rename {v2/examples => examples}/firmata_blink_robot.go (100%) rename {v2/examples => examples}/firmata_blinkm.go (100%) rename {v2/examples => examples}/firmata_bme280.go (100%) rename {v2/examples => examples}/firmata_bmp180.go (100%) rename {v2/examples => examples}/firmata_bmp280.go (100%) rename {v2/examples => examples}/firmata_button.go (100%) rename {v2/examples => examples}/firmata_buzzer.go (100%) rename {v2/examples => examples}/firmata_cat_toy.go (100%) rename {v2/examples => examples}/firmata_curie_imu.go (100%) rename {v2/examples => examples}/firmata_curie_imu_shock_detect.go (100%) rename {v2/examples => examples}/firmata_curie_imu_step_counter.go (100%) rename {v2/examples => examples}/firmata_curie_imu_tap_detect.go (100%) rename {v2/examples => examples}/firmata_direct_pin.go (100%) rename {v2/examples => examples}/firmata_gpio_max7219.go (100%) rename {v2/examples => examples}/firmata_grove_lcd.go (100%) rename {v2/examples => examples}/firmata_grove_sound_sensor.go (100%) rename {v2/examples => examples}/firmata_hmc6352.go (100%) rename {v2/examples => examples}/firmata_integration.go (100%) rename {v2/examples => examples}/firmata_led_brightness.go (100%) rename {v2/examples => examples}/firmata_led_brightness_with_analog_input.go (100%) rename {v2/examples => examples}/firmata_lidarlite.go (100%) rename {v2/examples => examples}/firmata_makey_button.go (100%) rename {v2/examples => examples}/firmata_metal_button.go (100%) rename {v2/examples => examples}/firmata_mma7660.go (100%) rename {v2/examples => examples}/firmata_motor.go (100%) rename {v2/examples => examples}/firmata_mpl115a2.go (100%) rename {v2/examples => examples}/firmata_mpu6050.go (100%) rename {v2/examples => examples}/firmata_pca9685.go (100%) rename {v2/examples => examples}/firmata_pir_motion.go (100%) rename {v2/examples => examples}/firmata_rgb_led.go (100%) rename {v2/examples => examples}/firmata_servo.go (100%) rename {v2/examples => examples}/firmata_ssd1306.go (100%) rename {v2/examples => examples}/firmata_temp36.go (100%) rename {v2/examples => examples}/firmata_tm1638.go (100%) rename {v2/examples => examples}/firmata_travis.go (100%) rename {v2/examples => examples}/firmata_wiichuck.go (100%) rename {v2/examples => examples}/gopigo3.go (100%) rename {v2/examples => examples}/gopigo3_grove_button.go (100%) rename {v2/examples => examples}/gopigo3_grove_lcd.go (100%) rename {v2/examples => examples}/gopigo3_grove_light_sensor.go (100%) rename {v2/examples => examples}/gopigo3_led_brightness.go (100%) rename {v2/examples => examples}/gopigo3_servo.go (100%) rename {v2/examples => examples}/haarcascade_frontalface_alt.xml (100%) rename {v2/examples => examples}/hello.go (100%) rename {v2/examples => examples}/hello_api.go (100%) rename {v2/examples => examples}/hello_api_auth.go (100%) rename {v2/examples => examples}/hello_api_custom.go (100%) rename {v2/examples => examples}/hello_api_video.go (100%) rename {v2/examples => examples}/holystone_hs200.go (100%) rename {v2/examples => examples}/jetson-nano_blink.go (100%) rename {v2/examples => examples}/jetson-nano_servo.go (100%) rename {v2/examples => examples}/joule_blink.go (100%) rename {v2/examples => examples}/joule_blinkm.go (100%) rename {v2/examples => examples}/joule_grove_lcd.go (100%) rename {v2/examples => examples}/joule_grove_rotary_sensor.go (100%) rename {v2/examples => examples}/joule_led_brightness.go (100%) rename {v2/examples => examples}/joule_led_brightness_with_analog_input.go (100%) rename {v2/examples => examples}/joule_leds.go (100%) rename {v2/examples => examples}/joule_rgb_led.go (100%) rename {v2/examples => examples}/joystick_ps3.go (100%) rename {v2/examples => examples}/joystick_ps4.go (100%) rename {v2/examples => examples}/joystick_ps5.go (100%) rename {v2/examples => examples}/joystick_xbox360.go (100%) rename {v2/examples => examples}/joystick_xbox360_rock_band_drums.go (100%) rename {v2/examples => examples}/joystick_xboxone.go (100%) rename {v2/examples => examples}/keyboard.go (100%) rename {v2/examples => examples}/keyboard_mqtt.go (100%) rename {v2/examples => examples}/laser.mp3 (100%) rename {v2/examples => examples}/leap_motion.go (100%) rename {v2/examples => examples}/leap_motion_gestures.go (100%) rename {v2/examples => examples}/leap_motion_hands.go (100%) rename {v2/examples => examples}/leap_servos.go (100%) rename {v2/examples => examples}/leap_sphero.go (100%) rename {v2/examples => examples}/mavlink.go (100%) rename {v2/examples => examples}/megapi_motor.go (100%) rename {v2/examples => examples}/metal_button.go (100%) rename {v2/examples => examples}/microbit_accelerometer.go (100%) rename {v2/examples => examples}/microbit_blink.go (100%) rename {v2/examples => examples}/microbit_buttons.go (100%) rename {v2/examples => examples}/microbit_buttons_leds.go (100%) rename {v2/examples => examples}/microbit_io_button.go (100%) rename {v2/examples => examples}/microbit_led.go (100%) rename {v2/examples => examples}/microbit_magnetometer.go (100%) rename {v2/examples => examples}/microbit_temperature.go (100%) rename {v2/examples => examples}/minidrone.go (100%) rename {v2/examples => examples}/minidrone_events.go (100%) rename {v2/examples => examples}/minidrone_mambo_ps3.go (100%) rename {v2/examples => examples}/minidrone_ps3.go (100%) rename {v2/examples => examples}/mqtt_driver_ping.go (100%) rename {v2/examples => examples}/mqtt_firmata_blink.go (100%) rename {v2/examples => examples}/mqtt_ping.go (100%) rename {v2/examples => examples}/nanopi_direct_pin.go (100%) rename {v2/examples => examples}/nanopi_direct_pin_event.go (100%) rename {v2/examples => examples}/nanopi_led_brightness.go (100%) rename {v2/examples => examples}/nanopi_pca9533.go (100%) rename {v2/examples => examples}/nats.go (100%) rename {v2/examples => examples}/nats_driver_ping.go (100%) rename {v2/examples => examples}/neurosky.go (100%) rename {v2/examples => examples}/ollie.go (100%) rename {v2/examples => examples}/ollie_boost.go (100%) rename {v2/examples => examples}/ollie_crazy.go (100%) rename {v2/examples => examples}/ollie_mqtt.go (100%) rename {v2/examples => examples}/ollie_multiple.go (100%) rename {v2/examples => examples}/ollie_roll.go (100%) rename {v2/examples => examples}/ollie_spin.go (100%) rename {v2/examples => examples}/opencv_face_detect.go (100%) rename {v2/examples => examples}/opencv_window.go (100%) rename {v2/examples => examples}/particle_api.go (100%) rename {v2/examples => examples}/particle_blink.go (100%) rename {v2/examples => examples}/particle_button.go (100%) rename {v2/examples => examples}/particle_events.go (100%) rename {v2/examples => examples}/particle_function.go (100%) rename {v2/examples => examples}/particle_led_brightness.go (100%) rename {v2/examples => examples}/particle_variable.go (100%) rename {v2/examples => examples}/pebble.go (100%) rename {v2/examples => examples}/pebble_accelerometer.go (100%) rename {v2/examples => examples}/raspi_adafruit_dcmotor.go (100%) rename {v2/examples => examples}/raspi_adafruit_servo.go (100%) rename {v2/examples => examples}/raspi_adafruit_stepper.go (100%) rename {v2/examples => examples}/raspi_ads1015.go (100%) rename {v2/examples => examples}/raspi_blink.go (100%) rename {v2/examples => examples}/raspi_blinkm.go (100%) rename {v2/examples => examples}/raspi_button.go (100%) rename {v2/examples => examples}/raspi_ccs811.go (100%) rename {v2/examples => examples}/raspi_direct_pin.go (100%) rename {v2/examples => examples}/raspi_direct_pin_event.go (100%) rename {v2/examples => examples}/raspi_generic.go (100%) rename {v2/examples => examples}/raspi_grove_pi_blink.go (100%) rename {v2/examples => examples}/raspi_grove_pi_button.go (100%) rename {v2/examples => examples}/raspi_grove_pi_dht.go (100%) rename {v2/examples => examples}/raspi_grove_pi_rotary.go (100%) rename {v2/examples => examples}/raspi_grove_pi_ultrasonic.go (100%) rename {v2/examples => examples}/raspi_grove_rotary_sensor.go (100%) rename {v2/examples => examples}/raspi_hmc5883l.go (100%) rename {v2/examples => examples}/raspi_ina3221.go (100%) rename {v2/examples => examples}/raspi_led_brightness.go (100%) rename {v2/examples => examples}/raspi_mcp3008.go (100%) rename {v2/examples => examples}/raspi_pca9533.go (100%) rename {v2/examples => examples}/raspi_sht2x.go (100%) rename {v2/examples => examples}/raspi_sht3x.go (100%) rename {v2/examples => examples}/raspi_ssd1306.go (100%) rename {v2/examples => examples}/raspi_ssd1306spi.go (100%) rename {v2/examples => examples}/raspi_stepper_move.go (100%) rename {v2/examples => examples}/sphero.go (100%) rename {v2/examples => examples}/sphero_api.go (100%) rename {v2/examples => examples}/sphero_conways.go (100%) rename {v2/examples => examples}/sphero_dpad.go (100%) rename {v2/examples => examples}/sphero_master.go (100%) rename {v2/examples => examples}/sphero_multiple.go (100%) rename {v2/examples => examples}/sprkplus.go (100%) rename {v2/examples => examples}/sprkplus_collision.go (100%) rename {v2/examples => examples}/square.go (100%) rename {v2/examples => examples}/square_fire.go (100%) rename {v2/examples => examples}/tello.go (100%) rename {v2/examples => examples}/tello_facetracker.go (100%) rename {v2/examples => examples}/tello_keyboard.go (100%) rename {v2/examples => examples}/tello_opencv.go (100%) rename {v2/examples => examples}/tello_ps3.go (100%) rename {v2/examples => examples}/tello_video.go (100%) rename {v2/examples => examples}/tinkerboard_adafruit1109_lcd_keys.go (100%) rename {v2/examples => examples}/tinkerboard_ads1115.go (100%) rename {v2/examples => examples}/tinkerboard_adxl345.go (100%) rename {v2/examples => examples}/tinkerboard_blink.go (100%) rename {v2/examples => examples}/tinkerboard_bme280.go (100%) rename {v2/examples => examples}/tinkerboard_bmp280.go (100%) rename {v2/examples => examples}/tinkerboard_direct_pin.go (100%) rename {v2/examples => examples}/tinkerboard_generic.go (100%) rename {v2/examples => examples}/tinkerboard_grove_lcd.go (100%) rename {v2/examples => examples}/tinkerboard_hmc5883l.go (100%) rename {v2/examples => examples}/tinkerboard_mfcrc522gpio.go (100%) rename {v2/examples => examples}/tinkerboard_mfcrc522spi.go (100%) rename {v2/examples => examples}/tinkerboard_mpl115a2.go (100%) rename {v2/examples => examples}/tinkerboard_mpu6050.go (100%) rename {v2/examples => examples}/tinkerboard_pca9533.go (100%) rename {v2/examples => examples}/tinkerboard_pcf8583_clock.go (100%) rename {v2/examples => examples}/tinkerboard_pcf8583_counter.go (100%) rename {v2/examples => examples}/tinkerboard_pcf8591.go (100%) rename {v2/examples => examples}/tinkerboard_yl40.go (100%) rename {v2/examples => examples}/up2_lcd.go (100%) rename {v2/examples => examples}/up2_leds.go (100%) rename {v2/examples => examples}/wifi_firmata_analog_input.go (100%) rename {v2/examples => examples}/wifi_firmata_blink.go (100%) rename v2/examples_test.go => examples_test.go (100%) rename v2/go.mod => go.mod (100%) rename v2/go.sum => go.sum (100%) delete mode 100644 go.work rename {v2/gobottest => gobottest}/gobottest.go (100%) rename {v2/gobottest => gobottest}/gobottest_test.go (100%) rename v2/helpers_test.go => helpers_test.go (100%) rename v2/master.go => master.go (100%) rename v2/master_test.go => master_test.go (100%) rename {v2/platforms => platforms}/adaptors/digitalpinsadaptor.go (100%) rename {v2/platforms => platforms}/adaptors/digitalpinsadaptor_test.go (100%) rename {v2/platforms => platforms}/adaptors/i2cbusadaptor.go (100%) rename {v2/platforms => platforms}/adaptors/i2cbusadaptor_test.go (100%) rename {v2/platforms => platforms}/adaptors/options.go (100%) rename {v2/platforms => platforms}/adaptors/pwmpinsadaptor.go (100%) rename {v2/platforms => platforms}/adaptors/pwmpinsadaptor_test.go (100%) rename {v2/platforms => platforms}/adaptors/spibusadaptor.go (100%) rename {v2/platforms => platforms}/adaptors/spibusadaptor_test.go (100%) rename {v2/platforms => platforms}/audio/LICENSE (100%) rename {v2/platforms => platforms}/audio/audio_adaptor.go (100%) rename {v2/platforms => platforms}/audio/audio_adaptor_test.go (100%) rename {v2/platforms => platforms}/audio/audio_driver.go (100%) rename {v2/platforms => platforms}/audio/audio_driver_test.go (100%) rename {v2/platforms => platforms}/audio/doc.go (100%) rename {v2/platforms => platforms}/beaglebone/LICENSE (100%) rename {v2/platforms => platforms}/beaglebone/README.md (100%) rename {v2/platforms => platforms}/beaglebone/beaglebone_adaptor.go (100%) rename {v2/platforms => platforms}/beaglebone/beaglebone_adaptor_test.go (100%) rename {v2/platforms => platforms}/beaglebone/black_pins.go (100%) rename {v2/platforms => platforms}/beaglebone/doc.go (100%) rename {v2/platforms => platforms}/beaglebone/pocketbeagle_adaptor.go (100%) rename {v2/platforms => platforms}/beaglebone/pocketbeagle_pins.go (100%) rename {v2/platforms => platforms}/ble/LICENSE (100%) rename {v2/platforms => platforms}/ble/README.md (100%) rename {v2/platforms => platforms}/ble/battery_driver.go (100%) rename {v2/platforms => platforms}/ble/battery_driver_test.go (100%) rename {v2/platforms => platforms}/ble/ble_client_adaptor.go (100%) rename {v2/platforms => platforms}/ble/ble_client_adaptor_test.go (100%) rename {v2/platforms => platforms}/ble/device_information_driver.go (100%) rename {v2/platforms => platforms}/ble/device_information_driver_test.go (100%) rename {v2/platforms => platforms}/ble/doc.go (100%) rename {v2/platforms => platforms}/ble/generic_access_driver.go (100%) rename {v2/platforms => platforms}/ble/generic_access_driver_test.go (100%) rename {v2/platforms => platforms}/ble/helpers_test.go (100%) rename {v2/platforms => platforms}/ble/serial_port.go (100%) rename {v2/platforms => platforms}/ble/serial_port_test.go (100%) rename {v2/platforms => platforms}/ble/uuid.go (100%) rename {v2/platforms => platforms}/chip/LICENSE (100%) rename {v2/platforms => platforms}/chip/README.md (100%) rename {v2/platforms => platforms}/chip/chip_adaptor.go (100%) rename {v2/platforms => platforms}/chip/chip_adaptor_test.go (100%) rename {v2/platforms => platforms}/chip/chip_pinmap.go (100%) rename {v2/platforms => platforms}/chip/chippro_pinmap.go (100%) rename {v2/platforms => platforms}/chip/doc.go (100%) rename {v2/platforms => platforms}/dexter/README.md (100%) rename {v2/platforms => platforms}/dexter/dexter.go (100%) rename {v2/platforms => platforms}/dexter/gopigo3/README.md (100%) rename {v2/platforms => platforms}/dexter/gopigo3/driver.go (100%) rename {v2/platforms => platforms}/dexter/gopigo3/driver_test.go (100%) rename {v2/platforms => platforms}/digispark/LICENSE (100%) rename {v2/platforms => platforms}/digispark/README.md (100%) rename {v2/platforms => platforms}/digispark/digispark_adaptor.go (100%) rename {v2/platforms => platforms}/digispark/digispark_adaptor_test.go (100%) rename {v2/platforms => platforms}/digispark/digispark_i2c.go (100%) rename {v2/platforms => platforms}/digispark/digispark_i2c_test.go (100%) rename {v2/platforms => platforms}/digispark/doc.go (100%) rename {v2/platforms => platforms}/digispark/littleWire.c (100%) rename {v2/platforms => platforms}/digispark/littleWire.go (100%) rename {v2/platforms => platforms}/digispark/littleWire.h (100%) rename {v2/platforms => platforms}/digispark/littleWire_servo.c (100%) rename {v2/platforms => platforms}/digispark/littleWire_servo.h (100%) rename {v2/platforms => platforms}/digispark/littleWire_util.c (100%) rename {v2/platforms => platforms}/digispark/littleWire_util.h (100%) rename {v2/platforms => platforms}/digispark/opendevice.c (100%) rename {v2/platforms => platforms}/digispark/opendevice.h (100%) rename {v2/platforms => platforms}/dji/README.md (100%) rename {v2/platforms => platforms}/dji/dji.go (100%) rename {v2/platforms => platforms}/dji/tello/README.md (100%) rename {v2/platforms => platforms}/dji/tello/crc.go (100%) rename {v2/platforms => platforms}/dji/tello/driver.go (100%) rename {v2/platforms => platforms}/dji/tello/driver_test.go (100%) rename {v2/platforms => platforms}/dji/tello/pitch.go (100%) rename {v2/platforms => platforms}/dji/tello/pitch_test.go (100%) rename {v2/platforms => platforms}/dragonboard/LICENSE (100%) rename {v2/platforms => platforms}/dragonboard/README.md (100%) rename {v2/platforms => platforms}/dragonboard/doc.go (100%) rename {v2/platforms => platforms}/dragonboard/dragonboard_adaptor.go (100%) rename {v2/platforms => platforms}/dragonboard/dragonboard_adaptor_test.go (100%) rename {v2/platforms => platforms}/firmata/LICENSE (100%) rename {v2/platforms => platforms}/firmata/README.md (100%) rename {v2/platforms => platforms}/firmata/ble_firmata_adaptor.go (100%) rename {v2/platforms => platforms}/firmata/ble_firmata_adaptor_test.go (100%) rename {v2/platforms => platforms}/firmata/client/client.go (100%) rename {v2/platforms => platforms}/firmata/client/client_test.go (100%) rename {v2/platforms => platforms}/firmata/client/examples/blink.go (100%) rename {v2/platforms => platforms}/firmata/doc.go (100%) rename {v2/platforms => platforms}/firmata/firmata_adaptor.go (100%) rename {v2/platforms => platforms}/firmata/firmata_adaptor_test.go (100%) rename {v2/platforms => platforms}/firmata/firmata_i2c.go (100%) rename {v2/platforms => platforms}/firmata/firmata_i2c_test.go (100%) rename {v2/platforms => platforms}/firmata/tcp_firmata_adaptor.go (100%) rename {v2/platforms => platforms}/firmata/tcp_firmata_adaptor_test.go (100%) rename {v2/platforms => platforms}/holystone/README.md (100%) rename {v2/platforms => platforms}/holystone/holystone.go (100%) rename {v2/platforms => platforms}/holystone/hs200/README.md (100%) rename {v2/platforms => platforms}/holystone/hs200/doc.go (100%) rename {v2/platforms => platforms}/holystone/hs200/hs200_driver.go (100%) rename {v2/platforms => platforms}/holystone/hs200/hs200_driver_test.go (100%) rename {v2/platforms => platforms}/intel-iot/LICENSE (100%) rename {v2/platforms => platforms}/intel-iot/README.md (100%) rename {v2/platforms => platforms}/intel-iot/curie/README.md (100%) rename {v2/platforms => platforms}/intel-iot/curie/doc.go (100%) rename {v2/platforms => platforms}/intel-iot/curie/imu_driver.go (100%) rename {v2/platforms => platforms}/intel-iot/curie/imu_driver_test.go (100%) rename {v2/platforms => platforms}/intel-iot/edison/README.md (100%) rename {v2/platforms => platforms}/intel-iot/edison/arduino_pinmap.go (100%) rename {v2/platforms => platforms}/intel-iot/edison/doc.go (100%) rename {v2/platforms => platforms}/intel-iot/edison/edison_adaptor.go (100%) rename {v2/platforms => platforms}/intel-iot/edison/edison_adaptor_test.go (100%) rename {v2/platforms => platforms}/intel-iot/edison/miniboard_pinmap.go (100%) rename {v2/platforms => platforms}/intel-iot/edison/sparkfun_pinmap.go (100%) rename {v2/platforms => platforms}/intel-iot/intel-iot.go (100%) rename {v2/platforms => platforms}/intel-iot/joule/README.md (100%) rename {v2/platforms => platforms}/intel-iot/joule/doc.go (100%) rename {v2/platforms => platforms}/intel-iot/joule/joule_adaptor.go (100%) rename {v2/platforms => platforms}/intel-iot/joule/joule_adaptor_test.go (100%) rename {v2/platforms => platforms}/intel-iot/joule/tuchuck_pinmap.go (100%) rename {v2/platforms => platforms}/jetson/README.md (100%) rename {v2/platforms => platforms}/jetson/doc.go (100%) rename {v2/platforms => platforms}/jetson/jetson_adaptor.go (100%) rename {v2/platforms => platforms}/jetson/jetson_adaptor_test.go (100%) rename {v2/platforms => platforms}/jetson/jetson_pin_map.go (100%) rename {v2/platforms => platforms}/jetson/pwm_pin.go (100%) rename {v2/platforms => platforms}/jetson/pwm_pin_test.go (100%) rename {v2/platforms => platforms}/joystick/LICENSE (100%) rename {v2/platforms => platforms}/joystick/README.md (100%) rename {v2/platforms => platforms}/joystick/bin/scanner.go (100%) rename {v2/platforms => platforms}/joystick/configs/dualsense.json (100%) rename {v2/platforms => platforms}/joystick/configs/dualshock3.json (100%) rename {v2/platforms => platforms}/joystick/configs/dualshock4.json (100%) rename {v2/platforms => platforms}/joystick/configs/magicseer1.json (100%) rename {v2/platforms => platforms}/joystick/configs/shield.json (100%) rename {v2/platforms => platforms}/joystick/configs/xbox360_power_a_mini_proex.json (100%) rename {v2/platforms => platforms}/joystick/doc.go (100%) rename {v2/platforms => platforms}/joystick/events.go (100%) rename {v2/platforms => platforms}/joystick/joystick_adaptor.go (100%) rename {v2/platforms => platforms}/joystick/joystick_adaptor_test.go (100%) rename {v2/platforms => platforms}/joystick/joystick_driver.go (100%) rename {v2/platforms => platforms}/joystick/joystick_driver_test.go (100%) rename {v2/platforms => platforms}/joystick/joystick_dualsense.go (100%) rename {v2/platforms => platforms}/joystick/joystick_dualshock3.go (100%) rename {v2/platforms => platforms}/joystick/joystick_dualshock4.go (100%) rename {v2/platforms => platforms}/joystick/joystick_nintendo_joycon.go (100%) rename {v2/platforms => platforms}/joystick/joystick_shield.go (100%) rename {v2/platforms => platforms}/joystick/joystick_tflight_hotas_x.go (100%) rename {v2/platforms => platforms}/joystick/joystick_xbox360.go (100%) rename {v2/platforms => platforms}/joystick/joystick_xbox360_rock_band_drums.go (100%) rename {v2/platforms => platforms}/joystick/joystick_xboxone.go (100%) rename {v2/platforms => platforms}/joystick/test_helper.go (100%) rename {v2/platforms => platforms}/keyboard/LICENSE (100%) rename {v2/platforms => platforms}/keyboard/README.md (100%) rename {v2/platforms => platforms}/keyboard/doc.go (100%) rename {v2/platforms => platforms}/keyboard/keyboard.go (100%) rename {v2/platforms => platforms}/keyboard/keyboard_driver.go (100%) rename {v2/platforms => platforms}/keyboard/keyboard_driver_test.go (100%) rename {v2/platforms => platforms}/keyboard/keyboard_test.go (100%) rename {v2/platforms => platforms}/leap/LICENSE (100%) rename {v2/platforms => platforms}/leap/README.md (100%) rename {v2/platforms => platforms}/leap/doc.go (100%) rename {v2/platforms => platforms}/leap/leap_motion_adaptor.go (100%) rename {v2/platforms => platforms}/leap/leap_motion_adaptor_test.go (100%) rename {v2/platforms => platforms}/leap/leap_motion_driver.go (100%) rename {v2/platforms => platforms}/leap/leap_motion_driver_test.go (100%) rename {v2/platforms => platforms}/leap/parser.go (100%) rename {v2/platforms => platforms}/leap/test/support/example_frame.json (100%) rename {v2/platforms => platforms}/mavlink/LICENSE (100%) rename {v2/platforms => platforms}/mavlink/README.md (100%) rename {v2/platforms => platforms}/mavlink/common/common.go (100%) rename {v2/platforms => platforms}/mavlink/common/mavlink.go (100%) rename {v2/platforms => platforms}/mavlink/common/version.go (100%) rename {v2/platforms => platforms}/mavlink/doc.go (100%) rename {v2/platforms => platforms}/mavlink/mavlink_adaptor.go (100%) rename {v2/platforms => platforms}/mavlink/mavlink_adaptor_test.go (100%) rename {v2/platforms => platforms}/mavlink/mavlink_driver.go (100%) rename {v2/platforms => platforms}/mavlink/mavlink_driver_test.go (100%) rename {v2/platforms => platforms}/mavlink/mavlink_udp_adaptor.go (100%) rename {v2/platforms => platforms}/mavlink/mavlink_udp_adaptor_test.go (100%) rename {v2/platforms => platforms}/megapi/README.md (100%) rename {v2/platforms => platforms}/megapi/doc.go (100%) rename {v2/platforms => platforms}/megapi/megapi_adaptor.go (100%) rename {v2/platforms => platforms}/megapi/motor_driver.go (100%) rename {v2/platforms => platforms}/microbit/LICENSE (100%) rename {v2/platforms => platforms}/microbit/README.md (100%) rename {v2/platforms => platforms}/microbit/accelerometer_driver.go (100%) rename {v2/platforms => platforms}/microbit/accelerometer_driver_test.go (100%) rename {v2/platforms => platforms}/microbit/button_driver.go (100%) rename {v2/platforms => platforms}/microbit/button_driver_test.go (100%) rename {v2/platforms => platforms}/microbit/doc.go (100%) rename {v2/platforms => platforms}/microbit/helpers_test.go (100%) rename {v2/platforms => platforms}/microbit/io_pin_driver.go (100%) rename {v2/platforms => platforms}/microbit/io_pin_driver_test.go (100%) rename {v2/platforms => platforms}/microbit/led_driver.go (100%) rename {v2/platforms => platforms}/microbit/led_driver_test.go (100%) rename {v2/platforms => platforms}/microbit/magnetometer_driver.go (100%) rename {v2/platforms => platforms}/microbit/magnetometer_driver_test.go (100%) rename {v2/platforms => platforms}/microbit/temperature_driver.go (100%) rename {v2/platforms => platforms}/microbit/temperature_driver_test.go (100%) rename {v2/platforms => platforms}/mqtt/LICENSE (100%) rename {v2/platforms => platforms}/mqtt/README.md (100%) rename {v2/platforms => platforms}/mqtt/doc.go (100%) rename {v2/platforms => platforms}/mqtt/mqtt_adaptor.go (100%) rename {v2/platforms => platforms}/mqtt/mqtt_adaptor_test.go (100%) rename {v2/platforms => platforms}/mqtt/mqtt_driver.go (100%) rename {v2/platforms => platforms}/mqtt/mqtt_driver_test.go (100%) rename {v2/platforms => platforms}/nanopi/LICENSE (100%) rename {v2/platforms => platforms}/nanopi/README.md (100%) rename {v2/platforms => platforms}/nanopi/doc.go (100%) rename {v2/platforms => platforms}/nanopi/nanopi_adaptor.go (100%) rename {v2/platforms => platforms}/nanopi/nanopi_adaptor_test.go (100%) rename {v2/platforms => platforms}/nanopi/nanopineo_pin_map.go (100%) rename {v2/platforms => platforms}/nats/README.md (100%) rename {v2/platforms => platforms}/nats/doc.go (100%) rename {v2/platforms => platforms}/nats/nats_adaptor.go (100%) rename {v2/platforms => platforms}/nats/nats_adaptor_test.go (100%) rename {v2/platforms => platforms}/nats/nats_driver.go (100%) rename {v2/platforms => platforms}/nats/nats_driver_test.go (100%) rename {v2/platforms => platforms}/nats/test_certs/catest-key.pem (100%) rename {v2/platforms => platforms}/nats/test_certs/catest.pem (100%) rename {v2/platforms => platforms}/nats/test_certs/client-cert.pem (100%) rename {v2/platforms => platforms}/nats/test_certs/client-key.pem (100%) rename {v2/platforms => platforms}/nats/test_certs/server-cert.pem (100%) rename {v2/platforms => platforms}/nats/test_certs/server-key.pem (100%) rename {v2/platforms => platforms}/neurosky/LICENSE (100%) rename {v2/platforms => platforms}/neurosky/README.md (100%) rename {v2/platforms => platforms}/neurosky/doc.go (100%) rename {v2/platforms => platforms}/neurosky/neurosky_adaptor.go (100%) rename {v2/platforms => platforms}/neurosky/neurosky_adaptor_test.go (100%) rename {v2/platforms => platforms}/neurosky/neurosky_driver.go (100%) rename {v2/platforms => platforms}/neurosky/neurosky_driver_test.go (100%) rename {v2/platforms => platforms}/opencv/LICENSE (100%) rename {v2/platforms => platforms}/opencv/README.md (100%) rename {v2/platforms => platforms}/opencv/camera_driver.go (100%) rename {v2/platforms => platforms}/opencv/camera_driver_test.go (100%) rename {v2/platforms => platforms}/opencv/doc.go (100%) rename {v2/platforms => platforms}/opencv/haarcascade_frontalface_alt.xml (100%) rename {v2/platforms => platforms}/opencv/helpers_test.go (100%) rename {v2/platforms => platforms}/opencv/lena-256x256.jpg (100%) rename {v2/platforms => platforms}/opencv/utils.go (100%) rename {v2/platforms => platforms}/opencv/utils_test.go (100%) rename {v2/platforms => platforms}/opencv/window_driver.go (100%) rename {v2/platforms => platforms}/opencv/window_driver_test.go (100%) rename {v2/platforms => platforms}/parrot/LICENSE (100%) rename {v2/platforms => platforms}/parrot/README.md (100%) rename {v2/platforms => platforms}/parrot/ardrone/LICENSE (100%) rename {v2/platforms => platforms}/parrot/ardrone/README.md (100%) rename {v2/platforms => platforms}/parrot/ardrone/ardrone_adaptor.go (100%) rename {v2/platforms => platforms}/parrot/ardrone/ardrone_adaptor_test.go (100%) rename {v2/platforms => platforms}/parrot/ardrone/ardrone_driver.go (100%) rename {v2/platforms => platforms}/parrot/ardrone/ardrone_driver_test.go (100%) rename {v2/platforms => platforms}/parrot/ardrone/doc.go (100%) rename {v2/platforms => platforms}/parrot/ardrone/pitch.go (100%) rename {v2/platforms => platforms}/parrot/ardrone/pitch_test.go (100%) rename {v2/platforms => platforms}/parrot/ardrone/test_helper.go (100%) rename {v2/platforms => platforms}/parrot/bebop/LICENSE (100%) rename {v2/platforms => platforms}/parrot/bebop/README.md (100%) rename {v2/platforms => platforms}/parrot/bebop/bebop_adaptor.go (100%) rename {v2/platforms => platforms}/parrot/bebop/bebop_adaptor_test.go (100%) rename {v2/platforms => platforms}/parrot/bebop/bebop_driver.go (100%) rename {v2/platforms => platforms}/parrot/bebop/bebop_driver_test.go (100%) rename {v2/platforms => platforms}/parrot/bebop/client/client.go (100%) rename {v2/platforms => platforms}/parrot/bebop/client/constants.go (100%) rename {v2/platforms => platforms}/parrot/bebop/client/examples/ff.conf (100%) rename {v2/platforms => platforms}/parrot/bebop/client/examples/takeoff.go (100%) rename {v2/platforms => platforms}/parrot/bebop/client/examples/video.go (100%) rename {v2/platforms => platforms}/parrot/bebop/doc.go (100%) rename {v2/platforms => platforms}/parrot/bebop/pitch.go (100%) rename {v2/platforms => platforms}/parrot/bebop/pitch_test.go (100%) rename {v2/platforms => platforms}/parrot/bebop/test_helper.go (100%) rename {v2/platforms => platforms}/parrot/minidrone/LICENSE (100%) rename {v2/platforms => platforms}/parrot/minidrone/README.md (100%) rename {v2/platforms => platforms}/parrot/minidrone/doc.go (100%) rename {v2/platforms => platforms}/parrot/minidrone/helpers_test.go (100%) rename {v2/platforms => platforms}/parrot/minidrone/minidrone_driver.go (100%) rename {v2/platforms => platforms}/parrot/minidrone/minidrone_driver_test.go (100%) rename {v2/platforms => platforms}/parrot/minidrone/pitch.go (100%) rename {v2/platforms => platforms}/parrot/minidrone/pitch_test.go (100%) rename {v2/platforms => platforms}/parrot/parrot.go (100%) rename {v2/platforms => platforms}/particle/LICENSE (100%) rename {v2/platforms => platforms}/particle/README.md (100%) rename {v2/platforms => platforms}/particle/adaptor.go (100%) rename {v2/platforms => platforms}/particle/adaptor_test.go (100%) rename {v2/platforms => platforms}/particle/doc.go (100%) rename {v2/platforms => platforms}/pebble/README.md (100%) rename {v2/platforms => platforms}/pebble/doc.go (100%) rename {v2/platforms => platforms}/pebble/pebble_adaptor.go (100%) rename {v2/platforms => platforms}/pebble/pebble_adaptor_test.go (100%) rename {v2/platforms => platforms}/pebble/pebble_driver.go (100%) rename {v2/platforms => platforms}/pebble/pebble_driver_test.go (100%) rename {v2/platforms => platforms}/raspi/LICENSE (100%) rename {v2/platforms => platforms}/raspi/README.md (100%) rename {v2/platforms => platforms}/raspi/doc.go (100%) rename {v2/platforms => platforms}/raspi/pwm_pin.go (100%) rename {v2/platforms => platforms}/raspi/pwm_pin_test.go (100%) rename {v2/platforms => platforms}/raspi/raspi_adaptor.go (100%) rename {v2/platforms => platforms}/raspi/raspi_adaptor_test.go (100%) rename {v2/platforms => platforms}/raspi/raspi_pin_map.go (100%) rename {v2/platforms => platforms}/rockpi/LICENSE (100%) rename {v2/platforms => platforms}/rockpi/README.md (100%) rename {v2/platforms => platforms}/rockpi/doc.go (100%) rename {v2/platforms => platforms}/rockpi/rockpi_adaptor.go (100%) rename {v2/platforms => platforms}/rockpi/rockpi_adaptor_test.go (100%) rename {v2/platforms => platforms}/rockpi/rockpi_pin_map.go (100%) rename {v2/platforms => platforms}/sphero/LICENSE (100%) rename {v2/platforms => platforms}/sphero/README.md (100%) rename {v2/platforms => platforms}/sphero/bb8/LICENSE (100%) rename {v2/platforms => platforms}/sphero/bb8/README.md (100%) rename {v2/platforms => platforms}/sphero/bb8/bb8_driver.go (100%) rename {v2/platforms => platforms}/sphero/bb8/bb8_driver_test.go (100%) rename {v2/platforms => platforms}/sphero/bb8/bb8_packets.go (100%) rename {v2/platforms => platforms}/sphero/bb8/doc.go (100%) rename {v2/platforms => platforms}/sphero/bb8/helpers_test.go (100%) rename {v2/platforms => platforms}/sphero/doc.go (100%) rename {v2/platforms => platforms}/sphero/ollie/LICENSE (100%) rename {v2/platforms => platforms}/sphero/ollie/README.md (100%) rename {v2/platforms => platforms}/sphero/ollie/doc.go (100%) rename {v2/platforms => platforms}/sphero/ollie/helpers_test.go (100%) rename {v2/platforms => platforms}/sphero/ollie/ollie_driver.go (100%) rename {v2/platforms => platforms}/sphero/ollie/ollie_driver_test.go (100%) rename {v2/platforms => platforms}/sphero/ollie/ollie_packets.go (100%) rename {v2/platforms => platforms}/sphero/sphero_adaptor.go (100%) rename {v2/platforms => platforms}/sphero/sphero_adaptor_test.go (100%) rename {v2/platforms => platforms}/sphero/sphero_driver.go (100%) rename {v2/platforms => platforms}/sphero/sphero_driver_test.go (100%) rename {v2/platforms => platforms}/sphero/sphero_packets.go (100%) rename {v2/platforms => platforms}/sphero/sprkplus/LICENSE (100%) rename {v2/platforms => platforms}/sphero/sprkplus/README.md (100%) rename {v2/platforms => platforms}/sphero/sprkplus/doc.go (100%) rename {v2/platforms => platforms}/sphero/sprkplus/helpers_test.go (100%) rename {v2/platforms => platforms}/sphero/sprkplus/sprkplus_driver.go (100%) rename {v2/platforms => platforms}/sphero/sprkplus/sprkplus_driver_test.go (100%) rename {v2/platforms => platforms}/sphero/sprkplus/sprkplus_packets.go (100%) rename {v2/platforms => platforms}/tinkerboard/LICENSE (100%) rename {v2/platforms => platforms}/tinkerboard/README.md (100%) rename {v2/platforms => platforms}/tinkerboard/adaptor.go (100%) rename {v2/platforms => platforms}/tinkerboard/adaptor_test.go (100%) rename {v2/platforms => platforms}/tinkerboard/doc.go (100%) rename {v2/platforms => platforms}/tinkerboard/pin_map.go (100%) rename {v2/platforms => platforms}/upboard/README.md (100%) rename {v2/platforms => platforms}/upboard/up2/LICENSE (100%) rename {v2/platforms => platforms}/upboard/up2/README.md (100%) rename {v2/platforms => platforms}/upboard/up2/adaptor.go (100%) rename {v2/platforms => platforms}/upboard/up2/adaptor_test.go (100%) rename {v2/platforms => platforms}/upboard/up2/doc.go (100%) rename {v2/platforms => platforms}/upboard/up2/pin_map.go (100%) rename {v2/platforms => platforms}/upboard/upboard.go (100%) rename v2/robot.go => robot.go (100%) rename v2/robot_test.go => robot_test.go (100%) rename v2/robot_work.go => robot_work.go (100%) rename v2/robot_work_test.go => robot_work_test.go (100%) rename v2/snapcraft.yaml => snapcraft.yaml (100%) rename {v2/system => system}/GPIO.md (100%) rename {v2/system => system}/I2C.md (100%) rename {v2/system => system}/PWM.md (100%) rename {v2/system => system}/README.md (100%) rename {v2/system => system}/digitalpin_access.go (100%) rename {v2/system => system}/digitalpin_access_test.go (100%) rename {v2/system => system}/digitalpin_bench_test.go (100%) rename {v2/system => system}/digitalpin_config.go (100%) rename {v2/system => system}/digitalpin_config_test.go (100%) rename {v2/system => system}/digitalpin_gpiod.go (100%) rename {v2/system => system}/digitalpin_gpiod_test.go (100%) rename {v2/system => system}/digitalpin_mock.go (100%) rename {v2/system => system}/digitalpin_sysfs.go (100%) rename {v2/system => system}/digitalpin_sysfs_test.go (100%) rename {v2/system => system}/doc.go (100%) rename {v2/system => system}/fs.go (100%) rename {v2/system => system}/fs_mock.go (100%) rename {v2/system => system}/fs_mock_test.go (100%) rename {v2/system => system}/fs_test.go (100%) rename {v2/system => system}/i2c_device.go (100%) rename {v2/system => system}/i2c_device_test.go (100%) rename {v2/system => system}/pwmpin_sysfs.go (100%) rename {v2/system => system}/pwmpin_sysfs_test.go (100%) rename {v2/system => system}/spi_access.go (100%) rename {v2/system => system}/spi_access_test.go (100%) rename {v2/system => system}/spi_gpio.go (100%) rename {v2/system => system}/spi_mock.go (100%) rename {v2/system => system}/spi_periphio.go (100%) rename {v2/system => system}/syscall.go (100%) rename {v2/system => system}/syscall_mock.go (100%) rename {v2/system => system}/system.go (100%) rename {v2/system => system}/system_options.go (100%) rename {v2/system => system}/system_test.go (100%) rename v2/utils.go => utils.go (100%) rename v2/utils_test.go => utils_test.go (100%) delete mode 100644 v2/Makefile rename v2/version.go => version.go (100%) diff --git a/.circleci/config.yml b/.circleci/config.yml index 57245474f..8091ab510 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -23,7 +23,6 @@ jobs: - run: name: Core and drivers tests command: | - cd ./v2 go test -v -coverprofile=coverage.txt -covermode=atomic . ./drivers/... - run: name: Code coverage @@ -42,7 +41,6 @@ jobs: # digispark needs libusb, joystick needs sdl2, opencv needs opencv name: Platform tests (except digispark, joystick, opencv) command: | - cd ./v2 go test -v $(go list ./platforms/... | grep -v platforms/digispark | grep -v platforms/joystick | grep -v platforms/opencv) "check_examples": @@ -57,7 +55,6 @@ jobs: # digispark needs libusb, joystick needs sdl2, opencv needs opencv name: Check examples (except digispark, joystick, opencv) command: | - cd ./v2 ALL=$(grep -l -r --include "*.go" 'build example' ./) SOME=$(grep -L 'digispark' $(grep -L 'joystick' $(grep -L 'gocv' ${ALL}))) for e in ${SOME} ; do go vet "${e}" ; done diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index cebafc42b..281730892 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -27,7 +27,7 @@ jobs: version: v1.52.2 # Optional: working directory, useful for monorepos - working-directory: v2 + # working-directory: v2 # Optional: golangci-lint command line arguments. # mostly there is no problem locally, but on server: "could not import C (cgo preprocessing failed) (typecheck)" diff --git a/CHANGELOG.md b/CHANGELOG.md index 6926bb6dd..0b48d2767 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,12 +1,22 @@ # CHANGELOG -## [Unreleased](https://github.com/hybridgroup/gobot/compare/v2.0.2...HEAD) +## [Unreleased](https://github.com/hybridgroup/gobot/compare/v2.1.0...HEAD) + +## [v2.1.0](https://github.com/hybridgroup/gobot/compare/v2.0.3...v2.1.0) (2023-05-29) + +### Build + +* **v2:** revert of [#927](https://github.com/hybridgroup/gobot/pull/927), no usage of a v2 subfolder anymore (issue [#920](https://github.com/hybridgroup/gobot/issues/920)) + +## [v2.0.3](https://github.com/hybridgroup/gobot/compare/v2.0.2...v2.0.3) (2023-05-24) + +* accidentally created release without any changes ## [v2.0.2](https://github.com/hybridgroup/gobot/compare/v2.0.1...v2.0.2) (2023-05-22) ### Build -* **v2:** fix usage by moving code to a v2 subfolder ([#927](https://github.com/hybridgroup/gobot/issues/927)) +* **v2:** fix usage by moving code to a v2 subfolder ([#927](https://github.com/hybridgroup/gobot/pull/927)) ## [v2.0.1](https://github.com/hybridgroup/gobot/compare/v2.0.0...v2.0.1) (2023-05-21) diff --git a/Makefile b/Makefile index 63cd82eaa..5ba96901e 100644 --- a/Makefile +++ b/Makefile @@ -1,16 +1,76 @@ -# this file is just a forwarder to the folder with go.mod for common use cases -# it is working since Go 1.18 is installed locally +# include also examples in other than ./examples folder +ALL_EXAMPLES := $(shell grep -l -r --include "*.go" 'build example' ./) +# prevent examples with gocv (opencv) dependencies +EXAMPLES_NO_GOCV := $(shell grep -L 'gocv' $(ALL_EXAMPLES)) +# prevent examples with joystick (sdl2) dependencies +EXAMPLES_NO_JOYSTICK := $(shell grep -L 'joystick' $(ALL_EXAMPLES)) +# prevent examples with joystick (sdl2) and gocv (opencv) dependencies +EXAMPLES_NO_GOCV_JOYSTICK := $(shell grep -L 'joystick' $$(grep -L 'gocv' $(EXAMPLES_NO_GOCV))) +# used examples +EXAMPLES := $(EXAMPLES_NO_GOCV_JOYSTICK) -gomoddir := $(shell go list -f '{{.Dir}}' -m) +.PHONY: test test_race test_cover robeaux version_check fmt_check fmt_fix examples examples_check $(EXAMPLES) +# opencv platform currently skipped to prevent install of preconditions +including_except := $(shell go list ./... | grep -v platforms/opencv) -.PHONY: test fmt_check examples_check - +# Run tests on nearly all directories without test cache test: - cd $(gomoddir) && make test && cd .. + go test -count=1 -v $(including_except) + +# Run tests with race detection +test_race: + go test -race $(including_except) + +# Test, generate and show coverage in browser +test_cover: + go test -v $(including_except) -coverprofile=coverage.txt ; \ + go tool cover -html=coverage.txt ; \ + +robeaux: +ifeq (,$(shell which go-bindata)) + $(error robeaux not built! https://github.com/jteeuwen/go-bindata is required to build robeaux assets ) +endif + cd api ; \ + npm install robeaux ; \ + cp -r node_modules/robeaux robeaux-tmp ; \ + cd robeaux-tmp ; \ + rm Makefile package.json README.markdown ; \ + touch css/fonts.css ; \ + echo "Updating robeaux..." ; \ + go-bindata -pkg="robeaux" -o robeaux.go -ignore=\\.git ./... ; \ + mv robeaux.go ../robeaux ; \ + cd .. ; \ + rm -rf robeaux-tmp/ ; \ + rm -rf node_modules/ ; \ + go fmt ./robeaux/robeaux.go ; \ +# Check for installed and module version match. Will exit with code 50 if not match. +# There is nothing bad in general, if you program with a higher version. +# At least the recipe "fmt_fix" will not work in that case. +version_check: + @gv=$$(echo $$(go version) | sed "s/^.* go\([0-9].[0-9]*\).*/\1/") ; \ + mv=$$(grep -m 1 'go 1.' ./go.mod | sed "s/^go \([0-9].[0-9]*\).*/\1/") ; \ + echo "go: $${gv}.*, go.mod: $${mv}" ; \ + if [ "$${gv}" != "$${mv}" ]; then exit 50; fi ; \ + +# Check for bad code style and other issues fmt_check: - cd $(gomoddir) && make fmt_check && cd .. + gofmt -l ./ + golangci-lint run -v + +# Fix bad code style (will only be executed, on version match) +fmt_fix: version_check + go fmt ./... + +examples: $(EXAMPLES) + +examples_check: + $(MAKE) CHECK=ON examples -examples_check: - cd $(gomoddir) && make examples_check && cd .. \ No newline at end of file +$(EXAMPLES): +ifeq ($(CHECK),ON) + go vet ./$@ +else + go build -o /tmp/gobot_examples/$@ ./$@ +endif diff --git a/v2/adaptor.go b/adaptor.go similarity index 100% rename from v2/adaptor.go rename to adaptor.go diff --git a/v2/api/api.go b/api/api.go similarity index 100% rename from v2/api/api.go rename to api/api.go diff --git a/v2/api/api_test.go b/api/api_test.go similarity index 100% rename from v2/api/api_test.go rename to api/api_test.go diff --git a/v2/api/basic_auth.go b/api/basic_auth.go similarity index 100% rename from v2/api/basic_auth.go rename to api/basic_auth.go diff --git a/v2/api/basic_auth_test.go b/api/basic_auth_test.go similarity index 100% rename from v2/api/basic_auth_test.go rename to api/basic_auth_test.go diff --git a/v2/api/cors.go b/api/cors.go similarity index 100% rename from v2/api/cors.go rename to api/cors.go diff --git a/v2/api/cors_test.go b/api/cors_test.go similarity index 100% rename from v2/api/cors_test.go rename to api/cors_test.go diff --git a/v2/api/doc.go b/api/doc.go similarity index 100% rename from v2/api/doc.go rename to api/doc.go diff --git a/v2/api/helpers_test.go b/api/helpers_test.go similarity index 100% rename from v2/api/helpers_test.go rename to api/helpers_test.go diff --git a/v2/api/robeaux/robeaux.go b/api/robeaux/robeaux.go similarity index 100% rename from v2/api/robeaux/robeaux.go rename to api/robeaux/robeaux.go diff --git a/appveyor.yml b/appveyor.yml index 9b6a24b19..a2abb7d93 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -13,7 +13,6 @@ before_test: - go env build_script: - - cd ./v2 - go test -v -cpu=2 . - go test -v -cpu=2 ./drivers/aio/... - go test -v -cpu=2 ./drivers/i2c/... diff --git a/v2/cli/README.md b/cli/README.md similarity index 100% rename from v2/cli/README.md rename to cli/README.md diff --git a/v2/cli/doc.go b/cli/doc.go similarity index 100% rename from v2/cli/doc.go rename to cli/doc.go diff --git a/v2/cli/generate.go b/cli/generate.go similarity index 100% rename from v2/cli/generate.go rename to cli/generate.go diff --git a/v2/cli/main.go b/cli/main.go similarity index 100% rename from v2/cli/main.go rename to cli/main.go diff --git a/v2/commander.go b/commander.go similarity index 100% rename from v2/commander.go rename to commander.go diff --git a/v2/commander_test.go b/commander_test.go similarity index 100% rename from v2/commander_test.go rename to commander_test.go diff --git a/v2/connection.go b/connection.go similarity index 100% rename from v2/connection.go rename to connection.go diff --git a/v2/device.go b/device.go similarity index 100% rename from v2/device.go rename to device.go diff --git a/v2/doc.go b/doc.go similarity index 100% rename from v2/doc.go rename to doc.go diff --git a/v2/driver.go b/driver.go similarity index 100% rename from v2/driver.go rename to driver.go diff --git a/v2/drivers/aio/LICENSE b/drivers/aio/LICENSE similarity index 100% rename from v2/drivers/aio/LICENSE rename to drivers/aio/LICENSE diff --git a/v2/drivers/aio/README.md b/drivers/aio/README.md similarity index 100% rename from v2/drivers/aio/README.md rename to drivers/aio/README.md diff --git a/v2/drivers/aio/aio.go b/drivers/aio/aio.go similarity index 100% rename from v2/drivers/aio/aio.go rename to drivers/aio/aio.go diff --git a/v2/drivers/aio/analog_actuator_driver.go b/drivers/aio/analog_actuator_driver.go similarity index 100% rename from v2/drivers/aio/analog_actuator_driver.go rename to drivers/aio/analog_actuator_driver.go diff --git a/v2/drivers/aio/analog_actuator_driver_test.go b/drivers/aio/analog_actuator_driver_test.go similarity index 100% rename from v2/drivers/aio/analog_actuator_driver_test.go rename to drivers/aio/analog_actuator_driver_test.go diff --git a/v2/drivers/aio/analog_sensor_driver.go b/drivers/aio/analog_sensor_driver.go similarity index 100% rename from v2/drivers/aio/analog_sensor_driver.go rename to drivers/aio/analog_sensor_driver.go diff --git a/v2/drivers/aio/analog_sensor_driver_test.go b/drivers/aio/analog_sensor_driver_test.go similarity index 100% rename from v2/drivers/aio/analog_sensor_driver_test.go rename to drivers/aio/analog_sensor_driver_test.go diff --git a/v2/drivers/aio/doc.go b/drivers/aio/doc.go similarity index 100% rename from v2/drivers/aio/doc.go rename to drivers/aio/doc.go diff --git a/v2/drivers/aio/grove_drivers.go b/drivers/aio/grove_drivers.go similarity index 100% rename from v2/drivers/aio/grove_drivers.go rename to drivers/aio/grove_drivers.go diff --git a/v2/drivers/aio/grove_drivers_test.go b/drivers/aio/grove_drivers_test.go similarity index 100% rename from v2/drivers/aio/grove_drivers_test.go rename to drivers/aio/grove_drivers_test.go diff --git a/v2/drivers/aio/grove_temperature_sensor_driver.go b/drivers/aio/grove_temperature_sensor_driver.go similarity index 100% rename from v2/drivers/aio/grove_temperature_sensor_driver.go rename to drivers/aio/grove_temperature_sensor_driver.go diff --git a/v2/drivers/aio/grove_temperature_sensor_driver_test.go b/drivers/aio/grove_temperature_sensor_driver_test.go similarity index 100% rename from v2/drivers/aio/grove_temperature_sensor_driver_test.go rename to drivers/aio/grove_temperature_sensor_driver_test.go diff --git a/v2/drivers/aio/helpers_test.go b/drivers/aio/helpers_test.go similarity index 100% rename from v2/drivers/aio/helpers_test.go rename to drivers/aio/helpers_test.go diff --git a/v2/drivers/aio/temperature_sensor_driver.go b/drivers/aio/temperature_sensor_driver.go similarity index 100% rename from v2/drivers/aio/temperature_sensor_driver.go rename to drivers/aio/temperature_sensor_driver.go diff --git a/v2/drivers/aio/temperature_sensor_driver_test.go b/drivers/aio/temperature_sensor_driver_test.go similarity index 100% rename from v2/drivers/aio/temperature_sensor_driver_test.go rename to drivers/aio/temperature_sensor_driver_test.go diff --git a/v2/drivers/common/mfrc522/mfrc522_connectionwrapper.go b/drivers/common/mfrc522/mfrc522_connectionwrapper.go similarity index 100% rename from v2/drivers/common/mfrc522/mfrc522_connectionwrapper.go rename to drivers/common/mfrc522/mfrc522_connectionwrapper.go diff --git a/v2/drivers/common/mfrc522/mfrc522_pcd.go b/drivers/common/mfrc522/mfrc522_pcd.go similarity index 100% rename from v2/drivers/common/mfrc522/mfrc522_pcd.go rename to drivers/common/mfrc522/mfrc522_pcd.go diff --git a/v2/drivers/common/mfrc522/mfrc522_pcd_register.go b/drivers/common/mfrc522/mfrc522_pcd_register.go similarity index 100% rename from v2/drivers/common/mfrc522/mfrc522_pcd_register.go rename to drivers/common/mfrc522/mfrc522_pcd_register.go diff --git a/v2/drivers/common/mfrc522/mfrc522_pcd_test.go b/drivers/common/mfrc522/mfrc522_pcd_test.go similarity index 100% rename from v2/drivers/common/mfrc522/mfrc522_pcd_test.go rename to drivers/common/mfrc522/mfrc522_pcd_test.go diff --git a/v2/drivers/common/mfrc522/mfrc522_picc.go b/drivers/common/mfrc522/mfrc522_picc.go similarity index 100% rename from v2/drivers/common/mfrc522/mfrc522_picc.go rename to drivers/common/mfrc522/mfrc522_picc.go diff --git a/v2/drivers/gpio/LICENSE b/drivers/gpio/LICENSE similarity index 100% rename from v2/drivers/gpio/LICENSE rename to drivers/gpio/LICENSE diff --git a/v2/drivers/gpio/README.md b/drivers/gpio/README.md similarity index 100% rename from v2/drivers/gpio/README.md rename to drivers/gpio/README.md diff --git a/v2/drivers/gpio/aip1640_driver.go b/drivers/gpio/aip1640_driver.go similarity index 100% rename from v2/drivers/gpio/aip1640_driver.go rename to drivers/gpio/aip1640_driver.go diff --git a/v2/drivers/gpio/aip1640_driver_test.go b/drivers/gpio/aip1640_driver_test.go similarity index 100% rename from v2/drivers/gpio/aip1640_driver_test.go rename to drivers/gpio/aip1640_driver_test.go diff --git a/v2/drivers/gpio/button_driver.go b/drivers/gpio/button_driver.go similarity index 100% rename from v2/drivers/gpio/button_driver.go rename to drivers/gpio/button_driver.go diff --git a/v2/drivers/gpio/button_driver_test.go b/drivers/gpio/button_driver_test.go similarity index 100% rename from v2/drivers/gpio/button_driver_test.go rename to drivers/gpio/button_driver_test.go diff --git a/v2/drivers/gpio/buzzer_driver.go b/drivers/gpio/buzzer_driver.go similarity index 100% rename from v2/drivers/gpio/buzzer_driver.go rename to drivers/gpio/buzzer_driver.go diff --git a/v2/drivers/gpio/buzzer_driver_test.go b/drivers/gpio/buzzer_driver_test.go similarity index 100% rename from v2/drivers/gpio/buzzer_driver_test.go rename to drivers/gpio/buzzer_driver_test.go diff --git a/v2/drivers/gpio/direct_pin_driver.go b/drivers/gpio/direct_pin_driver.go similarity index 100% rename from v2/drivers/gpio/direct_pin_driver.go rename to drivers/gpio/direct_pin_driver.go diff --git a/v2/drivers/gpio/direct_pin_driver_test.go b/drivers/gpio/direct_pin_driver_test.go similarity index 100% rename from v2/drivers/gpio/direct_pin_driver_test.go rename to drivers/gpio/direct_pin_driver_test.go diff --git a/v2/drivers/gpio/doc.go b/drivers/gpio/doc.go similarity index 100% rename from v2/drivers/gpio/doc.go rename to drivers/gpio/doc.go diff --git a/v2/drivers/gpio/easy_driver.go b/drivers/gpio/easy_driver.go similarity index 100% rename from v2/drivers/gpio/easy_driver.go rename to drivers/gpio/easy_driver.go diff --git a/v2/drivers/gpio/easy_driver_test.go b/drivers/gpio/easy_driver_test.go similarity index 100% rename from v2/drivers/gpio/easy_driver_test.go rename to drivers/gpio/easy_driver_test.go diff --git a/v2/drivers/gpio/gpio.go b/drivers/gpio/gpio.go similarity index 100% rename from v2/drivers/gpio/gpio.go rename to drivers/gpio/gpio.go diff --git a/v2/drivers/gpio/grove_drivers.go b/drivers/gpio/grove_drivers.go similarity index 100% rename from v2/drivers/gpio/grove_drivers.go rename to drivers/gpio/grove_drivers.go diff --git a/v2/drivers/gpio/grove_drivers_test.go b/drivers/gpio/grove_drivers_test.go similarity index 100% rename from v2/drivers/gpio/grove_drivers_test.go rename to drivers/gpio/grove_drivers_test.go diff --git a/v2/drivers/gpio/hd44780_driver.go b/drivers/gpio/hd44780_driver.go similarity index 100% rename from v2/drivers/gpio/hd44780_driver.go rename to drivers/gpio/hd44780_driver.go diff --git a/v2/drivers/gpio/hd44780_driver_test.go b/drivers/gpio/hd44780_driver_test.go similarity index 100% rename from v2/drivers/gpio/hd44780_driver_test.go rename to drivers/gpio/hd44780_driver_test.go diff --git a/v2/drivers/gpio/helpers_test.go b/drivers/gpio/helpers_test.go similarity index 100% rename from v2/drivers/gpio/helpers_test.go rename to drivers/gpio/helpers_test.go diff --git a/v2/drivers/gpio/led_driver.go b/drivers/gpio/led_driver.go similarity index 100% rename from v2/drivers/gpio/led_driver.go rename to drivers/gpio/led_driver.go diff --git a/v2/drivers/gpio/led_driver_test.go b/drivers/gpio/led_driver_test.go similarity index 100% rename from v2/drivers/gpio/led_driver_test.go rename to drivers/gpio/led_driver_test.go diff --git a/v2/drivers/gpio/makey_button_driver.go b/drivers/gpio/makey_button_driver.go similarity index 100% rename from v2/drivers/gpio/makey_button_driver.go rename to drivers/gpio/makey_button_driver.go diff --git a/v2/drivers/gpio/makey_button_driver_test.go b/drivers/gpio/makey_button_driver_test.go similarity index 100% rename from v2/drivers/gpio/makey_button_driver_test.go rename to drivers/gpio/makey_button_driver_test.go diff --git a/v2/drivers/gpio/max7219_driver.go b/drivers/gpio/max7219_driver.go similarity index 100% rename from v2/drivers/gpio/max7219_driver.go rename to drivers/gpio/max7219_driver.go diff --git a/v2/drivers/gpio/max7219_driver_test.go b/drivers/gpio/max7219_driver_test.go similarity index 100% rename from v2/drivers/gpio/max7219_driver_test.go rename to drivers/gpio/max7219_driver_test.go diff --git a/v2/drivers/gpio/motor_driver.go b/drivers/gpio/motor_driver.go similarity index 100% rename from v2/drivers/gpio/motor_driver.go rename to drivers/gpio/motor_driver.go diff --git a/v2/drivers/gpio/motor_driver_test.go b/drivers/gpio/motor_driver_test.go similarity index 100% rename from v2/drivers/gpio/motor_driver_test.go rename to drivers/gpio/motor_driver_test.go diff --git a/v2/drivers/gpio/pir_motion_driver.go b/drivers/gpio/pir_motion_driver.go similarity index 100% rename from v2/drivers/gpio/pir_motion_driver.go rename to drivers/gpio/pir_motion_driver.go diff --git a/v2/drivers/gpio/pir_motion_driver_test.go b/drivers/gpio/pir_motion_driver_test.go similarity index 100% rename from v2/drivers/gpio/pir_motion_driver_test.go rename to drivers/gpio/pir_motion_driver_test.go diff --git a/v2/drivers/gpio/relay_driver.go b/drivers/gpio/relay_driver.go similarity index 100% rename from v2/drivers/gpio/relay_driver.go rename to drivers/gpio/relay_driver.go diff --git a/v2/drivers/gpio/relay_driver_test.go b/drivers/gpio/relay_driver_test.go similarity index 100% rename from v2/drivers/gpio/relay_driver_test.go rename to drivers/gpio/relay_driver_test.go diff --git a/v2/drivers/gpio/rgb_led_driver.go b/drivers/gpio/rgb_led_driver.go similarity index 100% rename from v2/drivers/gpio/rgb_led_driver.go rename to drivers/gpio/rgb_led_driver.go diff --git a/v2/drivers/gpio/rgb_led_driver_test.go b/drivers/gpio/rgb_led_driver_test.go similarity index 100% rename from v2/drivers/gpio/rgb_led_driver_test.go rename to drivers/gpio/rgb_led_driver_test.go diff --git a/v2/drivers/gpio/servo_driver.go b/drivers/gpio/servo_driver.go similarity index 100% rename from v2/drivers/gpio/servo_driver.go rename to drivers/gpio/servo_driver.go diff --git a/v2/drivers/gpio/servo_driver_test.go b/drivers/gpio/servo_driver_test.go similarity index 100% rename from v2/drivers/gpio/servo_driver_test.go rename to drivers/gpio/servo_driver_test.go diff --git a/v2/drivers/gpio/stepper_driver.go b/drivers/gpio/stepper_driver.go similarity index 100% rename from v2/drivers/gpio/stepper_driver.go rename to drivers/gpio/stepper_driver.go diff --git a/v2/drivers/gpio/stepper_driver_test.go b/drivers/gpio/stepper_driver_test.go similarity index 100% rename from v2/drivers/gpio/stepper_driver_test.go rename to drivers/gpio/stepper_driver_test.go diff --git a/v2/drivers/gpio/tm1638_driver.go b/drivers/gpio/tm1638_driver.go similarity index 100% rename from v2/drivers/gpio/tm1638_driver.go rename to drivers/gpio/tm1638_driver.go diff --git a/v2/drivers/gpio/tm1638_driver_test.go b/drivers/gpio/tm1638_driver_test.go similarity index 100% rename from v2/drivers/gpio/tm1638_driver_test.go rename to drivers/gpio/tm1638_driver_test.go diff --git a/v2/drivers/i2c/LICENSE b/drivers/i2c/LICENSE similarity index 100% rename from v2/drivers/i2c/LICENSE rename to drivers/i2c/LICENSE diff --git a/v2/drivers/i2c/README.md b/drivers/i2c/README.md similarity index 100% rename from v2/drivers/i2c/README.md rename to drivers/i2c/README.md diff --git a/v2/drivers/i2c/adafruit1109_driver.go b/drivers/i2c/adafruit1109_driver.go similarity index 100% rename from v2/drivers/i2c/adafruit1109_driver.go rename to drivers/i2c/adafruit1109_driver.go diff --git a/v2/drivers/i2c/adafruit1109_driver_test.go b/drivers/i2c/adafruit1109_driver_test.go similarity index 100% rename from v2/drivers/i2c/adafruit1109_driver_test.go rename to drivers/i2c/adafruit1109_driver_test.go diff --git a/v2/drivers/i2c/adafruit_driver.go b/drivers/i2c/adafruit_driver.go similarity index 100% rename from v2/drivers/i2c/adafruit_driver.go rename to drivers/i2c/adafruit_driver.go diff --git a/v2/drivers/i2c/adafruit_driver_test.go b/drivers/i2c/adafruit_driver_test.go similarity index 100% rename from v2/drivers/i2c/adafruit_driver_test.go rename to drivers/i2c/adafruit_driver_test.go diff --git a/v2/drivers/i2c/ads1x15_driver.go b/drivers/i2c/ads1x15_driver.go similarity index 100% rename from v2/drivers/i2c/ads1x15_driver.go rename to drivers/i2c/ads1x15_driver.go diff --git a/v2/drivers/i2c/ads1x15_driver_1015_test.go b/drivers/i2c/ads1x15_driver_1015_test.go similarity index 100% rename from v2/drivers/i2c/ads1x15_driver_1015_test.go rename to drivers/i2c/ads1x15_driver_1015_test.go diff --git a/v2/drivers/i2c/ads1x15_driver_1115_test.go b/drivers/i2c/ads1x15_driver_1115_test.go similarity index 100% rename from v2/drivers/i2c/ads1x15_driver_1115_test.go rename to drivers/i2c/ads1x15_driver_1115_test.go diff --git a/v2/drivers/i2c/ads1x15_driver_test.go b/drivers/i2c/ads1x15_driver_test.go similarity index 100% rename from v2/drivers/i2c/ads1x15_driver_test.go rename to drivers/i2c/ads1x15_driver_test.go diff --git a/v2/drivers/i2c/adxl345_driver.go b/drivers/i2c/adxl345_driver.go similarity index 100% rename from v2/drivers/i2c/adxl345_driver.go rename to drivers/i2c/adxl345_driver.go diff --git a/v2/drivers/i2c/adxl345_driver_test.go b/drivers/i2c/adxl345_driver_test.go similarity index 100% rename from v2/drivers/i2c/adxl345_driver_test.go rename to drivers/i2c/adxl345_driver_test.go diff --git a/v2/drivers/i2c/bh1750_driver.go b/drivers/i2c/bh1750_driver.go similarity index 100% rename from v2/drivers/i2c/bh1750_driver.go rename to drivers/i2c/bh1750_driver.go diff --git a/v2/drivers/i2c/bh1750_driver_test.go b/drivers/i2c/bh1750_driver_test.go similarity index 100% rename from v2/drivers/i2c/bh1750_driver_test.go rename to drivers/i2c/bh1750_driver_test.go diff --git a/v2/drivers/i2c/blinkm_driver.go b/drivers/i2c/blinkm_driver.go similarity index 100% rename from v2/drivers/i2c/blinkm_driver.go rename to drivers/i2c/blinkm_driver.go diff --git a/v2/drivers/i2c/blinkm_driver_test.go b/drivers/i2c/blinkm_driver_test.go similarity index 100% rename from v2/drivers/i2c/blinkm_driver_test.go rename to drivers/i2c/blinkm_driver_test.go diff --git a/v2/drivers/i2c/bme280_driver.go b/drivers/i2c/bme280_driver.go similarity index 100% rename from v2/drivers/i2c/bme280_driver.go rename to drivers/i2c/bme280_driver.go diff --git a/v2/drivers/i2c/bme280_driver_test.go b/drivers/i2c/bme280_driver_test.go similarity index 100% rename from v2/drivers/i2c/bme280_driver_test.go rename to drivers/i2c/bme280_driver_test.go diff --git a/v2/drivers/i2c/bmp180_driver.go b/drivers/i2c/bmp180_driver.go similarity index 100% rename from v2/drivers/i2c/bmp180_driver.go rename to drivers/i2c/bmp180_driver.go diff --git a/v2/drivers/i2c/bmp180_driver_test.go b/drivers/i2c/bmp180_driver_test.go similarity index 100% rename from v2/drivers/i2c/bmp180_driver_test.go rename to drivers/i2c/bmp180_driver_test.go diff --git a/v2/drivers/i2c/bmp280_driver.go b/drivers/i2c/bmp280_driver.go similarity index 100% rename from v2/drivers/i2c/bmp280_driver.go rename to drivers/i2c/bmp280_driver.go diff --git a/v2/drivers/i2c/bmp280_driver_test.go b/drivers/i2c/bmp280_driver_test.go similarity index 100% rename from v2/drivers/i2c/bmp280_driver_test.go rename to drivers/i2c/bmp280_driver_test.go diff --git a/v2/drivers/i2c/bmp388_driver.go b/drivers/i2c/bmp388_driver.go similarity index 100% rename from v2/drivers/i2c/bmp388_driver.go rename to drivers/i2c/bmp388_driver.go diff --git a/v2/drivers/i2c/bmp388_driver_test.go b/drivers/i2c/bmp388_driver_test.go similarity index 100% rename from v2/drivers/i2c/bmp388_driver_test.go rename to drivers/i2c/bmp388_driver_test.go diff --git a/v2/drivers/i2c/ccs811_driver.go b/drivers/i2c/ccs811_driver.go similarity index 100% rename from v2/drivers/i2c/ccs811_driver.go rename to drivers/i2c/ccs811_driver.go diff --git a/v2/drivers/i2c/ccs811_driver_test.go b/drivers/i2c/ccs811_driver_test.go similarity index 100% rename from v2/drivers/i2c/ccs811_driver_test.go rename to drivers/i2c/ccs811_driver_test.go diff --git a/v2/drivers/i2c/doc.go b/drivers/i2c/doc.go similarity index 100% rename from v2/drivers/i2c/doc.go rename to drivers/i2c/doc.go diff --git a/v2/drivers/i2c/drv2605l_driver.go b/drivers/i2c/drv2605l_driver.go similarity index 100% rename from v2/drivers/i2c/drv2605l_driver.go rename to drivers/i2c/drv2605l_driver.go diff --git a/v2/drivers/i2c/drv2605l_driver_test.go b/drivers/i2c/drv2605l_driver_test.go similarity index 100% rename from v2/drivers/i2c/drv2605l_driver_test.go rename to drivers/i2c/drv2605l_driver_test.go diff --git a/v2/drivers/i2c/generic_driver.go b/drivers/i2c/generic_driver.go similarity index 100% rename from v2/drivers/i2c/generic_driver.go rename to drivers/i2c/generic_driver.go diff --git a/v2/drivers/i2c/generic_driver_test.go b/drivers/i2c/generic_driver_test.go similarity index 100% rename from v2/drivers/i2c/generic_driver_test.go rename to drivers/i2c/generic_driver_test.go diff --git a/v2/drivers/i2c/grove_drivers.go b/drivers/i2c/grove_drivers.go similarity index 100% rename from v2/drivers/i2c/grove_drivers.go rename to drivers/i2c/grove_drivers.go diff --git a/v2/drivers/i2c/grove_drivers_test.go b/drivers/i2c/grove_drivers_test.go similarity index 100% rename from v2/drivers/i2c/grove_drivers_test.go rename to drivers/i2c/grove_drivers_test.go diff --git a/v2/drivers/i2c/grovepi_driver.go b/drivers/i2c/grovepi_driver.go similarity index 100% rename from v2/drivers/i2c/grovepi_driver.go rename to drivers/i2c/grovepi_driver.go diff --git a/v2/drivers/i2c/grovepi_driver_test.go b/drivers/i2c/grovepi_driver_test.go similarity index 100% rename from v2/drivers/i2c/grovepi_driver_test.go rename to drivers/i2c/grovepi_driver_test.go diff --git a/v2/drivers/i2c/helpers_test.go b/drivers/i2c/helpers_test.go similarity index 100% rename from v2/drivers/i2c/helpers_test.go rename to drivers/i2c/helpers_test.go diff --git a/v2/drivers/i2c/hmc5883l_driver.go b/drivers/i2c/hmc5883l_driver.go similarity index 100% rename from v2/drivers/i2c/hmc5883l_driver.go rename to drivers/i2c/hmc5883l_driver.go diff --git a/v2/drivers/i2c/hmc5883l_driver_test.go b/drivers/i2c/hmc5883l_driver_test.go similarity index 100% rename from v2/drivers/i2c/hmc5883l_driver_test.go rename to drivers/i2c/hmc5883l_driver_test.go diff --git a/v2/drivers/i2c/hmc6352_driver.go b/drivers/i2c/hmc6352_driver.go similarity index 100% rename from v2/drivers/i2c/hmc6352_driver.go rename to drivers/i2c/hmc6352_driver.go diff --git a/v2/drivers/i2c/hmc6352_driver_test.go b/drivers/i2c/hmc6352_driver_test.go similarity index 100% rename from v2/drivers/i2c/hmc6352_driver_test.go rename to drivers/i2c/hmc6352_driver_test.go diff --git a/v2/drivers/i2c/i2c_config.go b/drivers/i2c/i2c_config.go similarity index 100% rename from v2/drivers/i2c/i2c_config.go rename to drivers/i2c/i2c_config.go diff --git a/v2/drivers/i2c/i2c_config_test.go b/drivers/i2c/i2c_config_test.go similarity index 100% rename from v2/drivers/i2c/i2c_config_test.go rename to drivers/i2c/i2c_config_test.go diff --git a/v2/drivers/i2c/i2c_connection.go b/drivers/i2c/i2c_connection.go similarity index 100% rename from v2/drivers/i2c/i2c_connection.go rename to drivers/i2c/i2c_connection.go diff --git a/v2/drivers/i2c/i2c_connection_test.go b/drivers/i2c/i2c_connection_test.go similarity index 100% rename from v2/drivers/i2c/i2c_connection_test.go rename to drivers/i2c/i2c_connection_test.go diff --git a/v2/drivers/i2c/i2c_driver.go b/drivers/i2c/i2c_driver.go similarity index 100% rename from v2/drivers/i2c/i2c_driver.go rename to drivers/i2c/i2c_driver.go diff --git a/v2/drivers/i2c/i2c_driver_test.go b/drivers/i2c/i2c_driver_test.go similarity index 100% rename from v2/drivers/i2c/i2c_driver_test.go rename to drivers/i2c/i2c_driver_test.go diff --git a/v2/drivers/i2c/ina3221_driver.go b/drivers/i2c/ina3221_driver.go similarity index 100% rename from v2/drivers/i2c/ina3221_driver.go rename to drivers/i2c/ina3221_driver.go diff --git a/v2/drivers/i2c/ina3221_driver_test.go b/drivers/i2c/ina3221_driver_test.go similarity index 100% rename from v2/drivers/i2c/ina3221_driver_test.go rename to drivers/i2c/ina3221_driver_test.go diff --git a/v2/drivers/i2c/jhd1313m1_driver.go b/drivers/i2c/jhd1313m1_driver.go similarity index 100% rename from v2/drivers/i2c/jhd1313m1_driver.go rename to drivers/i2c/jhd1313m1_driver.go diff --git a/v2/drivers/i2c/jhd1313m1_driver_test.go b/drivers/i2c/jhd1313m1_driver_test.go similarity index 100% rename from v2/drivers/i2c/jhd1313m1_driver_test.go rename to drivers/i2c/jhd1313m1_driver_test.go diff --git a/v2/drivers/i2c/l3gd20h_driver.go b/drivers/i2c/l3gd20h_driver.go similarity index 100% rename from v2/drivers/i2c/l3gd20h_driver.go rename to drivers/i2c/l3gd20h_driver.go diff --git a/v2/drivers/i2c/l3gd20h_driver_test.go b/drivers/i2c/l3gd20h_driver_test.go similarity index 100% rename from v2/drivers/i2c/l3gd20h_driver_test.go rename to drivers/i2c/l3gd20h_driver_test.go diff --git a/v2/drivers/i2c/lidarlite_driver.go b/drivers/i2c/lidarlite_driver.go similarity index 100% rename from v2/drivers/i2c/lidarlite_driver.go rename to drivers/i2c/lidarlite_driver.go diff --git a/v2/drivers/i2c/lidarlite_driver_test.go b/drivers/i2c/lidarlite_driver_test.go similarity index 100% rename from v2/drivers/i2c/lidarlite_driver_test.go rename to drivers/i2c/lidarlite_driver_test.go diff --git a/v2/drivers/i2c/mcp23017_driver.go b/drivers/i2c/mcp23017_driver.go similarity index 100% rename from v2/drivers/i2c/mcp23017_driver.go rename to drivers/i2c/mcp23017_driver.go diff --git a/v2/drivers/i2c/mcp23017_driver_test.go b/drivers/i2c/mcp23017_driver_test.go similarity index 100% rename from v2/drivers/i2c/mcp23017_driver_test.go rename to drivers/i2c/mcp23017_driver_test.go diff --git a/v2/drivers/i2c/mfrc522_driver.go b/drivers/i2c/mfrc522_driver.go similarity index 100% rename from v2/drivers/i2c/mfrc522_driver.go rename to drivers/i2c/mfrc522_driver.go diff --git a/v2/drivers/i2c/mma7660_driver.go b/drivers/i2c/mma7660_driver.go similarity index 100% rename from v2/drivers/i2c/mma7660_driver.go rename to drivers/i2c/mma7660_driver.go diff --git a/v2/drivers/i2c/mma7660_driver_test.go b/drivers/i2c/mma7660_driver_test.go similarity index 100% rename from v2/drivers/i2c/mma7660_driver_test.go rename to drivers/i2c/mma7660_driver_test.go diff --git a/v2/drivers/i2c/mpl115a2_driver.go b/drivers/i2c/mpl115a2_driver.go similarity index 100% rename from v2/drivers/i2c/mpl115a2_driver.go rename to drivers/i2c/mpl115a2_driver.go diff --git a/v2/drivers/i2c/mpl115a2_driver_test.go b/drivers/i2c/mpl115a2_driver_test.go similarity index 100% rename from v2/drivers/i2c/mpl115a2_driver_test.go rename to drivers/i2c/mpl115a2_driver_test.go diff --git a/v2/drivers/i2c/mpu6050_driver.go b/drivers/i2c/mpu6050_driver.go similarity index 100% rename from v2/drivers/i2c/mpu6050_driver.go rename to drivers/i2c/mpu6050_driver.go diff --git a/v2/drivers/i2c/mpu6050_driver_test.go b/drivers/i2c/mpu6050_driver_test.go similarity index 100% rename from v2/drivers/i2c/mpu6050_driver_test.go rename to drivers/i2c/mpu6050_driver_test.go diff --git a/v2/drivers/i2c/pca9501_driver.go b/drivers/i2c/pca9501_driver.go similarity index 100% rename from v2/drivers/i2c/pca9501_driver.go rename to drivers/i2c/pca9501_driver.go diff --git a/v2/drivers/i2c/pca9501_driver_test.go b/drivers/i2c/pca9501_driver_test.go similarity index 100% rename from v2/drivers/i2c/pca9501_driver_test.go rename to drivers/i2c/pca9501_driver_test.go diff --git a/v2/drivers/i2c/pca953x_driver.go b/drivers/i2c/pca953x_driver.go similarity index 100% rename from v2/drivers/i2c/pca953x_driver.go rename to drivers/i2c/pca953x_driver.go diff --git a/v2/drivers/i2c/pca953x_driver_test.go b/drivers/i2c/pca953x_driver_test.go similarity index 100% rename from v2/drivers/i2c/pca953x_driver_test.go rename to drivers/i2c/pca953x_driver_test.go diff --git a/v2/drivers/i2c/pca9685_driver.go b/drivers/i2c/pca9685_driver.go similarity index 100% rename from v2/drivers/i2c/pca9685_driver.go rename to drivers/i2c/pca9685_driver.go diff --git a/v2/drivers/i2c/pca9685_driver_test.go b/drivers/i2c/pca9685_driver_test.go similarity index 100% rename from v2/drivers/i2c/pca9685_driver_test.go rename to drivers/i2c/pca9685_driver_test.go diff --git a/v2/drivers/i2c/pcf8583_driver.go b/drivers/i2c/pcf8583_driver.go similarity index 100% rename from v2/drivers/i2c/pcf8583_driver.go rename to drivers/i2c/pcf8583_driver.go diff --git a/v2/drivers/i2c/pcf8583_driver_test.go b/drivers/i2c/pcf8583_driver_test.go similarity index 100% rename from v2/drivers/i2c/pcf8583_driver_test.go rename to drivers/i2c/pcf8583_driver_test.go diff --git a/v2/drivers/i2c/pcf8591_driver.go b/drivers/i2c/pcf8591_driver.go similarity index 100% rename from v2/drivers/i2c/pcf8591_driver.go rename to drivers/i2c/pcf8591_driver.go diff --git a/v2/drivers/i2c/pcf8591_driver_test.go b/drivers/i2c/pcf8591_driver_test.go similarity index 100% rename from v2/drivers/i2c/pcf8591_driver_test.go rename to drivers/i2c/pcf8591_driver_test.go diff --git a/v2/drivers/i2c/sht2x_driver.go b/drivers/i2c/sht2x_driver.go similarity index 100% rename from v2/drivers/i2c/sht2x_driver.go rename to drivers/i2c/sht2x_driver.go diff --git a/v2/drivers/i2c/sht2x_driver_test.go b/drivers/i2c/sht2x_driver_test.go similarity index 100% rename from v2/drivers/i2c/sht2x_driver_test.go rename to drivers/i2c/sht2x_driver_test.go diff --git a/v2/drivers/i2c/sht3x_driver.go b/drivers/i2c/sht3x_driver.go similarity index 100% rename from v2/drivers/i2c/sht3x_driver.go rename to drivers/i2c/sht3x_driver.go diff --git a/v2/drivers/i2c/sht3x_driver_test.go b/drivers/i2c/sht3x_driver_test.go similarity index 100% rename from v2/drivers/i2c/sht3x_driver_test.go rename to drivers/i2c/sht3x_driver_test.go diff --git a/v2/drivers/i2c/ssd1306_driver.go b/drivers/i2c/ssd1306_driver.go similarity index 100% rename from v2/drivers/i2c/ssd1306_driver.go rename to drivers/i2c/ssd1306_driver.go diff --git a/v2/drivers/i2c/ssd1306_driver_test.go b/drivers/i2c/ssd1306_driver_test.go similarity index 100% rename from v2/drivers/i2c/ssd1306_driver_test.go rename to drivers/i2c/ssd1306_driver_test.go diff --git a/v2/drivers/i2c/th02_driver.go b/drivers/i2c/th02_driver.go similarity index 100% rename from v2/drivers/i2c/th02_driver.go rename to drivers/i2c/th02_driver.go diff --git a/v2/drivers/i2c/th02_driver_test.go b/drivers/i2c/th02_driver_test.go similarity index 100% rename from v2/drivers/i2c/th02_driver_test.go rename to drivers/i2c/th02_driver_test.go diff --git a/v2/drivers/i2c/tsl2561_driver.go b/drivers/i2c/tsl2561_driver.go similarity index 100% rename from v2/drivers/i2c/tsl2561_driver.go rename to drivers/i2c/tsl2561_driver.go diff --git a/v2/drivers/i2c/tsl2561_driver_test.go b/drivers/i2c/tsl2561_driver_test.go similarity index 100% rename from v2/drivers/i2c/tsl2561_driver_test.go rename to drivers/i2c/tsl2561_driver_test.go diff --git a/v2/drivers/i2c/wiichuck_driver.go b/drivers/i2c/wiichuck_driver.go similarity index 100% rename from v2/drivers/i2c/wiichuck_driver.go rename to drivers/i2c/wiichuck_driver.go diff --git a/v2/drivers/i2c/wiichuck_driver_test.go b/drivers/i2c/wiichuck_driver_test.go similarity index 100% rename from v2/drivers/i2c/wiichuck_driver_test.go rename to drivers/i2c/wiichuck_driver_test.go diff --git a/v2/drivers/i2c/yl40_driver.go b/drivers/i2c/yl40_driver.go similarity index 100% rename from v2/drivers/i2c/yl40_driver.go rename to drivers/i2c/yl40_driver.go diff --git a/v2/drivers/i2c/yl40_driver_test.go b/drivers/i2c/yl40_driver_test.go similarity index 100% rename from v2/drivers/i2c/yl40_driver_test.go rename to drivers/i2c/yl40_driver_test.go diff --git a/v2/drivers/spi/README.md b/drivers/spi/README.md similarity index 100% rename from v2/drivers/spi/README.md rename to drivers/spi/README.md diff --git a/v2/drivers/spi/apa102.go b/drivers/spi/apa102.go similarity index 100% rename from v2/drivers/spi/apa102.go rename to drivers/spi/apa102.go diff --git a/v2/drivers/spi/apa102_test.go b/drivers/spi/apa102_test.go similarity index 100% rename from v2/drivers/spi/apa102_test.go rename to drivers/spi/apa102_test.go diff --git a/v2/drivers/spi/doc.go b/drivers/spi/doc.go similarity index 100% rename from v2/drivers/spi/doc.go rename to drivers/spi/doc.go diff --git a/v2/drivers/spi/helpers_test.go b/drivers/spi/helpers_test.go similarity index 100% rename from v2/drivers/spi/helpers_test.go rename to drivers/spi/helpers_test.go diff --git a/v2/drivers/spi/mcp3002.go b/drivers/spi/mcp3002.go similarity index 100% rename from v2/drivers/spi/mcp3002.go rename to drivers/spi/mcp3002.go diff --git a/v2/drivers/spi/mcp3002_test.go b/drivers/spi/mcp3002_test.go similarity index 100% rename from v2/drivers/spi/mcp3002_test.go rename to drivers/spi/mcp3002_test.go diff --git a/v2/drivers/spi/mcp3004.go b/drivers/spi/mcp3004.go similarity index 100% rename from v2/drivers/spi/mcp3004.go rename to drivers/spi/mcp3004.go diff --git a/v2/drivers/spi/mcp3004_test.go b/drivers/spi/mcp3004_test.go similarity index 100% rename from v2/drivers/spi/mcp3004_test.go rename to drivers/spi/mcp3004_test.go diff --git a/v2/drivers/spi/mcp3008.go b/drivers/spi/mcp3008.go similarity index 100% rename from v2/drivers/spi/mcp3008.go rename to drivers/spi/mcp3008.go diff --git a/v2/drivers/spi/mcp3008_test.go b/drivers/spi/mcp3008_test.go similarity index 100% rename from v2/drivers/spi/mcp3008_test.go rename to drivers/spi/mcp3008_test.go diff --git a/v2/drivers/spi/mcp3202.go b/drivers/spi/mcp3202.go similarity index 100% rename from v2/drivers/spi/mcp3202.go rename to drivers/spi/mcp3202.go diff --git a/v2/drivers/spi/mcp3202_test.go b/drivers/spi/mcp3202_test.go similarity index 100% rename from v2/drivers/spi/mcp3202_test.go rename to drivers/spi/mcp3202_test.go diff --git a/v2/drivers/spi/mcp3204.go b/drivers/spi/mcp3204.go similarity index 100% rename from v2/drivers/spi/mcp3204.go rename to drivers/spi/mcp3204.go diff --git a/v2/drivers/spi/mcp3204_test.go b/drivers/spi/mcp3204_test.go similarity index 100% rename from v2/drivers/spi/mcp3204_test.go rename to drivers/spi/mcp3204_test.go diff --git a/v2/drivers/spi/mcp3208.go b/drivers/spi/mcp3208.go similarity index 100% rename from v2/drivers/spi/mcp3208.go rename to drivers/spi/mcp3208.go diff --git a/v2/drivers/spi/mcp3208_test.go b/drivers/spi/mcp3208_test.go similarity index 100% rename from v2/drivers/spi/mcp3208_test.go rename to drivers/spi/mcp3208_test.go diff --git a/v2/drivers/spi/mcp3304.go b/drivers/spi/mcp3304.go similarity index 100% rename from v2/drivers/spi/mcp3304.go rename to drivers/spi/mcp3304.go diff --git a/v2/drivers/spi/mcp3304_test.go b/drivers/spi/mcp3304_test.go similarity index 100% rename from v2/drivers/spi/mcp3304_test.go rename to drivers/spi/mcp3304_test.go diff --git a/v2/drivers/spi/mfrc522_driver.go b/drivers/spi/mfrc522_driver.go similarity index 100% rename from v2/drivers/spi/mfrc522_driver.go rename to drivers/spi/mfrc522_driver.go diff --git a/v2/drivers/spi/mfrc522_driver_test.go b/drivers/spi/mfrc522_driver_test.go similarity index 100% rename from v2/drivers/spi/mfrc522_driver_test.go rename to drivers/spi/mfrc522_driver_test.go diff --git a/v2/drivers/spi/spi_config.go b/drivers/spi/spi_config.go similarity index 100% rename from v2/drivers/spi/spi_config.go rename to drivers/spi/spi_config.go diff --git a/v2/drivers/spi/spi_connection.go b/drivers/spi/spi_connection.go similarity index 100% rename from v2/drivers/spi/spi_connection.go rename to drivers/spi/spi_connection.go diff --git a/v2/drivers/spi/spi_connection_test.go b/drivers/spi/spi_connection_test.go similarity index 100% rename from v2/drivers/spi/spi_connection_test.go rename to drivers/spi/spi_connection_test.go diff --git a/v2/drivers/spi/spi_driver.go b/drivers/spi/spi_driver.go similarity index 100% rename from v2/drivers/spi/spi_driver.go rename to drivers/spi/spi_driver.go diff --git a/v2/drivers/spi/spi_driver_test.go b/drivers/spi/spi_driver_test.go similarity index 100% rename from v2/drivers/spi/spi_driver_test.go rename to drivers/spi/spi_driver_test.go diff --git a/v2/drivers/spi/ssd1306_driver.go b/drivers/spi/ssd1306_driver.go similarity index 100% rename from v2/drivers/spi/ssd1306_driver.go rename to drivers/spi/ssd1306_driver.go diff --git a/v2/drivers/spi/ssd1306_driver_test.go b/drivers/spi/ssd1306_driver_test.go similarity index 100% rename from v2/drivers/spi/ssd1306_driver_test.go rename to drivers/spi/ssd1306_driver_test.go diff --git a/v2/event.go b/event.go similarity index 100% rename from v2/event.go rename to event.go diff --git a/v2/eventer.go b/eventer.go similarity index 100% rename from v2/eventer.go rename to eventer.go diff --git a/v2/eventer_test.go b/eventer_test.go similarity index 100% rename from v2/eventer_test.go rename to eventer_test.go diff --git a/v2/examples/ardrone.go b/examples/ardrone.go similarity index 100% rename from v2/examples/ardrone.go rename to examples/ardrone.go diff --git a/v2/examples/ardrone_face_tracking.go b/examples/ardrone_face_tracking.go similarity index 100% rename from v2/examples/ardrone_face_tracking.go rename to examples/ardrone_face_tracking.go diff --git a/v2/examples/ardrone_ps3.go b/examples/ardrone_ps3.go similarity index 100% rename from v2/examples/ardrone_ps3.go rename to examples/ardrone_ps3.go diff --git a/v2/examples/audio.go b/examples/audio.go similarity index 100% rename from v2/examples/audio.go rename to examples/audio.go diff --git a/v2/examples/batty.go b/examples/batty.go similarity index 100% rename from v2/examples/batty.go rename to examples/batty.go diff --git a/v2/examples/bb8-collision.go b/examples/bb8-collision.go similarity index 100% rename from v2/examples/bb8-collision.go rename to examples/bb8-collision.go diff --git a/v2/examples/bb8.go b/examples/bb8.go similarity index 100% rename from v2/examples/bb8.go rename to examples/bb8.go diff --git a/v2/examples/beaglebone_basic_direct_pin.go b/examples/beaglebone_basic_direct_pin.go similarity index 100% rename from v2/examples/beaglebone_basic_direct_pin.go rename to examples/beaglebone_basic_direct_pin.go diff --git a/v2/examples/beaglebone_blink.go b/examples/beaglebone_blink.go similarity index 100% rename from v2/examples/beaglebone_blink.go rename to examples/beaglebone_blink.go diff --git a/v2/examples/beaglebone_blink_usr_led.go b/examples/beaglebone_blink_usr_led.go similarity index 100% rename from v2/examples/beaglebone_blink_usr_led.go rename to examples/beaglebone_blink_usr_led.go diff --git a/v2/examples/beaglebone_blinkm.go b/examples/beaglebone_blinkm.go similarity index 100% rename from v2/examples/beaglebone_blinkm.go rename to examples/beaglebone_blinkm.go diff --git a/v2/examples/beaglebone_button.go b/examples/beaglebone_button.go similarity index 100% rename from v2/examples/beaglebone_button.go rename to examples/beaglebone_button.go diff --git a/v2/examples/beaglebone_direct_pin.go b/examples/beaglebone_direct_pin.go similarity index 100% rename from v2/examples/beaglebone_direct_pin.go rename to examples/beaglebone_direct_pin.go diff --git a/v2/examples/beaglebone_grove_accelerometer.go b/examples/beaglebone_grove_accelerometer.go similarity index 100% rename from v2/examples/beaglebone_grove_accelerometer.go rename to examples/beaglebone_grove_accelerometer.go diff --git a/v2/examples/beaglebone_led_brightness.go b/examples/beaglebone_led_brightness.go similarity index 100% rename from v2/examples/beaglebone_led_brightness.go rename to examples/beaglebone_led_brightness.go diff --git a/v2/examples/beaglebone_led_brightness_with_analog_input.go b/examples/beaglebone_led_brightness_with_analog_input.go similarity index 100% rename from v2/examples/beaglebone_led_brightness_with_analog_input.go rename to examples/beaglebone_led_brightness_with_analog_input.go diff --git a/v2/examples/beaglebone_makey_button.go b/examples/beaglebone_makey_button.go similarity index 100% rename from v2/examples/beaglebone_makey_button.go rename to examples/beaglebone_makey_button.go diff --git a/v2/examples/beaglebone_servo.go b/examples/beaglebone_servo.go similarity index 100% rename from v2/examples/beaglebone_servo.go rename to examples/beaglebone_servo.go diff --git a/v2/examples/bebop.go b/examples/bebop.go similarity index 100% rename from v2/examples/bebop.go rename to examples/bebop.go diff --git a/v2/examples/bebop.sdp b/examples/bebop.sdp similarity index 100% rename from v2/examples/bebop.sdp rename to examples/bebop.sdp diff --git a/v2/examples/bebop_ps3.go b/examples/bebop_ps3.go similarity index 100% rename from v2/examples/bebop_ps3.go rename to examples/bebop_ps3.go diff --git a/v2/examples/bebop_ps3_video.go b/examples/bebop_ps3_video.go similarity index 100% rename from v2/examples/bebop_ps3_video.go rename to examples/bebop_ps3_video.go diff --git a/v2/examples/bebop_rtp_video.go b/examples/bebop_rtp_video.go similarity index 100% rename from v2/examples/bebop_rtp_video.go rename to examples/bebop_rtp_video.go diff --git a/v2/examples/ble_battery.go b/examples/ble_battery.go similarity index 100% rename from v2/examples/ble_battery.go rename to examples/ble_battery.go diff --git a/v2/examples/ble_device_info.go b/examples/ble_device_info.go similarity index 100% rename from v2/examples/ble_device_info.go rename to examples/ble_device_info.go diff --git a/v2/examples/ble_firmata_blink.go b/examples/ble_firmata_blink.go similarity index 100% rename from v2/examples/ble_firmata_blink.go rename to examples/ble_firmata_blink.go diff --git a/v2/examples/ble_firmata_curie_imu.go b/examples/ble_firmata_curie_imu.go similarity index 100% rename from v2/examples/ble_firmata_curie_imu.go rename to examples/ble_firmata_curie_imu.go diff --git a/v2/examples/ble_generic_access.go b/examples/ble_generic_access.go similarity index 100% rename from v2/examples/ble_generic_access.go rename to examples/ble_generic_access.go diff --git a/v2/examples/ble_multiple_generic.go b/examples/ble_multiple_generic.go similarity index 100% rename from v2/examples/ble_multiple_generic.go rename to examples/ble_multiple_generic.go diff --git a/v2/examples/ble_multiple_info.go b/examples/ble_multiple_info.go similarity index 100% rename from v2/examples/ble_multiple_info.go rename to examples/ble_multiple_info.go diff --git a/v2/examples/chip_blink.go b/examples/chip_blink.go similarity index 100% rename from v2/examples/chip_blink.go rename to examples/chip_blink.go diff --git a/v2/examples/chip_blinkm.go b/examples/chip_blinkm.go similarity index 100% rename from v2/examples/chip_blinkm.go rename to examples/chip_blinkm.go diff --git a/v2/examples/chip_button.go b/examples/chip_button.go similarity index 100% rename from v2/examples/chip_button.go rename to examples/chip_button.go diff --git a/v2/examples/chip_button_led.go b/examples/chip_button_led.go similarity index 100% rename from v2/examples/chip_button_led.go rename to examples/chip_button_led.go diff --git a/v2/examples/chip_drv2605l.go b/examples/chip_drv2605l.go similarity index 100% rename from v2/examples/chip_drv2605l.go rename to examples/chip_drv2605l.go diff --git a/v2/examples/chip_grove_accelerometer.go b/examples/chip_grove_accelerometer.go similarity index 100% rename from v2/examples/chip_grove_accelerometer.go rename to examples/chip_grove_accelerometer.go diff --git a/v2/examples/chip_grove_lcd.go b/examples/chip_grove_lcd.go similarity index 100% rename from v2/examples/chip_grove_lcd.go rename to examples/chip_grove_lcd.go diff --git a/v2/examples/chip_mpu6050.go b/examples/chip_mpu6050.go similarity index 100% rename from v2/examples/chip_mpu6050.go rename to examples/chip_mpu6050.go diff --git a/v2/examples/chip_tsl2561.go b/examples/chip_tsl2561.go similarity index 100% rename from v2/examples/chip_tsl2561.go rename to examples/chip_tsl2561.go diff --git a/v2/examples/chip_wiichuck.go b/examples/chip_wiichuck.go similarity index 100% rename from v2/examples/chip_wiichuck.go rename to examples/chip_wiichuck.go diff --git a/v2/examples/digispark_api.go b/examples/digispark_api.go similarity index 100% rename from v2/examples/digispark_api.go rename to examples/digispark_api.go diff --git a/v2/examples/digispark_blink.go b/examples/digispark_blink.go similarity index 100% rename from v2/examples/digispark_blink.go rename to examples/digispark_blink.go diff --git a/v2/examples/digispark_blinkm.go b/examples/digispark_blinkm.go similarity index 100% rename from v2/examples/digispark_blinkm.go rename to examples/digispark_blinkm.go diff --git a/v2/examples/digispark_driver.go b/examples/digispark_driver.go similarity index 100% rename from v2/examples/digispark_driver.go rename to examples/digispark_driver.go diff --git a/v2/examples/digispark_led_brightness.go b/examples/digispark_led_brightness.go similarity index 100% rename from v2/examples/digispark_led_brightness.go rename to examples/digispark_led_brightness.go diff --git a/v2/examples/digispark_mpl115a2.go b/examples/digispark_mpl115a2.go similarity index 100% rename from v2/examples/digispark_mpl115a2.go rename to examples/digispark_mpl115a2.go diff --git a/v2/examples/digispark_pca9501.go b/examples/digispark_pca9501.go similarity index 100% rename from v2/examples/digispark_pca9501.go rename to examples/digispark_pca9501.go diff --git a/v2/examples/digispark_servo.go b/examples/digispark_servo.go similarity index 100% rename from v2/examples/digispark_servo.go rename to examples/digispark_servo.go diff --git a/v2/examples/dragonboard_button.go b/examples/dragonboard_button.go similarity index 100% rename from v2/examples/dragonboard_button.go rename to examples/dragonboard_button.go diff --git a/v2/examples/edison_blink.go b/examples/edison_blink.go similarity index 100% rename from v2/examples/edison_blink.go rename to examples/edison_blink.go diff --git a/v2/examples/edison_blink_without_all_gobot_framework.go b/examples/edison_blink_without_all_gobot_framework.go similarity index 100% rename from v2/examples/edison_blink_without_all_gobot_framework.go rename to examples/edison_blink_without_all_gobot_framework.go diff --git a/v2/examples/edison_blinkm.go b/examples/edison_blinkm.go similarity index 100% rename from v2/examples/edison_blinkm.go rename to examples/edison_blinkm.go diff --git a/v2/examples/edison_bme280.go b/examples/edison_bme280.go similarity index 100% rename from v2/examples/edison_bme280.go rename to examples/edison_bme280.go diff --git a/v2/examples/edison_button.go b/examples/edison_button.go similarity index 100% rename from v2/examples/edison_button.go rename to examples/edison_button.go diff --git a/v2/examples/edison_button_led.go b/examples/edison_button_led.go similarity index 100% rename from v2/examples/edison_button_led.go rename to examples/edison_button_led.go diff --git a/v2/examples/edison_button_led_api.go b/examples/edison_button_led_api.go similarity index 100% rename from v2/examples/edison_button_led_api.go rename to examples/edison_button_led_api.go diff --git a/v2/examples/edison_grove_accelerometer.go b/examples/edison_grove_accelerometer.go similarity index 100% rename from v2/examples/edison_grove_accelerometer.go rename to examples/edison_grove_accelerometer.go diff --git a/v2/examples/edison_grove_blink.go b/examples/edison_grove_blink.go similarity index 100% rename from v2/examples/edison_grove_blink.go rename to examples/edison_grove_blink.go diff --git a/v2/examples/edison_grove_button.go b/examples/edison_grove_button.go similarity index 100% rename from v2/examples/edison_grove_button.go rename to examples/edison_grove_button.go diff --git a/v2/examples/edison_grove_buzzer.go b/examples/edison_grove_buzzer.go similarity index 100% rename from v2/examples/edison_grove_buzzer.go rename to examples/edison_grove_buzzer.go diff --git a/v2/examples/edison_grove_lcd.go b/examples/edison_grove_lcd.go similarity index 100% rename from v2/examples/edison_grove_lcd.go rename to examples/edison_grove_lcd.go diff --git a/v2/examples/edison_grove_led.go b/examples/edison_grove_led.go similarity index 100% rename from v2/examples/edison_grove_led.go rename to examples/edison_grove_led.go diff --git a/v2/examples/edison_grove_light_sensor.go b/examples/edison_grove_light_sensor.go similarity index 100% rename from v2/examples/edison_grove_light_sensor.go rename to examples/edison_grove_light_sensor.go diff --git a/v2/examples/edison_grove_piezo_vibration.go b/examples/edison_grove_piezo_vibration.go similarity index 100% rename from v2/examples/edison_grove_piezo_vibration.go rename to examples/edison_grove_piezo_vibration.go diff --git a/v2/examples/edison_grove_rotary_sensor.go b/examples/edison_grove_rotary_sensor.go similarity index 100% rename from v2/examples/edison_grove_rotary_sensor.go rename to examples/edison_grove_rotary_sensor.go diff --git a/v2/examples/edison_grove_sound_sensor.go b/examples/edison_grove_sound_sensor.go similarity index 100% rename from v2/examples/edison_grove_sound_sensor.go rename to examples/edison_grove_sound_sensor.go diff --git a/v2/examples/edison_grove_temperature_sensor.go b/examples/edison_grove_temperature_sensor.go similarity index 100% rename from v2/examples/edison_grove_temperature_sensor.go rename to examples/edison_grove_temperature_sensor.go diff --git a/v2/examples/edison_grove_touch.go b/examples/edison_grove_touch.go similarity index 100% rename from v2/examples/edison_grove_touch.go rename to examples/edison_grove_touch.go diff --git a/v2/examples/edison_led_brightness.go b/examples/edison_led_brightness.go similarity index 100% rename from v2/examples/edison_led_brightness.go rename to examples/edison_led_brightness.go diff --git a/v2/examples/edison_led_brightness_with_analog_input.go b/examples/edison_led_brightness_with_analog_input.go similarity index 100% rename from v2/examples/edison_led_brightness_with_analog_input.go rename to examples/edison_led_brightness_with_analog_input.go diff --git a/v2/examples/edison_miniboard_grove_accelerometer.go b/examples/edison_miniboard_grove_accelerometer.go similarity index 100% rename from v2/examples/edison_miniboard_grove_accelerometer.go rename to examples/edison_miniboard_grove_accelerometer.go diff --git a/v2/examples/edison_rgb_led.go b/examples/edison_rgb_led.go similarity index 100% rename from v2/examples/edison_rgb_led.go rename to examples/edison_rgb_led.go diff --git a/v2/examples/every_done.go b/examples/every_done.go similarity index 100% rename from v2/examples/every_done.go rename to examples/every_done.go diff --git a/v2/examples/firmata_adxl345.go b/examples/firmata_adxl345.go similarity index 100% rename from v2/examples/firmata_adxl345.go rename to examples/firmata_adxl345.go diff --git a/v2/examples/firmata_aip1640.go b/examples/firmata_aip1640.go similarity index 100% rename from v2/examples/firmata_aip1640.go rename to examples/firmata_aip1640.go diff --git a/v2/examples/firmata_blink.go b/examples/firmata_blink.go similarity index 100% rename from v2/examples/firmata_blink.go rename to examples/firmata_blink.go diff --git a/v2/examples/firmata_blink_api.go b/examples/firmata_blink_api.go similarity index 100% rename from v2/examples/firmata_blink_api.go rename to examples/firmata_blink_api.go diff --git a/v2/examples/firmata_blink_metal.go b/examples/firmata_blink_metal.go similarity index 100% rename from v2/examples/firmata_blink_metal.go rename to examples/firmata_blink_metal.go diff --git a/v2/examples/firmata_blink_robot.go b/examples/firmata_blink_robot.go similarity index 100% rename from v2/examples/firmata_blink_robot.go rename to examples/firmata_blink_robot.go diff --git a/v2/examples/firmata_blinkm.go b/examples/firmata_blinkm.go similarity index 100% rename from v2/examples/firmata_blinkm.go rename to examples/firmata_blinkm.go diff --git a/v2/examples/firmata_bme280.go b/examples/firmata_bme280.go similarity index 100% rename from v2/examples/firmata_bme280.go rename to examples/firmata_bme280.go diff --git a/v2/examples/firmata_bmp180.go b/examples/firmata_bmp180.go similarity index 100% rename from v2/examples/firmata_bmp180.go rename to examples/firmata_bmp180.go diff --git a/v2/examples/firmata_bmp280.go b/examples/firmata_bmp280.go similarity index 100% rename from v2/examples/firmata_bmp280.go rename to examples/firmata_bmp280.go diff --git a/v2/examples/firmata_button.go b/examples/firmata_button.go similarity index 100% rename from v2/examples/firmata_button.go rename to examples/firmata_button.go diff --git a/v2/examples/firmata_buzzer.go b/examples/firmata_buzzer.go similarity index 100% rename from v2/examples/firmata_buzzer.go rename to examples/firmata_buzzer.go diff --git a/v2/examples/firmata_cat_toy.go b/examples/firmata_cat_toy.go similarity index 100% rename from v2/examples/firmata_cat_toy.go rename to examples/firmata_cat_toy.go diff --git a/v2/examples/firmata_curie_imu.go b/examples/firmata_curie_imu.go similarity index 100% rename from v2/examples/firmata_curie_imu.go rename to examples/firmata_curie_imu.go diff --git a/v2/examples/firmata_curie_imu_shock_detect.go b/examples/firmata_curie_imu_shock_detect.go similarity index 100% rename from v2/examples/firmata_curie_imu_shock_detect.go rename to examples/firmata_curie_imu_shock_detect.go diff --git a/v2/examples/firmata_curie_imu_step_counter.go b/examples/firmata_curie_imu_step_counter.go similarity index 100% rename from v2/examples/firmata_curie_imu_step_counter.go rename to examples/firmata_curie_imu_step_counter.go diff --git a/v2/examples/firmata_curie_imu_tap_detect.go b/examples/firmata_curie_imu_tap_detect.go similarity index 100% rename from v2/examples/firmata_curie_imu_tap_detect.go rename to examples/firmata_curie_imu_tap_detect.go diff --git a/v2/examples/firmata_direct_pin.go b/examples/firmata_direct_pin.go similarity index 100% rename from v2/examples/firmata_direct_pin.go rename to examples/firmata_direct_pin.go diff --git a/v2/examples/firmata_gpio_max7219.go b/examples/firmata_gpio_max7219.go similarity index 100% rename from v2/examples/firmata_gpio_max7219.go rename to examples/firmata_gpio_max7219.go diff --git a/v2/examples/firmata_grove_lcd.go b/examples/firmata_grove_lcd.go similarity index 100% rename from v2/examples/firmata_grove_lcd.go rename to examples/firmata_grove_lcd.go diff --git a/v2/examples/firmata_grove_sound_sensor.go b/examples/firmata_grove_sound_sensor.go similarity index 100% rename from v2/examples/firmata_grove_sound_sensor.go rename to examples/firmata_grove_sound_sensor.go diff --git a/v2/examples/firmata_hmc6352.go b/examples/firmata_hmc6352.go similarity index 100% rename from v2/examples/firmata_hmc6352.go rename to examples/firmata_hmc6352.go diff --git a/v2/examples/firmata_integration.go b/examples/firmata_integration.go similarity index 100% rename from v2/examples/firmata_integration.go rename to examples/firmata_integration.go diff --git a/v2/examples/firmata_led_brightness.go b/examples/firmata_led_brightness.go similarity index 100% rename from v2/examples/firmata_led_brightness.go rename to examples/firmata_led_brightness.go diff --git a/v2/examples/firmata_led_brightness_with_analog_input.go b/examples/firmata_led_brightness_with_analog_input.go similarity index 100% rename from v2/examples/firmata_led_brightness_with_analog_input.go rename to examples/firmata_led_brightness_with_analog_input.go diff --git a/v2/examples/firmata_lidarlite.go b/examples/firmata_lidarlite.go similarity index 100% rename from v2/examples/firmata_lidarlite.go rename to examples/firmata_lidarlite.go diff --git a/v2/examples/firmata_makey_button.go b/examples/firmata_makey_button.go similarity index 100% rename from v2/examples/firmata_makey_button.go rename to examples/firmata_makey_button.go diff --git a/v2/examples/firmata_metal_button.go b/examples/firmata_metal_button.go similarity index 100% rename from v2/examples/firmata_metal_button.go rename to examples/firmata_metal_button.go diff --git a/v2/examples/firmata_mma7660.go b/examples/firmata_mma7660.go similarity index 100% rename from v2/examples/firmata_mma7660.go rename to examples/firmata_mma7660.go diff --git a/v2/examples/firmata_motor.go b/examples/firmata_motor.go similarity index 100% rename from v2/examples/firmata_motor.go rename to examples/firmata_motor.go diff --git a/v2/examples/firmata_mpl115a2.go b/examples/firmata_mpl115a2.go similarity index 100% rename from v2/examples/firmata_mpl115a2.go rename to examples/firmata_mpl115a2.go diff --git a/v2/examples/firmata_mpu6050.go b/examples/firmata_mpu6050.go similarity index 100% rename from v2/examples/firmata_mpu6050.go rename to examples/firmata_mpu6050.go diff --git a/v2/examples/firmata_pca9685.go b/examples/firmata_pca9685.go similarity index 100% rename from v2/examples/firmata_pca9685.go rename to examples/firmata_pca9685.go diff --git a/v2/examples/firmata_pir_motion.go b/examples/firmata_pir_motion.go similarity index 100% rename from v2/examples/firmata_pir_motion.go rename to examples/firmata_pir_motion.go diff --git a/v2/examples/firmata_rgb_led.go b/examples/firmata_rgb_led.go similarity index 100% rename from v2/examples/firmata_rgb_led.go rename to examples/firmata_rgb_led.go diff --git a/v2/examples/firmata_servo.go b/examples/firmata_servo.go similarity index 100% rename from v2/examples/firmata_servo.go rename to examples/firmata_servo.go diff --git a/v2/examples/firmata_ssd1306.go b/examples/firmata_ssd1306.go similarity index 100% rename from v2/examples/firmata_ssd1306.go rename to examples/firmata_ssd1306.go diff --git a/v2/examples/firmata_temp36.go b/examples/firmata_temp36.go similarity index 100% rename from v2/examples/firmata_temp36.go rename to examples/firmata_temp36.go diff --git a/v2/examples/firmata_tm1638.go b/examples/firmata_tm1638.go similarity index 100% rename from v2/examples/firmata_tm1638.go rename to examples/firmata_tm1638.go diff --git a/v2/examples/firmata_travis.go b/examples/firmata_travis.go similarity index 100% rename from v2/examples/firmata_travis.go rename to examples/firmata_travis.go diff --git a/v2/examples/firmata_wiichuck.go b/examples/firmata_wiichuck.go similarity index 100% rename from v2/examples/firmata_wiichuck.go rename to examples/firmata_wiichuck.go diff --git a/v2/examples/gopigo3.go b/examples/gopigo3.go similarity index 100% rename from v2/examples/gopigo3.go rename to examples/gopigo3.go diff --git a/v2/examples/gopigo3_grove_button.go b/examples/gopigo3_grove_button.go similarity index 100% rename from v2/examples/gopigo3_grove_button.go rename to examples/gopigo3_grove_button.go diff --git a/v2/examples/gopigo3_grove_lcd.go b/examples/gopigo3_grove_lcd.go similarity index 100% rename from v2/examples/gopigo3_grove_lcd.go rename to examples/gopigo3_grove_lcd.go diff --git a/v2/examples/gopigo3_grove_light_sensor.go b/examples/gopigo3_grove_light_sensor.go similarity index 100% rename from v2/examples/gopigo3_grove_light_sensor.go rename to examples/gopigo3_grove_light_sensor.go diff --git a/v2/examples/gopigo3_led_brightness.go b/examples/gopigo3_led_brightness.go similarity index 100% rename from v2/examples/gopigo3_led_brightness.go rename to examples/gopigo3_led_brightness.go diff --git a/v2/examples/gopigo3_servo.go b/examples/gopigo3_servo.go similarity index 100% rename from v2/examples/gopigo3_servo.go rename to examples/gopigo3_servo.go diff --git a/v2/examples/haarcascade_frontalface_alt.xml b/examples/haarcascade_frontalface_alt.xml similarity index 100% rename from v2/examples/haarcascade_frontalface_alt.xml rename to examples/haarcascade_frontalface_alt.xml diff --git a/v2/examples/hello.go b/examples/hello.go similarity index 100% rename from v2/examples/hello.go rename to examples/hello.go diff --git a/v2/examples/hello_api.go b/examples/hello_api.go similarity index 100% rename from v2/examples/hello_api.go rename to examples/hello_api.go diff --git a/v2/examples/hello_api_auth.go b/examples/hello_api_auth.go similarity index 100% rename from v2/examples/hello_api_auth.go rename to examples/hello_api_auth.go diff --git a/v2/examples/hello_api_custom.go b/examples/hello_api_custom.go similarity index 100% rename from v2/examples/hello_api_custom.go rename to examples/hello_api_custom.go diff --git a/v2/examples/hello_api_video.go b/examples/hello_api_video.go similarity index 100% rename from v2/examples/hello_api_video.go rename to examples/hello_api_video.go diff --git a/v2/examples/holystone_hs200.go b/examples/holystone_hs200.go similarity index 100% rename from v2/examples/holystone_hs200.go rename to examples/holystone_hs200.go diff --git a/v2/examples/jetson-nano_blink.go b/examples/jetson-nano_blink.go similarity index 100% rename from v2/examples/jetson-nano_blink.go rename to examples/jetson-nano_blink.go diff --git a/v2/examples/jetson-nano_servo.go b/examples/jetson-nano_servo.go similarity index 100% rename from v2/examples/jetson-nano_servo.go rename to examples/jetson-nano_servo.go diff --git a/v2/examples/joule_blink.go b/examples/joule_blink.go similarity index 100% rename from v2/examples/joule_blink.go rename to examples/joule_blink.go diff --git a/v2/examples/joule_blinkm.go b/examples/joule_blinkm.go similarity index 100% rename from v2/examples/joule_blinkm.go rename to examples/joule_blinkm.go diff --git a/v2/examples/joule_grove_lcd.go b/examples/joule_grove_lcd.go similarity index 100% rename from v2/examples/joule_grove_lcd.go rename to examples/joule_grove_lcd.go diff --git a/v2/examples/joule_grove_rotary_sensor.go b/examples/joule_grove_rotary_sensor.go similarity index 100% rename from v2/examples/joule_grove_rotary_sensor.go rename to examples/joule_grove_rotary_sensor.go diff --git a/v2/examples/joule_led_brightness.go b/examples/joule_led_brightness.go similarity index 100% rename from v2/examples/joule_led_brightness.go rename to examples/joule_led_brightness.go diff --git a/v2/examples/joule_led_brightness_with_analog_input.go b/examples/joule_led_brightness_with_analog_input.go similarity index 100% rename from v2/examples/joule_led_brightness_with_analog_input.go rename to examples/joule_led_brightness_with_analog_input.go diff --git a/v2/examples/joule_leds.go b/examples/joule_leds.go similarity index 100% rename from v2/examples/joule_leds.go rename to examples/joule_leds.go diff --git a/v2/examples/joule_rgb_led.go b/examples/joule_rgb_led.go similarity index 100% rename from v2/examples/joule_rgb_led.go rename to examples/joule_rgb_led.go diff --git a/v2/examples/joystick_ps3.go b/examples/joystick_ps3.go similarity index 100% rename from v2/examples/joystick_ps3.go rename to examples/joystick_ps3.go diff --git a/v2/examples/joystick_ps4.go b/examples/joystick_ps4.go similarity index 100% rename from v2/examples/joystick_ps4.go rename to examples/joystick_ps4.go diff --git a/v2/examples/joystick_ps5.go b/examples/joystick_ps5.go similarity index 100% rename from v2/examples/joystick_ps5.go rename to examples/joystick_ps5.go diff --git a/v2/examples/joystick_xbox360.go b/examples/joystick_xbox360.go similarity index 100% rename from v2/examples/joystick_xbox360.go rename to examples/joystick_xbox360.go diff --git a/v2/examples/joystick_xbox360_rock_band_drums.go b/examples/joystick_xbox360_rock_band_drums.go similarity index 100% rename from v2/examples/joystick_xbox360_rock_band_drums.go rename to examples/joystick_xbox360_rock_band_drums.go diff --git a/v2/examples/joystick_xboxone.go b/examples/joystick_xboxone.go similarity index 100% rename from v2/examples/joystick_xboxone.go rename to examples/joystick_xboxone.go diff --git a/v2/examples/keyboard.go b/examples/keyboard.go similarity index 100% rename from v2/examples/keyboard.go rename to examples/keyboard.go diff --git a/v2/examples/keyboard_mqtt.go b/examples/keyboard_mqtt.go similarity index 100% rename from v2/examples/keyboard_mqtt.go rename to examples/keyboard_mqtt.go diff --git a/v2/examples/laser.mp3 b/examples/laser.mp3 similarity index 100% rename from v2/examples/laser.mp3 rename to examples/laser.mp3 diff --git a/v2/examples/leap_motion.go b/examples/leap_motion.go similarity index 100% rename from v2/examples/leap_motion.go rename to examples/leap_motion.go diff --git a/v2/examples/leap_motion_gestures.go b/examples/leap_motion_gestures.go similarity index 100% rename from v2/examples/leap_motion_gestures.go rename to examples/leap_motion_gestures.go diff --git a/v2/examples/leap_motion_hands.go b/examples/leap_motion_hands.go similarity index 100% rename from v2/examples/leap_motion_hands.go rename to examples/leap_motion_hands.go diff --git a/v2/examples/leap_servos.go b/examples/leap_servos.go similarity index 100% rename from v2/examples/leap_servos.go rename to examples/leap_servos.go diff --git a/v2/examples/leap_sphero.go b/examples/leap_sphero.go similarity index 100% rename from v2/examples/leap_sphero.go rename to examples/leap_sphero.go diff --git a/v2/examples/mavlink.go b/examples/mavlink.go similarity index 100% rename from v2/examples/mavlink.go rename to examples/mavlink.go diff --git a/v2/examples/megapi_motor.go b/examples/megapi_motor.go similarity index 100% rename from v2/examples/megapi_motor.go rename to examples/megapi_motor.go diff --git a/v2/examples/metal_button.go b/examples/metal_button.go similarity index 100% rename from v2/examples/metal_button.go rename to examples/metal_button.go diff --git a/v2/examples/microbit_accelerometer.go b/examples/microbit_accelerometer.go similarity index 100% rename from v2/examples/microbit_accelerometer.go rename to examples/microbit_accelerometer.go diff --git a/v2/examples/microbit_blink.go b/examples/microbit_blink.go similarity index 100% rename from v2/examples/microbit_blink.go rename to examples/microbit_blink.go diff --git a/v2/examples/microbit_buttons.go b/examples/microbit_buttons.go similarity index 100% rename from v2/examples/microbit_buttons.go rename to examples/microbit_buttons.go diff --git a/v2/examples/microbit_buttons_leds.go b/examples/microbit_buttons_leds.go similarity index 100% rename from v2/examples/microbit_buttons_leds.go rename to examples/microbit_buttons_leds.go diff --git a/v2/examples/microbit_io_button.go b/examples/microbit_io_button.go similarity index 100% rename from v2/examples/microbit_io_button.go rename to examples/microbit_io_button.go diff --git a/v2/examples/microbit_led.go b/examples/microbit_led.go similarity index 100% rename from v2/examples/microbit_led.go rename to examples/microbit_led.go diff --git a/v2/examples/microbit_magnetometer.go b/examples/microbit_magnetometer.go similarity index 100% rename from v2/examples/microbit_magnetometer.go rename to examples/microbit_magnetometer.go diff --git a/v2/examples/microbit_temperature.go b/examples/microbit_temperature.go similarity index 100% rename from v2/examples/microbit_temperature.go rename to examples/microbit_temperature.go diff --git a/v2/examples/minidrone.go b/examples/minidrone.go similarity index 100% rename from v2/examples/minidrone.go rename to examples/minidrone.go diff --git a/v2/examples/minidrone_events.go b/examples/minidrone_events.go similarity index 100% rename from v2/examples/minidrone_events.go rename to examples/minidrone_events.go diff --git a/v2/examples/minidrone_mambo_ps3.go b/examples/minidrone_mambo_ps3.go similarity index 100% rename from v2/examples/minidrone_mambo_ps3.go rename to examples/minidrone_mambo_ps3.go diff --git a/v2/examples/minidrone_ps3.go b/examples/minidrone_ps3.go similarity index 100% rename from v2/examples/minidrone_ps3.go rename to examples/minidrone_ps3.go diff --git a/v2/examples/mqtt_driver_ping.go b/examples/mqtt_driver_ping.go similarity index 100% rename from v2/examples/mqtt_driver_ping.go rename to examples/mqtt_driver_ping.go diff --git a/v2/examples/mqtt_firmata_blink.go b/examples/mqtt_firmata_blink.go similarity index 100% rename from v2/examples/mqtt_firmata_blink.go rename to examples/mqtt_firmata_blink.go diff --git a/v2/examples/mqtt_ping.go b/examples/mqtt_ping.go similarity index 100% rename from v2/examples/mqtt_ping.go rename to examples/mqtt_ping.go diff --git a/v2/examples/nanopi_direct_pin.go b/examples/nanopi_direct_pin.go similarity index 100% rename from v2/examples/nanopi_direct_pin.go rename to examples/nanopi_direct_pin.go diff --git a/v2/examples/nanopi_direct_pin_event.go b/examples/nanopi_direct_pin_event.go similarity index 100% rename from v2/examples/nanopi_direct_pin_event.go rename to examples/nanopi_direct_pin_event.go diff --git a/v2/examples/nanopi_led_brightness.go b/examples/nanopi_led_brightness.go similarity index 100% rename from v2/examples/nanopi_led_brightness.go rename to examples/nanopi_led_brightness.go diff --git a/v2/examples/nanopi_pca9533.go b/examples/nanopi_pca9533.go similarity index 100% rename from v2/examples/nanopi_pca9533.go rename to examples/nanopi_pca9533.go diff --git a/v2/examples/nats.go b/examples/nats.go similarity index 100% rename from v2/examples/nats.go rename to examples/nats.go diff --git a/v2/examples/nats_driver_ping.go b/examples/nats_driver_ping.go similarity index 100% rename from v2/examples/nats_driver_ping.go rename to examples/nats_driver_ping.go diff --git a/v2/examples/neurosky.go b/examples/neurosky.go similarity index 100% rename from v2/examples/neurosky.go rename to examples/neurosky.go diff --git a/v2/examples/ollie.go b/examples/ollie.go similarity index 100% rename from v2/examples/ollie.go rename to examples/ollie.go diff --git a/v2/examples/ollie_boost.go b/examples/ollie_boost.go similarity index 100% rename from v2/examples/ollie_boost.go rename to examples/ollie_boost.go diff --git a/v2/examples/ollie_crazy.go b/examples/ollie_crazy.go similarity index 100% rename from v2/examples/ollie_crazy.go rename to examples/ollie_crazy.go diff --git a/v2/examples/ollie_mqtt.go b/examples/ollie_mqtt.go similarity index 100% rename from v2/examples/ollie_mqtt.go rename to examples/ollie_mqtt.go diff --git a/v2/examples/ollie_multiple.go b/examples/ollie_multiple.go similarity index 100% rename from v2/examples/ollie_multiple.go rename to examples/ollie_multiple.go diff --git a/v2/examples/ollie_roll.go b/examples/ollie_roll.go similarity index 100% rename from v2/examples/ollie_roll.go rename to examples/ollie_roll.go diff --git a/v2/examples/ollie_spin.go b/examples/ollie_spin.go similarity index 100% rename from v2/examples/ollie_spin.go rename to examples/ollie_spin.go diff --git a/v2/examples/opencv_face_detect.go b/examples/opencv_face_detect.go similarity index 100% rename from v2/examples/opencv_face_detect.go rename to examples/opencv_face_detect.go diff --git a/v2/examples/opencv_window.go b/examples/opencv_window.go similarity index 100% rename from v2/examples/opencv_window.go rename to examples/opencv_window.go diff --git a/v2/examples/particle_api.go b/examples/particle_api.go similarity index 100% rename from v2/examples/particle_api.go rename to examples/particle_api.go diff --git a/v2/examples/particle_blink.go b/examples/particle_blink.go similarity index 100% rename from v2/examples/particle_blink.go rename to examples/particle_blink.go diff --git a/v2/examples/particle_button.go b/examples/particle_button.go similarity index 100% rename from v2/examples/particle_button.go rename to examples/particle_button.go diff --git a/v2/examples/particle_events.go b/examples/particle_events.go similarity index 100% rename from v2/examples/particle_events.go rename to examples/particle_events.go diff --git a/v2/examples/particle_function.go b/examples/particle_function.go similarity index 100% rename from v2/examples/particle_function.go rename to examples/particle_function.go diff --git a/v2/examples/particle_led_brightness.go b/examples/particle_led_brightness.go similarity index 100% rename from v2/examples/particle_led_brightness.go rename to examples/particle_led_brightness.go diff --git a/v2/examples/particle_variable.go b/examples/particle_variable.go similarity index 100% rename from v2/examples/particle_variable.go rename to examples/particle_variable.go diff --git a/v2/examples/pebble.go b/examples/pebble.go similarity index 100% rename from v2/examples/pebble.go rename to examples/pebble.go diff --git a/v2/examples/pebble_accelerometer.go b/examples/pebble_accelerometer.go similarity index 100% rename from v2/examples/pebble_accelerometer.go rename to examples/pebble_accelerometer.go diff --git a/v2/examples/raspi_adafruit_dcmotor.go b/examples/raspi_adafruit_dcmotor.go similarity index 100% rename from v2/examples/raspi_adafruit_dcmotor.go rename to examples/raspi_adafruit_dcmotor.go diff --git a/v2/examples/raspi_adafruit_servo.go b/examples/raspi_adafruit_servo.go similarity index 100% rename from v2/examples/raspi_adafruit_servo.go rename to examples/raspi_adafruit_servo.go diff --git a/v2/examples/raspi_adafruit_stepper.go b/examples/raspi_adafruit_stepper.go similarity index 100% rename from v2/examples/raspi_adafruit_stepper.go rename to examples/raspi_adafruit_stepper.go diff --git a/v2/examples/raspi_ads1015.go b/examples/raspi_ads1015.go similarity index 100% rename from v2/examples/raspi_ads1015.go rename to examples/raspi_ads1015.go diff --git a/v2/examples/raspi_blink.go b/examples/raspi_blink.go similarity index 100% rename from v2/examples/raspi_blink.go rename to examples/raspi_blink.go diff --git a/v2/examples/raspi_blinkm.go b/examples/raspi_blinkm.go similarity index 100% rename from v2/examples/raspi_blinkm.go rename to examples/raspi_blinkm.go diff --git a/v2/examples/raspi_button.go b/examples/raspi_button.go similarity index 100% rename from v2/examples/raspi_button.go rename to examples/raspi_button.go diff --git a/v2/examples/raspi_ccs811.go b/examples/raspi_ccs811.go similarity index 100% rename from v2/examples/raspi_ccs811.go rename to examples/raspi_ccs811.go diff --git a/v2/examples/raspi_direct_pin.go b/examples/raspi_direct_pin.go similarity index 100% rename from v2/examples/raspi_direct_pin.go rename to examples/raspi_direct_pin.go diff --git a/v2/examples/raspi_direct_pin_event.go b/examples/raspi_direct_pin_event.go similarity index 100% rename from v2/examples/raspi_direct_pin_event.go rename to examples/raspi_direct_pin_event.go diff --git a/v2/examples/raspi_generic.go b/examples/raspi_generic.go similarity index 100% rename from v2/examples/raspi_generic.go rename to examples/raspi_generic.go diff --git a/v2/examples/raspi_grove_pi_blink.go b/examples/raspi_grove_pi_blink.go similarity index 100% rename from v2/examples/raspi_grove_pi_blink.go rename to examples/raspi_grove_pi_blink.go diff --git a/v2/examples/raspi_grove_pi_button.go b/examples/raspi_grove_pi_button.go similarity index 100% rename from v2/examples/raspi_grove_pi_button.go rename to examples/raspi_grove_pi_button.go diff --git a/v2/examples/raspi_grove_pi_dht.go b/examples/raspi_grove_pi_dht.go similarity index 100% rename from v2/examples/raspi_grove_pi_dht.go rename to examples/raspi_grove_pi_dht.go diff --git a/v2/examples/raspi_grove_pi_rotary.go b/examples/raspi_grove_pi_rotary.go similarity index 100% rename from v2/examples/raspi_grove_pi_rotary.go rename to examples/raspi_grove_pi_rotary.go diff --git a/v2/examples/raspi_grove_pi_ultrasonic.go b/examples/raspi_grove_pi_ultrasonic.go similarity index 100% rename from v2/examples/raspi_grove_pi_ultrasonic.go rename to examples/raspi_grove_pi_ultrasonic.go diff --git a/v2/examples/raspi_grove_rotary_sensor.go b/examples/raspi_grove_rotary_sensor.go similarity index 100% rename from v2/examples/raspi_grove_rotary_sensor.go rename to examples/raspi_grove_rotary_sensor.go diff --git a/v2/examples/raspi_hmc5883l.go b/examples/raspi_hmc5883l.go similarity index 100% rename from v2/examples/raspi_hmc5883l.go rename to examples/raspi_hmc5883l.go diff --git a/v2/examples/raspi_ina3221.go b/examples/raspi_ina3221.go similarity index 100% rename from v2/examples/raspi_ina3221.go rename to examples/raspi_ina3221.go diff --git a/v2/examples/raspi_led_brightness.go b/examples/raspi_led_brightness.go similarity index 100% rename from v2/examples/raspi_led_brightness.go rename to examples/raspi_led_brightness.go diff --git a/v2/examples/raspi_mcp3008.go b/examples/raspi_mcp3008.go similarity index 100% rename from v2/examples/raspi_mcp3008.go rename to examples/raspi_mcp3008.go diff --git a/v2/examples/raspi_pca9533.go b/examples/raspi_pca9533.go similarity index 100% rename from v2/examples/raspi_pca9533.go rename to examples/raspi_pca9533.go diff --git a/v2/examples/raspi_sht2x.go b/examples/raspi_sht2x.go similarity index 100% rename from v2/examples/raspi_sht2x.go rename to examples/raspi_sht2x.go diff --git a/v2/examples/raspi_sht3x.go b/examples/raspi_sht3x.go similarity index 100% rename from v2/examples/raspi_sht3x.go rename to examples/raspi_sht3x.go diff --git a/v2/examples/raspi_ssd1306.go b/examples/raspi_ssd1306.go similarity index 100% rename from v2/examples/raspi_ssd1306.go rename to examples/raspi_ssd1306.go diff --git a/v2/examples/raspi_ssd1306spi.go b/examples/raspi_ssd1306spi.go similarity index 100% rename from v2/examples/raspi_ssd1306spi.go rename to examples/raspi_ssd1306spi.go diff --git a/v2/examples/raspi_stepper_move.go b/examples/raspi_stepper_move.go similarity index 100% rename from v2/examples/raspi_stepper_move.go rename to examples/raspi_stepper_move.go diff --git a/v2/examples/sphero.go b/examples/sphero.go similarity index 100% rename from v2/examples/sphero.go rename to examples/sphero.go diff --git a/v2/examples/sphero_api.go b/examples/sphero_api.go similarity index 100% rename from v2/examples/sphero_api.go rename to examples/sphero_api.go diff --git a/v2/examples/sphero_conways.go b/examples/sphero_conways.go similarity index 100% rename from v2/examples/sphero_conways.go rename to examples/sphero_conways.go diff --git a/v2/examples/sphero_dpad.go b/examples/sphero_dpad.go similarity index 100% rename from v2/examples/sphero_dpad.go rename to examples/sphero_dpad.go diff --git a/v2/examples/sphero_master.go b/examples/sphero_master.go similarity index 100% rename from v2/examples/sphero_master.go rename to examples/sphero_master.go diff --git a/v2/examples/sphero_multiple.go b/examples/sphero_multiple.go similarity index 100% rename from v2/examples/sphero_multiple.go rename to examples/sphero_multiple.go diff --git a/v2/examples/sprkplus.go b/examples/sprkplus.go similarity index 100% rename from v2/examples/sprkplus.go rename to examples/sprkplus.go diff --git a/v2/examples/sprkplus_collision.go b/examples/sprkplus_collision.go similarity index 100% rename from v2/examples/sprkplus_collision.go rename to examples/sprkplus_collision.go diff --git a/v2/examples/square.go b/examples/square.go similarity index 100% rename from v2/examples/square.go rename to examples/square.go diff --git a/v2/examples/square_fire.go b/examples/square_fire.go similarity index 100% rename from v2/examples/square_fire.go rename to examples/square_fire.go diff --git a/v2/examples/tello.go b/examples/tello.go similarity index 100% rename from v2/examples/tello.go rename to examples/tello.go diff --git a/v2/examples/tello_facetracker.go b/examples/tello_facetracker.go similarity index 100% rename from v2/examples/tello_facetracker.go rename to examples/tello_facetracker.go diff --git a/v2/examples/tello_keyboard.go b/examples/tello_keyboard.go similarity index 100% rename from v2/examples/tello_keyboard.go rename to examples/tello_keyboard.go diff --git a/v2/examples/tello_opencv.go b/examples/tello_opencv.go similarity index 100% rename from v2/examples/tello_opencv.go rename to examples/tello_opencv.go diff --git a/v2/examples/tello_ps3.go b/examples/tello_ps3.go similarity index 100% rename from v2/examples/tello_ps3.go rename to examples/tello_ps3.go diff --git a/v2/examples/tello_video.go b/examples/tello_video.go similarity index 100% rename from v2/examples/tello_video.go rename to examples/tello_video.go diff --git a/v2/examples/tinkerboard_adafruit1109_lcd_keys.go b/examples/tinkerboard_adafruit1109_lcd_keys.go similarity index 100% rename from v2/examples/tinkerboard_adafruit1109_lcd_keys.go rename to examples/tinkerboard_adafruit1109_lcd_keys.go diff --git a/v2/examples/tinkerboard_ads1115.go b/examples/tinkerboard_ads1115.go similarity index 100% rename from v2/examples/tinkerboard_ads1115.go rename to examples/tinkerboard_ads1115.go diff --git a/v2/examples/tinkerboard_adxl345.go b/examples/tinkerboard_adxl345.go similarity index 100% rename from v2/examples/tinkerboard_adxl345.go rename to examples/tinkerboard_adxl345.go diff --git a/v2/examples/tinkerboard_blink.go b/examples/tinkerboard_blink.go similarity index 100% rename from v2/examples/tinkerboard_blink.go rename to examples/tinkerboard_blink.go diff --git a/v2/examples/tinkerboard_bme280.go b/examples/tinkerboard_bme280.go similarity index 100% rename from v2/examples/tinkerboard_bme280.go rename to examples/tinkerboard_bme280.go diff --git a/v2/examples/tinkerboard_bmp280.go b/examples/tinkerboard_bmp280.go similarity index 100% rename from v2/examples/tinkerboard_bmp280.go rename to examples/tinkerboard_bmp280.go diff --git a/v2/examples/tinkerboard_direct_pin.go b/examples/tinkerboard_direct_pin.go similarity index 100% rename from v2/examples/tinkerboard_direct_pin.go rename to examples/tinkerboard_direct_pin.go diff --git a/v2/examples/tinkerboard_generic.go b/examples/tinkerboard_generic.go similarity index 100% rename from v2/examples/tinkerboard_generic.go rename to examples/tinkerboard_generic.go diff --git a/v2/examples/tinkerboard_grove_lcd.go b/examples/tinkerboard_grove_lcd.go similarity index 100% rename from v2/examples/tinkerboard_grove_lcd.go rename to examples/tinkerboard_grove_lcd.go diff --git a/v2/examples/tinkerboard_hmc5883l.go b/examples/tinkerboard_hmc5883l.go similarity index 100% rename from v2/examples/tinkerboard_hmc5883l.go rename to examples/tinkerboard_hmc5883l.go diff --git a/v2/examples/tinkerboard_mfcrc522gpio.go b/examples/tinkerboard_mfcrc522gpio.go similarity index 100% rename from v2/examples/tinkerboard_mfcrc522gpio.go rename to examples/tinkerboard_mfcrc522gpio.go diff --git a/v2/examples/tinkerboard_mfcrc522spi.go b/examples/tinkerboard_mfcrc522spi.go similarity index 100% rename from v2/examples/tinkerboard_mfcrc522spi.go rename to examples/tinkerboard_mfcrc522spi.go diff --git a/v2/examples/tinkerboard_mpl115a2.go b/examples/tinkerboard_mpl115a2.go similarity index 100% rename from v2/examples/tinkerboard_mpl115a2.go rename to examples/tinkerboard_mpl115a2.go diff --git a/v2/examples/tinkerboard_mpu6050.go b/examples/tinkerboard_mpu6050.go similarity index 100% rename from v2/examples/tinkerboard_mpu6050.go rename to examples/tinkerboard_mpu6050.go diff --git a/v2/examples/tinkerboard_pca9533.go b/examples/tinkerboard_pca9533.go similarity index 100% rename from v2/examples/tinkerboard_pca9533.go rename to examples/tinkerboard_pca9533.go diff --git a/v2/examples/tinkerboard_pcf8583_clock.go b/examples/tinkerboard_pcf8583_clock.go similarity index 100% rename from v2/examples/tinkerboard_pcf8583_clock.go rename to examples/tinkerboard_pcf8583_clock.go diff --git a/v2/examples/tinkerboard_pcf8583_counter.go b/examples/tinkerboard_pcf8583_counter.go similarity index 100% rename from v2/examples/tinkerboard_pcf8583_counter.go rename to examples/tinkerboard_pcf8583_counter.go diff --git a/v2/examples/tinkerboard_pcf8591.go b/examples/tinkerboard_pcf8591.go similarity index 100% rename from v2/examples/tinkerboard_pcf8591.go rename to examples/tinkerboard_pcf8591.go diff --git a/v2/examples/tinkerboard_yl40.go b/examples/tinkerboard_yl40.go similarity index 100% rename from v2/examples/tinkerboard_yl40.go rename to examples/tinkerboard_yl40.go diff --git a/v2/examples/up2_lcd.go b/examples/up2_lcd.go similarity index 100% rename from v2/examples/up2_lcd.go rename to examples/up2_lcd.go diff --git a/v2/examples/up2_leds.go b/examples/up2_leds.go similarity index 100% rename from v2/examples/up2_leds.go rename to examples/up2_leds.go diff --git a/v2/examples/wifi_firmata_analog_input.go b/examples/wifi_firmata_analog_input.go similarity index 100% rename from v2/examples/wifi_firmata_analog_input.go rename to examples/wifi_firmata_analog_input.go diff --git a/v2/examples/wifi_firmata_blink.go b/examples/wifi_firmata_blink.go similarity index 100% rename from v2/examples/wifi_firmata_blink.go rename to examples/wifi_firmata_blink.go diff --git a/v2/examples_test.go b/examples_test.go similarity index 100% rename from v2/examples_test.go rename to examples_test.go diff --git a/v2/go.mod b/go.mod similarity index 100% rename from v2/go.mod rename to go.mod diff --git a/v2/go.sum b/go.sum similarity index 100% rename from v2/go.sum rename to go.sum diff --git a/go.work b/go.work deleted file mode 100644 index 01271d001..000000000 --- a/go.work +++ /dev/null @@ -1,5 +0,0 @@ -go 1.17 - -// this helps go tools and golangci-lint to find the subfolder -// it is working since Go 1.18 is installed -use ./v2 diff --git a/v2/gobottest/gobottest.go b/gobottest/gobottest.go similarity index 100% rename from v2/gobottest/gobottest.go rename to gobottest/gobottest.go diff --git a/v2/gobottest/gobottest_test.go b/gobottest/gobottest_test.go similarity index 100% rename from v2/gobottest/gobottest_test.go rename to gobottest/gobottest_test.go diff --git a/v2/helpers_test.go b/helpers_test.go similarity index 100% rename from v2/helpers_test.go rename to helpers_test.go diff --git a/v2/master.go b/master.go similarity index 100% rename from v2/master.go rename to master.go diff --git a/v2/master_test.go b/master_test.go similarity index 100% rename from v2/master_test.go rename to master_test.go diff --git a/v2/platforms/adaptors/digitalpinsadaptor.go b/platforms/adaptors/digitalpinsadaptor.go similarity index 100% rename from v2/platforms/adaptors/digitalpinsadaptor.go rename to platforms/adaptors/digitalpinsadaptor.go diff --git a/v2/platforms/adaptors/digitalpinsadaptor_test.go b/platforms/adaptors/digitalpinsadaptor_test.go similarity index 100% rename from v2/platforms/adaptors/digitalpinsadaptor_test.go rename to platforms/adaptors/digitalpinsadaptor_test.go diff --git a/v2/platforms/adaptors/i2cbusadaptor.go b/platforms/adaptors/i2cbusadaptor.go similarity index 100% rename from v2/platforms/adaptors/i2cbusadaptor.go rename to platforms/adaptors/i2cbusadaptor.go diff --git a/v2/platforms/adaptors/i2cbusadaptor_test.go b/platforms/adaptors/i2cbusadaptor_test.go similarity index 100% rename from v2/platforms/adaptors/i2cbusadaptor_test.go rename to platforms/adaptors/i2cbusadaptor_test.go diff --git a/v2/platforms/adaptors/options.go b/platforms/adaptors/options.go similarity index 100% rename from v2/platforms/adaptors/options.go rename to platforms/adaptors/options.go diff --git a/v2/platforms/adaptors/pwmpinsadaptor.go b/platforms/adaptors/pwmpinsadaptor.go similarity index 100% rename from v2/platforms/adaptors/pwmpinsadaptor.go rename to platforms/adaptors/pwmpinsadaptor.go diff --git a/v2/platforms/adaptors/pwmpinsadaptor_test.go b/platforms/adaptors/pwmpinsadaptor_test.go similarity index 100% rename from v2/platforms/adaptors/pwmpinsadaptor_test.go rename to platforms/adaptors/pwmpinsadaptor_test.go diff --git a/v2/platforms/adaptors/spibusadaptor.go b/platforms/adaptors/spibusadaptor.go similarity index 100% rename from v2/platforms/adaptors/spibusadaptor.go rename to platforms/adaptors/spibusadaptor.go diff --git a/v2/platforms/adaptors/spibusadaptor_test.go b/platforms/adaptors/spibusadaptor_test.go similarity index 100% rename from v2/platforms/adaptors/spibusadaptor_test.go rename to platforms/adaptors/spibusadaptor_test.go diff --git a/v2/platforms/audio/LICENSE b/platforms/audio/LICENSE similarity index 100% rename from v2/platforms/audio/LICENSE rename to platforms/audio/LICENSE diff --git a/v2/platforms/audio/audio_adaptor.go b/platforms/audio/audio_adaptor.go similarity index 100% rename from v2/platforms/audio/audio_adaptor.go rename to platforms/audio/audio_adaptor.go diff --git a/v2/platforms/audio/audio_adaptor_test.go b/platforms/audio/audio_adaptor_test.go similarity index 100% rename from v2/platforms/audio/audio_adaptor_test.go rename to platforms/audio/audio_adaptor_test.go diff --git a/v2/platforms/audio/audio_driver.go b/platforms/audio/audio_driver.go similarity index 100% rename from v2/platforms/audio/audio_driver.go rename to platforms/audio/audio_driver.go diff --git a/v2/platforms/audio/audio_driver_test.go b/platforms/audio/audio_driver_test.go similarity index 100% rename from v2/platforms/audio/audio_driver_test.go rename to platforms/audio/audio_driver_test.go diff --git a/v2/platforms/audio/doc.go b/platforms/audio/doc.go similarity index 100% rename from v2/platforms/audio/doc.go rename to platforms/audio/doc.go diff --git a/v2/platforms/beaglebone/LICENSE b/platforms/beaglebone/LICENSE similarity index 100% rename from v2/platforms/beaglebone/LICENSE rename to platforms/beaglebone/LICENSE diff --git a/v2/platforms/beaglebone/README.md b/platforms/beaglebone/README.md similarity index 100% rename from v2/platforms/beaglebone/README.md rename to platforms/beaglebone/README.md diff --git a/v2/platforms/beaglebone/beaglebone_adaptor.go b/platforms/beaglebone/beaglebone_adaptor.go similarity index 100% rename from v2/platforms/beaglebone/beaglebone_adaptor.go rename to platforms/beaglebone/beaglebone_adaptor.go diff --git a/v2/platforms/beaglebone/beaglebone_adaptor_test.go b/platforms/beaglebone/beaglebone_adaptor_test.go similarity index 100% rename from v2/platforms/beaglebone/beaglebone_adaptor_test.go rename to platforms/beaglebone/beaglebone_adaptor_test.go diff --git a/v2/platforms/beaglebone/black_pins.go b/platforms/beaglebone/black_pins.go similarity index 100% rename from v2/platforms/beaglebone/black_pins.go rename to platforms/beaglebone/black_pins.go diff --git a/v2/platforms/beaglebone/doc.go b/platforms/beaglebone/doc.go similarity index 100% rename from v2/platforms/beaglebone/doc.go rename to platforms/beaglebone/doc.go diff --git a/v2/platforms/beaglebone/pocketbeagle_adaptor.go b/platforms/beaglebone/pocketbeagle_adaptor.go similarity index 100% rename from v2/platforms/beaglebone/pocketbeagle_adaptor.go rename to platforms/beaglebone/pocketbeagle_adaptor.go diff --git a/v2/platforms/beaglebone/pocketbeagle_pins.go b/platforms/beaglebone/pocketbeagle_pins.go similarity index 100% rename from v2/platforms/beaglebone/pocketbeagle_pins.go rename to platforms/beaglebone/pocketbeagle_pins.go diff --git a/v2/platforms/ble/LICENSE b/platforms/ble/LICENSE similarity index 100% rename from v2/platforms/ble/LICENSE rename to platforms/ble/LICENSE diff --git a/v2/platforms/ble/README.md b/platforms/ble/README.md similarity index 100% rename from v2/platforms/ble/README.md rename to platforms/ble/README.md diff --git a/v2/platforms/ble/battery_driver.go b/platforms/ble/battery_driver.go similarity index 100% rename from v2/platforms/ble/battery_driver.go rename to platforms/ble/battery_driver.go diff --git a/v2/platforms/ble/battery_driver_test.go b/platforms/ble/battery_driver_test.go similarity index 100% rename from v2/platforms/ble/battery_driver_test.go rename to platforms/ble/battery_driver_test.go diff --git a/v2/platforms/ble/ble_client_adaptor.go b/platforms/ble/ble_client_adaptor.go similarity index 100% rename from v2/platforms/ble/ble_client_adaptor.go rename to platforms/ble/ble_client_adaptor.go diff --git a/v2/platforms/ble/ble_client_adaptor_test.go b/platforms/ble/ble_client_adaptor_test.go similarity index 100% rename from v2/platforms/ble/ble_client_adaptor_test.go rename to platforms/ble/ble_client_adaptor_test.go diff --git a/v2/platforms/ble/device_information_driver.go b/platforms/ble/device_information_driver.go similarity index 100% rename from v2/platforms/ble/device_information_driver.go rename to platforms/ble/device_information_driver.go diff --git a/v2/platforms/ble/device_information_driver_test.go b/platforms/ble/device_information_driver_test.go similarity index 100% rename from v2/platforms/ble/device_information_driver_test.go rename to platforms/ble/device_information_driver_test.go diff --git a/v2/platforms/ble/doc.go b/platforms/ble/doc.go similarity index 100% rename from v2/platforms/ble/doc.go rename to platforms/ble/doc.go diff --git a/v2/platforms/ble/generic_access_driver.go b/platforms/ble/generic_access_driver.go similarity index 100% rename from v2/platforms/ble/generic_access_driver.go rename to platforms/ble/generic_access_driver.go diff --git a/v2/platforms/ble/generic_access_driver_test.go b/platforms/ble/generic_access_driver_test.go similarity index 100% rename from v2/platforms/ble/generic_access_driver_test.go rename to platforms/ble/generic_access_driver_test.go diff --git a/v2/platforms/ble/helpers_test.go b/platforms/ble/helpers_test.go similarity index 100% rename from v2/platforms/ble/helpers_test.go rename to platforms/ble/helpers_test.go diff --git a/v2/platforms/ble/serial_port.go b/platforms/ble/serial_port.go similarity index 100% rename from v2/platforms/ble/serial_port.go rename to platforms/ble/serial_port.go diff --git a/v2/platforms/ble/serial_port_test.go b/platforms/ble/serial_port_test.go similarity index 100% rename from v2/platforms/ble/serial_port_test.go rename to platforms/ble/serial_port_test.go diff --git a/v2/platforms/ble/uuid.go b/platforms/ble/uuid.go similarity index 100% rename from v2/platforms/ble/uuid.go rename to platforms/ble/uuid.go diff --git a/v2/platforms/chip/LICENSE b/platforms/chip/LICENSE similarity index 100% rename from v2/platforms/chip/LICENSE rename to platforms/chip/LICENSE diff --git a/v2/platforms/chip/README.md b/platforms/chip/README.md similarity index 100% rename from v2/platforms/chip/README.md rename to platforms/chip/README.md diff --git a/v2/platforms/chip/chip_adaptor.go b/platforms/chip/chip_adaptor.go similarity index 100% rename from v2/platforms/chip/chip_adaptor.go rename to platforms/chip/chip_adaptor.go diff --git a/v2/platforms/chip/chip_adaptor_test.go b/platforms/chip/chip_adaptor_test.go similarity index 100% rename from v2/platforms/chip/chip_adaptor_test.go rename to platforms/chip/chip_adaptor_test.go diff --git a/v2/platforms/chip/chip_pinmap.go b/platforms/chip/chip_pinmap.go similarity index 100% rename from v2/platforms/chip/chip_pinmap.go rename to platforms/chip/chip_pinmap.go diff --git a/v2/platforms/chip/chippro_pinmap.go b/platforms/chip/chippro_pinmap.go similarity index 100% rename from v2/platforms/chip/chippro_pinmap.go rename to platforms/chip/chippro_pinmap.go diff --git a/v2/platforms/chip/doc.go b/platforms/chip/doc.go similarity index 100% rename from v2/platforms/chip/doc.go rename to platforms/chip/doc.go diff --git a/v2/platforms/dexter/README.md b/platforms/dexter/README.md similarity index 100% rename from v2/platforms/dexter/README.md rename to platforms/dexter/README.md diff --git a/v2/platforms/dexter/dexter.go b/platforms/dexter/dexter.go similarity index 100% rename from v2/platforms/dexter/dexter.go rename to platforms/dexter/dexter.go diff --git a/v2/platforms/dexter/gopigo3/README.md b/platforms/dexter/gopigo3/README.md similarity index 100% rename from v2/platforms/dexter/gopigo3/README.md rename to platforms/dexter/gopigo3/README.md diff --git a/v2/platforms/dexter/gopigo3/driver.go b/platforms/dexter/gopigo3/driver.go similarity index 100% rename from v2/platforms/dexter/gopigo3/driver.go rename to platforms/dexter/gopigo3/driver.go diff --git a/v2/platforms/dexter/gopigo3/driver_test.go b/platforms/dexter/gopigo3/driver_test.go similarity index 100% rename from v2/platforms/dexter/gopigo3/driver_test.go rename to platforms/dexter/gopigo3/driver_test.go diff --git a/v2/platforms/digispark/LICENSE b/platforms/digispark/LICENSE similarity index 100% rename from v2/platforms/digispark/LICENSE rename to platforms/digispark/LICENSE diff --git a/v2/platforms/digispark/README.md b/platforms/digispark/README.md similarity index 100% rename from v2/platforms/digispark/README.md rename to platforms/digispark/README.md diff --git a/v2/platforms/digispark/digispark_adaptor.go b/platforms/digispark/digispark_adaptor.go similarity index 100% rename from v2/platforms/digispark/digispark_adaptor.go rename to platforms/digispark/digispark_adaptor.go diff --git a/v2/platforms/digispark/digispark_adaptor_test.go b/platforms/digispark/digispark_adaptor_test.go similarity index 100% rename from v2/platforms/digispark/digispark_adaptor_test.go rename to platforms/digispark/digispark_adaptor_test.go diff --git a/v2/platforms/digispark/digispark_i2c.go b/platforms/digispark/digispark_i2c.go similarity index 100% rename from v2/platforms/digispark/digispark_i2c.go rename to platforms/digispark/digispark_i2c.go diff --git a/v2/platforms/digispark/digispark_i2c_test.go b/platforms/digispark/digispark_i2c_test.go similarity index 100% rename from v2/platforms/digispark/digispark_i2c_test.go rename to platforms/digispark/digispark_i2c_test.go diff --git a/v2/platforms/digispark/doc.go b/platforms/digispark/doc.go similarity index 100% rename from v2/platforms/digispark/doc.go rename to platforms/digispark/doc.go diff --git a/v2/platforms/digispark/littleWire.c b/platforms/digispark/littleWire.c similarity index 100% rename from v2/platforms/digispark/littleWire.c rename to platforms/digispark/littleWire.c diff --git a/v2/platforms/digispark/littleWire.go b/platforms/digispark/littleWire.go similarity index 100% rename from v2/platforms/digispark/littleWire.go rename to platforms/digispark/littleWire.go diff --git a/v2/platforms/digispark/littleWire.h b/platforms/digispark/littleWire.h similarity index 100% rename from v2/platforms/digispark/littleWire.h rename to platforms/digispark/littleWire.h diff --git a/v2/platforms/digispark/littleWire_servo.c b/platforms/digispark/littleWire_servo.c similarity index 100% rename from v2/platforms/digispark/littleWire_servo.c rename to platforms/digispark/littleWire_servo.c diff --git a/v2/platforms/digispark/littleWire_servo.h b/platforms/digispark/littleWire_servo.h similarity index 100% rename from v2/platforms/digispark/littleWire_servo.h rename to platforms/digispark/littleWire_servo.h diff --git a/v2/platforms/digispark/littleWire_util.c b/platforms/digispark/littleWire_util.c similarity index 100% rename from v2/platforms/digispark/littleWire_util.c rename to platforms/digispark/littleWire_util.c diff --git a/v2/platforms/digispark/littleWire_util.h b/platforms/digispark/littleWire_util.h similarity index 100% rename from v2/platforms/digispark/littleWire_util.h rename to platforms/digispark/littleWire_util.h diff --git a/v2/platforms/digispark/opendevice.c b/platforms/digispark/opendevice.c similarity index 100% rename from v2/platforms/digispark/opendevice.c rename to platforms/digispark/opendevice.c diff --git a/v2/platforms/digispark/opendevice.h b/platforms/digispark/opendevice.h similarity index 100% rename from v2/platforms/digispark/opendevice.h rename to platforms/digispark/opendevice.h diff --git a/v2/platforms/dji/README.md b/platforms/dji/README.md similarity index 100% rename from v2/platforms/dji/README.md rename to platforms/dji/README.md diff --git a/v2/platforms/dji/dji.go b/platforms/dji/dji.go similarity index 100% rename from v2/platforms/dji/dji.go rename to platforms/dji/dji.go diff --git a/v2/platforms/dji/tello/README.md b/platforms/dji/tello/README.md similarity index 100% rename from v2/platforms/dji/tello/README.md rename to platforms/dji/tello/README.md diff --git a/v2/platforms/dji/tello/crc.go b/platforms/dji/tello/crc.go similarity index 100% rename from v2/platforms/dji/tello/crc.go rename to platforms/dji/tello/crc.go diff --git a/v2/platforms/dji/tello/driver.go b/platforms/dji/tello/driver.go similarity index 100% rename from v2/platforms/dji/tello/driver.go rename to platforms/dji/tello/driver.go diff --git a/v2/platforms/dji/tello/driver_test.go b/platforms/dji/tello/driver_test.go similarity index 100% rename from v2/platforms/dji/tello/driver_test.go rename to platforms/dji/tello/driver_test.go diff --git a/v2/platforms/dji/tello/pitch.go b/platforms/dji/tello/pitch.go similarity index 100% rename from v2/platforms/dji/tello/pitch.go rename to platforms/dji/tello/pitch.go diff --git a/v2/platforms/dji/tello/pitch_test.go b/platforms/dji/tello/pitch_test.go similarity index 100% rename from v2/platforms/dji/tello/pitch_test.go rename to platforms/dji/tello/pitch_test.go diff --git a/v2/platforms/dragonboard/LICENSE b/platforms/dragonboard/LICENSE similarity index 100% rename from v2/platforms/dragonboard/LICENSE rename to platforms/dragonboard/LICENSE diff --git a/v2/platforms/dragonboard/README.md b/platforms/dragonboard/README.md similarity index 100% rename from v2/platforms/dragonboard/README.md rename to platforms/dragonboard/README.md diff --git a/v2/platforms/dragonboard/doc.go b/platforms/dragonboard/doc.go similarity index 100% rename from v2/platforms/dragonboard/doc.go rename to platforms/dragonboard/doc.go diff --git a/v2/platforms/dragonboard/dragonboard_adaptor.go b/platforms/dragonboard/dragonboard_adaptor.go similarity index 100% rename from v2/platforms/dragonboard/dragonboard_adaptor.go rename to platforms/dragonboard/dragonboard_adaptor.go diff --git a/v2/platforms/dragonboard/dragonboard_adaptor_test.go b/platforms/dragonboard/dragonboard_adaptor_test.go similarity index 100% rename from v2/platforms/dragonboard/dragonboard_adaptor_test.go rename to platforms/dragonboard/dragonboard_adaptor_test.go diff --git a/v2/platforms/firmata/LICENSE b/platforms/firmata/LICENSE similarity index 100% rename from v2/platforms/firmata/LICENSE rename to platforms/firmata/LICENSE diff --git a/v2/platforms/firmata/README.md b/platforms/firmata/README.md similarity index 100% rename from v2/platforms/firmata/README.md rename to platforms/firmata/README.md diff --git a/v2/platforms/firmata/ble_firmata_adaptor.go b/platforms/firmata/ble_firmata_adaptor.go similarity index 100% rename from v2/platforms/firmata/ble_firmata_adaptor.go rename to platforms/firmata/ble_firmata_adaptor.go diff --git a/v2/platforms/firmata/ble_firmata_adaptor_test.go b/platforms/firmata/ble_firmata_adaptor_test.go similarity index 100% rename from v2/platforms/firmata/ble_firmata_adaptor_test.go rename to platforms/firmata/ble_firmata_adaptor_test.go diff --git a/v2/platforms/firmata/client/client.go b/platforms/firmata/client/client.go similarity index 100% rename from v2/platforms/firmata/client/client.go rename to platforms/firmata/client/client.go diff --git a/v2/platforms/firmata/client/client_test.go b/platforms/firmata/client/client_test.go similarity index 100% rename from v2/platforms/firmata/client/client_test.go rename to platforms/firmata/client/client_test.go diff --git a/v2/platforms/firmata/client/examples/blink.go b/platforms/firmata/client/examples/blink.go similarity index 100% rename from v2/platforms/firmata/client/examples/blink.go rename to platforms/firmata/client/examples/blink.go diff --git a/v2/platforms/firmata/doc.go b/platforms/firmata/doc.go similarity index 100% rename from v2/platforms/firmata/doc.go rename to platforms/firmata/doc.go diff --git a/v2/platforms/firmata/firmata_adaptor.go b/platforms/firmata/firmata_adaptor.go similarity index 100% rename from v2/platforms/firmata/firmata_adaptor.go rename to platforms/firmata/firmata_adaptor.go diff --git a/v2/platforms/firmata/firmata_adaptor_test.go b/platforms/firmata/firmata_adaptor_test.go similarity index 100% rename from v2/platforms/firmata/firmata_adaptor_test.go rename to platforms/firmata/firmata_adaptor_test.go diff --git a/v2/platforms/firmata/firmata_i2c.go b/platforms/firmata/firmata_i2c.go similarity index 100% rename from v2/platforms/firmata/firmata_i2c.go rename to platforms/firmata/firmata_i2c.go diff --git a/v2/platforms/firmata/firmata_i2c_test.go b/platforms/firmata/firmata_i2c_test.go similarity index 100% rename from v2/platforms/firmata/firmata_i2c_test.go rename to platforms/firmata/firmata_i2c_test.go diff --git a/v2/platforms/firmata/tcp_firmata_adaptor.go b/platforms/firmata/tcp_firmata_adaptor.go similarity index 100% rename from v2/platforms/firmata/tcp_firmata_adaptor.go rename to platforms/firmata/tcp_firmata_adaptor.go diff --git a/v2/platforms/firmata/tcp_firmata_adaptor_test.go b/platforms/firmata/tcp_firmata_adaptor_test.go similarity index 100% rename from v2/platforms/firmata/tcp_firmata_adaptor_test.go rename to platforms/firmata/tcp_firmata_adaptor_test.go diff --git a/v2/platforms/holystone/README.md b/platforms/holystone/README.md similarity index 100% rename from v2/platforms/holystone/README.md rename to platforms/holystone/README.md diff --git a/v2/platforms/holystone/holystone.go b/platforms/holystone/holystone.go similarity index 100% rename from v2/platforms/holystone/holystone.go rename to platforms/holystone/holystone.go diff --git a/v2/platforms/holystone/hs200/README.md b/platforms/holystone/hs200/README.md similarity index 100% rename from v2/platforms/holystone/hs200/README.md rename to platforms/holystone/hs200/README.md diff --git a/v2/platforms/holystone/hs200/doc.go b/platforms/holystone/hs200/doc.go similarity index 100% rename from v2/platforms/holystone/hs200/doc.go rename to platforms/holystone/hs200/doc.go diff --git a/v2/platforms/holystone/hs200/hs200_driver.go b/platforms/holystone/hs200/hs200_driver.go similarity index 100% rename from v2/platforms/holystone/hs200/hs200_driver.go rename to platforms/holystone/hs200/hs200_driver.go diff --git a/v2/platforms/holystone/hs200/hs200_driver_test.go b/platforms/holystone/hs200/hs200_driver_test.go similarity index 100% rename from v2/platforms/holystone/hs200/hs200_driver_test.go rename to platforms/holystone/hs200/hs200_driver_test.go diff --git a/v2/platforms/intel-iot/LICENSE b/platforms/intel-iot/LICENSE similarity index 100% rename from v2/platforms/intel-iot/LICENSE rename to platforms/intel-iot/LICENSE diff --git a/v2/platforms/intel-iot/README.md b/platforms/intel-iot/README.md similarity index 100% rename from v2/platforms/intel-iot/README.md rename to platforms/intel-iot/README.md diff --git a/v2/platforms/intel-iot/curie/README.md b/platforms/intel-iot/curie/README.md similarity index 100% rename from v2/platforms/intel-iot/curie/README.md rename to platforms/intel-iot/curie/README.md diff --git a/v2/platforms/intel-iot/curie/doc.go b/platforms/intel-iot/curie/doc.go similarity index 100% rename from v2/platforms/intel-iot/curie/doc.go rename to platforms/intel-iot/curie/doc.go diff --git a/v2/platforms/intel-iot/curie/imu_driver.go b/platforms/intel-iot/curie/imu_driver.go similarity index 100% rename from v2/platforms/intel-iot/curie/imu_driver.go rename to platforms/intel-iot/curie/imu_driver.go diff --git a/v2/platforms/intel-iot/curie/imu_driver_test.go b/platforms/intel-iot/curie/imu_driver_test.go similarity index 100% rename from v2/platforms/intel-iot/curie/imu_driver_test.go rename to platforms/intel-iot/curie/imu_driver_test.go diff --git a/v2/platforms/intel-iot/edison/README.md b/platforms/intel-iot/edison/README.md similarity index 100% rename from v2/platforms/intel-iot/edison/README.md rename to platforms/intel-iot/edison/README.md diff --git a/v2/platforms/intel-iot/edison/arduino_pinmap.go b/platforms/intel-iot/edison/arduino_pinmap.go similarity index 100% rename from v2/platforms/intel-iot/edison/arduino_pinmap.go rename to platforms/intel-iot/edison/arduino_pinmap.go diff --git a/v2/platforms/intel-iot/edison/doc.go b/platforms/intel-iot/edison/doc.go similarity index 100% rename from v2/platforms/intel-iot/edison/doc.go rename to platforms/intel-iot/edison/doc.go diff --git a/v2/platforms/intel-iot/edison/edison_adaptor.go b/platforms/intel-iot/edison/edison_adaptor.go similarity index 100% rename from v2/platforms/intel-iot/edison/edison_adaptor.go rename to platforms/intel-iot/edison/edison_adaptor.go diff --git a/v2/platforms/intel-iot/edison/edison_adaptor_test.go b/platforms/intel-iot/edison/edison_adaptor_test.go similarity index 100% rename from v2/platforms/intel-iot/edison/edison_adaptor_test.go rename to platforms/intel-iot/edison/edison_adaptor_test.go diff --git a/v2/platforms/intel-iot/edison/miniboard_pinmap.go b/platforms/intel-iot/edison/miniboard_pinmap.go similarity index 100% rename from v2/platforms/intel-iot/edison/miniboard_pinmap.go rename to platforms/intel-iot/edison/miniboard_pinmap.go diff --git a/v2/platforms/intel-iot/edison/sparkfun_pinmap.go b/platforms/intel-iot/edison/sparkfun_pinmap.go similarity index 100% rename from v2/platforms/intel-iot/edison/sparkfun_pinmap.go rename to platforms/intel-iot/edison/sparkfun_pinmap.go diff --git a/v2/platforms/intel-iot/intel-iot.go b/platforms/intel-iot/intel-iot.go similarity index 100% rename from v2/platforms/intel-iot/intel-iot.go rename to platforms/intel-iot/intel-iot.go diff --git a/v2/platforms/intel-iot/joule/README.md b/platforms/intel-iot/joule/README.md similarity index 100% rename from v2/platforms/intel-iot/joule/README.md rename to platforms/intel-iot/joule/README.md diff --git a/v2/platforms/intel-iot/joule/doc.go b/platforms/intel-iot/joule/doc.go similarity index 100% rename from v2/platforms/intel-iot/joule/doc.go rename to platforms/intel-iot/joule/doc.go diff --git a/v2/platforms/intel-iot/joule/joule_adaptor.go b/platforms/intel-iot/joule/joule_adaptor.go similarity index 100% rename from v2/platforms/intel-iot/joule/joule_adaptor.go rename to platforms/intel-iot/joule/joule_adaptor.go diff --git a/v2/platforms/intel-iot/joule/joule_adaptor_test.go b/platforms/intel-iot/joule/joule_adaptor_test.go similarity index 100% rename from v2/platforms/intel-iot/joule/joule_adaptor_test.go rename to platforms/intel-iot/joule/joule_adaptor_test.go diff --git a/v2/platforms/intel-iot/joule/tuchuck_pinmap.go b/platforms/intel-iot/joule/tuchuck_pinmap.go similarity index 100% rename from v2/platforms/intel-iot/joule/tuchuck_pinmap.go rename to platforms/intel-iot/joule/tuchuck_pinmap.go diff --git a/v2/platforms/jetson/README.md b/platforms/jetson/README.md similarity index 100% rename from v2/platforms/jetson/README.md rename to platforms/jetson/README.md diff --git a/v2/platforms/jetson/doc.go b/platforms/jetson/doc.go similarity index 100% rename from v2/platforms/jetson/doc.go rename to platforms/jetson/doc.go diff --git a/v2/platforms/jetson/jetson_adaptor.go b/platforms/jetson/jetson_adaptor.go similarity index 100% rename from v2/platforms/jetson/jetson_adaptor.go rename to platforms/jetson/jetson_adaptor.go diff --git a/v2/platforms/jetson/jetson_adaptor_test.go b/platforms/jetson/jetson_adaptor_test.go similarity index 100% rename from v2/platforms/jetson/jetson_adaptor_test.go rename to platforms/jetson/jetson_adaptor_test.go diff --git a/v2/platforms/jetson/jetson_pin_map.go b/platforms/jetson/jetson_pin_map.go similarity index 100% rename from v2/platforms/jetson/jetson_pin_map.go rename to platforms/jetson/jetson_pin_map.go diff --git a/v2/platforms/jetson/pwm_pin.go b/platforms/jetson/pwm_pin.go similarity index 100% rename from v2/platforms/jetson/pwm_pin.go rename to platforms/jetson/pwm_pin.go diff --git a/v2/platforms/jetson/pwm_pin_test.go b/platforms/jetson/pwm_pin_test.go similarity index 100% rename from v2/platforms/jetson/pwm_pin_test.go rename to platforms/jetson/pwm_pin_test.go diff --git a/v2/platforms/joystick/LICENSE b/platforms/joystick/LICENSE similarity index 100% rename from v2/platforms/joystick/LICENSE rename to platforms/joystick/LICENSE diff --git a/v2/platforms/joystick/README.md b/platforms/joystick/README.md similarity index 100% rename from v2/platforms/joystick/README.md rename to platforms/joystick/README.md diff --git a/v2/platforms/joystick/bin/scanner.go b/platforms/joystick/bin/scanner.go similarity index 100% rename from v2/platforms/joystick/bin/scanner.go rename to platforms/joystick/bin/scanner.go diff --git a/v2/platforms/joystick/configs/dualsense.json b/platforms/joystick/configs/dualsense.json similarity index 100% rename from v2/platforms/joystick/configs/dualsense.json rename to platforms/joystick/configs/dualsense.json diff --git a/v2/platforms/joystick/configs/dualshock3.json b/platforms/joystick/configs/dualshock3.json similarity index 100% rename from v2/platforms/joystick/configs/dualshock3.json rename to platforms/joystick/configs/dualshock3.json diff --git a/v2/platforms/joystick/configs/dualshock4.json b/platforms/joystick/configs/dualshock4.json similarity index 100% rename from v2/platforms/joystick/configs/dualshock4.json rename to platforms/joystick/configs/dualshock4.json diff --git a/v2/platforms/joystick/configs/magicseer1.json b/platforms/joystick/configs/magicseer1.json similarity index 100% rename from v2/platforms/joystick/configs/magicseer1.json rename to platforms/joystick/configs/magicseer1.json diff --git a/v2/platforms/joystick/configs/shield.json b/platforms/joystick/configs/shield.json similarity index 100% rename from v2/platforms/joystick/configs/shield.json rename to platforms/joystick/configs/shield.json diff --git a/v2/platforms/joystick/configs/xbox360_power_a_mini_proex.json b/platforms/joystick/configs/xbox360_power_a_mini_proex.json similarity index 100% rename from v2/platforms/joystick/configs/xbox360_power_a_mini_proex.json rename to platforms/joystick/configs/xbox360_power_a_mini_proex.json diff --git a/v2/platforms/joystick/doc.go b/platforms/joystick/doc.go similarity index 100% rename from v2/platforms/joystick/doc.go rename to platforms/joystick/doc.go diff --git a/v2/platforms/joystick/events.go b/platforms/joystick/events.go similarity index 100% rename from v2/platforms/joystick/events.go rename to platforms/joystick/events.go diff --git a/v2/platforms/joystick/joystick_adaptor.go b/platforms/joystick/joystick_adaptor.go similarity index 100% rename from v2/platforms/joystick/joystick_adaptor.go rename to platforms/joystick/joystick_adaptor.go diff --git a/v2/platforms/joystick/joystick_adaptor_test.go b/platforms/joystick/joystick_adaptor_test.go similarity index 100% rename from v2/platforms/joystick/joystick_adaptor_test.go rename to platforms/joystick/joystick_adaptor_test.go diff --git a/v2/platforms/joystick/joystick_driver.go b/platforms/joystick/joystick_driver.go similarity index 100% rename from v2/platforms/joystick/joystick_driver.go rename to platforms/joystick/joystick_driver.go diff --git a/v2/platforms/joystick/joystick_driver_test.go b/platforms/joystick/joystick_driver_test.go similarity index 100% rename from v2/platforms/joystick/joystick_driver_test.go rename to platforms/joystick/joystick_driver_test.go diff --git a/v2/platforms/joystick/joystick_dualsense.go b/platforms/joystick/joystick_dualsense.go similarity index 100% rename from v2/platforms/joystick/joystick_dualsense.go rename to platforms/joystick/joystick_dualsense.go diff --git a/v2/platforms/joystick/joystick_dualshock3.go b/platforms/joystick/joystick_dualshock3.go similarity index 100% rename from v2/platforms/joystick/joystick_dualshock3.go rename to platforms/joystick/joystick_dualshock3.go diff --git a/v2/platforms/joystick/joystick_dualshock4.go b/platforms/joystick/joystick_dualshock4.go similarity index 100% rename from v2/platforms/joystick/joystick_dualshock4.go rename to platforms/joystick/joystick_dualshock4.go diff --git a/v2/platforms/joystick/joystick_nintendo_joycon.go b/platforms/joystick/joystick_nintendo_joycon.go similarity index 100% rename from v2/platforms/joystick/joystick_nintendo_joycon.go rename to platforms/joystick/joystick_nintendo_joycon.go diff --git a/v2/platforms/joystick/joystick_shield.go b/platforms/joystick/joystick_shield.go similarity index 100% rename from v2/platforms/joystick/joystick_shield.go rename to platforms/joystick/joystick_shield.go diff --git a/v2/platforms/joystick/joystick_tflight_hotas_x.go b/platforms/joystick/joystick_tflight_hotas_x.go similarity index 100% rename from v2/platforms/joystick/joystick_tflight_hotas_x.go rename to platforms/joystick/joystick_tflight_hotas_x.go diff --git a/v2/platforms/joystick/joystick_xbox360.go b/platforms/joystick/joystick_xbox360.go similarity index 100% rename from v2/platforms/joystick/joystick_xbox360.go rename to platforms/joystick/joystick_xbox360.go diff --git a/v2/platforms/joystick/joystick_xbox360_rock_band_drums.go b/platforms/joystick/joystick_xbox360_rock_band_drums.go similarity index 100% rename from v2/platforms/joystick/joystick_xbox360_rock_band_drums.go rename to platforms/joystick/joystick_xbox360_rock_band_drums.go diff --git a/v2/platforms/joystick/joystick_xboxone.go b/platforms/joystick/joystick_xboxone.go similarity index 100% rename from v2/platforms/joystick/joystick_xboxone.go rename to platforms/joystick/joystick_xboxone.go diff --git a/v2/platforms/joystick/test_helper.go b/platforms/joystick/test_helper.go similarity index 100% rename from v2/platforms/joystick/test_helper.go rename to platforms/joystick/test_helper.go diff --git a/v2/platforms/keyboard/LICENSE b/platforms/keyboard/LICENSE similarity index 100% rename from v2/platforms/keyboard/LICENSE rename to platforms/keyboard/LICENSE diff --git a/v2/platforms/keyboard/README.md b/platforms/keyboard/README.md similarity index 100% rename from v2/platforms/keyboard/README.md rename to platforms/keyboard/README.md diff --git a/v2/platforms/keyboard/doc.go b/platforms/keyboard/doc.go similarity index 100% rename from v2/platforms/keyboard/doc.go rename to platforms/keyboard/doc.go diff --git a/v2/platforms/keyboard/keyboard.go b/platforms/keyboard/keyboard.go similarity index 100% rename from v2/platforms/keyboard/keyboard.go rename to platforms/keyboard/keyboard.go diff --git a/v2/platforms/keyboard/keyboard_driver.go b/platforms/keyboard/keyboard_driver.go similarity index 100% rename from v2/platforms/keyboard/keyboard_driver.go rename to platforms/keyboard/keyboard_driver.go diff --git a/v2/platforms/keyboard/keyboard_driver_test.go b/platforms/keyboard/keyboard_driver_test.go similarity index 100% rename from v2/platforms/keyboard/keyboard_driver_test.go rename to platforms/keyboard/keyboard_driver_test.go diff --git a/v2/platforms/keyboard/keyboard_test.go b/platforms/keyboard/keyboard_test.go similarity index 100% rename from v2/platforms/keyboard/keyboard_test.go rename to platforms/keyboard/keyboard_test.go diff --git a/v2/platforms/leap/LICENSE b/platforms/leap/LICENSE similarity index 100% rename from v2/platforms/leap/LICENSE rename to platforms/leap/LICENSE diff --git a/v2/platforms/leap/README.md b/platforms/leap/README.md similarity index 100% rename from v2/platforms/leap/README.md rename to platforms/leap/README.md diff --git a/v2/platforms/leap/doc.go b/platforms/leap/doc.go similarity index 100% rename from v2/platforms/leap/doc.go rename to platforms/leap/doc.go diff --git a/v2/platforms/leap/leap_motion_adaptor.go b/platforms/leap/leap_motion_adaptor.go similarity index 100% rename from v2/platforms/leap/leap_motion_adaptor.go rename to platforms/leap/leap_motion_adaptor.go diff --git a/v2/platforms/leap/leap_motion_adaptor_test.go b/platforms/leap/leap_motion_adaptor_test.go similarity index 100% rename from v2/platforms/leap/leap_motion_adaptor_test.go rename to platforms/leap/leap_motion_adaptor_test.go diff --git a/v2/platforms/leap/leap_motion_driver.go b/platforms/leap/leap_motion_driver.go similarity index 100% rename from v2/platforms/leap/leap_motion_driver.go rename to platforms/leap/leap_motion_driver.go diff --git a/v2/platforms/leap/leap_motion_driver_test.go b/platforms/leap/leap_motion_driver_test.go similarity index 100% rename from v2/platforms/leap/leap_motion_driver_test.go rename to platforms/leap/leap_motion_driver_test.go diff --git a/v2/platforms/leap/parser.go b/platforms/leap/parser.go similarity index 100% rename from v2/platforms/leap/parser.go rename to platforms/leap/parser.go diff --git a/v2/platforms/leap/test/support/example_frame.json b/platforms/leap/test/support/example_frame.json similarity index 100% rename from v2/platforms/leap/test/support/example_frame.json rename to platforms/leap/test/support/example_frame.json diff --git a/v2/platforms/mavlink/LICENSE b/platforms/mavlink/LICENSE similarity index 100% rename from v2/platforms/mavlink/LICENSE rename to platforms/mavlink/LICENSE diff --git a/v2/platforms/mavlink/README.md b/platforms/mavlink/README.md similarity index 100% rename from v2/platforms/mavlink/README.md rename to platforms/mavlink/README.md diff --git a/v2/platforms/mavlink/common/common.go b/platforms/mavlink/common/common.go similarity index 100% rename from v2/platforms/mavlink/common/common.go rename to platforms/mavlink/common/common.go diff --git a/v2/platforms/mavlink/common/mavlink.go b/platforms/mavlink/common/mavlink.go similarity index 100% rename from v2/platforms/mavlink/common/mavlink.go rename to platforms/mavlink/common/mavlink.go diff --git a/v2/platforms/mavlink/common/version.go b/platforms/mavlink/common/version.go similarity index 100% rename from v2/platforms/mavlink/common/version.go rename to platforms/mavlink/common/version.go diff --git a/v2/platforms/mavlink/doc.go b/platforms/mavlink/doc.go similarity index 100% rename from v2/platforms/mavlink/doc.go rename to platforms/mavlink/doc.go diff --git a/v2/platforms/mavlink/mavlink_adaptor.go b/platforms/mavlink/mavlink_adaptor.go similarity index 100% rename from v2/platforms/mavlink/mavlink_adaptor.go rename to platforms/mavlink/mavlink_adaptor.go diff --git a/v2/platforms/mavlink/mavlink_adaptor_test.go b/platforms/mavlink/mavlink_adaptor_test.go similarity index 100% rename from v2/platforms/mavlink/mavlink_adaptor_test.go rename to platforms/mavlink/mavlink_adaptor_test.go diff --git a/v2/platforms/mavlink/mavlink_driver.go b/platforms/mavlink/mavlink_driver.go similarity index 100% rename from v2/platforms/mavlink/mavlink_driver.go rename to platforms/mavlink/mavlink_driver.go diff --git a/v2/platforms/mavlink/mavlink_driver_test.go b/platforms/mavlink/mavlink_driver_test.go similarity index 100% rename from v2/platforms/mavlink/mavlink_driver_test.go rename to platforms/mavlink/mavlink_driver_test.go diff --git a/v2/platforms/mavlink/mavlink_udp_adaptor.go b/platforms/mavlink/mavlink_udp_adaptor.go similarity index 100% rename from v2/platforms/mavlink/mavlink_udp_adaptor.go rename to platforms/mavlink/mavlink_udp_adaptor.go diff --git a/v2/platforms/mavlink/mavlink_udp_adaptor_test.go b/platforms/mavlink/mavlink_udp_adaptor_test.go similarity index 100% rename from v2/platforms/mavlink/mavlink_udp_adaptor_test.go rename to platforms/mavlink/mavlink_udp_adaptor_test.go diff --git a/v2/platforms/megapi/README.md b/platforms/megapi/README.md similarity index 100% rename from v2/platforms/megapi/README.md rename to platforms/megapi/README.md diff --git a/v2/platforms/megapi/doc.go b/platforms/megapi/doc.go similarity index 100% rename from v2/platforms/megapi/doc.go rename to platforms/megapi/doc.go diff --git a/v2/platforms/megapi/megapi_adaptor.go b/platforms/megapi/megapi_adaptor.go similarity index 100% rename from v2/platforms/megapi/megapi_adaptor.go rename to platforms/megapi/megapi_adaptor.go diff --git a/v2/platforms/megapi/motor_driver.go b/platforms/megapi/motor_driver.go similarity index 100% rename from v2/platforms/megapi/motor_driver.go rename to platforms/megapi/motor_driver.go diff --git a/v2/platforms/microbit/LICENSE b/platforms/microbit/LICENSE similarity index 100% rename from v2/platforms/microbit/LICENSE rename to platforms/microbit/LICENSE diff --git a/v2/platforms/microbit/README.md b/platforms/microbit/README.md similarity index 100% rename from v2/platforms/microbit/README.md rename to platforms/microbit/README.md diff --git a/v2/platforms/microbit/accelerometer_driver.go b/platforms/microbit/accelerometer_driver.go similarity index 100% rename from v2/platforms/microbit/accelerometer_driver.go rename to platforms/microbit/accelerometer_driver.go diff --git a/v2/platforms/microbit/accelerometer_driver_test.go b/platforms/microbit/accelerometer_driver_test.go similarity index 100% rename from v2/platforms/microbit/accelerometer_driver_test.go rename to platforms/microbit/accelerometer_driver_test.go diff --git a/v2/platforms/microbit/button_driver.go b/platforms/microbit/button_driver.go similarity index 100% rename from v2/platforms/microbit/button_driver.go rename to platforms/microbit/button_driver.go diff --git a/v2/platforms/microbit/button_driver_test.go b/platforms/microbit/button_driver_test.go similarity index 100% rename from v2/platforms/microbit/button_driver_test.go rename to platforms/microbit/button_driver_test.go diff --git a/v2/platforms/microbit/doc.go b/platforms/microbit/doc.go similarity index 100% rename from v2/platforms/microbit/doc.go rename to platforms/microbit/doc.go diff --git a/v2/platforms/microbit/helpers_test.go b/platforms/microbit/helpers_test.go similarity index 100% rename from v2/platforms/microbit/helpers_test.go rename to platforms/microbit/helpers_test.go diff --git a/v2/platforms/microbit/io_pin_driver.go b/platforms/microbit/io_pin_driver.go similarity index 100% rename from v2/platforms/microbit/io_pin_driver.go rename to platforms/microbit/io_pin_driver.go diff --git a/v2/platforms/microbit/io_pin_driver_test.go b/platforms/microbit/io_pin_driver_test.go similarity index 100% rename from v2/platforms/microbit/io_pin_driver_test.go rename to platforms/microbit/io_pin_driver_test.go diff --git a/v2/platforms/microbit/led_driver.go b/platforms/microbit/led_driver.go similarity index 100% rename from v2/platforms/microbit/led_driver.go rename to platforms/microbit/led_driver.go diff --git a/v2/platforms/microbit/led_driver_test.go b/platforms/microbit/led_driver_test.go similarity index 100% rename from v2/platforms/microbit/led_driver_test.go rename to platforms/microbit/led_driver_test.go diff --git a/v2/platforms/microbit/magnetometer_driver.go b/platforms/microbit/magnetometer_driver.go similarity index 100% rename from v2/platforms/microbit/magnetometer_driver.go rename to platforms/microbit/magnetometer_driver.go diff --git a/v2/platforms/microbit/magnetometer_driver_test.go b/platforms/microbit/magnetometer_driver_test.go similarity index 100% rename from v2/platforms/microbit/magnetometer_driver_test.go rename to platforms/microbit/magnetometer_driver_test.go diff --git a/v2/platforms/microbit/temperature_driver.go b/platforms/microbit/temperature_driver.go similarity index 100% rename from v2/platforms/microbit/temperature_driver.go rename to platforms/microbit/temperature_driver.go diff --git a/v2/platforms/microbit/temperature_driver_test.go b/platforms/microbit/temperature_driver_test.go similarity index 100% rename from v2/platforms/microbit/temperature_driver_test.go rename to platforms/microbit/temperature_driver_test.go diff --git a/v2/platforms/mqtt/LICENSE b/platforms/mqtt/LICENSE similarity index 100% rename from v2/platforms/mqtt/LICENSE rename to platforms/mqtt/LICENSE diff --git a/v2/platforms/mqtt/README.md b/platforms/mqtt/README.md similarity index 100% rename from v2/platforms/mqtt/README.md rename to platforms/mqtt/README.md diff --git a/v2/platforms/mqtt/doc.go b/platforms/mqtt/doc.go similarity index 100% rename from v2/platforms/mqtt/doc.go rename to platforms/mqtt/doc.go diff --git a/v2/platforms/mqtt/mqtt_adaptor.go b/platforms/mqtt/mqtt_adaptor.go similarity index 100% rename from v2/platforms/mqtt/mqtt_adaptor.go rename to platforms/mqtt/mqtt_adaptor.go diff --git a/v2/platforms/mqtt/mqtt_adaptor_test.go b/platforms/mqtt/mqtt_adaptor_test.go similarity index 100% rename from v2/platforms/mqtt/mqtt_adaptor_test.go rename to platforms/mqtt/mqtt_adaptor_test.go diff --git a/v2/platforms/mqtt/mqtt_driver.go b/platforms/mqtt/mqtt_driver.go similarity index 100% rename from v2/platforms/mqtt/mqtt_driver.go rename to platforms/mqtt/mqtt_driver.go diff --git a/v2/platforms/mqtt/mqtt_driver_test.go b/platforms/mqtt/mqtt_driver_test.go similarity index 100% rename from v2/platforms/mqtt/mqtt_driver_test.go rename to platforms/mqtt/mqtt_driver_test.go diff --git a/v2/platforms/nanopi/LICENSE b/platforms/nanopi/LICENSE similarity index 100% rename from v2/platforms/nanopi/LICENSE rename to platforms/nanopi/LICENSE diff --git a/v2/platforms/nanopi/README.md b/platforms/nanopi/README.md similarity index 100% rename from v2/platforms/nanopi/README.md rename to platforms/nanopi/README.md diff --git a/v2/platforms/nanopi/doc.go b/platforms/nanopi/doc.go similarity index 100% rename from v2/platforms/nanopi/doc.go rename to platforms/nanopi/doc.go diff --git a/v2/platforms/nanopi/nanopi_adaptor.go b/platforms/nanopi/nanopi_adaptor.go similarity index 100% rename from v2/platforms/nanopi/nanopi_adaptor.go rename to platforms/nanopi/nanopi_adaptor.go diff --git a/v2/platforms/nanopi/nanopi_adaptor_test.go b/platforms/nanopi/nanopi_adaptor_test.go similarity index 100% rename from v2/platforms/nanopi/nanopi_adaptor_test.go rename to platforms/nanopi/nanopi_adaptor_test.go diff --git a/v2/platforms/nanopi/nanopineo_pin_map.go b/platforms/nanopi/nanopineo_pin_map.go similarity index 100% rename from v2/platforms/nanopi/nanopineo_pin_map.go rename to platforms/nanopi/nanopineo_pin_map.go diff --git a/v2/platforms/nats/README.md b/platforms/nats/README.md similarity index 100% rename from v2/platforms/nats/README.md rename to platforms/nats/README.md diff --git a/v2/platforms/nats/doc.go b/platforms/nats/doc.go similarity index 100% rename from v2/platforms/nats/doc.go rename to platforms/nats/doc.go diff --git a/v2/platforms/nats/nats_adaptor.go b/platforms/nats/nats_adaptor.go similarity index 100% rename from v2/platforms/nats/nats_adaptor.go rename to platforms/nats/nats_adaptor.go diff --git a/v2/platforms/nats/nats_adaptor_test.go b/platforms/nats/nats_adaptor_test.go similarity index 100% rename from v2/platforms/nats/nats_adaptor_test.go rename to platforms/nats/nats_adaptor_test.go diff --git a/v2/platforms/nats/nats_driver.go b/platforms/nats/nats_driver.go similarity index 100% rename from v2/platforms/nats/nats_driver.go rename to platforms/nats/nats_driver.go diff --git a/v2/platforms/nats/nats_driver_test.go b/platforms/nats/nats_driver_test.go similarity index 100% rename from v2/platforms/nats/nats_driver_test.go rename to platforms/nats/nats_driver_test.go diff --git a/v2/platforms/nats/test_certs/catest-key.pem b/platforms/nats/test_certs/catest-key.pem similarity index 100% rename from v2/platforms/nats/test_certs/catest-key.pem rename to platforms/nats/test_certs/catest-key.pem diff --git a/v2/platforms/nats/test_certs/catest.pem b/platforms/nats/test_certs/catest.pem similarity index 100% rename from v2/platforms/nats/test_certs/catest.pem rename to platforms/nats/test_certs/catest.pem diff --git a/v2/platforms/nats/test_certs/client-cert.pem b/platforms/nats/test_certs/client-cert.pem similarity index 100% rename from v2/platforms/nats/test_certs/client-cert.pem rename to platforms/nats/test_certs/client-cert.pem diff --git a/v2/platforms/nats/test_certs/client-key.pem b/platforms/nats/test_certs/client-key.pem similarity index 100% rename from v2/platforms/nats/test_certs/client-key.pem rename to platforms/nats/test_certs/client-key.pem diff --git a/v2/platforms/nats/test_certs/server-cert.pem b/platforms/nats/test_certs/server-cert.pem similarity index 100% rename from v2/platforms/nats/test_certs/server-cert.pem rename to platforms/nats/test_certs/server-cert.pem diff --git a/v2/platforms/nats/test_certs/server-key.pem b/platforms/nats/test_certs/server-key.pem similarity index 100% rename from v2/platforms/nats/test_certs/server-key.pem rename to platforms/nats/test_certs/server-key.pem diff --git a/v2/platforms/neurosky/LICENSE b/platforms/neurosky/LICENSE similarity index 100% rename from v2/platforms/neurosky/LICENSE rename to platforms/neurosky/LICENSE diff --git a/v2/platforms/neurosky/README.md b/platforms/neurosky/README.md similarity index 100% rename from v2/platforms/neurosky/README.md rename to platforms/neurosky/README.md diff --git a/v2/platforms/neurosky/doc.go b/platforms/neurosky/doc.go similarity index 100% rename from v2/platforms/neurosky/doc.go rename to platforms/neurosky/doc.go diff --git a/v2/platforms/neurosky/neurosky_adaptor.go b/platforms/neurosky/neurosky_adaptor.go similarity index 100% rename from v2/platforms/neurosky/neurosky_adaptor.go rename to platforms/neurosky/neurosky_adaptor.go diff --git a/v2/platforms/neurosky/neurosky_adaptor_test.go b/platforms/neurosky/neurosky_adaptor_test.go similarity index 100% rename from v2/platforms/neurosky/neurosky_adaptor_test.go rename to platforms/neurosky/neurosky_adaptor_test.go diff --git a/v2/platforms/neurosky/neurosky_driver.go b/platforms/neurosky/neurosky_driver.go similarity index 100% rename from v2/platforms/neurosky/neurosky_driver.go rename to platforms/neurosky/neurosky_driver.go diff --git a/v2/platforms/neurosky/neurosky_driver_test.go b/platforms/neurosky/neurosky_driver_test.go similarity index 100% rename from v2/platforms/neurosky/neurosky_driver_test.go rename to platforms/neurosky/neurosky_driver_test.go diff --git a/v2/platforms/opencv/LICENSE b/platforms/opencv/LICENSE similarity index 100% rename from v2/platforms/opencv/LICENSE rename to platforms/opencv/LICENSE diff --git a/v2/platforms/opencv/README.md b/platforms/opencv/README.md similarity index 100% rename from v2/platforms/opencv/README.md rename to platforms/opencv/README.md diff --git a/v2/platforms/opencv/camera_driver.go b/platforms/opencv/camera_driver.go similarity index 100% rename from v2/platforms/opencv/camera_driver.go rename to platforms/opencv/camera_driver.go diff --git a/v2/platforms/opencv/camera_driver_test.go b/platforms/opencv/camera_driver_test.go similarity index 100% rename from v2/platforms/opencv/camera_driver_test.go rename to platforms/opencv/camera_driver_test.go diff --git a/v2/platforms/opencv/doc.go b/platforms/opencv/doc.go similarity index 100% rename from v2/platforms/opencv/doc.go rename to platforms/opencv/doc.go diff --git a/v2/platforms/opencv/haarcascade_frontalface_alt.xml b/platforms/opencv/haarcascade_frontalface_alt.xml similarity index 100% rename from v2/platforms/opencv/haarcascade_frontalface_alt.xml rename to platforms/opencv/haarcascade_frontalface_alt.xml diff --git a/v2/platforms/opencv/helpers_test.go b/platforms/opencv/helpers_test.go similarity index 100% rename from v2/platforms/opencv/helpers_test.go rename to platforms/opencv/helpers_test.go diff --git a/v2/platforms/opencv/lena-256x256.jpg b/platforms/opencv/lena-256x256.jpg similarity index 100% rename from v2/platforms/opencv/lena-256x256.jpg rename to platforms/opencv/lena-256x256.jpg diff --git a/v2/platforms/opencv/utils.go b/platforms/opencv/utils.go similarity index 100% rename from v2/platforms/opencv/utils.go rename to platforms/opencv/utils.go diff --git a/v2/platforms/opencv/utils_test.go b/platforms/opencv/utils_test.go similarity index 100% rename from v2/platforms/opencv/utils_test.go rename to platforms/opencv/utils_test.go diff --git a/v2/platforms/opencv/window_driver.go b/platforms/opencv/window_driver.go similarity index 100% rename from v2/platforms/opencv/window_driver.go rename to platforms/opencv/window_driver.go diff --git a/v2/platforms/opencv/window_driver_test.go b/platforms/opencv/window_driver_test.go similarity index 100% rename from v2/platforms/opencv/window_driver_test.go rename to platforms/opencv/window_driver_test.go diff --git a/v2/platforms/parrot/LICENSE b/platforms/parrot/LICENSE similarity index 100% rename from v2/platforms/parrot/LICENSE rename to platforms/parrot/LICENSE diff --git a/v2/platforms/parrot/README.md b/platforms/parrot/README.md similarity index 100% rename from v2/platforms/parrot/README.md rename to platforms/parrot/README.md diff --git a/v2/platforms/parrot/ardrone/LICENSE b/platforms/parrot/ardrone/LICENSE similarity index 100% rename from v2/platforms/parrot/ardrone/LICENSE rename to platforms/parrot/ardrone/LICENSE diff --git a/v2/platforms/parrot/ardrone/README.md b/platforms/parrot/ardrone/README.md similarity index 100% rename from v2/platforms/parrot/ardrone/README.md rename to platforms/parrot/ardrone/README.md diff --git a/v2/platforms/parrot/ardrone/ardrone_adaptor.go b/platforms/parrot/ardrone/ardrone_adaptor.go similarity index 100% rename from v2/platforms/parrot/ardrone/ardrone_adaptor.go rename to platforms/parrot/ardrone/ardrone_adaptor.go diff --git a/v2/platforms/parrot/ardrone/ardrone_adaptor_test.go b/platforms/parrot/ardrone/ardrone_adaptor_test.go similarity index 100% rename from v2/platforms/parrot/ardrone/ardrone_adaptor_test.go rename to platforms/parrot/ardrone/ardrone_adaptor_test.go diff --git a/v2/platforms/parrot/ardrone/ardrone_driver.go b/platforms/parrot/ardrone/ardrone_driver.go similarity index 100% rename from v2/platforms/parrot/ardrone/ardrone_driver.go rename to platforms/parrot/ardrone/ardrone_driver.go diff --git a/v2/platforms/parrot/ardrone/ardrone_driver_test.go b/platforms/parrot/ardrone/ardrone_driver_test.go similarity index 100% rename from v2/platforms/parrot/ardrone/ardrone_driver_test.go rename to platforms/parrot/ardrone/ardrone_driver_test.go diff --git a/v2/platforms/parrot/ardrone/doc.go b/platforms/parrot/ardrone/doc.go similarity index 100% rename from v2/platforms/parrot/ardrone/doc.go rename to platforms/parrot/ardrone/doc.go diff --git a/v2/platforms/parrot/ardrone/pitch.go b/platforms/parrot/ardrone/pitch.go similarity index 100% rename from v2/platforms/parrot/ardrone/pitch.go rename to platforms/parrot/ardrone/pitch.go diff --git a/v2/platforms/parrot/ardrone/pitch_test.go b/platforms/parrot/ardrone/pitch_test.go similarity index 100% rename from v2/platforms/parrot/ardrone/pitch_test.go rename to platforms/parrot/ardrone/pitch_test.go diff --git a/v2/platforms/parrot/ardrone/test_helper.go b/platforms/parrot/ardrone/test_helper.go similarity index 100% rename from v2/platforms/parrot/ardrone/test_helper.go rename to platforms/parrot/ardrone/test_helper.go diff --git a/v2/platforms/parrot/bebop/LICENSE b/platforms/parrot/bebop/LICENSE similarity index 100% rename from v2/platforms/parrot/bebop/LICENSE rename to platforms/parrot/bebop/LICENSE diff --git a/v2/platforms/parrot/bebop/README.md b/platforms/parrot/bebop/README.md similarity index 100% rename from v2/platforms/parrot/bebop/README.md rename to platforms/parrot/bebop/README.md diff --git a/v2/platforms/parrot/bebop/bebop_adaptor.go b/platforms/parrot/bebop/bebop_adaptor.go similarity index 100% rename from v2/platforms/parrot/bebop/bebop_adaptor.go rename to platforms/parrot/bebop/bebop_adaptor.go diff --git a/v2/platforms/parrot/bebop/bebop_adaptor_test.go b/platforms/parrot/bebop/bebop_adaptor_test.go similarity index 100% rename from v2/platforms/parrot/bebop/bebop_adaptor_test.go rename to platforms/parrot/bebop/bebop_adaptor_test.go diff --git a/v2/platforms/parrot/bebop/bebop_driver.go b/platforms/parrot/bebop/bebop_driver.go similarity index 100% rename from v2/platforms/parrot/bebop/bebop_driver.go rename to platforms/parrot/bebop/bebop_driver.go diff --git a/v2/platforms/parrot/bebop/bebop_driver_test.go b/platforms/parrot/bebop/bebop_driver_test.go similarity index 100% rename from v2/platforms/parrot/bebop/bebop_driver_test.go rename to platforms/parrot/bebop/bebop_driver_test.go diff --git a/v2/platforms/parrot/bebop/client/client.go b/platforms/parrot/bebop/client/client.go similarity index 100% rename from v2/platforms/parrot/bebop/client/client.go rename to platforms/parrot/bebop/client/client.go diff --git a/v2/platforms/parrot/bebop/client/constants.go b/platforms/parrot/bebop/client/constants.go similarity index 100% rename from v2/platforms/parrot/bebop/client/constants.go rename to platforms/parrot/bebop/client/constants.go diff --git a/v2/platforms/parrot/bebop/client/examples/ff.conf b/platforms/parrot/bebop/client/examples/ff.conf similarity index 100% rename from v2/platforms/parrot/bebop/client/examples/ff.conf rename to platforms/parrot/bebop/client/examples/ff.conf diff --git a/v2/platforms/parrot/bebop/client/examples/takeoff.go b/platforms/parrot/bebop/client/examples/takeoff.go similarity index 100% rename from v2/platforms/parrot/bebop/client/examples/takeoff.go rename to platforms/parrot/bebop/client/examples/takeoff.go diff --git a/v2/platforms/parrot/bebop/client/examples/video.go b/platforms/parrot/bebop/client/examples/video.go similarity index 100% rename from v2/platforms/parrot/bebop/client/examples/video.go rename to platforms/parrot/bebop/client/examples/video.go diff --git a/v2/platforms/parrot/bebop/doc.go b/platforms/parrot/bebop/doc.go similarity index 100% rename from v2/platforms/parrot/bebop/doc.go rename to platforms/parrot/bebop/doc.go diff --git a/v2/platforms/parrot/bebop/pitch.go b/platforms/parrot/bebop/pitch.go similarity index 100% rename from v2/platforms/parrot/bebop/pitch.go rename to platforms/parrot/bebop/pitch.go diff --git a/v2/platforms/parrot/bebop/pitch_test.go b/platforms/parrot/bebop/pitch_test.go similarity index 100% rename from v2/platforms/parrot/bebop/pitch_test.go rename to platforms/parrot/bebop/pitch_test.go diff --git a/v2/platforms/parrot/bebop/test_helper.go b/platforms/parrot/bebop/test_helper.go similarity index 100% rename from v2/platforms/parrot/bebop/test_helper.go rename to platforms/parrot/bebop/test_helper.go diff --git a/v2/platforms/parrot/minidrone/LICENSE b/platforms/parrot/minidrone/LICENSE similarity index 100% rename from v2/platforms/parrot/minidrone/LICENSE rename to platforms/parrot/minidrone/LICENSE diff --git a/v2/platforms/parrot/minidrone/README.md b/platforms/parrot/minidrone/README.md similarity index 100% rename from v2/platforms/parrot/minidrone/README.md rename to platforms/parrot/minidrone/README.md diff --git a/v2/platforms/parrot/minidrone/doc.go b/platforms/parrot/minidrone/doc.go similarity index 100% rename from v2/platforms/parrot/minidrone/doc.go rename to platforms/parrot/minidrone/doc.go diff --git a/v2/platforms/parrot/minidrone/helpers_test.go b/platforms/parrot/minidrone/helpers_test.go similarity index 100% rename from v2/platforms/parrot/minidrone/helpers_test.go rename to platforms/parrot/minidrone/helpers_test.go diff --git a/v2/platforms/parrot/minidrone/minidrone_driver.go b/platforms/parrot/minidrone/minidrone_driver.go similarity index 100% rename from v2/platforms/parrot/minidrone/minidrone_driver.go rename to platforms/parrot/minidrone/minidrone_driver.go diff --git a/v2/platforms/parrot/minidrone/minidrone_driver_test.go b/platforms/parrot/minidrone/minidrone_driver_test.go similarity index 100% rename from v2/platforms/parrot/minidrone/minidrone_driver_test.go rename to platforms/parrot/minidrone/minidrone_driver_test.go diff --git a/v2/platforms/parrot/minidrone/pitch.go b/platforms/parrot/minidrone/pitch.go similarity index 100% rename from v2/platforms/parrot/minidrone/pitch.go rename to platforms/parrot/minidrone/pitch.go diff --git a/v2/platforms/parrot/minidrone/pitch_test.go b/platforms/parrot/minidrone/pitch_test.go similarity index 100% rename from v2/platforms/parrot/minidrone/pitch_test.go rename to platforms/parrot/minidrone/pitch_test.go diff --git a/v2/platforms/parrot/parrot.go b/platforms/parrot/parrot.go similarity index 100% rename from v2/platforms/parrot/parrot.go rename to platforms/parrot/parrot.go diff --git a/v2/platforms/particle/LICENSE b/platforms/particle/LICENSE similarity index 100% rename from v2/platforms/particle/LICENSE rename to platforms/particle/LICENSE diff --git a/v2/platforms/particle/README.md b/platforms/particle/README.md similarity index 100% rename from v2/platforms/particle/README.md rename to platforms/particle/README.md diff --git a/v2/platforms/particle/adaptor.go b/platforms/particle/adaptor.go similarity index 100% rename from v2/platforms/particle/adaptor.go rename to platforms/particle/adaptor.go diff --git a/v2/platforms/particle/adaptor_test.go b/platforms/particle/adaptor_test.go similarity index 100% rename from v2/platforms/particle/adaptor_test.go rename to platforms/particle/adaptor_test.go diff --git a/v2/platforms/particle/doc.go b/platforms/particle/doc.go similarity index 100% rename from v2/platforms/particle/doc.go rename to platforms/particle/doc.go diff --git a/v2/platforms/pebble/README.md b/platforms/pebble/README.md similarity index 100% rename from v2/platforms/pebble/README.md rename to platforms/pebble/README.md diff --git a/v2/platforms/pebble/doc.go b/platforms/pebble/doc.go similarity index 100% rename from v2/platforms/pebble/doc.go rename to platforms/pebble/doc.go diff --git a/v2/platforms/pebble/pebble_adaptor.go b/platforms/pebble/pebble_adaptor.go similarity index 100% rename from v2/platforms/pebble/pebble_adaptor.go rename to platforms/pebble/pebble_adaptor.go diff --git a/v2/platforms/pebble/pebble_adaptor_test.go b/platforms/pebble/pebble_adaptor_test.go similarity index 100% rename from v2/platforms/pebble/pebble_adaptor_test.go rename to platforms/pebble/pebble_adaptor_test.go diff --git a/v2/platforms/pebble/pebble_driver.go b/platforms/pebble/pebble_driver.go similarity index 100% rename from v2/platforms/pebble/pebble_driver.go rename to platforms/pebble/pebble_driver.go diff --git a/v2/platforms/pebble/pebble_driver_test.go b/platforms/pebble/pebble_driver_test.go similarity index 100% rename from v2/platforms/pebble/pebble_driver_test.go rename to platforms/pebble/pebble_driver_test.go diff --git a/v2/platforms/raspi/LICENSE b/platforms/raspi/LICENSE similarity index 100% rename from v2/platforms/raspi/LICENSE rename to platforms/raspi/LICENSE diff --git a/v2/platforms/raspi/README.md b/platforms/raspi/README.md similarity index 100% rename from v2/platforms/raspi/README.md rename to platforms/raspi/README.md diff --git a/v2/platforms/raspi/doc.go b/platforms/raspi/doc.go similarity index 100% rename from v2/platforms/raspi/doc.go rename to platforms/raspi/doc.go diff --git a/v2/platforms/raspi/pwm_pin.go b/platforms/raspi/pwm_pin.go similarity index 100% rename from v2/platforms/raspi/pwm_pin.go rename to platforms/raspi/pwm_pin.go diff --git a/v2/platforms/raspi/pwm_pin_test.go b/platforms/raspi/pwm_pin_test.go similarity index 100% rename from v2/platforms/raspi/pwm_pin_test.go rename to platforms/raspi/pwm_pin_test.go diff --git a/v2/platforms/raspi/raspi_adaptor.go b/platforms/raspi/raspi_adaptor.go similarity index 100% rename from v2/platforms/raspi/raspi_adaptor.go rename to platforms/raspi/raspi_adaptor.go diff --git a/v2/platforms/raspi/raspi_adaptor_test.go b/platforms/raspi/raspi_adaptor_test.go similarity index 100% rename from v2/platforms/raspi/raspi_adaptor_test.go rename to platforms/raspi/raspi_adaptor_test.go diff --git a/v2/platforms/raspi/raspi_pin_map.go b/platforms/raspi/raspi_pin_map.go similarity index 100% rename from v2/platforms/raspi/raspi_pin_map.go rename to platforms/raspi/raspi_pin_map.go diff --git a/v2/platforms/rockpi/LICENSE b/platforms/rockpi/LICENSE similarity index 100% rename from v2/platforms/rockpi/LICENSE rename to platforms/rockpi/LICENSE diff --git a/v2/platforms/rockpi/README.md b/platforms/rockpi/README.md similarity index 100% rename from v2/platforms/rockpi/README.md rename to platforms/rockpi/README.md diff --git a/v2/platforms/rockpi/doc.go b/platforms/rockpi/doc.go similarity index 100% rename from v2/platforms/rockpi/doc.go rename to platforms/rockpi/doc.go diff --git a/v2/platforms/rockpi/rockpi_adaptor.go b/platforms/rockpi/rockpi_adaptor.go similarity index 100% rename from v2/platforms/rockpi/rockpi_adaptor.go rename to platforms/rockpi/rockpi_adaptor.go diff --git a/v2/platforms/rockpi/rockpi_adaptor_test.go b/platforms/rockpi/rockpi_adaptor_test.go similarity index 100% rename from v2/platforms/rockpi/rockpi_adaptor_test.go rename to platforms/rockpi/rockpi_adaptor_test.go diff --git a/v2/platforms/rockpi/rockpi_pin_map.go b/platforms/rockpi/rockpi_pin_map.go similarity index 100% rename from v2/platforms/rockpi/rockpi_pin_map.go rename to platforms/rockpi/rockpi_pin_map.go diff --git a/v2/platforms/sphero/LICENSE b/platforms/sphero/LICENSE similarity index 100% rename from v2/platforms/sphero/LICENSE rename to platforms/sphero/LICENSE diff --git a/v2/platforms/sphero/README.md b/platforms/sphero/README.md similarity index 100% rename from v2/platforms/sphero/README.md rename to platforms/sphero/README.md diff --git a/v2/platforms/sphero/bb8/LICENSE b/platforms/sphero/bb8/LICENSE similarity index 100% rename from v2/platforms/sphero/bb8/LICENSE rename to platforms/sphero/bb8/LICENSE diff --git a/v2/platforms/sphero/bb8/README.md b/platforms/sphero/bb8/README.md similarity index 100% rename from v2/platforms/sphero/bb8/README.md rename to platforms/sphero/bb8/README.md diff --git a/v2/platforms/sphero/bb8/bb8_driver.go b/platforms/sphero/bb8/bb8_driver.go similarity index 100% rename from v2/platforms/sphero/bb8/bb8_driver.go rename to platforms/sphero/bb8/bb8_driver.go diff --git a/v2/platforms/sphero/bb8/bb8_driver_test.go b/platforms/sphero/bb8/bb8_driver_test.go similarity index 100% rename from v2/platforms/sphero/bb8/bb8_driver_test.go rename to platforms/sphero/bb8/bb8_driver_test.go diff --git a/v2/platforms/sphero/bb8/bb8_packets.go b/platforms/sphero/bb8/bb8_packets.go similarity index 100% rename from v2/platforms/sphero/bb8/bb8_packets.go rename to platforms/sphero/bb8/bb8_packets.go diff --git a/v2/platforms/sphero/bb8/doc.go b/platforms/sphero/bb8/doc.go similarity index 100% rename from v2/platforms/sphero/bb8/doc.go rename to platforms/sphero/bb8/doc.go diff --git a/v2/platforms/sphero/bb8/helpers_test.go b/platforms/sphero/bb8/helpers_test.go similarity index 100% rename from v2/platforms/sphero/bb8/helpers_test.go rename to platforms/sphero/bb8/helpers_test.go diff --git a/v2/platforms/sphero/doc.go b/platforms/sphero/doc.go similarity index 100% rename from v2/platforms/sphero/doc.go rename to platforms/sphero/doc.go diff --git a/v2/platforms/sphero/ollie/LICENSE b/platforms/sphero/ollie/LICENSE similarity index 100% rename from v2/platforms/sphero/ollie/LICENSE rename to platforms/sphero/ollie/LICENSE diff --git a/v2/platforms/sphero/ollie/README.md b/platforms/sphero/ollie/README.md similarity index 100% rename from v2/platforms/sphero/ollie/README.md rename to platforms/sphero/ollie/README.md diff --git a/v2/platforms/sphero/ollie/doc.go b/platforms/sphero/ollie/doc.go similarity index 100% rename from v2/platforms/sphero/ollie/doc.go rename to platforms/sphero/ollie/doc.go diff --git a/v2/platforms/sphero/ollie/helpers_test.go b/platforms/sphero/ollie/helpers_test.go similarity index 100% rename from v2/platforms/sphero/ollie/helpers_test.go rename to platforms/sphero/ollie/helpers_test.go diff --git a/v2/platforms/sphero/ollie/ollie_driver.go b/platforms/sphero/ollie/ollie_driver.go similarity index 100% rename from v2/platforms/sphero/ollie/ollie_driver.go rename to platforms/sphero/ollie/ollie_driver.go diff --git a/v2/platforms/sphero/ollie/ollie_driver_test.go b/platforms/sphero/ollie/ollie_driver_test.go similarity index 100% rename from v2/platforms/sphero/ollie/ollie_driver_test.go rename to platforms/sphero/ollie/ollie_driver_test.go diff --git a/v2/platforms/sphero/ollie/ollie_packets.go b/platforms/sphero/ollie/ollie_packets.go similarity index 100% rename from v2/platforms/sphero/ollie/ollie_packets.go rename to platforms/sphero/ollie/ollie_packets.go diff --git a/v2/platforms/sphero/sphero_adaptor.go b/platforms/sphero/sphero_adaptor.go similarity index 100% rename from v2/platforms/sphero/sphero_adaptor.go rename to platforms/sphero/sphero_adaptor.go diff --git a/v2/platforms/sphero/sphero_adaptor_test.go b/platforms/sphero/sphero_adaptor_test.go similarity index 100% rename from v2/platforms/sphero/sphero_adaptor_test.go rename to platforms/sphero/sphero_adaptor_test.go diff --git a/v2/platforms/sphero/sphero_driver.go b/platforms/sphero/sphero_driver.go similarity index 100% rename from v2/platforms/sphero/sphero_driver.go rename to platforms/sphero/sphero_driver.go diff --git a/v2/platforms/sphero/sphero_driver_test.go b/platforms/sphero/sphero_driver_test.go similarity index 100% rename from v2/platforms/sphero/sphero_driver_test.go rename to platforms/sphero/sphero_driver_test.go diff --git a/v2/platforms/sphero/sphero_packets.go b/platforms/sphero/sphero_packets.go similarity index 100% rename from v2/platforms/sphero/sphero_packets.go rename to platforms/sphero/sphero_packets.go diff --git a/v2/platforms/sphero/sprkplus/LICENSE b/platforms/sphero/sprkplus/LICENSE similarity index 100% rename from v2/platforms/sphero/sprkplus/LICENSE rename to platforms/sphero/sprkplus/LICENSE diff --git a/v2/platforms/sphero/sprkplus/README.md b/platforms/sphero/sprkplus/README.md similarity index 100% rename from v2/platforms/sphero/sprkplus/README.md rename to platforms/sphero/sprkplus/README.md diff --git a/v2/platforms/sphero/sprkplus/doc.go b/platforms/sphero/sprkplus/doc.go similarity index 100% rename from v2/platforms/sphero/sprkplus/doc.go rename to platforms/sphero/sprkplus/doc.go diff --git a/v2/platforms/sphero/sprkplus/helpers_test.go b/platforms/sphero/sprkplus/helpers_test.go similarity index 100% rename from v2/platforms/sphero/sprkplus/helpers_test.go rename to platforms/sphero/sprkplus/helpers_test.go diff --git a/v2/platforms/sphero/sprkplus/sprkplus_driver.go b/platforms/sphero/sprkplus/sprkplus_driver.go similarity index 100% rename from v2/platforms/sphero/sprkplus/sprkplus_driver.go rename to platforms/sphero/sprkplus/sprkplus_driver.go diff --git a/v2/platforms/sphero/sprkplus/sprkplus_driver_test.go b/platforms/sphero/sprkplus/sprkplus_driver_test.go similarity index 100% rename from v2/platforms/sphero/sprkplus/sprkplus_driver_test.go rename to platforms/sphero/sprkplus/sprkplus_driver_test.go diff --git a/v2/platforms/sphero/sprkplus/sprkplus_packets.go b/platforms/sphero/sprkplus/sprkplus_packets.go similarity index 100% rename from v2/platforms/sphero/sprkplus/sprkplus_packets.go rename to platforms/sphero/sprkplus/sprkplus_packets.go diff --git a/v2/platforms/tinkerboard/LICENSE b/platforms/tinkerboard/LICENSE similarity index 100% rename from v2/platforms/tinkerboard/LICENSE rename to platforms/tinkerboard/LICENSE diff --git a/v2/platforms/tinkerboard/README.md b/platforms/tinkerboard/README.md similarity index 100% rename from v2/platforms/tinkerboard/README.md rename to platforms/tinkerboard/README.md diff --git a/v2/platforms/tinkerboard/adaptor.go b/platforms/tinkerboard/adaptor.go similarity index 100% rename from v2/platforms/tinkerboard/adaptor.go rename to platforms/tinkerboard/adaptor.go diff --git a/v2/platforms/tinkerboard/adaptor_test.go b/platforms/tinkerboard/adaptor_test.go similarity index 100% rename from v2/platforms/tinkerboard/adaptor_test.go rename to platforms/tinkerboard/adaptor_test.go diff --git a/v2/platforms/tinkerboard/doc.go b/platforms/tinkerboard/doc.go similarity index 100% rename from v2/platforms/tinkerboard/doc.go rename to platforms/tinkerboard/doc.go diff --git a/v2/platforms/tinkerboard/pin_map.go b/platforms/tinkerboard/pin_map.go similarity index 100% rename from v2/platforms/tinkerboard/pin_map.go rename to platforms/tinkerboard/pin_map.go diff --git a/v2/platforms/upboard/README.md b/platforms/upboard/README.md similarity index 100% rename from v2/platforms/upboard/README.md rename to platforms/upboard/README.md diff --git a/v2/platforms/upboard/up2/LICENSE b/platforms/upboard/up2/LICENSE similarity index 100% rename from v2/platforms/upboard/up2/LICENSE rename to platforms/upboard/up2/LICENSE diff --git a/v2/platforms/upboard/up2/README.md b/platforms/upboard/up2/README.md similarity index 100% rename from v2/platforms/upboard/up2/README.md rename to platforms/upboard/up2/README.md diff --git a/v2/platforms/upboard/up2/adaptor.go b/platforms/upboard/up2/adaptor.go similarity index 100% rename from v2/platforms/upboard/up2/adaptor.go rename to platforms/upboard/up2/adaptor.go diff --git a/v2/platforms/upboard/up2/adaptor_test.go b/platforms/upboard/up2/adaptor_test.go similarity index 100% rename from v2/platforms/upboard/up2/adaptor_test.go rename to platforms/upboard/up2/adaptor_test.go diff --git a/v2/platforms/upboard/up2/doc.go b/platforms/upboard/up2/doc.go similarity index 100% rename from v2/platforms/upboard/up2/doc.go rename to platforms/upboard/up2/doc.go diff --git a/v2/platforms/upboard/up2/pin_map.go b/platforms/upboard/up2/pin_map.go similarity index 100% rename from v2/platforms/upboard/up2/pin_map.go rename to platforms/upboard/up2/pin_map.go diff --git a/v2/platforms/upboard/upboard.go b/platforms/upboard/upboard.go similarity index 100% rename from v2/platforms/upboard/upboard.go rename to platforms/upboard/upboard.go diff --git a/v2/robot.go b/robot.go similarity index 100% rename from v2/robot.go rename to robot.go diff --git a/v2/robot_test.go b/robot_test.go similarity index 100% rename from v2/robot_test.go rename to robot_test.go diff --git a/v2/robot_work.go b/robot_work.go similarity index 100% rename from v2/robot_work.go rename to robot_work.go diff --git a/v2/robot_work_test.go b/robot_work_test.go similarity index 100% rename from v2/robot_work_test.go rename to robot_work_test.go diff --git a/v2/snapcraft.yaml b/snapcraft.yaml similarity index 100% rename from v2/snapcraft.yaml rename to snapcraft.yaml diff --git a/v2/system/GPIO.md b/system/GPIO.md similarity index 100% rename from v2/system/GPIO.md rename to system/GPIO.md diff --git a/v2/system/I2C.md b/system/I2C.md similarity index 100% rename from v2/system/I2C.md rename to system/I2C.md diff --git a/v2/system/PWM.md b/system/PWM.md similarity index 100% rename from v2/system/PWM.md rename to system/PWM.md diff --git a/v2/system/README.md b/system/README.md similarity index 100% rename from v2/system/README.md rename to system/README.md diff --git a/v2/system/digitalpin_access.go b/system/digitalpin_access.go similarity index 100% rename from v2/system/digitalpin_access.go rename to system/digitalpin_access.go diff --git a/v2/system/digitalpin_access_test.go b/system/digitalpin_access_test.go similarity index 100% rename from v2/system/digitalpin_access_test.go rename to system/digitalpin_access_test.go diff --git a/v2/system/digitalpin_bench_test.go b/system/digitalpin_bench_test.go similarity index 100% rename from v2/system/digitalpin_bench_test.go rename to system/digitalpin_bench_test.go diff --git a/v2/system/digitalpin_config.go b/system/digitalpin_config.go similarity index 100% rename from v2/system/digitalpin_config.go rename to system/digitalpin_config.go diff --git a/v2/system/digitalpin_config_test.go b/system/digitalpin_config_test.go similarity index 100% rename from v2/system/digitalpin_config_test.go rename to system/digitalpin_config_test.go diff --git a/v2/system/digitalpin_gpiod.go b/system/digitalpin_gpiod.go similarity index 100% rename from v2/system/digitalpin_gpiod.go rename to system/digitalpin_gpiod.go diff --git a/v2/system/digitalpin_gpiod_test.go b/system/digitalpin_gpiod_test.go similarity index 100% rename from v2/system/digitalpin_gpiod_test.go rename to system/digitalpin_gpiod_test.go diff --git a/v2/system/digitalpin_mock.go b/system/digitalpin_mock.go similarity index 100% rename from v2/system/digitalpin_mock.go rename to system/digitalpin_mock.go diff --git a/v2/system/digitalpin_sysfs.go b/system/digitalpin_sysfs.go similarity index 100% rename from v2/system/digitalpin_sysfs.go rename to system/digitalpin_sysfs.go diff --git a/v2/system/digitalpin_sysfs_test.go b/system/digitalpin_sysfs_test.go similarity index 100% rename from v2/system/digitalpin_sysfs_test.go rename to system/digitalpin_sysfs_test.go diff --git a/v2/system/doc.go b/system/doc.go similarity index 100% rename from v2/system/doc.go rename to system/doc.go diff --git a/v2/system/fs.go b/system/fs.go similarity index 100% rename from v2/system/fs.go rename to system/fs.go diff --git a/v2/system/fs_mock.go b/system/fs_mock.go similarity index 100% rename from v2/system/fs_mock.go rename to system/fs_mock.go diff --git a/v2/system/fs_mock_test.go b/system/fs_mock_test.go similarity index 100% rename from v2/system/fs_mock_test.go rename to system/fs_mock_test.go diff --git a/v2/system/fs_test.go b/system/fs_test.go similarity index 100% rename from v2/system/fs_test.go rename to system/fs_test.go diff --git a/v2/system/i2c_device.go b/system/i2c_device.go similarity index 100% rename from v2/system/i2c_device.go rename to system/i2c_device.go diff --git a/v2/system/i2c_device_test.go b/system/i2c_device_test.go similarity index 100% rename from v2/system/i2c_device_test.go rename to system/i2c_device_test.go diff --git a/v2/system/pwmpin_sysfs.go b/system/pwmpin_sysfs.go similarity index 100% rename from v2/system/pwmpin_sysfs.go rename to system/pwmpin_sysfs.go diff --git a/v2/system/pwmpin_sysfs_test.go b/system/pwmpin_sysfs_test.go similarity index 100% rename from v2/system/pwmpin_sysfs_test.go rename to system/pwmpin_sysfs_test.go diff --git a/v2/system/spi_access.go b/system/spi_access.go similarity index 100% rename from v2/system/spi_access.go rename to system/spi_access.go diff --git a/v2/system/spi_access_test.go b/system/spi_access_test.go similarity index 100% rename from v2/system/spi_access_test.go rename to system/spi_access_test.go diff --git a/v2/system/spi_gpio.go b/system/spi_gpio.go similarity index 100% rename from v2/system/spi_gpio.go rename to system/spi_gpio.go diff --git a/v2/system/spi_mock.go b/system/spi_mock.go similarity index 100% rename from v2/system/spi_mock.go rename to system/spi_mock.go diff --git a/v2/system/spi_periphio.go b/system/spi_periphio.go similarity index 100% rename from v2/system/spi_periphio.go rename to system/spi_periphio.go diff --git a/v2/system/syscall.go b/system/syscall.go similarity index 100% rename from v2/system/syscall.go rename to system/syscall.go diff --git a/v2/system/syscall_mock.go b/system/syscall_mock.go similarity index 100% rename from v2/system/syscall_mock.go rename to system/syscall_mock.go diff --git a/v2/system/system.go b/system/system.go similarity index 100% rename from v2/system/system.go rename to system/system.go diff --git a/v2/system/system_options.go b/system/system_options.go similarity index 100% rename from v2/system/system_options.go rename to system/system_options.go diff --git a/v2/system/system_test.go b/system/system_test.go similarity index 100% rename from v2/system/system_test.go rename to system/system_test.go diff --git a/v2/utils.go b/utils.go similarity index 100% rename from v2/utils.go rename to utils.go diff --git a/v2/utils_test.go b/utils_test.go similarity index 100% rename from v2/utils_test.go rename to utils_test.go diff --git a/v2/Makefile b/v2/Makefile deleted file mode 100644 index 5ba96901e..000000000 --- a/v2/Makefile +++ /dev/null @@ -1,76 +0,0 @@ -# include also examples in other than ./examples folder -ALL_EXAMPLES := $(shell grep -l -r --include "*.go" 'build example' ./) -# prevent examples with gocv (opencv) dependencies -EXAMPLES_NO_GOCV := $(shell grep -L 'gocv' $(ALL_EXAMPLES)) -# prevent examples with joystick (sdl2) dependencies -EXAMPLES_NO_JOYSTICK := $(shell grep -L 'joystick' $(ALL_EXAMPLES)) -# prevent examples with joystick (sdl2) and gocv (opencv) dependencies -EXAMPLES_NO_GOCV_JOYSTICK := $(shell grep -L 'joystick' $$(grep -L 'gocv' $(EXAMPLES_NO_GOCV))) -# used examples -EXAMPLES := $(EXAMPLES_NO_GOCV_JOYSTICK) - -.PHONY: test test_race test_cover robeaux version_check fmt_check fmt_fix examples examples_check $(EXAMPLES) - -# opencv platform currently skipped to prevent install of preconditions -including_except := $(shell go list ./... | grep -v platforms/opencv) - -# Run tests on nearly all directories without test cache -test: - go test -count=1 -v $(including_except) - -# Run tests with race detection -test_race: - go test -race $(including_except) - -# Test, generate and show coverage in browser -test_cover: - go test -v $(including_except) -coverprofile=coverage.txt ; \ - go tool cover -html=coverage.txt ; \ - -robeaux: -ifeq (,$(shell which go-bindata)) - $(error robeaux not built! https://github.com/jteeuwen/go-bindata is required to build robeaux assets ) -endif - cd api ; \ - npm install robeaux ; \ - cp -r node_modules/robeaux robeaux-tmp ; \ - cd robeaux-tmp ; \ - rm Makefile package.json README.markdown ; \ - touch css/fonts.css ; \ - echo "Updating robeaux..." ; \ - go-bindata -pkg="robeaux" -o robeaux.go -ignore=\\.git ./... ; \ - mv robeaux.go ../robeaux ; \ - cd .. ; \ - rm -rf robeaux-tmp/ ; \ - rm -rf node_modules/ ; \ - go fmt ./robeaux/robeaux.go ; \ - -# Check for installed and module version match. Will exit with code 50 if not match. -# There is nothing bad in general, if you program with a higher version. -# At least the recipe "fmt_fix" will not work in that case. -version_check: - @gv=$$(echo $$(go version) | sed "s/^.* go\([0-9].[0-9]*\).*/\1/") ; \ - mv=$$(grep -m 1 'go 1.' ./go.mod | sed "s/^go \([0-9].[0-9]*\).*/\1/") ; \ - echo "go: $${gv}.*, go.mod: $${mv}" ; \ - if [ "$${gv}" != "$${mv}" ]; then exit 50; fi ; \ - -# Check for bad code style and other issues -fmt_check: - gofmt -l ./ - golangci-lint run -v - -# Fix bad code style (will only be executed, on version match) -fmt_fix: version_check - go fmt ./... - -examples: $(EXAMPLES) - -examples_check: - $(MAKE) CHECK=ON examples - -$(EXAMPLES): -ifeq ($(CHECK),ON) - go vet ./$@ -else - go build -o /tmp/gobot_examples/$@ ./$@ -endif diff --git a/v2/version.go b/version.go similarity index 100% rename from v2/version.go rename to version.go From ca2e38a0f8bc36086244c2b7f97af0a34b59177e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 29 May 2023 17:24:10 +0000 Subject: [PATCH 03/20] build(deps): bump github.com/warthog618/gpiod from 0.8.0 to 0.8.1 Bumps [github.com/warthog618/gpiod](https://github.com/warthog618/gpiod) from 0.8.0 to 0.8.1. - [Commits](https://github.com/warthog618/gpiod/compare/v0.8.0...v0.8.1) --- updated-dependencies: - dependency-name: github.com/warthog618/gpiod dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- go.mod | 4 +- go.sum | 176 ++++++--------------------------------------------------- 2 files changed, 19 insertions(+), 161 deletions(-) diff --git a/go.mod b/go.mod index 4204a4c9a..d18b03e3b 100644 --- a/go.mod +++ b/go.mod @@ -13,10 +13,10 @@ require ( github.com/nats-io/nats.go v1.18.0 github.com/pkg/errors v0.9.1 github.com/sigurn/crc8 v0.0.0-20220107193325-2243fe600f9f - github.com/stretchr/testify v1.8.0 + github.com/stretchr/testify v1.8.1 github.com/urfave/cli v1.22.10 github.com/veandco/go-sdl2 v0.4.25 - github.com/warthog618/gpiod v0.8.0 + github.com/warthog618/gpiod v0.8.1 go.bug.st/serial v1.4.0 gocv.io/x/gocv v0.31.0 golang.org/x/net v0.10.0 diff --git a/go.sum b/go.sum index 31a8f94e8..a3b620c6f 100644 --- a/go.sum +++ b/go.sum @@ -1,25 +1,8 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= -github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= -github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= -github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= +github.com/BurntSushi/toml v1.2.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/bgould/http v0.0.0-20190627042742-d268792bdee7/go.mod h1:BTqvVegvwifopl4KTEDth6Zezs9eR+lCWhvGKvkxJHE= github.com/bmizerany/pat v0.0.0-20210406213842-e4b6760bdd6f h1:gOO/tNZMjjvTKZWpY7YnXC72ULNLErRtp94LountVE8= github.com/bmizerany/pat v0.0.0-20210406213842-e4b6760bdd6f/go.mod h1:8rLXio+WjiTceGBHIoTvn60HIbs7Hm7bcHjyrSqYB9c= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/coreos/bbolt v1.3.3/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= -github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= -github.com/coreos/etcd v3.3.15+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= -github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= -github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= -github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= -github.com/cpuguy83/go-md2man v1.0.10 h1:BSKMNlYxDvnunlTymqtgONjNnaRV1sTpcovwwjF22jk= -github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= @@ -28,7 +11,6 @@ github.com/creack/goselect v0.1.2/go.mod h1:a/NhLweNvqIYMuxcMOuWY516Cimucms3DglD github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/donovanhide/eventsource v0.0.0-20210830082556-c59027999da0 h1:C7t6eeMaEQVy6e8CarIhscYQlNmw5e3G36y7l7Y21Ao= github.com/donovanhide/eventsource v0.0.0-20210830082556-c59027999da0/go.mod h1:56wL82FO0bfMU5RvfXoIwSOP2ggqqxT+tAfNEIyxuHw= github.com/eclipse/paho.mqtt.golang v1.2.0/go.mod h1:H9keYFcgq3Qr5OUJm/JZI/i6U7joQ8SYLhZwfeOo6Ts= @@ -37,31 +19,17 @@ github.com/eclipse/paho.mqtt.golang v1.4.1/go.mod h1:JGt0RsEwEX+Xa/agj90YJ9d9DH2 github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo= github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= github.com/frankban/quicktest v1.10.2/go.mod h1:K+q6oSqb0W0Ininfk863uOk1lMy69l/P6txr3mVT54s= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= github.com/glerchundi/subcommands v0.0.0-20181212083838-923a6ccb11f8/go.mod h1:r0g3O7Y5lrWXgDfcFBRgnAKzjmPgTzwoMC2ieB345FY= -github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/log v0.2.1/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= -github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= -github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= -github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/godbus/dbus/v5 v5.0.3/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk= github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/gofrs/uuid v4.4.0+incompatible h1:3qXRTX8/NbyulANqlc0lchS1gqAVxRgsuW1YrTJupqA= github.com/gofrs/uuid v4.4.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= -github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/gogo/protobuf v1.3.0/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= @@ -70,23 +38,15 @@ github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvq github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0 h1:LUVKkCeviFUMKqHa4tXIIij/lbhnMbP7Fn5wKdKkRh4= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= -github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/grpc-ecosystem/go-grpc-middleware v1.1.0/go.mod h1:f5nM7jw/oeRSadq3xCzHAvxcr8HZnzsqU6ILg/0NiiE= -github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= -github.com/grpc-ecosystem/grpc-gateway v1.11.2/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/hajimehoshi/go-jisx0208 v1.0.0/go.mod h1:yYxEStHL7lt9uL+AbdWgW9gBumwieDoZCiB1f/0X0as= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= @@ -98,41 +58,23 @@ github.com/hybridgroup/go-ardrone v0.0.0-20140402002621-b9750d8d7b78 h1:7of6LJZ4 github.com/hybridgroup/go-ardrone v0.0.0-20140402002621-b9750d8d7b78/go.mod h1:YllNbhGM1UEcySxCv1BWK5lre7QLmJJ+O0ADUOo2nbc= github.com/hybridgroup/mjpeg v0.0.0-20140228234708-4680f319790e h1:xCcwD5FOXul+j1dn8xD16nbrhJkkum/Cn+jTd/u1LhY= github.com/hybridgroup/mjpeg v0.0.0-20140228234708-4680f319790e/go.mod h1:eagM805MRKrioHYuU7iKLUyFPVKqVV6um5DAvCkUtXs= -github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= -github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= +github.com/inconshreveable/mousetrap v1.0.1/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= +github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/jonboulle/clockwork v0.2.2/go.mod h1:Pkfl5aHPm1nk2H9h0bjmnJD/BcgbGXUBGnn1kMkgxc8= github.com/jonboulle/clockwork v0.3.0/go.mod h1:Pkfl5aHPm1nk2H9h0bjmnJD/BcgbGXUBGnn1kMkgxc8= -github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= -github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= -github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= -github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/klauspost/compress v1.14.4 h1:eijASRJcobkVtSt81Olfh7JX43osYLwy5krOJo6YEu4= github.com/klauspost/compress v1.14.4/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= github.com/minio/highwayhash v1.0.2 h1:Aak5U0nElisjDCfPSG79Tgzkn2gl66NxOMspRrKnA/g= github.com/minio/highwayhash v1.0.2/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLTk+kldvVxY= -github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/muka/go-bluetooth v0.0.0-20220830075246-0746e3a1ea53 h1:zfLHhuGzmSbthZ00FfbEjgAHUOOj7NGiITojMTCFy6U= github.com/muka/go-bluetooth v0.0.0-20220830075246-0746e3a1ea53/go.mod h1:dMCjicU6vRBk34dqOmIZm0aod6gUwZXOXzBROqGous0= -github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/nats-io/jwt/v2 v2.2.1-0.20220113022732-58e87895b296 h1:vU9tpM3apjYlLLeY23zRWJ9Zktr5jp+mloR942LEOpY= github.com/nats-io/jwt/v2 v2.2.1-0.20220113022732-58e87895b296/go.mod h1:0tqz9Hlu6bCBFLWAASKhE5vUA4c24L9KPUUgvwumE/k= github.com/nats-io/nats-server/v2 v2.7.4 h1:c+BZJ3rGzUKCBIM4IXO8uNT2u1vajGbD1kPA6wqCEaM= @@ -146,33 +88,16 @@ github.com/nats-io/nuid v1.0.1 h1:5iA8DT8V7q8WK2EScv2padNa/rTESc1KdnPw4TC2paw= github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= -github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/paypal/gatt v0.0.0-20151011220935-4ae819d591cf/go.mod h1:+AwQL2mK3Pd3S+TUwg0tYQjid0q1txyNUJuuSmz8Kdk= -github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pelletier/go-toml v1.6.0/go.mod h1:5N711Q9dKgbdkxHL+MEfF31hpT7l0S0s/t2kKREewys= github.com/peterbourgon/ff/v3 v3.1.2/go.mod h1:XNJLY8EIl6MjMVjBS4F0+G0LYoAqs0DTa4rmHHukKDE= -github.com/pilebones/go-udev v0.0.0-20180820235104-043677e09b13 h1:Y+ynP+0QIjUejN2tsuIlWOJG1CThJy6amRuWlBL94Vg= -github.com/pilebones/go-udev v0.0.0-20180820235104-043677e09b13/go.mod h1:MXAPLpvZeTqLpU1eO6kFXzU0uBMooSGc1MPXAcBoy1M= -github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pilebones/go-udev v0.9.0 h1:N1uEO/SxUwtIctc0WLU0t69JeBxIYEYnj8lT/Nabl9Q= +github.com/pilebones/go-udev v0.9.0/go.mod h1:T2eI2tUSK0hA2WS5QLjXJUfQkluZQu+18Cqvem3CaXI= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= -github.com/prometheus/client_golang v1.1.0/go.mod h1:I1FGZT9+L76gKKOs5djB6ezCbFQP1xR9D75/vuwEF3g= -github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.6.0/go.mod h1:eBmuwkDJBwy6iBfxCBob6t6dR6ENT/y+J+Zk0j9GMYc= -github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= -github.com/prometheus/procfs v0.0.3/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ= -github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= -github.com/russross/blackfriday v1.5.2 h1:HyvC0ARfnZBqnXwABFeSZHpKvJHJJfPz81GNueLj0oo= -github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= @@ -183,64 +108,42 @@ github.com/saltosystems/winrt-go v0.0.0-20220913104103-712830fcd2ad/go.mod h1:Uv github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sigurn/crc8 v0.0.0-20220107193325-2243fe600f9f h1:1R9KdKjCNSd7F8iGTxIpoID9prlYH8nuNYKt0XvweHA= github.com/sigurn/crc8 v0.0.0-20220107193325-2243fe600f9f/go.mod h1:vQhwQ4meQEDfahT5kd61wLAF5AAeh5ZPLVI4JJ/tYo8= -github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= -github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sirupsen/logrus v1.5.0/go.mod h1:+F7Ogzej0PZc/94MaYx/nvG9jOFMD2osvC3s+Squfpo= github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0= github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= -github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= -github.com/smartystreets/goconvey v0.0.0-20190731233626-505e41936337/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= -github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= -github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= -github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= -github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= -github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/cobra v1.6.1/go.mod h1:IOw/AERYS7UzyrGinqmz6HLUo219MORXGxhbaJUqzrY= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.5/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/suapapa/go_eddystone v1.3.1/go.mod h1:bXC11TfJOS+3g3q/Uzd7FKd5g62STQEfeEIhcKe4Qy8= github.com/tdakkota/win32metadata v0.1.0/go.mod h1:77e6YvX0LIVW+O81fhWLnXAxxcyu/wdZdG7iwed7Fyk= github.com/tinygo-org/cbgo v0.0.4 h1:3D76CRYbH03Rudi8sEgs/YO0x3JIMdyq8jlQtk/44fU= github.com/tinygo-org/cbgo v0.0.4/go.mod h1:7+HgWIHd4nbAz0ESjGlJ1/v9LDU1Ox8MGzP9mah/fLk= -github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= -github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= github.com/urfave/cli v1.22.10 h1:p8Fspmz3iTctJstry1PYS3HVdllxnEzTEsgIgtxTrCk= github.com/urfave/cli v1.22.10/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= github.com/valyala/fastjson v1.6.3/go.mod h1:CLCAqky6SMuOcxStkYQvblddUtoRxhYMGLrsQns1aXY= github.com/veandco/go-sdl2 v0.4.25 h1:J5ac3KKOccp/0xGJA1PaNYKPUcZm19IxhDGs8lJofPI= github.com/veandco/go-sdl2 v0.4.25/go.mod h1:OROqMhHD43nT4/i9crJukyVecjPNYYuCofep6SNiAjY= -github.com/warthog618/config v0.4.1/go.mod h1:IzcIkVay6dCubN3WBAJzPuqHyE1fTPxICvKTQ/2JA9g= -github.com/warthog618/gpiod v0.8.0 h1:qxH9XVvWHpTxzWFSndBcujFyNH5zVRzHM63tcmm85o4= -github.com/warthog618/gpiod v0.8.0/go.mod h1:a7Csa+IJtDBZ39++zC/6Srjo01qWejt/5velrDWuNkY= -github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= -github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= +github.com/warthog618/config v0.5.1/go.mod h1:6Fux1X42nlCKzdwP3iloUvHtBCZYa+lalHHO9V0arHE= +github.com/warthog618/gpiod v0.8.1 h1:+8iHpHd3fljAd6l4AT8jPbMDQNKdvBIpW/hmLgAcHiM= +github.com/warthog618/gpiod v0.8.1/go.mod h1:A7v1hGR2eTsnkN+e9RoAPYgJG9bLJWtwyIIK+pgqC7s= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= go.bug.st/serial v1.4.0 h1:IXHzPVbUBbql66lQZ1iV9LWzGXT5lh6S9gZxHK/KyQE= go.bug.st/serial v1.4.0/go.mod h1:z8CesKorE90Qr/oRSJiEuvzYRKol9r/anJZEb5kt304= -go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= -go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= -go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= -go.uber.org/multierr v1.2.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= -go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= gocv.io/x/gocv v0.31.0 h1:BHDtK8v+YPvoSPQTTiZB2fM/7BLg6511JqkruY2z6LQ= gocv.io/x/gocv v0.31.0/go.mod h1:oc6FvfYqfBp99p+yOEzs9tbYF9gOrAQSeL/dyIPefJU= -golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= @@ -249,22 +152,11 @@ golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.0.0-20220112180741-5e0467b6c7ce/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.1.0 h1:MDRAIl0xIo9Io2xV565hzXHw3zVseKrJKodhohM5CjU= golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/image v0.0.0-20210628002857-a66eb6448b8d/go.mod h1:023OzeP/+EPmXeapQh35lcL3II3LrY8Ic+EFFKVhULM= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200425230154-ff2c4b7c35a0/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= @@ -277,29 +169,17 @@ golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190130150945-aca44879d564/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190801041406-cbf593c0f2f3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190927073244-c990c680b611/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200728102440-3e129f6d46b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -313,7 +193,9 @@ golang.org/x/sys v0.0.0-20220624220833-87e55d714810/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220829200755-d48e67d00261/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -329,17 +211,9 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/time v0.0.0-20190921001708-c4c64cad1fd0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20211116232009-f0f3c7e86c11 h1:GZokNIeuVkl3aZHJchRrr13WCsols02MLUcz1U9is6M= golang.org/x/time v0.0.0-20211116232009-f0f3c7e86c11/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200925191224-5d1fdd8fa346/go.mod h1:z6u4i615ZeAfBE4XtMziQW1fSVJXACjjbWkB/mvPzlU= golang.org/x/tools v0.1.11/go.mod h1:SgwaegtQh8clINPpECJMqnxLv9I09HLqnW3RMqW0CA4= @@ -349,13 +223,6 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20190927181202-20e1ac93f88c/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.24.0/go.mod h1:XDChyiUovWa60DnaeDeZmSW86xtLtjtZbwvSiRnRtcA= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -365,30 +232,21 @@ google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2 google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/ini.v1 v1.48.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= -gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= periph.io/x/conn/v3 v3.6.10/go.mod h1:UqWNaPMosWmNCwtufoTSTTYhB2wXWsMRAJyo1PlxO4Q= periph.io/x/conn/v3 v3.7.0 h1:f1EXLn4pkf7AEWwkol2gilCNZ0ElY+bxS4WE2PQXfrA= periph.io/x/conn/v3 v3.7.0/go.mod h1:ypY7UVxgDbP9PJGwFSVelRRagxyXYfttVh7hJZUHEhg= periph.io/x/d2xx v0.0.4/go.mod h1:38Euaaj+s6l0faIRHh32a+PrjXvxFTFkPBEQI0TKg34= periph.io/x/host/v3 v3.7.2 h1:rCAUxkzy2xrzh18HP2AoVwTL/fEKqmcJ1icsZQGM58Q= periph.io/x/host/v3 v3.7.2/go.mod h1:nHMlzkPwmnHyP9Tn0I8FV+e0N3K7TjFXLZkIWzAicog= -sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= tinygo.org/x/bluetooth v0.6.0 h1:5RTUh28WBtWfRtwFcsDcdiCvlSWr9F7fHxRikQZW/Io= tinygo.org/x/bluetooth v0.6.0/go.mod h1:tiW1IiKOupcsvM2CX0PwLsf6aZRL+ciSIqP2YlgYOtQ= tinygo.org/x/drivers v0.14.0/go.mod h1:uT2svMq3EpBZpKkGO+NQHjxjGf1f42ra4OnMMwQL2aI= From b493cf5cf007640dd7af223e6cd1b478398be2a5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 29 May 2023 17:24:06 +0000 Subject: [PATCH 04/20] build(deps): bump github.com/eclipse/paho.mqtt.golang Bumps [github.com/eclipse/paho.mqtt.golang](https://github.com/eclipse/paho.mqtt.golang) from 1.4.1 to 1.4.2. - [Release notes](https://github.com/eclipse/paho.mqtt.golang/releases) - [Commits](https://github.com/eclipse/paho.mqtt.golang/compare/v1.4.1...v1.4.2) --- updated-dependencies: - dependency-name: github.com/eclipse/paho.mqtt.golang dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index d18b03e3b..5bed3078b 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.17 require ( github.com/bmizerany/pat v0.0.0-20210406213842-e4b6760bdd6f github.com/donovanhide/eventsource v0.0.0-20210830082556-c59027999da0 - github.com/eclipse/paho.mqtt.golang v1.4.1 + github.com/eclipse/paho.mqtt.golang v1.4.2 github.com/gofrs/uuid v4.4.0+incompatible github.com/hashicorp/go-multierror v1.1.1 github.com/hybridgroup/go-ardrone v0.0.0-20140402002621-b9750d8d7b78 diff --git a/go.sum b/go.sum index a3b620c6f..c20e41cb5 100644 --- a/go.sum +++ b/go.sum @@ -14,8 +14,8 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/donovanhide/eventsource v0.0.0-20210830082556-c59027999da0 h1:C7t6eeMaEQVy6e8CarIhscYQlNmw5e3G36y7l7Y21Ao= github.com/donovanhide/eventsource v0.0.0-20210830082556-c59027999da0/go.mod h1:56wL82FO0bfMU5RvfXoIwSOP2ggqqxT+tAfNEIyxuHw= github.com/eclipse/paho.mqtt.golang v1.2.0/go.mod h1:H9keYFcgq3Qr5OUJm/JZI/i6U7joQ8SYLhZwfeOo6Ts= -github.com/eclipse/paho.mqtt.golang v1.4.1 h1:tUSpviiL5G3P9SZZJPC4ZULZJsxQKXxfENpMvdbAXAI= -github.com/eclipse/paho.mqtt.golang v1.4.1/go.mod h1:JGt0RsEwEX+Xa/agj90YJ9d9DH2b7upDZMK9HRbFvCA= +github.com/eclipse/paho.mqtt.golang v1.4.2 h1:66wOzfUHSSI1zamx7jR6yMEI5EuHnT1G6rNA5PM12m4= +github.com/eclipse/paho.mqtt.golang v1.4.2/go.mod h1:JGt0RsEwEX+Xa/agj90YJ9d9DH2b7upDZMK9HRbFvCA= github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo= github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= github.com/frankban/quicktest v1.10.2/go.mod h1:K+q6oSqb0W0Ininfk863uOk1lMy69l/P6txr3mVT54s= From 24043c9e937e7282ba4ad711a17fb2fbf7625f41 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 29 May 2023 17:49:39 +0000 Subject: [PATCH 05/20] build(deps): bump go.bug.st/serial from 1.4.0 to 1.5.0 Bumps [go.bug.st/serial](https://github.com/bugst/go-serial) from 1.4.0 to 1.5.0. - [Commits](https://github.com/bugst/go-serial/compare/v1.4.0...v1.5.0) --- updated-dependencies: - dependency-name: go.bug.st/serial dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index 5bed3078b..4816d099b 100644 --- a/go.mod +++ b/go.mod @@ -17,7 +17,7 @@ require ( github.com/urfave/cli v1.22.10 github.com/veandco/go-sdl2 v0.4.25 github.com/warthog618/gpiod v0.8.1 - go.bug.st/serial v1.4.0 + go.bug.st/serial v1.5.0 gocv.io/x/gocv v0.31.0 golang.org/x/net v0.10.0 periph.io/x/conn/v3 v3.7.0 diff --git a/go.sum b/go.sum index c20e41cb5..1cc2af103 100644 --- a/go.sum +++ b/go.sum @@ -140,8 +140,8 @@ github.com/warthog618/gpiod v0.8.1/go.mod h1:A7v1hGR2eTsnkN+e9RoAPYgJG9bLJWtwyII github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -go.bug.st/serial v1.4.0 h1:IXHzPVbUBbql66lQZ1iV9LWzGXT5lh6S9gZxHK/KyQE= -go.bug.st/serial v1.4.0/go.mod h1:z8CesKorE90Qr/oRSJiEuvzYRKol9r/anJZEb5kt304= +go.bug.st/serial v1.5.0 h1:ThuUkHpOEmCVXxGEfpoExjQCS2WBVV4ZcUKVYInM9T4= +go.bug.st/serial v1.5.0/go.mod h1:UABfsluHAiaNI+La2iESysd9Vetq7VRdpxvjx7CmmOE= gocv.io/x/gocv v0.31.0 h1:BHDtK8v+YPvoSPQTTiZB2fM/7BLg6511JqkruY2z6LQ= gocv.io/x/gocv v0.31.0/go.mod h1:oc6FvfYqfBp99p+yOEzs9tbYF9gOrAQSeL/dyIPefJU= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= @@ -185,7 +185,6 @@ golang.org/x/sys v0.0.0-20200728102440-3e129f6d46b1/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220111092808-5a964db01320/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= From 91d9cb6b49d80c838f4d7e3dcc56f7e96e801890 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 29 May 2023 17:49:31 +0000 Subject: [PATCH 06/20] build(deps): bump github.com/stretchr/testify from 1.8.0 to 1.8.3 Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.8.0 to 1.8.3. - [Release notes](https://github.com/stretchr/testify/releases) - [Commits](https://github.com/stretchr/testify/compare/v1.8.0...v1.8.3) --- updated-dependencies: - dependency-name: github.com/stretchr/testify dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index 4816d099b..532cedff6 100644 --- a/go.mod +++ b/go.mod @@ -13,7 +13,7 @@ require ( github.com/nats-io/nats.go v1.18.0 github.com/pkg/errors v0.9.1 github.com/sigurn/crc8 v0.0.0-20220107193325-2243fe600f9f - github.com/stretchr/testify v1.8.1 + github.com/stretchr/testify v1.8.3 github.com/urfave/cli v1.22.10 github.com/veandco/go-sdl2 v0.4.25 github.com/warthog618/gpiod v0.8.1 diff --git a/go.sum b/go.sum index 1cc2af103..26425f9c3 100644 --- a/go.sum +++ b/go.sum @@ -123,8 +123,9 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.5/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= +github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/suapapa/go_eddystone v1.3.1/go.mod h1:bXC11TfJOS+3g3q/Uzd7FKd5g62STQEfeEIhcKe4Qy8= github.com/tdakkota/win32metadata v0.1.0/go.mod h1:77e6YvX0LIVW+O81fhWLnXAxxcyu/wdZdG7iwed7Fyk= github.com/tinygo-org/cbgo v0.0.4 h1:3D76CRYbH03Rudi8sEgs/YO0x3JIMdyq8jlQtk/44fU= From 2b18516f240cfcfb079e47eddbc9ac99ca236c4d Mon Sep 17 00:00:00 2001 From: Thomas Kohler Date: Sun, 4 Jun 2023 14:13:41 +0200 Subject: [PATCH 07/20] Build(go, deps): switch to Go 1.18 and update modules (#940) --- .circleci/config.yml | 6 +- .github/workflows/golangci-lint.yml | 2 +- go.mod | 27 +++---- go.sum | 116 +++++++--------------------- platforms/nats/nats_adaptor_test.go | 16 ++-- 5 files changed, 57 insertions(+), 110 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 8091ab510..2727f9153 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -14,7 +14,7 @@ version: 2 jobs: "test_core_and_drivers_with_coverage": docker: - - image: cimg/go:1.17 + - image: cimg/go:1.18 steps: - checkout - run: @@ -31,7 +31,7 @@ jobs: "test_platforms": docker: - - image: cimg/go:1.17 + - image: cimg/go:1.18 steps: - checkout - run: @@ -45,7 +45,7 @@ jobs: "check_examples": docker: - - image: cimg/go:1.17 + - image: cimg/go:1.18 steps: - checkout - run: diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 281730892..c3d6a976b 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -17,7 +17,7 @@ jobs: steps: - uses: actions/setup-go@v4 with: - go-version: '1.17' + go-version: '1.18' cache: false - uses: actions/checkout@v3 - name: golangci-lint diff --git a/go.mod b/go.mod index 532cedff6..f888b4caa 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module gobot.io/x/gobot/v2 -go 1.17 +go 1.18 require ( github.com/bmizerany/pat v0.0.0-20210406213842-e4b6760bdd6f @@ -10,18 +10,18 @@ require ( github.com/hashicorp/go-multierror v1.1.1 github.com/hybridgroup/go-ardrone v0.0.0-20140402002621-b9750d8d7b78 github.com/hybridgroup/mjpeg v0.0.0-20140228234708-4680f319790e - github.com/nats-io/nats.go v1.18.0 + github.com/nats-io/nats.go v1.26.0 github.com/pkg/errors v0.9.1 github.com/sigurn/crc8 v0.0.0-20220107193325-2243fe600f9f - github.com/stretchr/testify v1.8.3 - github.com/urfave/cli v1.22.10 - github.com/veandco/go-sdl2 v0.4.25 + github.com/stretchr/testify v1.8.4 + github.com/urfave/cli v1.22.13 + github.com/veandco/go-sdl2 v0.4.35 github.com/warthog618/gpiod v0.8.1 go.bug.st/serial v1.5.0 - gocv.io/x/gocv v0.31.0 + gocv.io/x/gocv v0.32.1 golang.org/x/net v0.10.0 periph.io/x/conn/v3 v3.7.0 - periph.io/x/host/v3 v3.7.2 + periph.io/x/host/v3 v3.8.2 tinygo.org/x/bluetooth v0.6.0 ) @@ -35,17 +35,18 @@ require ( github.com/golang/protobuf v1.5.0 // indirect github.com/gorilla/websocket v1.5.0 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect - github.com/muka/go-bluetooth v0.0.0-20220830075246-0746e3a1ea53 // indirect + github.com/klauspost/compress v1.16.5 // indirect + github.com/muka/go-bluetooth v0.0.0-20221213043340-85dc80edc4e1 // indirect github.com/nats-io/nats-server/v2 v2.7.4 // indirect - github.com/nats-io/nkeys v0.3.0 // indirect + github.com/nats-io/nkeys v0.4.4 // indirect github.com/nats-io/nuid v1.0.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect - github.com/saltosystems/winrt-go v0.0.0-20220913104103-712830fcd2ad // indirect - github.com/sirupsen/logrus v1.9.0 // indirect + github.com/saltosystems/winrt-go v0.0.0-20230510070731-e096b9afa761 // indirect + github.com/sirupsen/logrus v1.9.3 // indirect github.com/tinygo-org/cbgo v0.0.4 // indirect - golang.org/x/crypto v0.1.0 // indirect - golang.org/x/sync v0.1.0 // indirect + golang.org/x/crypto v0.9.0 // indirect + golang.org/x/sync v0.2.0 // indirect golang.org/x/sys v0.8.0 // indirect google.golang.org/protobuf v1.28.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/go.sum b/go.sum index 26425f9c3..61f7dc96e 100644 --- a/go.sum +++ b/go.sum @@ -3,7 +3,6 @@ github.com/BurntSushi/toml v1.2.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbi github.com/bgould/http v0.0.0-20190627042742-d268792bdee7/go.mod h1:BTqvVegvwifopl4KTEDth6Zezs9eR+lCWhvGKvkxJHE= github.com/bmizerany/pat v0.0.0-20210406213842-e4b6760bdd6f h1:gOO/tNZMjjvTKZWpY7YnXC72ULNLErRtp94LountVE8= github.com/bmizerany/pat v0.0.0-20210406213842-e4b6760bdd6f/go.mod h1:8rLXio+WjiTceGBHIoTvn60HIbs7Hm7bcHjyrSqYB9c= -github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/goselect v0.1.2 h1:2DNy14+JPjRBgPzAd1thbQp4BSIihxcBf0IXhQXDRa0= @@ -19,7 +18,6 @@ github.com/eclipse/paho.mqtt.golang v1.4.2/go.mod h1:JGt0RsEwEX+Xa/agj90YJ9d9DH2 github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo= github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= github.com/frankban/quicktest v1.10.2/go.mod h1:K+q6oSqb0W0Ininfk863uOk1lMy69l/P6txr3mVT54s= -github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= github.com/glerchundi/subcommands v0.0.0-20181212083838-923a6ccb11f8/go.mod h1:r0g3O7Y5lrWXgDfcFBRgnAKzjmPgTzwoMC2ieB345FY= github.com/go-kit/log v0.2.1/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= @@ -30,17 +28,8 @@ github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk= github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/gofrs/uuid v4.4.0+incompatible h1:3qXRTX8/NbyulANqlc0lchS1gqAVxRgsuW1YrTJupqA= github.com/gofrs/uuid v4.4.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= -github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= -github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= -github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= -github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0 h1:LUVKkCeviFUMKqHa4tXIIij/lbhnMbP7Fn5wKdKkRh4= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -53,37 +42,29 @@ github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= -github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hybridgroup/go-ardrone v0.0.0-20140402002621-b9750d8d7b78 h1:7of6LJZ4LF9AvF4bTiMr2I72KxodBf1BXrSD9Tz0lWU= github.com/hybridgroup/go-ardrone v0.0.0-20140402002621-b9750d8d7b78/go.mod h1:YllNbhGM1UEcySxCv1BWK5lre7QLmJJ+O0ADUOo2nbc= github.com/hybridgroup/mjpeg v0.0.0-20140228234708-4680f319790e h1:xCcwD5FOXul+j1dn8xD16nbrhJkkum/Cn+jTd/u1LhY= github.com/hybridgroup/mjpeg v0.0.0-20140228234708-4680f319790e/go.mod h1:eagM805MRKrioHYuU7iKLUyFPVKqVV6um5DAvCkUtXs= -github.com/inconshreveable/mousetrap v1.0.1/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= -github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= -github.com/jonboulle/clockwork v0.2.2/go.mod h1:Pkfl5aHPm1nk2H9h0bjmnJD/BcgbGXUBGnn1kMkgxc8= -github.com/jonboulle/clockwork v0.3.0/go.mod h1:Pkfl5aHPm1nk2H9h0bjmnJD/BcgbGXUBGnn1kMkgxc8= -github.com/klauspost/compress v1.14.4 h1:eijASRJcobkVtSt81Olfh7JX43osYLwy5krOJo6YEu4= -github.com/klauspost/compress v1.14.4/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= +github.com/klauspost/compress v1.16.5 h1:IFV2oUNUzZaz+XyusxpLzpzS8Pt5rh0Z16For/djlyI= +github.com/klauspost/compress v1.16.5/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= github.com/minio/highwayhash v1.0.2 h1:Aak5U0nElisjDCfPSG79Tgzkn2gl66NxOMspRrKnA/g= -github.com/minio/highwayhash v1.0.2/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLTk+kldvVxY= -github.com/muka/go-bluetooth v0.0.0-20220830075246-0746e3a1ea53 h1:zfLHhuGzmSbthZ00FfbEjgAHUOOj7NGiITojMTCFy6U= github.com/muka/go-bluetooth v0.0.0-20220830075246-0746e3a1ea53/go.mod h1:dMCjicU6vRBk34dqOmIZm0aod6gUwZXOXzBROqGous0= +github.com/muka/go-bluetooth v0.0.0-20221213043340-85dc80edc4e1 h1:BuVRHr4HHJbk1DHyWkArJ7E8J/VA8ncCr/VLnQFazBo= +github.com/muka/go-bluetooth v0.0.0-20221213043340-85dc80edc4e1/go.mod h1:dMCjicU6vRBk34dqOmIZm0aod6gUwZXOXzBROqGous0= github.com/nats-io/jwt/v2 v2.2.1-0.20220113022732-58e87895b296 h1:vU9tpM3apjYlLLeY23zRWJ9Zktr5jp+mloR942LEOpY= -github.com/nats-io/jwt/v2 v2.2.1-0.20220113022732-58e87895b296/go.mod h1:0tqz9Hlu6bCBFLWAASKhE5vUA4c24L9KPUUgvwumE/k= github.com/nats-io/nats-server/v2 v2.7.4 h1:c+BZJ3rGzUKCBIM4IXO8uNT2u1vajGbD1kPA6wqCEaM= github.com/nats-io/nats-server/v2 v2.7.4/go.mod h1:1vZ2Nijh8tcyNe8BDVyTviCd9NYzRbubQYiEHsvOQWc= -github.com/nats-io/nats.go v1.13.1-0.20220308171302-2f2f6968e98d/go.mod h1:BPko4oXsySz4aSWeFgOHLZs3G4Jq4ZAyE6/zMCxRT6w= -github.com/nats-io/nats.go v1.18.0 h1:o480Ao6kuSSFyJO75rGTXCEPj7LGkY84C1Ye+Uhm4c0= -github.com/nats-io/nats.go v1.18.0/go.mod h1:BPko4oXsySz4aSWeFgOHLZs3G4Jq4ZAyE6/zMCxRT6w= -github.com/nats-io/nkeys v0.3.0 h1:cgM5tL53EvYRU+2YLXIK0G2mJtK12Ft9oeooSZMA2G8= -github.com/nats-io/nkeys v0.3.0/go.mod h1:gvUNGjVcM2IPr5rCsRsC6Wb3Hr2CQAm08dsxtV6A5y4= +github.com/nats-io/nats.go v1.26.0 h1:fWJTYPnZ8DzxIaqIHOAMfColuznchnd5Ab5dbJpgPIE= +github.com/nats-io/nats.go v1.26.0/go.mod h1:XpbWUlOElGwTYbMR7imivs7jJj9GtK7ypv321Wp6pjc= +github.com/nats-io/nkeys v0.4.4 h1:xvBJ8d69TznjcQl9t6//Q5xXuVhyYiSos6RPtvQNTwA= +github.com/nats-io/nkeys v0.4.4/go.mod h1:XUkxdLPTufzlihbamfzQ7mw/VGx6ObUs+0bN5sNvt64= github.com/nats-io/nuid v1.0.1 h1:5iA8DT8V7q8WK2EScv2padNa/rTESc1KdnPw4TC2paw= github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= @@ -93,27 +74,23 @@ github.com/paypal/gatt v0.0.0-20151011220935-4ae819d591cf/go.mod h1:+AwQL2mK3Pd3 github.com/pelletier/go-toml v1.6.0/go.mod h1:5N711Q9dKgbdkxHL+MEfF31hpT7l0S0s/t2kKREewys= github.com/peterbourgon/ff/v3 v3.1.2/go.mod h1:XNJLY8EIl6MjMVjBS4F0+G0LYoAqs0DTa4rmHHukKDE= github.com/pilebones/go-udev v0.9.0 h1:N1uEO/SxUwtIctc0WLU0t69JeBxIYEYnj8lT/Nabl9Q= -github.com/pilebones/go-udev v0.9.0/go.mod h1:T2eI2tUSK0hA2WS5QLjXJUfQkluZQu+18Cqvem3CaXI= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/sago35/go-bdf v0.0.0-20200313142241-6c17821c91c4/go.mod h1:rOebXGuMLsXhZAC6mF/TjxONsm45498ZyzVhel++6KM= github.com/saltosystems/winrt-go v0.0.0-20220826130236-ddc8202da421/go.mod h1:UvKm1lyhg+8ehk99i8g5Q7AX1LXUJgks0lRyAkG/ahQ= -github.com/saltosystems/winrt-go v0.0.0-20220913104103-712830fcd2ad h1:sE3kYG0WAV8eML/eK3uoKgsD85qH8yvlKuPGWOgAecg= -github.com/saltosystems/winrt-go v0.0.0-20220913104103-712830fcd2ad/go.mod h1:UvKm1lyhg+8ehk99i8g5Q7AX1LXUJgks0lRyAkG/ahQ= -github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= +github.com/saltosystems/winrt-go v0.0.0-20230510070731-e096b9afa761 h1:xEscoMxTrGSpdho1mP9VnGsK0DGhXKwm0qP7kYcjgrI= +github.com/saltosystems/winrt-go v0.0.0-20230510070731-e096b9afa761/go.mod h1:UvKm1lyhg+8ehk99i8g5Q7AX1LXUJgks0lRyAkG/ahQ= github.com/sigurn/crc8 v0.0.0-20220107193325-2243fe600f9f h1:1R9KdKjCNSd7F8iGTxIpoID9prlYH8nuNYKt0XvweHA= github.com/sigurn/crc8 v0.0.0-20220107193325-2243fe600f9f/go.mod h1:vQhwQ4meQEDfahT5kd61wLAF5AAeh5ZPLVI4JJ/tYo8= github.com/sirupsen/logrus v1.5.0/go.mod h1:+F7Ogzej0PZc/94MaYx/nvG9jOFMD2osvC3s+Squfpo= github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= -github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0= github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= -github.com/spf13/cobra v1.6.1/go.mod h1:IOw/AERYS7UzyrGinqmz6HLUo219MORXGxhbaJUqzrY= -github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= +github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= @@ -123,40 +100,35 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.5/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= -github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/suapapa/go_eddystone v1.3.1/go.mod h1:bXC11TfJOS+3g3q/Uzd7FKd5g62STQEfeEIhcKe4Qy8= github.com/tdakkota/win32metadata v0.1.0/go.mod h1:77e6YvX0LIVW+O81fhWLnXAxxcyu/wdZdG7iwed7Fyk= github.com/tinygo-org/cbgo v0.0.4 h1:3D76CRYbH03Rudi8sEgs/YO0x3JIMdyq8jlQtk/44fU= github.com/tinygo-org/cbgo v0.0.4/go.mod h1:7+HgWIHd4nbAz0ESjGlJ1/v9LDU1Ox8MGzP9mah/fLk= -github.com/urfave/cli v1.22.10 h1:p8Fspmz3iTctJstry1PYS3HVdllxnEzTEsgIgtxTrCk= -github.com/urfave/cli v1.22.10/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= +github.com/urfave/cli v1.22.13 h1:wsLILXG8qCJNse/qAgLNf23737Cx05GflHg/PJGe1Ok= +github.com/urfave/cli v1.22.13/go.mod h1:VufqObjsMTF2BBwKawpx9R8eAneNEWhoO0yx8Vd+FkE= github.com/valyala/fastjson v1.6.3/go.mod h1:CLCAqky6SMuOcxStkYQvblddUtoRxhYMGLrsQns1aXY= -github.com/veandco/go-sdl2 v0.4.25 h1:J5ac3KKOccp/0xGJA1PaNYKPUcZm19IxhDGs8lJofPI= -github.com/veandco/go-sdl2 v0.4.25/go.mod h1:OROqMhHD43nT4/i9crJukyVecjPNYYuCofep6SNiAjY= -github.com/warthog618/config v0.5.1/go.mod h1:6Fux1X42nlCKzdwP3iloUvHtBCZYa+lalHHO9V0arHE= +github.com/veandco/go-sdl2 v0.4.35 h1:NohzsfageDWGtCd9nf7Pc3sokMK/MOK+UA2QMJARWzQ= +github.com/veandco/go-sdl2 v0.4.35/go.mod h1:OROqMhHD43nT4/i9crJukyVecjPNYYuCofep6SNiAjY= github.com/warthog618/gpiod v0.8.1 h1:+8iHpHd3fljAd6l4AT8jPbMDQNKdvBIpW/hmLgAcHiM= github.com/warthog618/gpiod v0.8.1/go.mod h1:A7v1hGR2eTsnkN+e9RoAPYgJG9bLJWtwyIIK+pgqC7s= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= -github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= go.bug.st/serial v1.5.0 h1:ThuUkHpOEmCVXxGEfpoExjQCS2WBVV4ZcUKVYInM9T4= go.bug.st/serial v1.5.0/go.mod h1:UABfsluHAiaNI+La2iESysd9Vetq7VRdpxvjx7CmmOE= -gocv.io/x/gocv v0.31.0 h1:BHDtK8v+YPvoSPQTTiZB2fM/7BLg6511JqkruY2z6LQ= -gocv.io/x/gocv v0.31.0/go.mod h1:oc6FvfYqfBp99p+yOEzs9tbYF9gOrAQSeL/dyIPefJU= +gocv.io/x/gocv v0.32.1 h1:BC9hHs5+47nVgySUFVKntc6RsF3SULFzqk6OV9xz+C0= +gocv.io/x/gocv v0.32.1/go.mod h1:oc6FvfYqfBp99p+yOEzs9tbYF9gOrAQSeL/dyIPefJU= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20210314154223-e6e6c4f2bb5b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20220112180741-5e0467b6c7ce/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.1.0 h1:MDRAIl0xIo9Io2xV565hzXHw3zVseKrJKodhohM5CjU= -golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= +golang.org/x/crypto v0.9.0 h1:LF6fAI+IutBocDJ2OT0Q1g8plpYljMZ4+lty+dsqw3g= +golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0= golang.org/x/image v0.0.0-20210628002857-a66eb6448b8d/go.mod h1:023OzeP/+EPmXeapQh35lcL3II3LrY8Ic+EFFKVhULM= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200425230154-ff2c4b7c35a0/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= @@ -164,19 +136,13 @@ golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81R golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= -golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= -golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20190130150945-aca44879d564/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sync v0.2.0 h1:PUR+T4wwASmuSTYdKjYHI5TD22Wy5ogLU5qZCOLxBrI= +golang.org/x/sync v0.2.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -187,66 +153,40 @@ golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220111092808-5a964db01320/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220624220833-87e55d714810/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220829200755-d48e67d00261/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= -golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/time v0.0.0-20211116232009-f0f3c7e86c11 h1:GZokNIeuVkl3aZHJchRrr13WCsols02MLUcz1U9is6M= -golang.org/x/time v0.0.0-20211116232009-f0f3c7e86c11/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200925191224-5d1fdd8fa346/go.mod h1:z6u4i615ZeAfBE4XtMziQW1fSVJXACjjbWkB/mvPzlU= golang.org/x/tools v0.1.11/go.mod h1:SgwaegtQh8clINPpECJMqnxLv9I09HLqnW3RMqW0CA4= -golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= -google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= -google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= -google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -periph.io/x/conn/v3 v3.6.10/go.mod h1:UqWNaPMosWmNCwtufoTSTTYhB2wXWsMRAJyo1PlxO4Q= periph.io/x/conn/v3 v3.7.0 h1:f1EXLn4pkf7AEWwkol2gilCNZ0ElY+bxS4WE2PQXfrA= periph.io/x/conn/v3 v3.7.0/go.mod h1:ypY7UVxgDbP9PJGwFSVelRRagxyXYfttVh7hJZUHEhg= -periph.io/x/d2xx v0.0.4/go.mod h1:38Euaaj+s6l0faIRHh32a+PrjXvxFTFkPBEQI0TKg34= -periph.io/x/host/v3 v3.7.2 h1:rCAUxkzy2xrzh18HP2AoVwTL/fEKqmcJ1icsZQGM58Q= -periph.io/x/host/v3 v3.7.2/go.mod h1:nHMlzkPwmnHyP9Tn0I8FV+e0N3K7TjFXLZkIWzAicog= +periph.io/x/host/v3 v3.8.2 h1:ayKUDzgUCN0g8+/xM9GTkWaOBhSLVcVHGTfjAOi8OsQ= +periph.io/x/host/v3 v3.8.2/go.mod h1:yFL76AesNHR68PboofSWYaQTKmvPXsQH2Apvp/ls/K4= tinygo.org/x/bluetooth v0.6.0 h1:5RTUh28WBtWfRtwFcsDcdiCvlSWr9F7fHxRikQZW/Io= tinygo.org/x/bluetooth v0.6.0/go.mod h1:tiW1IiKOupcsvM2CX0PwLsf6aZRL+ciSIqP2YlgYOtQ= tinygo.org/x/drivers v0.14.0/go.mod h1:uT2svMq3EpBZpKkGO+NQHjxjGf1f42ra4OnMMwQL2aI= diff --git a/platforms/nats/nats_adaptor_test.go b/platforms/nats/nats_adaptor_test.go index 502c552f9..f0ff1d49e 100644 --- a/platforms/nats/nats_adaptor_test.go +++ b/platforms/nats/nats_adaptor_test.go @@ -74,7 +74,9 @@ func TestNatsAdapterSetsRootCAs(t *testing.T) { gobottest.Assert(t, a.Host, "tls://localhost:4242") a.Connect() o := a.client.Opts - gobottest.Assert(t, len(o.TLSConfig.RootCAs.Subjects()), 1) + casPool, err := o.RootCAsCB() + gobottest.Assert(t, err, nil) + gobottest.Refute(t, casPool, nil) gobottest.Assert(t, o.Secure, true) } @@ -82,8 +84,10 @@ func TestNatsAdapterSetsClientCerts(t *testing.T) { a := initTestNatsAdaptorTLS(nats.ClientCert("test_certs/client-cert.pem", "test_certs/client-key.pem")) gobottest.Assert(t, a.Host, "tls://localhost:4242") a.Connect() - certs := a.client.Opts.TLSConfig.Certificates - gobottest.Assert(t, len(certs), 1) + cert, err := a.client.Opts.TLSCertCB() + gobottest.Assert(t, err, nil) + gobottest.Refute(t, cert, nil) + gobottest.Refute(t, cert.Leaf, nil) gobottest.Assert(t, a.client.Opts.Secure, true) } @@ -91,8 +95,10 @@ func TestNatsAdapterSetsClientCertsWithUserInfo(t *testing.T) { a := initTestNatsAdaptorTLS(nats.ClientCert("test_certs/client-cert.pem", "test_certs/client-key.pem"), nats.UserInfo("test", "testwd")) gobottest.Assert(t, a.Host, "tls://localhost:4242") a.Connect() - certs := a.client.Opts.TLSConfig.Certificates - gobottest.Assert(t, len(certs), 1) + cert, err := a.client.Opts.TLSCertCB() + gobottest.Assert(t, err, nil) + gobottest.Refute(t, cert, nil) + gobottest.Refute(t, cert.Leaf, nil) gobottest.Assert(t, a.client.Opts.Secure, true) gobottest.Assert(t, a.client.Opts.User, "test") gobottest.Assert(t, a.client.Opts.Password, "testwd") From d94ed686f354ad9d366b3ff9cc0fba3fddcbbfa1 Mon Sep 17 00:00:00 2001 From: Thomas Kohler Date: Sun, 4 Jun 2023 18:36:55 +0200 Subject: [PATCH 08/20] core(build): CLI removed (#946) * core(build): CLI removed * adjust install instructions in doc and README * fix master_test and remove useless/duplicated tests examples_test.go --- .gitignore | 4 +- CONTRIBUTING.md | 5 +- README.md | 401 ++++++++++++++------------ cli/README.md | 40 --- cli/doc.go | 11 - cli/generate.go | 417 --------------------------- cli/main.go | 21 -- drivers/aio/README.md | 6 +- drivers/aio/doc.go | 2 +- drivers/gpio/README.md | 6 +- drivers/gpio/doc.go | 2 +- drivers/i2c/README.md | 6 +- drivers/i2c/doc.go | 2 +- drivers/spi/README.md | 6 +- drivers/spi/doc.go | 2 +- examples_test.go | 53 ---- master_test.go | 4 - platforms/beaglebone/README.md | 143 ++++----- platforms/beaglebone/doc.go | 2 +- platforms/ble/README.md | 68 +++-- platforms/chip/README.md | 34 ++- platforms/dexter/gopigo3/README.md | 67 +++-- platforms/digispark/README.md | 81 +++--- platforms/digispark/doc.go | 2 +- platforms/dji/tello/README.md | 49 ++-- platforms/dragonboard/README.md | 27 +- platforms/firmata/README.md | 177 ++++++------ platforms/firmata/doc.go | 2 +- platforms/holystone/hs200/README.md | 58 ++-- platforms/intel-iot/curie/README.md | 137 ++++----- platforms/intel-iot/edison/README.md | 78 +++-- platforms/intel-iot/joule/README.md | 73 +++-- platforms/jetson/README.md | 52 ++-- platforms/joystick/README.md | 192 ++++++------ platforms/joystick/doc.go | 5 +- platforms/keyboard/README.md | 52 ++-- platforms/keyboard/doc.go | 2 +- platforms/leap/README.md | 64 ++-- platforms/leap/doc.go | 7 +- platforms/mavlink/README.md | 99 +++---- platforms/mavlink/doc.go | 2 +- platforms/megapi/README.md | 63 ++-- platforms/microbit/README.md | 140 ++++----- platforms/mqtt/README.md | 6 +- platforms/mqtt/doc.go | 2 +- platforms/nanopi/README.md | 9 +- platforms/nats/README.md | 6 +- platforms/nats/doc.go | 2 +- platforms/neurosky/README.md | 122 ++++---- platforms/neurosky/doc.go | 2 +- platforms/opencv/README.md | 63 ++-- platforms/opencv/doc.go | 2 +- platforms/parrot/ardrone/README.md | 56 ++-- platforms/parrot/ardrone/doc.go | 2 +- platforms/parrot/bebop/README.md | 59 ++-- platforms/parrot/bebop/doc.go | 2 +- platforms/parrot/minidrone/README.md | 141 ++++----- platforms/particle/README.md | 54 ++-- platforms/particle/doc.go | 2 +- platforms/pebble/README.md | 68 ++--- platforms/pebble/doc.go | 2 +- platforms/raspi/README.md | 74 ++--- platforms/sphero/README.md | 71 +++-- platforms/sphero/bb8/README.md | 73 ++--- platforms/sphero/doc.go | 2 +- platforms/sphero/ollie/README.md | 73 ++--- platforms/sphero/sprkplus/README.md | 73 ++--- platforms/tinkerboard/README.md | 9 +- platforms/upboard/up2/README.md | 48 +-- snapcraft.yaml | 28 -- version.go | 8 - 71 files changed, 1611 insertions(+), 2112 deletions(-) delete mode 100644 cli/README.md delete mode 100644 cli/doc.go delete mode 100644 cli/generate.go delete mode 100644 cli/main.go delete mode 100644 examples_test.go delete mode 100644 snapcraft.yaml delete mode 100644 version.go diff --git a/.gitignore b/.gitignore index 60d87424a..eab6070e6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,14 +1,14 @@ .sass-cache *.test *.swp +*.snap profile.cov count.out -*.swp -*.snap /parts /prime /stage vendor/ +output/ .idea/ coverage.txt .chglog/chglog_tmp*.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 407273fd1..ae735ac17 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -47,6 +47,7 @@ Descriptions for each of these will eventually be provided below. * If there are commits after yours use “git rebase -i ” * If you have local changes you may need to use “git stash” * For git help see [progit](http://git-scm.com/book) which is an awesome (and free) book on git +* Use one of the latest existing platforms/drivers etc. as a blueprint for creating a new one ## Creating Pull Requests @@ -58,9 +59,9 @@ The basics are as follows: 1. Fork the project via the GitHub UI -2. `go get` the upstream repo and set it up as the `upstream` remote and your own repo as the `origin` remote: +2. `git clone` the upstream repo and set it up as the `upstream` remote and your own repo as the `origin` remote: - `go get gobot.io/x/gobot/v2` + `git clone https://github.com/hybridgroup/gobot.git` `cd $GOPATH/src/gobot.io/x/gobot` `git remote rename origin upstream` `git remote add origin git@github.com/YOUR_GITHUB_NAME/gobot` diff --git a/README.md b/README.md index 029d3586e..9b56dd39c 100644 --- a/README.md +++ b/README.md @@ -7,87 +7,122 @@ [![Go Report Card](https://goreportcard.com/badge/hybridgroup/gobot)](https://goreportcard.com/report/hybridgroup/gobot) [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://github.com/hybridgroup/gobot/blob/master/LICENSE.txt) -Gobot (https://gobot.io/) is a framework using the Go programming language (https://golang.org/) for robotics, physical +Gobot () is a framework using the Go programming language () for robotics, physical computing, and the Internet of Things. It provides a simple, yet powerful way to create solutions that incorporate multiple, different hardware devices at the same time. -Want to run Go directly on microcontrollers? Check out our sister project TinyGo (https://tinygo.org/) +Want to run Go directly on microcontrollers? Check out our sister project TinyGo () ## Getting Started -Get the Gobot package by running this command: `go get -d -u gobot.io/x/gobot/v2` +### Get in touch + +Get the Gobot source code by running this commands: + +```sh +git clone https://github.com/hybridgroup/gobot.git +git checkout release +``` + +Afterwards have a look at the [examples directory](./examples). You need to find an example matching your platform for your +first test (e.g. "raspi_blink.go"). Than build the binary (cross compile), transfer it to your target and run it. + +`env GOOS=linux GOARCH=arm GOARM=5 go build -o ./output/my_raspi_bink examples/raspi_blink.go` + +> Building the code on your local machine with the example code above will create a binary for ARMv5. This is probably not +> what you need for your specific target platform. Please read also the platform specific documentation in the platform +> subfolders. + +### Create your first project + +Create a new folder and a new Go module project. + +```sh +mkdir ~/my_gobot_example +go mod init my.gobot.example.com +``` + +Copy your example file besides the go.mod file, import the requirements and build. + +```sh +go mod tidy +env GOOS=linux GOARCH=arm GOARM=5 go build -o ./output/my_raspi_bink raspi_blink.go +``` + +Now you are ready to modify the example and test your changes. Start by removing the build directives at the beginning +of the file. ## Examples -#### Gobot with Arduino +### Gobot with Arduino ```go package main import ( - "time" + "time" - "gobot.io/x/gobot/v2" - "gobot.io/x/gobot/v2/drivers/gpio" - "gobot.io/x/gobot/v2/platforms/firmata" + "gobot.io/x/gobot/v2" + "gobot.io/x/gobot/v2/drivers/gpio" + "gobot.io/x/gobot/v2/platforms/firmata" ) func main() { - firmataAdaptor := firmata.NewAdaptor("/dev/ttyACM0") - led := gpio.NewLedDriver(firmataAdaptor, "13") - - work := func() { - gobot.Every(1*time.Second, func() { - led.Toggle() - }) - } - - robot := gobot.NewRobot("bot", - []gobot.Connection{firmataAdaptor}, - []gobot.Device{led}, - work, - ) - - robot.Start() + firmataAdaptor := firmata.NewAdaptor("/dev/ttyACM0") + led := gpio.NewLedDriver(firmataAdaptor, "13") + + work := func() { + gobot.Every(1*time.Second, func() { + led.Toggle() + }) + } + + robot := gobot.NewRobot("bot", + []gobot.Connection{firmataAdaptor}, + []gobot.Device{led}, + work, + ) + + robot.Start() } ``` -#### Gobot with Sphero +### Gobot with Sphero ```go package main import ( - "fmt" - "time" + "fmt" + "time" - "gobot.io/x/gobot/v2" - "gobot.io/x/gobot/v2/platforms/sphero" + "gobot.io/x/gobot/v2" + "gobot.io/x/gobot/v2/platforms/sphero" ) func main() { - adaptor := sphero.NewAdaptor("/dev/rfcomm0") - driver := sphero.NewSpheroDriver(adaptor) - - work := func() { - gobot.Every(3*time.Second, func() { - driver.Roll(30, uint16(gobot.Rand(360))) - }) - } - - robot := gobot.NewRobot("sphero", - []gobot.Connection{adaptor}, - []gobot.Device{driver}, - work, - ) - - robot.Start() + adaptor := sphero.NewAdaptor("/dev/rfcomm0") + driver := sphero.NewSpheroDriver(adaptor) + + work := func() { + gobot.Every(3*time.Second, func() { + driver.Roll(30, uint16(gobot.Rand(360))) + }) + } + + robot := gobot.NewRobot("sphero", + []gobot.Connection{adaptor}, + []gobot.Device{driver}, + work, + ) + + robot.Start() } ``` -#### "Metal" Gobot +### "Metal" Gobot You can use the entire Gobot framework as shown in the examples above ("Classic" Gobot), or you can pick and choose from the various Gobot packages to control hardware with nothing but pure idiomatic Golang code ("Metal" Gobot). For example: @@ -96,26 +131,26 @@ the various Gobot packages to control hardware with nothing but pure idiomatic G package main import ( - "gobot.io/x/gobot/v2/drivers/gpio" - "gobot.io/x/gobot/v2/platforms/intel-iot/edison" - "time" + "gobot.io/x/gobot/v2/drivers/gpio" + "gobot.io/x/gobot/v2/platforms/intel-iot/edison" + "time" ) func main() { - e := edison.NewAdaptor() - e.Connect() + e := edison.NewAdaptor() + e.Connect() - led := gpio.NewLedDriver(e, "13") - led.Start() + led := gpio.NewLedDriver(e, "13") + led.Start() - for { - led.Toggle() - time.Sleep(1000 * time.Millisecond) - } + for { + led.Toggle() + time.Sleep(1000 * time.Millisecond) + } } ``` -#### "Master" Gobot +### "Master" Gobot You can also use the full capabilities of the framework aka "Master Gobot" to control swarms of robots or other features such as the built-in API server. For example: @@ -124,62 +159,62 @@ such as the built-in API server. For example: package main import ( - "fmt" - "time" + "fmt" + "time" - "gobot.io/x/gobot/v2" - "gobot.io/x/gobot/v2/api" - "gobot.io/x/gobot/v2/platforms/sphero" + "gobot.io/x/gobot/v2" + "gobot.io/x/gobot/v2/api" + "gobot.io/x/gobot/v2/platforms/sphero" ) func NewSwarmBot(port string) *gobot.Robot { - spheroAdaptor := sphero.NewAdaptor(port) - spheroDriver := sphero.NewSpheroDriver(spheroAdaptor) - spheroDriver.SetName("Sphero" + port) - - work := func() { - spheroDriver.Stop() - - spheroDriver.On(sphero.Collision, func(data interface{}) { - fmt.Println("Collision Detected!") - }) - - gobot.Every(1*time.Second, func() { - spheroDriver.Roll(100, uint16(gobot.Rand(360))) - }) - gobot.Every(3*time.Second, func() { - spheroDriver.SetRGB(uint8(gobot.Rand(255)), - uint8(gobot.Rand(255)), - uint8(gobot.Rand(255)), - ) - }) - } - - robot := gobot.NewRobot("sphero", - []gobot.Connection{spheroAdaptor}, - []gobot.Device{spheroDriver}, - work, - ) - - return robot + spheroAdaptor := sphero.NewAdaptor(port) + spheroDriver := sphero.NewSpheroDriver(spheroAdaptor) + spheroDriver.SetName("Sphero" + port) + + work := func() { + spheroDriver.Stop() + + spheroDriver.On(sphero.Collision, func(data interface{}) { + fmt.Println("Collision Detected!") + }) + + gobot.Every(1*time.Second, func() { + spheroDriver.Roll(100, uint16(gobot.Rand(360))) + }) + gobot.Every(3*time.Second, func() { + spheroDriver.SetRGB(uint8(gobot.Rand(255)), + uint8(gobot.Rand(255)), + uint8(gobot.Rand(255)), + ) + }) + } + + robot := gobot.NewRobot("sphero", + []gobot.Connection{spheroAdaptor}, + []gobot.Device{spheroDriver}, + work, + ) + + return robot } func main() { - master := gobot.NewMaster() - api.NewAPI(master).Start() + master := gobot.NewMaster() + api.NewAPI(master).Start() - spheros := []string{ - "/dev/rfcomm0", - "/dev/rfcomm1", - "/dev/rfcomm2", - "/dev/rfcomm3", - } + spheros := []string{ + "/dev/rfcomm0", + "/dev/rfcomm1", + "/dev/rfcomm2", + "/dev/rfcomm3", + } - for _, port := range spheros { - master.AddRobot(NewSwarmBot(port)) - } + for _, port := range spheros { + master.AddRobot(NewSwarmBot(port)) + } - master.Start() + master.Start() } ``` @@ -233,94 +268,94 @@ Support for many devices that use General Purpose Input/Output (GPIO) have a shared set of drivers provided using the `gobot/drivers/gpio` package: - [GPIO](https://en.wikipedia.org/wiki/General_Purpose_Input/Output) <=> [Drivers](https://github.com/hybridgroup/gobot/tree/master/drivers/gpio) - - AIP1640 LED - - Button - - Buzzer - - Direct Pin - - EasyDriver - - Grove Button - - Grove Buzzer - - Grove LED - - Grove Magnetic Switch - - Grove Relay - - Grove Touch Sensor - - LED - - Makey Button - - Motor - - Proximity Infra Red (PIR) Motion Sensor - - Relay - - RGB LED - - Servo - - Stepper Motor - - TM1638 LED Controller + - AIP1640 LED + - Button + - Buzzer + - Direct Pin + - EasyDriver + - Grove Button + - Grove Buzzer + - Grove LED + - Grove Magnetic Switch + - Grove Relay + - Grove Touch Sensor + - LED + - Makey Button + - Motor + - Proximity Infra Red (PIR) Motion Sensor + - Relay + - RGB LED + - Servo + - Stepper Motor + - TM1638 LED Controller Support for many devices that use Analog Input/Output (AIO) have a shared set of drivers provided using the `gobot/drivers/aio` package: - [AIO](https://en.wikipedia.org/wiki/Analog-to-digital_converter) <=> [Drivers](https://github.com/hybridgroup/gobot/tree/master/drivers/aio) - - Analog Sensor - - Grove Light Sensor - - Grove Piezo Vibration Sensor - - Grove Rotary Dial - - Grove Sound Sensor - - Grove Temperature Sensor + - Analog Sensor + - Grove Light Sensor + - Grove Piezo Vibration Sensor + - Grove Rotary Dial + - Grove Sound Sensor + - Grove Temperature Sensor Support for devices that use Inter-Integrated Circuit (I2C) have a shared set of drivers provided using the `gobot/drivers/i2c` package: - [I2C](https://en.wikipedia.org/wiki/I%C2%B2C) <=> [Drivers](https://github.com/hybridgroup/gobot/tree/master/drivers/i2c) - - Adafruit 2x16 RGB-LCD with 5 keys - - Adafruit Motor Hat - - ADS1015 Analog to Digital Converter - - ADS1115 Analog to Digital Converter - - ADXL345 Digital Accelerometer - - BH1750 Digital Luminosity/Lux/Light Sensor - - BlinkM LED - - BME280 Barometric Pressure/Temperature/Altitude/Humidity Sensor - - BMP180 Barometric Pressure/Temperature/Altitude Sensor - - BMP280 Barometric Pressure/Temperature/Altitude Sensor - - BMP388 Barometric Pressure/Temperature/Altitude Sensor - - DRV2605L Haptic Controller - - Generic driver for read and write values to/from register address - - Grove Digital Accelerometer - - GrovePi Expansion Board - - Grove RGB LCD - - HMC6352 Compass - - HMC5883L 3-Axis Digital Compass - - INA3221 Voltage Monitor - - JHD1313M1 LCD Display w/RGB Backlight - - L3GD20H 3-Axis Gyroscope - - LIDAR-Lite - - MCP23017 Port Expander - - MMA7660 3-Axis Accelerometer - - MPL115A2 Barometric Pressure/Temperature - - MPU6050 Accelerometer/Gyroscope - - PCA9501 8-bit I/O port with interrupt, 2-kbit EEPROM - - PCA953x LED Dimmer for PCA9530 (2-bit), PCA9533 (4-bit), PCA9531 (8-bit), PCA9532 (16-bit) - - PCA9685 16-channel 12-bit PWM/Servo Driver - - PCF8583 clock and calendar or event counter, 240 x 8-bit RAM - - PCF8591 8-bit 4xA/D & 1xD/A converter - - SHT2x Temperature/Humidity - - SHT3x-D Temperature/Humidity - - SSD1306 OLED Display Controller - - TSL2561 Digital Luminosity/Lux/Light Sensor - - Wii Nunchuck Controller - - YL-40 Brightness/Temperature sensor, Potentiometer, analog input, analog output Driver + - Adafruit 2x16 RGB-LCD with 5 keys + - Adafruit Motor Hat + - ADS1015 Analog to Digital Converter + - ADS1115 Analog to Digital Converter + - ADXL345 Digital Accelerometer + - BH1750 Digital Luminosity/Lux/Light Sensor + - BlinkM LED + - BME280 Barometric Pressure/Temperature/Altitude/Humidity Sensor + - BMP180 Barometric Pressure/Temperature/Altitude Sensor + - BMP280 Barometric Pressure/Temperature/Altitude Sensor + - BMP388 Barometric Pressure/Temperature/Altitude Sensor + - DRV2605L Haptic Controller + - Generic driver for read and write values to/from register address + - Grove Digital Accelerometer + - GrovePi Expansion Board + - Grove RGB LCD + - HMC6352 Compass + - HMC5883L 3-Axis Digital Compass + - INA3221 Voltage Monitor + - JHD1313M1 LCD Display w/RGB Backlight + - L3GD20H 3-Axis Gyroscope + - LIDAR-Lite + - MCP23017 Port Expander + - MMA7660 3-Axis Accelerometer + - MPL115A2 Barometric Pressure/Temperature + - MPU6050 Accelerometer/Gyroscope + - PCA9501 8-bit I/O port with interrupt, 2-kbit EEPROM + - PCA953x LED Dimmer for PCA9530 (2-bit), PCA9533 (4-bit), PCA9531 (8-bit), PCA9532 (16-bit) + - PCA9685 16-channel 12-bit PWM/Servo Driver + - PCF8583 clock and calendar or event counter, 240 x 8-bit RAM + - PCF8591 8-bit 4xA/D & 1xD/A converter + - SHT2x Temperature/Humidity + - SHT3x-D Temperature/Humidity + - SSD1306 OLED Display Controller + - TSL2561 Digital Luminosity/Lux/Light Sensor + - Wii Nunchuck Controller + - YL-40 Brightness/Temperature sensor, Potentiometer, analog input, analog output Driver Support for devices that use Serial Peripheral Interface (SPI) have a shared set of drivers provided using the `gobot/drivers/spi` package: - [SPI](https://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus) <=> [Drivers](https://github.com/hybridgroup/gobot/tree/master/drivers/spi) - - APA102 Programmable LEDs - - MCP3002 Analog/Digital Converter - - MCP3004 Analog/Digital Converter - - MCP3008 Analog/Digital Converter - - MCP3202 Analog/Digital Converter - - MCP3204 Analog/Digital Converter - - MCP3208 Analog/Digital Converter - - MCP3304 Analog/Digital Converter - - MFRC522 RFID Card Reader - - SSD1306 OLED Display Controller + - APA102 Programmable LEDs + - MCP3002 Analog/Digital Converter + - MCP3004 Analog/Digital Converter + - MCP3008 Analog/Digital Converter + - MCP3202 Analog/Digital Converter + - MCP3204 Analog/Digital Converter + - MCP3208 Analog/Digital Converter + - MCP3304 Analog/Digital Converter + - MFRC522 RFID Card Reader + - SSD1306 OLED Display Controller More platforms and drivers are coming soon... @@ -354,20 +389,18 @@ Gobot uses the Gort [http://gort.io](http://gort.io) Command Line Interface (CLI right from the command line. We call it "RobotOps", aka "DevOps For Robotics". You can scan, connect, update device firmware, and more! -Gobot also has its own CLI to generate new platforms, adaptors, and drivers. You can check it out in the `/cli` directory. - ## Documentation -We're always adding documentation to our web site at https://gobot.io/ please check there as we continue to work on Gobot +We're always adding documentation to our web site at please check there as we continue to work on Gobot Thank you! ## Need help? -* Issues: https://github.com/hybridgroup/gobot/issues -* Twitter: [@gobotio](https://twitter.com/gobotio) -* Slack: [https://gophers.slack.com/messages/C0N5HDB08](https://gophers.slack.com/messages/C0N5HDB08) -* Mailing list: https://groups.google.com/forum/#!forum/gobotio +- Issues: +- Twitter: [@gobotio](https://twitter.com/gobotio) +- Slack: [https://gophers.slack.com/messages/C0N5HDB08](https://gophers.slack.com/messages/C0N5HDB08) +- Mailing list: ## Contributing diff --git a/cli/README.md b/cli/README.md deleted file mode 100644 index 750f39baf..000000000 --- a/cli/README.md +++ /dev/null @@ -1,40 +0,0 @@ -# Gobot CLI - -Gobot has its own CLI to generate new platforms, adaptors, and drivers. - -## Building the CLI - -``` -go build -o /path/to/dest/gobot . -``` - -## Running the CLI - -``` -/path/to/dest/gobot help -``` - -Should display help for the Gobot CLI: - -``` -CLI tool for generating new Gobot projects. - - NAME: - gobot - Command Line Utility for generating new Gobot adaptors, drivers, and platforms - - USAGE: - gobot [global options] command [command options] [arguments...] - -... -``` - -## Installing from the snap - -Gobot is also published in the [snap store](https://snapcraft.io/). It is not yet stable, so you can help testing it in any of the [supported Linux distributions](https://snapcraft.io/docs/core/install) with: - -``` -sudo snap install gobot --edge -``` - -## License -Copyright (c) 2013-2018 The Hybrid Group. Licensed under the Apache 2.0 license. diff --git a/cli/doc.go b/cli/doc.go deleted file mode 100644 index 7c5ea774d..000000000 --- a/cli/doc.go +++ /dev/null @@ -1,11 +0,0 @@ -/* -CLI tool for generating new Gobot projects. - - NAME: - gobot - Command Line Utility for generating new Gobot adaptors, drivers, and platforms - - USAGE: - gobot [global options] command [command options] [arguments...] - -*/ -package main diff --git a/cli/generate.go b/cli/generate.go deleted file mode 100644 index e70531e91..000000000 --- a/cli/generate.go +++ /dev/null @@ -1,417 +0,0 @@ -package main - -import ( - "fmt" - "io/ioutil" - "os" - "strings" - "text/template" - - "github.com/urfave/cli" -) - -type config struct { - Package string - Name string - UpperName string - FirstLetter string - Example string - dir string -} - -func Generate() cli.Command { - return cli.Command{ - Name: "generate", - Usage: "Generate new Gobot adaptors, drivers, and platforms", - Action: func(c *cli.Context) { - valid := false - for _, s := range []string{"adaptor", "driver", "platform"} { - if s == c.Args().First() { - valid = true - } - } - if !valid { - fmt.Println("Invalid/no subcommand supplied.") - fmt.Println("Usage:") - fmt.Println(" gobot generate adaptor [package] # generate a new Gobot adaptor") - fmt.Println(" gobot generate driver [package] # generate a new Gobot driver") - fmt.Println(" gobot generate platform [package] # generate a new Gobot platform") - return - } - - if len(c.Args()) < 2 { - fmt.Println("Please provide a one word name.") - return - } - - name := strings.ToLower(c.Args()[1]) - packageName := name - if len(c.Args()) > 2 { - packageName = strings.ToLower(c.Args()[2]) - } - upperName := strings.ToUpper(string(name[0])) + string(name[1:]) - - cfg := config{ - Package: packageName, - UpperName: upperName, - Name: name, - FirstLetter: string(name[0]), - dir: ".", - } - - switch c.Args().First() { - case "adaptor": - if err := generateAdaptor(cfg); err != nil { - fmt.Println(err) - } - case "driver": - if err := generateDriver(cfg); err != nil { - fmt.Println(err) - } - case "platform": - pwd, err := os.Getwd() - if err != nil { - fmt.Println(err) - return - } - dir := pwd + "/" + cfg.Name - fmt.Println("Creating", dir) - if err := os.MkdirAll(dir, 0700); err != nil { - fmt.Println(err) - return - } - cfg.dir = dir - - examplesDir := dir + "/examples" - fmt.Println("Creating", examplesDir) - if err := os.MkdirAll(examplesDir, 0700); err != nil { - fmt.Println(err) - return - } - - if err := generatePlatform(cfg); err != nil { - fmt.Println(err) - } - } - }, - } -} - -func generate(c config, file string, tmpl string) error { - fileLocation := c.dir + "/" + file - fmt.Println("Creating", fileLocation) - - f, err := os.Create(fileLocation) - defer f.Close() //nolint:staticcheck // for historical reasons - if err != nil { - return err - } - - t, err := template.New("").Parse(tmpl) - if err != nil { - return err - } - - return t.Execute(f, c) -} - -func generateDriver(c config) error { - if err := generate(c, c.Name+"_driver.go", driver()); err != nil { - return err - } - - return generate(c, c.Name+"_driver_test.go", driverTest()) -} - -func generateAdaptor(c config) error { - if err := generate(c, c.Name+"_adaptor.go", adaptor()); err != nil { - return err - } - - return generate(c, c.Name+"_adaptor_test.go", adaptorTest()) -} - -func generatePlatform(c config) error { - if err := generateDriver(c); err != nil { - return err - } - if err := generateAdaptor(c); err != nil { - return err - } - - dir := c.dir - exampleDir := dir + "/examples" - c.dir = exampleDir - - if err := generate(c, "main.go", example()); err != nil { - return err - } - - c.dir = dir - - exp, err := ioutil.ReadFile(exampleDir + "/main.go") - if err != nil { - return err - } - c.Example = string(exp) - - return generate(c, "README.md", readme()) -} - -func adaptor() string { - return `package {{.Package}} - -type {{.UpperName}}Adaptor struct { - name string -} - -func New{{.UpperName}}Adaptor() *{{.UpperName}}Adaptor { - return &{{.UpperName}}Adaptor{ - name: "{{.UpperName}}", - } -} - -func ({{.FirstLetter}} *{{.UpperName}}Adaptor) Name() string { return {{.FirstLetter}}.name } - -func ({{.FirstLetter}} *{{.UpperName}}Adaptor) SetName(name string) { {{.FirstLetter}}.name = name } - -func ({{.FirstLetter}} *{{.UpperName}}Adaptor) Connect() error { return nil } - -func ({{.FirstLetter}} *{{.UpperName}}Adaptor) Finalize() error { return nil } - -func ({{.FirstLetter}} *{{.UpperName}}Adaptor) Ping() string { return "pong" } -` -} - -func driver() string { - return `package {{.Package}} - -import ( - "time" - - "gobot.io/x/gobot/v2" -) - -const Hello string = "hello" - -type {{.UpperName}}Driver struct { - name string - connection gobot.Connection - interval time.Duration - halt chan bool - gobot.Eventer - gobot.Commander -} - -func New{{.UpperName}}Driver(a *{{.UpperName}}Adaptor) *{{.UpperName}}Driver { - {{.FirstLetter}} := &{{.UpperName}}Driver{ - name: "{{.UpperName}}", - connection: a, - interval: 500*time.Millisecond, - halt: make(chan bool, 0), - Eventer: gobot.NewEventer(), - Commander: gobot.NewCommander(), - } - - {{.FirstLetter}}.AddEvent(Hello) - - {{.FirstLetter}}.AddCommand(Hello, func(params map[string]interface{}) interface{} { - return {{.FirstLetter}}.Hello() - }) - - return {{.FirstLetter}} -} - -func ({{.FirstLetter}} *{{.UpperName}}Driver) Name() string { return {{.FirstLetter}}.name } - -func ({{.FirstLetter}} *{{.UpperName}}Driver) SetName(name string) { {{.FirstLetter}}.name = name } - -func ({{.FirstLetter}} *{{.UpperName}}Driver) Connection() gobot.Connection { - return {{.FirstLetter}}.connection -} - -func ({{.FirstLetter}} *{{.UpperName}}Driver) adaptor() *{{.UpperName}}Adaptor { - return {{.FirstLetter}}.Connection().(*{{.UpperName}}Adaptor) -} - -func ({{.FirstLetter}} *{{.UpperName}}Driver) Hello() string { - return "hello from " + {{.FirstLetter}}.Name() + "!" -} - -func ({{.FirstLetter}} *{{.UpperName}}Driver) Ping() string { - return {{.FirstLetter}}.adaptor().Ping() -} - -func ({{.FirstLetter}} *{{.UpperName}}Driver) Start() error { - go func() { - for { - {{.FirstLetter}}.Publish({{.FirstLetter}}.Event(Hello), {{.FirstLetter}}.Hello()) - - select { - case <- time.After({{.FirstLetter}}.interval): - case <- {{.FirstLetter}}.halt: - return - } - } - }() - return nil -} - -func ({{.FirstLetter}} *{{.UpperName}}Driver) Halt() error { - {{.FirstLetter}}.halt <- true - return nil -} - -` -} - -func example() string { - return ` -package main - -import ( - "../" - "fmt" - "time" - - "gobot.io/x/gobot/v2" -) - -func main() { - gbot := gobot.NewMaster() - - conn := {{.Package}}.New{{.UpperName}}Adaptor() - dev := {{.Package}}.New{{.UpperName}}Driver(conn) - - work := func() { - dev.On(dev.Event({{.Package}}.Hello), func(data interface{}) { - fmt.Println(data) - }) - - gobot.Every(1200*time.Millisecond, func() { - fmt.Println(dev.Ping()) - }) - } - - robot := gobot.NewRobot( - "robot", - []gobot.Connection{conn}, - []gobot.Device{dev}, - work, - ) - - gbot.AddRobot(robot) - gbot.Start() -} -` -} - -func driverTest() string { - return `package {{.Package}} - -import ( - "testing" - "time" - - "gobot.io/x/gobot/v2" - "gobot.io/x/gobot/v2/gobottest" -) - -var _ gobot.Driver = (*{{.UpperName}}Driver)(nil) - -func Test{{.UpperName}}Driver(t *testing.T) { - d := New{{.UpperName}}Driver(New{{.UpperName}}Adaptor()) - - gobottest.Assert(t, d.Name(), "{{.UpperName}}") - gobottest.Assert(t, d.Connection().Name(), "{{.UpperName}}") - - ret := d.Command(Hello)(nil) - gobottest.Assert(t, ret.(string), "hello from {{.UpperName}}!") - - gobottest.Assert(t, d.Ping(), "pong") - - gobottest.Assert(t, len(d.Start()), 0) - - time.Sleep(d.interval) - - sem := make(chan bool, 0) - - d.On(d.Event(Hello), func(data interface{}) { - sem <- true - }) - - select { - case <-sem: - case <-time.After(600 * time.Millisecond): - t.Errorf("Hello Event was not published") - } - - gobottest.Assert(t, len(d.Halt()), 0) - - d.On(d.Event(Hello), func(data interface{}) { - sem <- true - }) - - select { - case <-sem: - t.Errorf("Hello Event should not publish after Halt") - case <-time.After(600 * time.Millisecond): - } -} - -` -} - -func adaptorTest() string { - return `package {{.Package}} - -import ( - "testing" - - "gobot.io/x/gobot/v2" - "gobot.io/x/gobot/v2/gobottest" -) - -var _ gobot.Adaptor = (*{{.UpperName}}Adaptor)(nil) - -func Test{{.UpperName}}Adaptor(t *testing.T) { - a := New{{.UpperName}}Adaptor() - - gobottest.Assert(t, a.Name(), "{{.UpperName}}") - - gobottest.Assert(t, len(a.Connect()), 0) - - gobottest.Assert(t, a.Ping(), "pong") - - gobottest.Assert(t, len(a.Connect()), 0) - - gobottest.Assert(t, len(a.Finalize()), 0) -} -` -} - -func readme() string { - return `# {{.Package}} - -Gobot (http://gobot.io/) is a framework for robotics and physical computing using Go - -This repository contains the Gobot adaptor and driver for {{.Package}}. - -For more information about Gobot, check out the github repo at -https://gobot.io/x/gobot/v2 - -## Installing -` + "```bash\ngo get path/to/repo/{{.Package}}\n```" + ` - -## Using -` + "```go{{.Example}}\n```" + ` - -## Connecting - -Explain how to connect to the device here... - -## License - -Copyright (c) 2018 . Licensed under the license. -` -} diff --git a/cli/main.go b/cli/main.go deleted file mode 100644 index 9dffc7f40..000000000 --- a/cli/main.go +++ /dev/null @@ -1,21 +0,0 @@ -package main - -import ( - "os" - - "github.com/urfave/cli" - "gobot.io/x/gobot/v2" -) - -func main() { - app := cli.NewApp() - app.Name = "gobot" - app.Author = "The Gobot team" - app.Email = "https://gobot.io/x/gobot/v2" - app.Version = gobot.Version() - app.Usage = "Command Line Utility for generating new Gobot adaptors, drivers, and platforms" - app.Commands = []cli.Command{ - Generate(), - } - app.Run(os.Args) -} diff --git a/drivers/aio/README.md b/drivers/aio/README.md index eebf4e104..131fb93b7 100644 --- a/drivers/aio/README.md +++ b/drivers/aio/README.md @@ -6,11 +6,7 @@ that supports the needed interfaces for analog devices. ## Getting Started -## Installing - -```sh -go get -d -u gobot.io/x/gobot/v2/... -``` +Please refer to the main [README.md](https://github.com/hybridgroup/gobot/blob/release/README.md) ## Hardware Support diff --git a/drivers/aio/doc.go b/drivers/aio/doc.go index fec23b8d0..10f8facd8 100644 --- a/drivers/aio/doc.go +++ b/drivers/aio/doc.go @@ -3,7 +3,7 @@ Package aio provides Gobot drivers for Analog Input/Output devices. Installing: - go get -d -u gobot.io/x/gobot/v2 + Please refer to the main [README.md](https://github.com/hybridgroup/gobot/blob/release/README.md) For further information refer to aio README: https://github.com/hybridgroup/gobot/blob/master/platforms/aio/README.md diff --git a/drivers/gpio/README.md b/drivers/gpio/README.md index f2b420b9c..e9b2da3aa 100644 --- a/drivers/gpio/README.md +++ b/drivers/gpio/README.md @@ -6,11 +6,7 @@ that supports the needed interfaces for GPIO devices. ## Getting Started -## Installing - -```sh -go get -d -u gobot.io/x/gobot/v2/... -``` +Please refer to the main [README.md](https://github.com/hybridgroup/gobot/blob/release/README.md) ## Hardware Support diff --git a/drivers/gpio/doc.go b/drivers/gpio/doc.go index 854ba6db5..39a488ee9 100644 --- a/drivers/gpio/doc.go +++ b/drivers/gpio/doc.go @@ -3,7 +3,7 @@ Package gpio provides Gobot drivers for General Purpose Input/Output devices. Installing: - go get -d -u gobot.io/x/gobot/v2 + Please refer to the main [README.md](https://github.com/hybridgroup/gobot/blob/release/README.md) For further information refer to gpio README: https://github.com/hybridgroup/gobot/blob/master/platforms/gpio/README.md diff --git a/drivers/i2c/README.md b/drivers/i2c/README.md index 6afa05cbc..b17c583a5 100644 --- a/drivers/i2c/README.md +++ b/drivers/i2c/README.md @@ -6,11 +6,7 @@ interfaces for i2c devices. ## Getting Started -## Installing - -```sh -go get -d -u gobot.io/x/gobot/v2/... -``` +Please refer to the main [README.md](https://github.com/hybridgroup/gobot/blob/release/README.md) ## Hardware Support diff --git a/drivers/i2c/doc.go b/drivers/i2c/doc.go index c112ada70..907dcf013 100644 --- a/drivers/i2c/doc.go +++ b/drivers/i2c/doc.go @@ -3,7 +3,7 @@ Package i2c provides Gobot drivers for i2c devices. Installing: - go get -d -u gobot.io/x/gobot/v2 + Please refer to the main [README.md](https://github.com/hybridgroup/gobot/blob/release/README.md) For further information refer to i2c README: https://github.com/hybridgroup/gobot/blob/master/drivers/i2c/README.md diff --git a/drivers/spi/README.md b/drivers/spi/README.md index 9a3ee55f4..b2f2ed5f1 100644 --- a/drivers/spi/README.md +++ b/drivers/spi/README.md @@ -4,11 +4,7 @@ This package provides drivers for [SPI](https://en.wikipedia.org/wiki/Serial_Per ## Getting Started -## Installing - -```sh -go get -d -u gobot.io/x/gobot/v2/... -``` +Please refer to the main [README.md](https://github.com/hybridgroup/gobot/blob/release/README.md) ## Hardware Support diff --git a/drivers/spi/doc.go b/drivers/spi/doc.go index 682c2fcef..a7a62641b 100644 --- a/drivers/spi/doc.go +++ b/drivers/spi/doc.go @@ -3,7 +3,7 @@ Package spi provides Gobot drivers for spi devices. Uses periph.io for spi Installing: - go get -d -u gobot.io/x/gobot/v2 + Please refer to the main [README.md](https://github.com/hybridgroup/gobot/blob/release/README.md) For further information refer to spi README: https://github.com/hybridgroup/gobot/blob/master/drivers/spi/README.md diff --git a/examples_test.go b/examples_test.go deleted file mode 100644 index 533f882c3..000000000 --- a/examples_test.go +++ /dev/null @@ -1,53 +0,0 @@ -package gobot_test - -import ( - "fmt" - "testing" - "time" - - "gobot.io/x/gobot/v2" - "gobot.io/x/gobot/v2/gobottest" -) - -func ExampleEvery() { - gobot.Every(1*time.Second, func() { - fmt.Println("Hello") - }) -} - -func ExampleAfter() { - gobot.After(1*time.Second, func() { - fmt.Println("Hello") - }) -} - -func ExampleRand() { - i := gobot.Rand(100) - fmt.Printf("%v is > 0 && < 100", i) -} - -func ExampleFromScale() { - fmt.Println(gobot.FromScale(5, 0, 10)) - // Output: - // 0.5 -} - -func ExampleToScale() { - fmt.Println(gobot.ToScale(500, 0, 10)) - // Output: - // 10 -} - -func ExampleAssert() { - t := &testing.T{} - var a int = 100 - var b int = 100 - gobottest.Assert(t, a, b) -} - -func ExampleRefute() { - t := &testing.T{} - var a int = 100 - var b int = 200 - gobottest.Refute(t, a, b) -} diff --git a/master_test.go b/master_test.go index 34f6f3d75..3df73ca2f 100644 --- a/master_test.go +++ b/master_test.go @@ -34,10 +34,6 @@ func initTestMaster1Robot() *Master { return g } -func TestVersion(t *testing.T) { - gobottest.Assert(t, version, Version()) -} - func TestNullReadWriteCloser(t *testing.T) { n := &NullReadWriteCloser{} i, _ := n.Write([]byte{1, 2, 3}) diff --git a/platforms/beaglebone/README.md b/platforms/beaglebone/README.md index 40dc41132..c07c1f4aa 100644 --- a/platforms/beaglebone/README.md +++ b/platforms/beaglebone/README.md @@ -2,59 +2,60 @@ The BeagleBone is an ARM based single board computer, with lots of GPIO, I2C, and analog interfaces built in. -The Gobot adaptor for the BeagleBone supports all of the various BeagleBone boards such as the BeagleBone Black, SeeedStudio BeagleBone Green, SeeedStudio BeagleBone Green Wireless, and others that use the latest Debian and standard "Cape Manager" interfaces. +The Gobot adaptor for the BeagleBone supports all of the various BeagleBone boards such as the BeagleBone Black, +SeeedStudio BeagleBone Green, SeeedStudio BeagleBone Green Wireless, and others that use the latest Debian and standard +"Cape Manager" interfaces. For more info about the BeagleBone platform go to [http://beagleboard.org/getting-started](http://beagleboard.org/getting-started). -In addition, there is an separate Adaptor for the PocketBeagle, a USB-key-fob sized computer. The PocketBeagle has a different pin layout and somewhat different capabilities. +In addition, there is an separate Adaptor for the PocketBeagle, a USB-key-fob sized computer. The PocketBeagle has a +different pin layout and somewhat different capabilities. For more info about the PocketBeagle platform go to [http://beagleboard.org/pocket](http://beagleboard.org/pocket). - ## How to Install -We recommend updating to the latest Debian OS when using the BeagleBone. The current Gobot only supports 4.x versions of the OS. If you need support for older versions of the OS, you will need to use Gobot v1.4. - -You would normally install Go and Gobot on your workstation. Once installed, cross compile your program on your workstation, transfer the final executable to your BeagleBone, and run the program on the BeagleBone itself as documented here. +We recommend updating to the latest Debian OS when using the BeagleBone. The current Gobot only supports 4.x versions of +the OS. If you need support for older versions of the OS, you will need to use Gobot v1.4. -``` -go get -d -u gobot.io/x/gobot/v2/... -``` +You would normally install Go and Gobot on your workstation. Once installed, cross compile your program on your workstation, +transfer the final executable to your BeagleBone, and run the program on the BeagleBone itself as documented here. ## How to Use The pin numbering used by your Gobot program should match the way your board is labeled right on the board itself. -Gobot also has support for the four built-in LEDs on the BeagleBone Black, by referring to them as `usr0`, `usr1`, `usr2`, and `usr3`. +Gobot also has support for the four built-in LEDs on the BeagleBone Black, by referring to them as `usr0`, `usr1`, `usr2`, +and `usr3`. ```go package main import ( - "time" + "time" - "gobot.io/x/gobot/v2" - "gobot.io/x/gobot/v2/drivers/gpio" - "gobot.io/x/gobot/v2/platforms/beaglebone" + "gobot.io/x/gobot/v2" + "gobot.io/x/gobot/v2/drivers/gpio" + "gobot.io/x/gobot/v2/platforms/beaglebone" ) func main() { - beagleboneAdaptor := beaglebone.NewAdaptor() - led := gpio.NewLedDriver(beagleboneAdaptor, "P9_12") - - work := func() { - gobot.Every(1*time.Second, func() { - led.Toggle() - }) - } - - robot := gobot.NewRobot("blinkBot", - []gobot.Connection{beagleboneAdaptor}, - []gobot.Device{led}, - work, - ) - - robot.Start() + beagleboneAdaptor := beaglebone.NewAdaptor() + led := gpio.NewLedDriver(beagleboneAdaptor, "P9_12") + + work := func() { + gobot.Every(1*time.Second, func() { + led.Toggle() + }) + } + + robot := gobot.NewRobot("blinkBot", + []gobot.Connection{beagleboneAdaptor}, + []gobot.Device{led}, + work, + ) + + robot.Start() } ``` @@ -64,30 +65,30 @@ To use the PocketBeagle, use `beaglebone.NewPocketBeagleAdaptor()` like this: package main import ( - "time" + "time" - "gobot.io/x/gobot/v2" - "gobot.io/x/gobot/v2/drivers/gpio" - "gobot.io/x/gobot/v2/platforms/beaglebone" + "gobot.io/x/gobot/v2" + "gobot.io/x/gobot/v2/drivers/gpio" + "gobot.io/x/gobot/v2/platforms/beaglebone" ) func main() { - beagleboneAdaptor := beaglebone.NewPocketBeagleAdaptor() - led := gpio.NewLedDriver(beagleboneAdaptor, "P1_02") - - work := func() { - gobot.Every(1*time.Second, func() { - led.Toggle() - }) - } - - robot := gobot.NewRobot("pocketBeagleBot", - []gobot.Connection{beagleboneAdaptor}, - []gobot.Device{led}, - work, - ) - - robot.Start() + beagleboneAdaptor := beaglebone.NewPocketBeagleAdaptor() + led := gpio.NewLedDriver(beagleboneAdaptor, "P1_02") + + work := func() { + gobot.Every(1*time.Second, func() { + led.Toggle() + }) + } + + robot := gobot.NewRobot("pocketBeagleBot", + []gobot.Connection{beagleboneAdaptor}, + []gobot.Device{led}, + work, + ) + + robot.Start() } ``` @@ -97,53 +98,63 @@ func main() { Compile your Gobot program on your workstation like this: -```bash -$ GOARM=7 GOARCH=arm GOOS=linux go build examples/beaglebone_blink.go +```sh +GOARM=7 GOARCH=arm GOOS=linux go build examples/beaglebone_blink.go ``` -Once you have compiled your code, you can you can upload your program and execute it on the BeagleBone from your workstation using the `scp` and `ssh` commands like this: +Once you have compiled your code, you can you can upload your program and execute it on the BeagleBone from your workstation +using the `scp` and `ssh` commands like this: -```bash -$ scp beaglebone_blink debian@192.168.7.2:/home/debian/ -$ ssh -t debian@192.168.7.2 "./beaglebone_blink" +```sh +scp beaglebone_blink debian@192.168.7.2:/home/debian/ +ssh -t debian@192.168.7.2 "./beaglebone_blink" ``` -In order to run the preceeding commands, you must be running the official Debian Linux through the usb->ethernet connection, or be connected to the board using WiFi. +In order to run the preceeding commands, you must be running the official Debian Linux through the usb->ethernet connection, +or be connected to the board using WiFi. You must also configure hardware settings as described below. ### Updating your board to the latest OS -We recommend using your BeagleBone with the latest Debian OS. It is very easy to do this using the Etcher (https://etcher.io/) utility program. +We recommend using your BeagleBone with the latest Debian OS. It is very easy to do this using the Etcher () +utility program. -First, download the latest BeagleBone OS from http://beagleboard.org/latest-images +First, download the latest BeagleBone OS from Now, use Etcher to create an SD card with the OS image you have downloaded. Once you have created the SD card, boot your BeagleBone using the new image as follows: -- Insert SD card into your (powered-down) board, hold down the USER/BOOT button (if using Black) and apply power, either by the USB cable or 5V adapter. +- Insert SD card into your (powered-down) board, hold down the USER/BOOT button (if using Black) and apply power, either + by the USB cable or 5V adapter. - If all you want to do it boot once from the SD card, it should now be booting. -- If using BeagleBone Black and desire to write the image to your on-board eMMC, you'll need to follow the instructions at http://elinux.org/Beagleboard:BeagleBoneBlack_Debian#Flashing_eMMC. When the flashing is complete, all 4 USRx LEDs will be steady on or off. The latest Debian flasher images automatically power down the board upon completion. This can take up to 45 minutes. Power-down your board, remove the SD card and apply power again to be complete. +- If using BeagleBone Black and desire to write the image to your on-board eMMC, you'll need to follow the instructions at + . When the flashing is complete, all 4 USRx LEDs + will be steady on or off. The latest Debian flasher images automatically power down the board upon completion. This can + take up to 45 minutes. Power-down your board, remove the SD card and apply power again to be complete. These instructions come from the Beagleboard web site's "Getting Started" page located here: -http://beagleboard.org/getting-started + ### Configure hardware settings -Thanks to the BeagleBone team, the new "U-Boot Overlays" system for enabling hardware and the "cape-universal", the latest Debian OS should "just work" with any GPIO, PWM, I2C, or SPI pins. +Thanks to the BeagleBone team, the new "U-Boot Overlays" system for enabling hardware and the "cape-universal", the latest +Debian OS should "just work" with any GPIO, PWM, I2C, or SPI pins. If you want to dig in and learn more about this check out: -https://elinux.org/Beagleboard:BeagleBoneBlack_Debian#U-Boot_Overlays + ### Upgrading from an older version -Please note that if you are upgrading a board that has already run from an older version of Debian OS, you might need to clear out your older eMMC bootloader, otherwise the new U-Boot Overlays in the newer U-Boot may not get enabled. If so, login using SSH and run the following command on your BeagleBone board: +Please note that if you are upgrading a board that has already run from an older version of Debian OS, you might need to +clear out your older eMMC bootloader, otherwise the new U-Boot Overlays in the newer U-Boot may not get enabled. If so, +login using SSH and run the following command on your BeagleBone board: - sudo dd if=/dev/zero of=/dev/mmcblk1 count=1 seek=1 bs=128k +`sudo dd if=/dev/zero of=/dev/mmcblk1 count=1 seek=1 bs=128k` Thanks to [@RobertCNelson](https://github.com/RobertCNelson) for the tip on the above. diff --git a/platforms/beaglebone/doc.go b/platforms/beaglebone/doc.go index 0215f2a15..d868ed3f7 100644 --- a/platforms/beaglebone/doc.go +++ b/platforms/beaglebone/doc.go @@ -4,7 +4,7 @@ separate Adaptor for the PocketBeagle. Installing: - go get gobot.io/x/gobot/v2/platforms/beaglebone + Please refer to the main [README.md](https://github.com/hybridgroup/gobot/blob/release/README.md) Example: diff --git a/platforms/ble/README.md b/platforms/ble/README.md index 342741f5b..5871bd6fe 100644 --- a/platforms/ble/README.md +++ b/platforms/ble/README.md @@ -4,7 +4,7 @@ The Gobot BLE adaptor makes it easy to interact with Bluetooth LE aka Bluetooth It is written using the [TinyGo Bluetooh](tinygo.org/x/bluetooth) package. -Learn more about Bluetooth LE at http://en.wikipedia.org/wiki/Bluetooth_low_energy +Learn more about Bluetooth LE at This package also includes drivers for several well-known BLE Services: @@ -13,13 +13,13 @@ This package also includes drivers for several well-known BLE Services: - Generic Access Service ## How to Install -``` -go get -d -u gobot.io/x/gobot/v2/... -``` + +Please refer to the main [README.md](https://github.com/hybridgroup/gobot/blob/release/README.md) ### macOS -You need to have XCode installed to be able to compile code that uses the Gobot BLE adaptor on macOS. This is because the `bluetooth` package uses a CGo based implementation. +You need to have XCode installed to be able to compile code that uses the Gobot BLE adaptor on macOS. This is because the +`bluetooth` package uses a CGo based implementation. ### Ubuntu @@ -27,24 +27,28 @@ Everything should already just compile on most Linux systems. ### Windows -You will need to have a GCC compiler such as [mingw-w64](https://github.com/mingw-w64/mingw-w64) installed in order to use BLE on Windows. +You will need to have a GCC compiler such as [mingw-w64](https://github.com/mingw-w64/mingw-w64) installed in order to use +BLE on Windows. ## How To Connect -When using BLE a "peripheral" aka "server" is something you connect to such a a pulse meter. A "central" aka "client" is what does the connecting, such as your computer or mobile phone. +When using BLE a "peripheral" aka "server" is something you connect to such a a pulse meter. A "central" aka "client" is +what does the connecting, such as your computer or mobile phone. -You need to know the BLE ID of the peripheral you want to connect to. The Gobot BLE client adaptor also lets you connect to a peripheral by friendly name. +You need to know the BLE ID of the peripheral you want to connect to. The Gobot BLE client adaptor also lets you connect +to a peripheral by friendly name. -### Ubuntu +### Connect on Ubuntu -On Linux the BLE code will need to run as a root user account. The easiest way to accomplish this is probably to use `go build` to build your program, and then to run the requesting executable using `sudo`. +On Linux the BLE code will need to run as a root user account. The easiest way to accomplish this is probably to use +`go build` to build your program, and then to run the requesting executable using `sudo`. For example: go build examples/minidrone.go sudo ./minidrone AA:BB:CC:DD:EE -### Windows +### Connect on Windows Hopefully coming soon... @@ -56,30 +60,30 @@ Here is an example that uses the BLE "Battery" service to retrieve the current c package main import ( - "fmt" - "os" - "time" + "fmt" + "os" + "time" - "gobot.io/x/gobot/v2" - "gobot.io/x/gobot/v2/platforms/ble" + "gobot.io/x/gobot/v2" + "gobot.io/x/gobot/v2/platforms/ble" ) func main() { - bleAdaptor := ble.NewClientAdaptor(os.Args[1]) - battery := ble.NewBatteryDriver(bleAdaptor) - - work := func() { - gobot.Every(5*time.Second, func() { - fmt.Println("Battery level:", battery.GetBatteryLevel()) - }) - } - - robot := gobot.NewRobot("bleBot", - []gobot.Connection{bleAdaptor}, - []gobot.Device{battery}, - work, - ) - - robot.Start() + bleAdaptor := ble.NewClientAdaptor(os.Args[1]) + battery := ble.NewBatteryDriver(bleAdaptor) + + work := func() { + gobot.Every(5*time.Second, func() { + fmt.Println("Battery level:", battery.GetBatteryLevel()) + }) + } + + robot := gobot.NewRobot("bleBot", + []gobot.Connection{bleAdaptor}, + []gobot.Device{battery}, + work, + ) + + robot.Start() } ``` diff --git a/platforms/chip/README.md b/platforms/chip/README.md index eb30914e4..4b62bbc83 100644 --- a/platforms/chip/README.md +++ b/platforms/chip/README.md @@ -1,40 +1,43 @@ # C.H.I.P. -The [C.H.I.P.](http://www.getchip.com/) is a small, inexpensive ARM based single board computer, with many different IO interfaces available on the [pin headers](http://docs.getchip.com/#pin-headers). +The [C.H.I.P.](http://www.getchip.com/) is a small, inexpensive ARM based single board computer, with many different IO +interfaces available on the [pin headers](http://docs.getchip.com/#pin-headers). For documentation about the C.H.I.P. platform click [here](http://docs.getchip.com/). -The [C.H.I.P. Pro](https://getchip.com/pages/chippro) is a version of C.H.I.P. intended for use in embedded product development. Here is info about the [C.H.I.P. Pro pin headers](https://docs.getchip.com/chip_pro.html#pin-descriptions). - +The [C.H.I.P. Pro](https://getchip.com/pages/chippro) is a version of C.H.I.P. intended for use in embedded product +development. Here is info about the [C.H.I.P. Pro pin headers](https://docs.getchip.com/chip_pro.html#pin-descriptions). ## How to Install -We recommend updating to the latest Debian OS when using the C.H.I.P., however Gobot should also support older versions of the OS, should your application require this. +We recommend updating to the latest Debian OS when using the C.H.I.P., however Gobot should also support older versions +of the OS, should your application require this. -You would normally install Go and Gobot on your workstation. Once installed, cross compile your program on your workstation, transfer the final executable to your C.H.I.P and run the program on the C.H.I.P. itself as documented here. +You would normally install Go and Gobot on your workstation. Once installed, cross compile your program on your +workstation, transfer the final executable to your C.H.I.P and run the program on the C.H.I.P. itself as documented here. -``` -go get -d -u gobot.io/x/gobot/v2/... -``` +Please refer to the main [README.md](https://github.com/hybridgroup/gobot/blob/release/README.md) ### PWM support + Note that PWM might not be available in your kernel. In that case, you can install the required device tree overlay from the command line using [Gort](https://gobot.io/x/gort) CLI commands on the C.H.I.P device. Here are the steps: Install the required patched device tree compiler as described in the [C.H.I.P docs](https://docs.getchip.com/dip.html#make-a-dtbo-device-tree-overlay-blob): -``` + +```sh gort chip install dtc ``` Now, install the pwm overlay to activate pwm on the PWM0 pin: -``` + +```sh gort chip install pwm ``` Reboot the device to make sure the init script loads the overlay on boot. - ## How to Use The pin numbering used by your Gobot program should match the way your board is labeled right on the board itself. @@ -87,12 +90,13 @@ chipProAdaptor := chip.NewProAdaptor() Compile your Gobot program on your workstation like this: ```bash -$ GOARM=7 GOARCH=arm GOOS=linux go build examples/chip_button.go +GOARM=7 GOARCH=arm GOOS=linux go build examples/chip_button.go ``` -Once you have compiled your code, you can you can upload your program and execute it on the C.H.I.P. from your workstation using the `scp` and `ssh` commands like this: +Once you have compiled your code, you can you can upload your program and execute it on the C.H.I.P. from your workstation +using the `scp` and `ssh` commands like this: ```bash -$ scp chip_button root@192.168.1.xx: -$ ssh -t root@192.168.1.xx "./chip_button" +scp chip_button root@192.168.1.xx: +ssh -t root@192.168.1.xx "./chip_button" ``` diff --git a/platforms/dexter/gopigo3/README.md b/platforms/dexter/gopigo3/README.md index c5b475c15..cadbc9df4 100644 --- a/platforms/dexter/gopigo3/README.md +++ b/platforms/dexter/gopigo3/README.md @@ -4,50 +4,49 @@ The GoPiGo3 is a robotics controller by Dexter Industries that is compatible wit ## How to Install -``` -go get -d -u gobot.io/x/gobot/v2/... -``` +Please refer to the main [README.md](https://github.com/hybridgroup/gobot/blob/release/README.md) ## How to Use + This example will blink the left and right leds red/blue. ```go package main import ( - "fmt" - "time" + "fmt" + "time" - "gobot.io/x/gobot/v2" - g "gobot.io/x/gobot/v2/platforms/dexter/gopigo3" - "gobot.io/x/gobot/v2/platforms/raspi" + "gobot.io/x/gobot/v2" + g "gobot.io/x/gobot/v2/platforms/dexter/gopigo3" + "gobot.io/x/gobot/v2/platforms/raspi" ) func main() { - raspiAdaptor := raspi.NewAdaptor() - gopigo3 := g.NewDriver(raspiAdaptor) - - work := func() { - on := uint8(0xFF) - gobot.Every(1000*time.Millisecond, func() { - err := gopigo3.SetLED(g.LED_EYE_RIGHT, 0x00, 0x00, on) - if err != nil { - fmt.Println(err) - } - err = gopigo3.SetLED(g.LED_EYE_LEFT, ^on, 0x00, 0x00) - if err != nil { - fmt.Println(err) - } - on = ^on - }) - } - - robot := gobot.NewRobot("gopigo3", - []gobot.Connection{raspiAdaptor}, - []gobot.Device{gopigo3}, - work, - ) - - robot.Start() + raspiAdaptor := raspi.NewAdaptor() + gopigo3 := g.NewDriver(raspiAdaptor) + + work := func() { + on := uint8(0xFF) + gobot.Every(1000*time.Millisecond, func() { + err := gopigo3.SetLED(g.LED_EYE_RIGHT, 0x00, 0x00, on) + if err != nil { + fmt.Println(err) + } + err = gopigo3.SetLED(g.LED_EYE_LEFT, ^on, 0x00, 0x00) + if err != nil { + fmt.Println(err) + } + on = ^on + }) + } + + robot := gobot.NewRobot("gopigo3", + []gobot.Connection{raspiAdaptor}, + []gobot.Device{gopigo3}, + work, + ) + + robot.Start() } -``` \ No newline at end of file +``` diff --git a/platforms/digispark/README.md b/platforms/digispark/README.md index 4803aac27..95813e2bc 100644 --- a/platforms/digispark/README.md +++ b/platforms/digispark/README.md @@ -1,33 +1,32 @@ # Digispark -The Digispark is an Attiny85 based microcontroller development board similar to the Arduino line, only cheaper, smaller, and a bit less powerful. With a whole host of shields to extend its functionality and the ability to use the familiar Arduino IDE the Digispark is a great way to jump into electronics, or perfect for when an Arduino is too big or too much. +The Digispark is an Attiny85 based microcontroller development board similar to the Arduino line, only cheaper, smaller, +and a bit less powerful. With a whole host of shields to extend its functionality and the ability to use the familiar +Arduino IDE the Digispark is a great way to jump into electronics, or perfect for when an Arduino is too big or too much. -This package provides the Gobot adaptor for the [Digispark](http://digistump.com/products/1) ATTiny-based USB development board with the [Little Wire](http://littlewire.github.io/) protocol firmware installed. +This package provides the Gobot adaptor for the [Digispark](http://digistump.com/products/1) ATTiny-based USB development +board with the [Little Wire](http://littlewire.github.io/) protocol firmware installed. ## How to Install +Please refer to the main [README.md](https://github.com/hybridgroup/gobot/blob/release/README.md) + This package requires `libusb`. ### OSX To install `libusb` on OSX using Homebrew: -``` -$ brew install libusb && brew install libusb-compat +```sh +brew install libusb && brew install libusb-compat ``` ### Ubuntu To install libusb on linux: -``` -$ sudo apt-get install libusb-dev -``` - -Now you can install the package with - -``` -go get -d -u gobot.io/x/gobot/v2/... +```sh +sudo apt-get install libusb-dev ``` ## How to Use @@ -36,30 +35,30 @@ go get -d -u gobot.io/x/gobot/v2/... package main import ( - "time" + "time" - "gobot.io/x/gobot/v2" - "gobot.io/x/gobot/v2/drivers/gpio" - "gobot.io/x/gobot/v2/platforms/digispark" + "gobot.io/x/gobot/v2" + "gobot.io/x/gobot/v2/drivers/gpio" + "gobot.io/x/gobot/v2/platforms/digispark" ) func main() { - digisparkAdaptor := digispark.NewAdaptor() - led := gpio.NewLedDriver(digisparkAdaptor, "0") - - work := func() { - gobot.Every(1*time.Second, func() { - led.Toggle() - }) - } - - robot := gobot.NewRobot("blinkBot", - []gobot.Connection{digisparkAdaptor}, - []gobot.Device{led}, - work, - ) - - robot.Start() + digisparkAdaptor := digispark.NewAdaptor() + led := gpio.NewLedDriver(digisparkAdaptor, "0") + + work := func() { + gobot.Every(1*time.Second, func() { + led.Toggle() + }) + } + + robot := gobot.NewRobot("blinkBot", + []gobot.Connection{digisparkAdaptor}, + []gobot.Device{led}, + work, + ) + + robot.Start() } ``` @@ -75,26 +74,26 @@ Download and install Gort, and then use the following commands: Then, install the needed Digispark firmware. -``` +```sh gort digispark install ``` -### OSX +### Connect on OSX **Important**: 2012 MBP The USB ports on the 2012 MBPs (Retina and non) cause issues due to their USB3 controllers, currently the best work around is to use a cheap USB hub (non USB3). Plug the Digispark into your computer via the USB port and run: -``` +```sh gort digispark upload littlewire ``` -### Ubuntu +### Connect on Ubuntu Ubuntu requires an extra one-time step to set up the Digispark for communication with Gobot. Run the following command: -``` +```sh gort digispark set-udev-rules ``` @@ -102,18 +101,18 @@ You might need to enter your administrative password. This steps adds a udev rul Once this is done, you can upload Little Wire to your Digispark: -``` +```sh gort digispark upload littlewire ``` -### Windows +### Connect on Windows We need instructions here, because it supposedly works. ### Manual instructions -For manual instructions on how to install Little Wire on a Digispark check out http://digistump.com/board/index.php/topic,160.0.html +For manual instructions on how to install Little Wire on a Digispark check out -Thanks to [@bluebie](https://github.com/Bluebie) for these instructions! (https://github.com/Bluebie/micronucleus-t85/wiki/Ubuntu-Linux) +Thanks to [@bluebie](https://github.com/Bluebie) for these instructions! () Now plug the Digispark into your computer via the USB port. diff --git a/platforms/digispark/doc.go b/platforms/digispark/doc.go index ec04f7c9e..4a6477dfa 100644 --- a/platforms/digispark/doc.go +++ b/platforms/digispark/doc.go @@ -6,7 +6,7 @@ Installing: This package requires installing `libusb`. Then you can install the package with: - go get -u -d gobot.io/x/gobot/v2/platforms/digispark + Please refer to the main [README.md](https://github.com/hybridgroup/gobot/blob/release/README.md) Example: diff --git a/platforms/dji/tello/README.md b/platforms/dji/tello/README.md index 7407ab59f..9b0f9cf61 100644 --- a/platforms/dji/tello/README.md +++ b/platforms/dji/tello/README.md @@ -6,9 +6,7 @@ For more information on this drone, go to: [https://www.ryzerobotics.com/tello]( ## How to Install -``` -go get -d -u gobot.io/x/gobot/v2/... -``` +Please refer to the main [README.md](https://github.com/hybridgroup/gobot/blob/release/README.md) ## How to Use @@ -22,31 +20,31 @@ Here is a sample of how you initialize and use the driver: package main import ( - "fmt" - "time" + "fmt" + "time" - "gobot.io/x/gobot/v2" - "gobot.io/x/gobot/v2/platforms/dji/tello" + "gobot.io/x/gobot/v2" + "gobot.io/x/gobot/v2/platforms/dji/tello" ) func main() { - drone := tello.NewDriver("8888") + drone := tello.NewDriver("8888") - work := func() { - drone.TakeOff() + work := func() { + drone.TakeOff() - gobot.After(5*time.Second, func() { - drone.Land() - }) - } + gobot.After(5*time.Second, func() { + drone.Land() + }) + } - robot := gobot.NewRobot("tello", - []gobot.Connection{}, - []gobot.Device{drone}, - work, - ) + robot := gobot.NewRobot("tello", + []gobot.Connection{}, + []gobot.Device{drone}, + work, + ) - robot.Start() + robot.Start() } ``` @@ -62,10 +60,13 @@ drone := tello.NewDriverWithIP("192.168.10.1", "8888") This driver could not exist without the awesome members of the unofficial Tello forum: -https://tellopilots.com/forums/tello-development.8/ + -Special thanks to [@Kragrathea](https://github.com/Kragrathea) who figured out a LOT of the packets and code as implemented in C#: [https://github.com/Kragrathea/TelloPC](https://github.com/Kragrathea/TelloPC) +Special thanks to [@Kragrathea](https://github.com/Kragrathea) who figured out a LOT of the packets and code as implemented +in C#: [https://github.com/Kragrathea/TelloPC](https://github.com/Kragrathea/TelloPC) -Also thanks to [@microlinux](https://github.com/microlinux) with the Python library which served as the first example for the Tello community: [https://github.com/microlinux/tello](https://github.com/microlinux/tello) +Also thanks to [@microlinux](https://github.com/microlinux) with the Python library which served as the first example for +the Tello community: [https://github.com/microlinux/tello](https://github.com/microlinux/tello) -Thank you to bluejune for the [https://bitbucket.org/PingguSoft/pytello](https://bitbucket.org/PingguSoft/pytello) repo, especially the Wireshark Lua dissector which has proven indispensable. +Thank you to bluejune for the [https://bitbucket.org/PingguSoft/pytello](https://bitbucket.org/PingguSoft/pytello) repo, +especially the Wireshark Lua dissector which has proven indispensable. diff --git a/platforms/dragonboard/README.md b/platforms/dragonboard/README.md index 530a616fc..30862006a 100644 --- a/platforms/dragonboard/README.md +++ b/platforms/dragonboard/README.md @@ -1,16 +1,18 @@ # DragonBoard™ 410c -The [DragonBoard 410c](http://www.96boards.org/product/dragonboard410c/), a product of Arrow Electronics, is the development board based on the mid-tier Qualcomm® Snapdragon™ 410E processor. It features advanced processing power, Wi-Fi, Bluetooth connectivity, and GPS, all packed into a board the size of a credit card. +The [DragonBoard 410c](http://www.96boards.org/product/dragonboard410c/), a product of Arrow Electronics, is the development +board based on the mid-tier Qualcomm® Snapdragon™ 410E processor. It features advanced processing power, Wi-Fi, Bluetooth +connectivity, and GPS, all packed into a board the size of a credit card. ## How to Install -Make sure you are using the latest Linaro Debian image. Both AArch32 and AArch64 work™ though you should stick to 64bit as OS internals may be different and aren't tested. +Please refer to the main [README.md](https://github.com/hybridgroup/gobot/blob/release/README.md) -You would normally install Go and Gobot on your workstation. Once installed, cross compile your program on your workstation, transfer the final executable to your DragonBoard and run the program on the DragonBoard itself as documented here. +Make sure you are using the latest Linaro Debian image. Both AArch32 and AArch64 work™ though you should stick to 64bit +as OS internals may be different and aren't tested. -``` -go get -d -u gobot.io/x/gobot/v2/... -``` +You would normally install Go and Gobot on your workstation. Once installed, cross compile your program on your workstation, +transfer the final executable to your DragonBoard and run the program on the DragonBoard itself as documented here. ## How to Use @@ -57,13 +59,14 @@ func main() { Compile your Gobot program on your workstation like this: -```bash -$ GOARCH=arm64 GOOS=linux go build examples/dragon_button.go +```sh +GOARCH=arm64 GOOS=linux go build examples/dragon_button.go ``` -Once you have compiled your code, you can you can upload your program and execute it on the DragonBoard from your workstation using the `scp` and `ssh` commands like this: +Once you have compiled your code, you can you can upload your program and execute it on the DragonBoard from your workstation +using the `scp` and `ssh` commands like this: -```bash -$ scp dragon_button root@192.168.1.xx: -$ ssh -t root@192.168.1.xx "./dragon_button" +```sh +scp dragon_button root@192.168.1.xx: +ssh -t root@192.168.1.xx "./dragon_button" ``` diff --git a/platforms/firmata/README.md b/platforms/firmata/README.md index c00b3fd06..6d7dedb6e 100644 --- a/platforms/firmata/README.md +++ b/platforms/firmata/README.md @@ -1,22 +1,25 @@ # Firmata -Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware and software. It's intended for artists, designers, hobbyists and anyone interested in creating interactive objects or environments. +Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware and software. It's +intended for artists, designers, hobbyists and anyone interested in creating interactive objects or environments. -This package provides the adaptor for microcontrollers such as Arduino that support the [Firmata](https://github.com/firmata/protocol) protocol +This package provides the adaptor for microcontrollers such as Arduino that support the [Firmata](https://github.com/firmata/protocol) +protocol. -You can connect to the microcontroller using either a serial connection, or a TCP connection to a WiFi-connected microcontroller such as the ESP8266. +You can connect to the microcontroller using either a serial connection, or a TCP connection to a WiFi-connected +microcontroller such as the ESP8266. For more info about the Arduino platform, go to [http://arduino.cc/](http://arduino.cc/). ## How to Install -``` -go get -d -u gobot.io/x/gobot/v2/... -``` +Please refer to the main [README.md](https://github.com/hybridgroup/gobot/blob/release/README.md) -You must install Firmata on your microcontroller before you can connect to it using Gobot. You can do this in many cases using Gort ([http://gort.io](http://gort.io)). +You must install Firmata on your microcontroller before you can connect to it using Gobot. You can do this in many cases +using Gort ([http://gort.io](http://gort.io)). -In order to use a TCP connection with a WiFi-enbaled microcontroller, you must install WifiFirmata on the microcontroller. You can use the Arduino IDE to do this. +In order to use a TCP connection with a WiFi-enbaled microcontroller, you must install WifiFirmata on the microcontroller. +You can use the Arduino IDE to do this. ## How to Use @@ -26,30 +29,30 @@ With a serial connection: package main import ( - "time" + "time" - "gobot.io/x/gobot/v2" - "gobot.io/x/gobot/v2/drivers/gpio" - "gobot.io/x/gobot/v2/platforms/firmata" + "gobot.io/x/gobot/v2" + "gobot.io/x/gobot/v2/drivers/gpio" + "gobot.io/x/gobot/v2/platforms/firmata" ) func main() { - firmataAdaptor := firmata.NewAdaptor("/dev/ttyACM0") - led := gpio.NewLedDriver(firmataAdaptor, "13") - - work := func() { - gobot.Every(1*time.Second, func() { - led.Toggle() - }) - } - - robot := gobot.NewRobot("bot", - []gobot.Connection{firmataAdaptor}, - []gobot.Device{led}, - work, - ) - - robot.Start() + firmataAdaptor := firmata.NewAdaptor("/dev/ttyACM0") + led := gpio.NewLedDriver(firmataAdaptor, "13") + + work := func() { + gobot.Every(1*time.Second, func() { + led.Toggle() + }) + } + + robot := gobot.NewRobot("bot", + []gobot.Connection{firmataAdaptor}, + []gobot.Device{led}, + work, + ) + + robot.Start() } ``` @@ -59,41 +62,42 @@ With a TCP connection, use the `NewTCPAdaptor`: package main import ( - "time" + "time" - "gobot.io/x/gobot/v2" - "gobot.io/x/gobot/v2/drivers/gpio" - "gobot.io/x/gobot/v2/platforms/firmata" + "gobot.io/x/gobot/v2" + "gobot.io/x/gobot/v2/drivers/gpio" + "gobot.io/x/gobot/v2/platforms/firmata" ) func main() { - firmataAdaptor := firmata.NewTCPAdaptor("192.168.0.66:3030") - led := gpio.NewLedDriver(firmataAdaptor, "2") - - work := func() { - gobot.Every(1*time.Second, func() { - led.Toggle() - }) - } - - robot := gobot.NewRobot("bot", - []gobot.Connection{firmataAdaptor}, - []gobot.Device{led}, - work, - ) - - robot.Start() + firmataAdaptor := firmata.NewTCPAdaptor("192.168.0.66:3030") + led := gpio.NewLedDriver(firmataAdaptor, "2") + + work := func() { + gobot.Every(1*time.Second, func() { + led.Toggle() + }) + } + + robot := gobot.NewRobot("bot", + []gobot.Connection{firmataAdaptor}, + []gobot.Device{led}, + work, + ) + + robot.Start() } ``` -**Important** note that analog pins A4 and A5 are normally used by the Firmata I2C interface, so you will not be able to use them as analog inputs without changing the Firmata sketch. - +**Important** note that analog pins A4 and A5 are normally used by the Firmata I2C interface, so you will not be able to +use them as analog inputs without changing the Firmata sketch. ## How to Connect ### Upload the Firmata Firmware to the Arduino -This section assumes you're using an Arduino Uno or another compatible board. If you already have the Firmata sketch installed, you can skip straight to the examples. +This section assumes you're using an Arduino Uno or another compatible board. If you already have the Firmata sketch installed, +you can skip straight to the examples. ### OS X @@ -101,22 +105,24 @@ First plug the Arduino into your computer via the USB/serial port. A dialog box will appear telling you that a new network interface has been detected. Click "Network Preferences...", and when it opens, simply click "Apply". -Once plugged in, use [Gort](http://gort.io)'s `gort scan serial` command to find out your connection info and serial port address: +Once plugged in, use [Gort](http://gort.io)'s `gort scan serial` command to find out your connection info and serial port +address: -``` -$ gort scan serial +```sh +gort scan serial ``` Use the `gort arduino install` command to install `avrdude`, this will allow you to upload firmata to the arduino: -``` -$ gort arduino install +```sh +gort arduino install ``` -Once the avrdude uploader is installed we upload the firmata protocol to the arduino, use the arduino serial port address found when you ran `gort scan serial`: +Once the avrdude uploader is installed we upload the firmata protocol to the arduino, use the arduino serial port address +found when you ran `gort scan serial`: -``` -$ gort arduino upload firmata /dev/tty.usbmodem1421 +```sh +gort arduino upload firmata /dev/tty.usbmodem1421 ``` Now you are ready to connect and communicate with the Arduino using serial port connection @@ -127,48 +133,55 @@ Note that Gobot works best with the `tty.` version of the serial port as shown a First plug the Arduino into your computer via the USB/serial port. -Once plugged in, use [Gort](http://gort.io)'s `gort scan serial` command to find out your connection info and serial port address: +Once plugged in, use [Gort](http://gort.io)'s `gort scan serial` command to find out your connection info and serial port +address: -``` -$ gort scan serial +```sh +gort scan serial ``` Use the `gort arduino install` command to install `avrdude`, this will allow you to upload firmata to the arduino: -``` -$ gort arduino install +```sh +gort arduino install ``` -Once the avrdude uploader is installed we upload the firmata protocol to the arduino, use the arduino serial port address found when you ran `gort scan serial`, or leave it blank to use the default address `ttyACM0`: +Once the avrdude uploader is installed we upload the firmata protocol to the arduino, use the arduino serial port address +found when you ran `gort scan serial`, or leave it blank to use the default address `ttyACM0`: -``` -$ gort arduino upload firmata /dev/ttyACM0 +```sh +gort arduino upload firmata /dev/ttyACM0 ``` Now you are ready to connect and communicate with the Arduino using serial port connection ### Windows -First download and install gort for your OS from the [gort.io](gort.io) [downloads page](http://gort.io/documentation/getting_started/downloads/) and install it. +First download and install gort for your OS from the [gort.io](gort.io) [downloads page](http://gort.io/documentation/getting_started/downloads/) +and install it. -Open a command prompt window by right clicking on the start button and choose `Command Prompt (Admin)` (on windows 8.1). Then navigate to the folder where you uncompressed gort (uncomress to a folder first if you haven't done this yet). +Open a command prompt window by right clicking on the start button and choose `Command Prompt (Admin)` (on windows 8.1). +Then navigate to the folder where you uncompressed gort (uncomress to a folder first if you haven't done this yet). Once inside the gort folder, first install avrdude which we'll use to upload firmata to the arduino. -``` -$ gort arduino install +```cmd +gort arduino install ``` -When the installation is complete, close the command prompt window and open a new one. We need to do this for the env variables to reload. +When the installation is complete, close the command prompt window and open a new one. We need to do this for the env variables +to reload. -``` -$ gort scan serial +```cmd +gort scan serial ``` -Take note of your arduinos serialport address (COM1 | COM2 | COM3| etc). You need to already have installed the arduino drivers from [arduino.cc/en/Main/Software](https://www.arduino.cc/en/Main/Software). Finally upload the firmata protocol sketch to the arduino. +Take note of your arduinos serialport address (COM1 | COM2 | COM3| etc). You need to already have installed the arduino +drivers from [arduino.cc/en/Main/Software](https://www.arduino.cc/en/Main/Software). Finally upload the firmata protocol +sketch to the arduino. -``` -$ gort arduino upload firmata +```cmd +gort arduino upload firmata ``` Make sure to substitute `` with the apropiate serialport address. @@ -182,13 +195,15 @@ for your arduino and click upload. Wait for the upload to finish and you should with your arduino. ## Hardware Support + The following Firmata devices have been tested and are known to work: - - [Arduino Uno R3](http://arduino.cc/en/Main/arduinoBoardUno) - - [Arduino/Genuino 101](https://www.arduino.cc/en/Main/ArduinoBoard101) - - [Teensy 3.0](http://www.pjrc.com/store/teensy3.html) +- [Arduino Uno R3](http://arduino.cc/en/Main/arduinoBoardUno) +- [Arduino/Genuino 101](https://www.arduino.cc/en/Main/ArduinoBoard101) +- [Teensy 3.0](http://www.pjrc.com/store/teensy3.html) The following WiFi devices have been tested and are known to work: - - [NodeMCU 1.0](http://nodemcu.com/index_en.html) + +- [NodeMCU 1.0](http://nodemcu.com/index_en.html) More devices are coming soon... diff --git a/platforms/firmata/doc.go b/platforms/firmata/doc.go index 2677c01e9..adf227c12 100644 --- a/platforms/firmata/doc.go +++ b/platforms/firmata/doc.go @@ -3,7 +3,7 @@ Package firmata provides the Gobot adaptor for microcontrollers that support the Installing: - go get -d -u gobot.io/x/gobot/v2/... && go get gobot.io/x/gobot/v2/platforms/firmata + Please refer to the main [README.md](https://github.com/hybridgroup/gobot/blob/release/README.md) Example: diff --git a/platforms/holystone/hs200/README.md b/platforms/holystone/hs200/README.md index f6067ea18..7357f3a9d 100644 --- a/platforms/holystone/hs200/README.md +++ b/platforms/holystone/hs200/README.md @@ -3,18 +3,18 @@ This package contains the Gobot driver for the Holystone HS200 drone. For more information on this drone, go to: -http://www.holystone.com/product/Holy_Stone_HS200W_FPV_Drone_with_720P_HD_Live_Video_Wifi_Camera_2_4GHz_4CH_6_Axis_Gyro_RC_Quadcopter_with_Altitude_Hold,_Gravity_Sensor_and_Headless_Mode_Function_RTF,_Color_Red-39.html + ## How to Install -``` -go get -d -u gobot.io/x/gobot/v2/... -``` +Please refer to the main [README.md](https://github.com/hybridgroup/gobot/blob/release/README.md) ## How to Use + - Connect to the drone's Wi-Fi network and identify the drone/gateway IP address. - Use that IP address when you create a new driver. -- Some drones appear to use a different TCP port (8080 vs. 8888?). If the example doesn't work scan the drone for open ports or modify the driver not to use TCP. +- Some drones appear to use a different TCP port (8080 vs. 8888?). If the example doesn't work scan the drone for open + ports or modify the driver not to use TCP. Here is a sample of how you initialize and use the driver: @@ -22,45 +22,49 @@ Here is a sample of how you initialize and use the driver: package main import ( - "time" + "time" - "gobot.io/x/gobot/v2" - "gobot.io/x/gobot/v2/platforms/holystone/hs200" + "gobot.io/x/gobot/v2" + "gobot.io/x/gobot/v2/platforms/holystone/hs200" ) func main() { - drone := hs200.NewDriver("172.16.10.1:8888", "172.16.10.1:8080") + drone := hs200.NewDriver("172.16.10.1:8888", "172.16.10.1:8080") - work := func() { - drone.TakeOff() + work := func() { + drone.TakeOff() - gobot.After(5*time.Second, func() { - drone.Land() - }) - } + gobot.After(5*time.Second, func() { + drone.Land() + }) + } - robot := gobot.NewRobot("hs200", - []gobot.Connection{}, - []gobot.Device{drone}, - work, - ) + robot := gobot.NewRobot("hs200", + []gobot.Connection{}, + []gobot.Device{drone}, + work, + ) - robot.Start() + robot.Start() } ``` ## References -https://hackaday.io/project/19356/logs -https://github.com/lancecaraccioli/holystone-hs110w + + + ## Random notes -- The hs200 sends out an RTSP video feed from its own board camera. Not clear how this is turned on. The data is apparently streamed over UDP. (Reference mentions rtsp://192.168.0.1/0 in VLC, I didn't try it!) + +- The hs200 sends out an RTSP video feed from its own board camera. Not clear how this is turned on. The data is + apparently streamed over UDP. (Reference mentions rtsp://192.168.0.1/0 in VLC, I didn't try it!) - The Android control app seems to be sending out the following TCP bytes for an unknown purpose: -`00 01 02 03 04 05 06 07 08 09 25 25` but the drone flies without a TCP connection. + `00 01 02 03 04 05 06 07 08 09 25 25` but the drone flies without a TCP connection. - The drone apparently always replies "noact\r\n" over TCP. - The app occasionally sends out 29 bytes long UDP packets besides the 11 byte control packet for an unknown purpose: -`26 e1 07 00 00 07 00 00 00 10 00 00 00 00 00 00 00 14 00 00 00 0e 00 00 00 03 00 00 00` + `26 e1 07 00 00 07 00 00 00 10 00 00 00 00 00 00 00 14 00 00 00 0e 00 00 00 03 00 00 00` - The doesn't seem to be any telemetry coming out of the drone besides the video feed. -- The drone can sometimes be a little flaky. Ensure you've got a fully charged battery, minimal Wi-Fi interference, various connectors on the drone all well seated. +- The drone can sometimes be a little flaky. Ensure you've got a fully charged battery, minimal Wi-Fi interference, + various connectors on the drone all well seated. - It's not clear whether the drone's remote uses Wi-Fi or not, possibly Wi-Fi is only for the mobile app. diff --git a/platforms/intel-iot/curie/README.md b/platforms/intel-iot/curie/README.md index cc4fdc180..45b5eee11 100644 --- a/platforms/intel-iot/curie/README.md +++ b/platforms/intel-iot/curie/README.md @@ -1,18 +1,20 @@ # Curie -The Intel Curie is a tiny computer for the Internet of Things. It is the processor used by the [Arduino/Genuino 101](https://www.arduino.cc/en/Main/ArduinoBoard101) and the [Intel TinyTILE](https://software.intel.com/en-us/node/675623). +The Intel Curie is a tiny computer for the Internet of Things. It is the processor used by the [Arduino/Genuino 101](https://www.arduino.cc/en/Main/ArduinoBoard101) +and the [Intel TinyTILE](https://software.intel.com/en-us/node/675623). -In addition to the GPIO, ADC, and I2C hardware interfaces, the Curie also has a built-in Inertial Measurement Unit (IMU), including an accelerometer, gyroscope, and thermometer. +In addition to the GPIO, ADC, and I2C hardware interfaces, the Curie also has a built-in Inertial Measurement Unit (IMU), +including an accelerometer, gyroscope, and thermometer. For more info about the Intel Curie platform go to: [https://www.intel.com/content/www/us/en/products/boards-kits/curie.html](https://www.intel.com/content/www/us/en/products/boards-kits/curie.html). ## How to Install -You would normally install Go and Gobot on your computer. When you execute the Gobot program code, it communicates with the connected microcontroller using the [Firmata protocol](https://github.com/firmata/protocol), either using a serial port, or the Bluetooth LE wireless interface. +Please refer to the main [README.md](https://github.com/hybridgroup/gobot/blob/release/README.md) -``` -go get -d -u gobot.io/x/gobot/v2/... -``` +You would normally install Go and Gobot on your computer. When you execute the Gobot program code, it communicates with +the connected microcontroller using the [Firmata protocol](https://github.com/firmata/protocol), either using a serial +port, or the Bluetooth LE wireless interface. ## How To Use @@ -20,51 +22,51 @@ go get -d -u gobot.io/x/gobot/v2/... package main import ( - "log" - "time" + "log" + "time" - "gobot.io/x/gobot/v2" - "gobot.io/x/gobot/v2/drivers/gpio" - "gobot.io/x/gobot/v2/platforms/firmata" - "gobot.io/x/gobot/v2/platforms/intel-iot/curie" + "gobot.io/x/gobot/v2" + "gobot.io/x/gobot/v2/drivers/gpio" + "gobot.io/x/gobot/v2/platforms/firmata" + "gobot.io/x/gobot/v2/platforms/intel-iot/curie" ) func main() { - firmataAdaptor := firmata.NewAdaptor("/dev/ttyACM0") - led := gpio.NewLedDriver(firmataAdaptor, "13") - imu := curie.NewIMUDriver(firmataAdaptor) - - work := func() { - imu.On("Accelerometer", func(data interface{}) { - log.Println("Accelerometer", data) - }) - - imu.On("Gyroscope", func(data interface{}) { - log.Println("Gyroscope", data) - }) - - imu.On("Temperature", func(data interface{}) { - log.Println("Temperature", data) - }) - - gobot.Every(1*time.Second, func() { - led.Toggle() - }) - - gobot.Every(100*time.Millisecond, func() { - imu.ReadAccelerometer() - imu.ReadGyroscope() - imu.ReadTemperature() - }) - } - - robot := gobot.NewRobot("curieBot", - []gobot.Connection{firmataAdaptor}, - []gobot.Device{imu, led}, - work, - ) - - robot.Start() + firmataAdaptor := firmata.NewAdaptor("/dev/ttyACM0") + led := gpio.NewLedDriver(firmataAdaptor, "13") + imu := curie.NewIMUDriver(firmataAdaptor) + + work := func() { + imu.On("Accelerometer", func(data interface{}) { + log.Println("Accelerometer", data) + }) + + imu.On("Gyroscope", func(data interface{}) { + log.Println("Gyroscope", data) + }) + + imu.On("Temperature", func(data interface{}) { + log.Println("Temperature", data) + }) + + gobot.Every(1*time.Second, func() { + led.Toggle() + }) + + gobot.Every(100*time.Millisecond, func() { + imu.ReadAccelerometer() + imu.ReadGyroscope() + imu.ReadTemperature() + }) + } + + robot := gobot.NewRobot("curieBot", + []gobot.Connection{firmataAdaptor}, + []gobot.Device{imu, led}, + work, + ) + + robot.Start() } ``` @@ -77,29 +79,29 @@ You need to flash your Intel Curie with firmware that uses ConfigurableFirmata a To setup your Arduino environment: - Install the latest Arduino, if you have not done so yet. -- Install the "Intel Curie Boards" board files using the "Board Manager". You can find it in the Arduino IDE under the "Tools" menu. Choose "Boards > Boards Manager". - - Search for the "Intel Curie Boards" package in the "Boards Manager" dialog, and then install the latest version. - -- Download the ZIP file for the ConfigurableFirmata library. You can download the latest version of the ConfigurableFirmata from here: - - [https://github.com/firmata/ConfigurableFirmata/archive/master.zip](https://github.com/firmata/ConfigurableFirmata/archive/master.zip) - - Once you have downloaded ConfigurableFirmata, install it by using the "Library Manager". You can find it in the Arduino IDE under the "Sketch" menu. Choose "Include Library > Add .ZIP Library". Select the ZIP file for the ConfigurableFirmata library that you just downloaded. - +- Install the "Intel Curie Boards" board files using the "Board Manager". You can find it in the Arduino IDE under the + "Tools" menu. Choose "Boards > Boards Manager". +- Search for the "Intel Curie Boards" package in the "Boards Manager" dialog, and then install the latest version. +- Download the ZIP file for the ConfigurableFirmata library. You can download the latest version of the ConfigurableFirmata + from here: + [https://github.com/firmata/ConfigurableFirmata/archive/master.zip](https://github.com/firmata/ConfigurableFirmata/archive/master.zip) + Once you have downloaded ConfigurableFirmata, install it by using the "Library Manager". You can find it in the Arduino + IDE under the "Sketch" menu. Choose "Include Library > Add .ZIP Library". Select the ZIP file for the ConfigurableFirmata + library that you just downloaded. - Download the ZIP file for the FirmataCurieIMU library. You can download the latest version of FirmataCurieIMU from here: - - [https://github.com/intel-iot-devkit/firmata-curie-imu/archive/master.zip](https://github.com/intel-iot-devkit/firmata-curie-imu/archive/master.zip) - - Once you have downloaded the FirmataCurieIMU library, install it by using the "Library Manager". You can find it in the Arduino IDE under the "Sketch" menu. Choose "Include Library > Add .ZIP Library". Select the ZIP file for the FirmataCurieIMU library that you just downloaded. - -- Linux only: On some Linux distributions, additional device rules are required in order to connect to the board. Run the following command then unplug the board and plug it back in before proceeding: + [https://github.com/intel-iot-devkit/firmata-curie-imu/archive/master.zip](https://github.com/intel-iot-devkit/firmata-curie-imu/archive/master.zip) +- Once you have downloaded the FirmataCurieIMU library, install it by using the "Library Manager". You can find it in the + Arduino IDE under the "Sketch" menu. Choose "Include Library > Add .ZIP Library". Select the ZIP file for the FirmataCurieIMU + library that you just downloaded. +- Linux only: On some Linux distributions, additional device rules are required in order to connect to the board. Run the + following command then unplug the board and plug it back in before proceeding: ```sh curl -sL https://raw.githubusercontent.com/01org/corelibs-arduino101/master/scripts/create_dfu_udev_rule | sudo -E bash - ``` -Now you are ready to install your firmware. You must decide if you want to connect via the serial port, or using Bluetooth LE. +Now you are ready to install your firmware. You must decide if you want to connect via the serial port, or using +Bluetooth LE. ### Serial Port @@ -107,7 +109,9 @@ To use your Intel Curie connected via serial port, you should use the sketch loc [https://github.com/intel-iot-devkit/firmata-curie-imu/blob/master/examples/everythingIMU/everythingIMU.ino](https://github.com/intel-iot-devkit/firmata-curie-imu/blob/master/examples/everythingIMU/everythingIMU.ino) -Once you have loaded this sketch on your Intel Curie, you can run your Gobot code to communicate with it. Leave your Arduino 101 or TinyTILE connected using the serial cable that you used to flash the firmware, and refer to that same serial port name in your Gobot code. +Once you have loaded this sketch on your Intel Curie, you can run your Gobot code to communicate with it. Leave your +Arduino 101 or TinyTILE connected using the serial cable that you used to flash the firmware, and refer to that same serial +port name in your Gobot code. ### Bluetooth LE @@ -117,4 +121,5 @@ To use your Intel Curie connected via Bluetooth LE, you should use the sketch lo Once you have loaded this sketch on your Intel Curie, you can run your Gobot code to communicate with it. -Power up your Arduino 101 or TinyTILE using a battery or other power source, and connect using the BLE address or name. The default BLE name is "FIRMATA". +Power up your Arduino 101 or TinyTILE using a battery or other power source, and connect using the BLE address or name. +The default BLE name is "FIRMATA". diff --git a/platforms/intel-iot/edison/README.md b/platforms/intel-iot/edison/README.md index cc7e4dcd8..8334b34ce 100644 --- a/platforms/intel-iot/edison/README.md +++ b/platforms/intel-iot/edison/README.md @@ -1,40 +1,39 @@ # Edison -The Intel Edison is a WiFi and Bluetooth enabled development platform for the Internet of Things. It packs a robust set of features into its small size and supports a broad spectrum of I/O and software support. +The Intel Edison is a WiFi and Bluetooth enabled development platform for the Internet of Things. It packs a robust set +of features into its small size and supports a broad spectrum of I/O and software support. For more info about the Edison platform click [here](http://www.intel.com/content/www/us/en/do-it-yourself/edison.html). ## How to Install -You would normally install Go and Gobot on your workstation. Once installed, cross compile your program on your workstation, transfer the final executable to your Intel Edison, and run the program on the Intel Edison itself as documented here. - -``` -go get -d -u gobot.io/x/gobot/v2/... -``` +Please refer to the main [README.md](https://github.com/hybridgroup/gobot/blob/release/README.md) ### Setting up your Intel Edison Everything you need to get started with the Edison is in the Intel Getting Started Guide: -https://software.intel.com/en-us/iot/library/edison-getting-started + Don't forget to configure your Edison's wifi connection and flash your Edison with the latest firmware image! The recommended way to connect to your device is via wifi, for that follow the directions here: -https://software.intel.com/en-us/connecting-your-intel-edison-board-using-wifi + -If you don't have a wifi network available, the Intel documentation explains how to use another connection type, but note that this guide assumes you are using wifi connection. +If you don't have a wifi network available, the Intel documentation explains how to use another connection type, but note +that this guide assumes you are using wifi connection. You can obtain the IP address of your Edison, by running the floowing command: -``` +```sh ip addr show | grep inet ``` -Don't forget to setup the a password for the device otherwise you won't be able to connect using SSH. From within the screen session, run the following command: +Don't forget to setup the a password for the device otherwise you won't be able to connect using SSH. From within the screen +session, run the following command: -``` +```ah configure_edison --password ``` @@ -43,38 +42,36 @@ later on you aren't able to scp to the device, try to reset the password. This password will obviously be needed next time you connect to your device. - ## How To Use - ```go package main import ( - "time" + "time" - "gobot.io/x/gobot/v2" - "gobot.io/x/gobot/v2/drivers/gpio" - "gobot.io/x/gobot/v2/platforms/intel-iot/edison" + "gobot.io/x/gobot/v2" + "gobot.io/x/gobot/v2/drivers/gpio" + "gobot.io/x/gobot/v2/platforms/intel-iot/edison" ) func main() { - e := edison.NewAdaptor() - led := gpio.NewLedDriver(e, "13") - - work := func() { - gobot.Every(1*time.Second, func() { - led.Toggle() - }) - } - - robot := gobot.NewRobot("blinkBot", - []gobot.Connection{e}, - []gobot.Device{led}, - work, - ) - - robot.Start() + e := edison.NewAdaptor() + led := gpio.NewLedDriver(e, "13") + + work := func() { + gobot.Every(1*time.Second, func() { + led.Toggle() + }) + } + + robot := gobot.NewRobot("blinkBot", + []gobot.Connection{e}, + []gobot.Device{led}, + work, + ) + + robot.Start() } ``` @@ -86,15 +83,16 @@ You can read the [full API documentation online](http://godoc.org/gobot.io/x/gob Compile your Gobot program on your workstation like this: -```bash -$ GOARCH=386 GOOS=linux go build examples/edison_blink.go +```sh +GOARCH=386 GOOS=linux go build examples/edison_blink.go ``` -Once you have compiled your code, you can you can upload your program and execute it on the Intel Edison from your workstation using the `scp` and `ssh` commands like this: +Once you have compiled your code, you can you can upload your program and execute it on the Intel Edison from your workstation +using the `scp` and `ssh` commands like this: -```bash -$ scp edison_blink root@:/home/root/ -$ ssh -t root@ "./edison_blink" +```sh +scp edison_blink root@:/home/root/ +ssh -t root@ "./edison_blink" ``` At this point you should see one of the onboard LEDs blinking. Press control + c diff --git a/platforms/intel-iot/joule/README.md b/platforms/intel-iot/joule/README.md index 9204d4f1a..7800e61eb 100644 --- a/platforms/intel-iot/joule/README.md +++ b/platforms/intel-iot/joule/README.md @@ -4,55 +4,51 @@ The Intel Joule is a WiFi and Bluetooth enabled development platform for the Int For more info about the Intel Joule platform go to: -http://www.intel.com/joule + ## How to Install -You would normally install Go and Gobot on your workstation. Once installed, cross compile your program on your workstation, transfer the final executable to your Intel Joule, and run the program on the Intel Joule itself as documented here. - -``` -go get -d -u gobot.io/x/gobot/v2/... -``` +Please refer to the main [README.md](https://github.com/hybridgroup/gobot/blob/release/README.md) ### Setting up your Intel Joule Everything you need to get started with the Joule is in the Intel Getting Started Guide located at: -https://intel.com/joule/getstarted + -Don't forget to configure your Joule's WiFi connection and update your Joule to the latest firmware image. Gobot has been tested using the reference OS based on Ostro. +Don't forget to configure your Joule's WiFi connection and update your Joule to the latest firmware image. Gobot has been +tested using the reference OS based on Ostro. ## How To Use - ```go package main import ( - "time" + "time" - "gobot.io/x/gobot/v2" - "gobot.io/x/gobot/v2/drivers/gpio" - "gobot.io/x/gobot/v2/platforms/intel-iot/joule" + "gobot.io/x/gobot/v2" + "gobot.io/x/gobot/v2/drivers/gpio" + "gobot.io/x/gobot/v2/platforms/intel-iot/joule" ) func main() { - e := joule.NewAdaptor() - led := gpio.NewLedDriver(e, "GP103") - - work := func() { - gobot.Every(1*time.Second, func() { - led.Toggle() - }) - } - - robot := gobot.NewRobot("blinkBot", - []gobot.Connection{e}, - []gobot.Device{led}, - work, - ) - - robot.Start() + e := joule.NewAdaptor() + led := gpio.NewLedDriver(e, "GP103") + + work := func() { + gobot.Every(1*time.Second, func() { + led.Toggle() + }) + } + + robot := gobot.NewRobot("blinkBot", + []gobot.Connection{e}, + []gobot.Device{led}, + work, + ) + + robot.Start() } ``` @@ -64,15 +60,16 @@ You can read the [full API documentation online](http://godoc.org/gobot.io/x/gob Compile your Gobot program on your workstation like this: -```bash -$ GOARCH=386 GOOS=linux go build joule_blink.go +```sh +GOARCH=386 GOOS=linux go build joule_blink.go ``` -Once you have compiled your code, you can you can upload your program and execute it on the Intel Joule from your workstation using the `scp` and `ssh` commands like this: +Once you have compiled your code, you can you can upload your program and execute it on the Intel Joule from your workstation +using the `scp` and `ssh` commands like this: -```bash -$ scp joule_blink root@:/home/root/ -$ ssh -t root@ "./joule_blink" +```sh +scp joule_blink root@:/home/root/ +ssh -t root@ "./joule_blink" ``` At this point you should see one of the onboard LEDs blinking. Press control + c @@ -85,8 +82,10 @@ over once again and start it from the command line (via screen). The Gobot pin mapping for the Intel Joule uses a naming system based on how the pins are labeled on the board itself. -There are 2 jumpers on the Joule expansion board, labeled "J12" and "J13". There are 2 rows of pins on each jumper, labeled from 1 to 40. So to use the 26th pin of jumper J12, you use pin name "J12_26". +There are 2 jumpers on the Joule expansion board, labeled "J12" and "J13". There are 2 rows of pins on each jumper, labeled +from 1 to 40. So to use the 26th pin of jumper J12, you use pin name "J12_26". In addition, there are pins that control the build-in LEDs (pins GP100 thru GP103) as used in the example above. -The i2c interfaces on the Intel Joule developer kit board require that you terminate the SDA & SCL lines using 2 10K resistors pulled up to the voltage used for the i2c device, for example 5V. +The i2c interfaces on the Intel Joule developer kit board require that you terminate the SDA & SCL lines using 2 10K resistors +pulled up to the voltage used for the i2c device, for example 5V. diff --git a/platforms/jetson/README.md b/platforms/jetson/README.md index 928d34e79..18fde6556 100644 --- a/platforms/jetson/README.md +++ b/platforms/jetson/README.md @@ -8,13 +8,10 @@ For more info about the Jetson Nano platform, click [here](https://developer.nvi ## How to Install -We recommend updating to the latest jetson-nano OS when using the Jetson Nano, however Gobot should also support older versions of the OS, should your application require this. +Please refer to the main [README.md](https://github.com/hybridgroup/gobot/blob/release/README.md) -You would normally install Go and Gobot on your workstation. Once installed, cross compile your program on your workstation, transfer the final executable to your Jetson Nano, and run the program on the Jetson Nano as documented here. - -``` -go get -d -u gobot.io/x/gobot/v2/... -``` +We recommend updating to the latest jetson-nano OS when using the Jetson Nano, however Gobot should also support older +versions of the OS, should your application require this. ## How to Use @@ -24,30 +21,30 @@ The pin numbering used by your Gobot program should match the way your board is package main import ( - "time" + "time" - "gobot.io/x/gobot/v2" - "gobot.io/x/gobot/v2/drivers/gpio" - "gobot.io/x/gobot/v2/platforms/jetson" + "gobot.io/x/gobot/v2" + "gobot.io/x/gobot/v2/drivers/gpio" + "gobot.io/x/gobot/v2/platforms/jetson" ) func main() { - r := jetson.NewAdaptor() - led := gpio.NewLedDriver(r, "40") + r := jetson.NewAdaptor() + led := gpio.NewLedDriver(r, "40") - work := func() { - gobot.Every(1*time.Second, func() { - led.Toggle() - }) - } + work := func() { + gobot.Every(1*time.Second, func() { + led.Toggle() + }) + } - robot := gobot.NewRobot("blinkBot", - []gobot.Connection{r}, - []gobot.Device{led}, - work, - ) + robot := gobot.NewRobot("blinkBot", + []gobot.Connection{r}, + []gobot.Device{led}, + work, + ) - robot.Start() + robot.Start() } ``` @@ -56,9 +53,10 @@ func main() { ### Compiling -Once you have compiled your code, you can upload your program and execute it on the Jetson Nano from your workstation using the `scp` and `ssh` commands like this: +Once you have compiled your code, you can upload your program and execute it on the Jetson Nano from your workstation using +the `scp` and `ssh` commands like this: -```bash -$ scp jetson-nano_blink jn@192.168.1.xxx:/home/jn/ -$ ssh -t jn@192.168.1.xxx "./jetson-nano_blink" +```sh +scp jetson-nano_blink jn@192.168.1.xxx:/home/jn/ +ssh -t jn@192.168.1.xxx "./jetson-nano_blink" ``` diff --git a/platforms/joystick/README.md b/platforms/joystick/README.md index 360cde7d3..5e4b9d2cc 100644 --- a/platforms/joystick/README.md +++ b/platforms/joystick/README.md @@ -3,6 +3,7 @@ You can use Gobot with any USB joystick or game controller that is compatible with [Simple DirectMedia Layer](http://www.libsdl.org/). Current configurations included: + - Dualshock3 game controller - Dualshock4 game controller - Dualsense game controller @@ -19,35 +20,31 @@ This package requires `sdl2` to be installed on your system To install `sdl2` on macOS using Homebrew: -``` -$ brew install sdl2 +```sh +brew install sdl2 ``` To use an XBox360 controller on macOS, you will most likely need to install additional software such as [https://github.com/360Controller/360Controller](https://github.com/360Controller/360Controller). ### Linux (Ubuntu and Raspbian) +Please refer to the main [README.md](https://github.com/hybridgroup/gobot/blob/release/README.md) + You must be running a Linux kernel that is v4.14+ in order for the various controller mappings to work as expected. Then you must install the latest SDL2 v2.0.8 or greater: -``` +```sh wget https://www.libsdl.org/release/SDL2-2.0.8.tar.gz tar -zxvf SDL2-2.0.8.tar.gz cd SDL2-2.0.8/ ./configure && make && sudo make install ``` -Now you can install the package with - -``` -go get -d -u gobot.io/x/gobot/v2/... -``` - ## How to Use -Controller configurations are stored in Gobot it, but you can also use external file in JSON format. Take a look at the `configs` directory for examples. - +Controller configurations are stored in Gobot it, but you can also use external file in JSON format. Take a look at the +`configs` directory for examples. ## How to Connect @@ -63,100 +60,101 @@ This small program receives joystick and button press events from an PlayStation package main import ( - "fmt" + "fmt" - "gobot.io/x/gobot/v2" - "gobot.io/x/gobot/v2/platforms/joystick" + "gobot.io/x/gobot/v2" + "gobot.io/x/gobot/v2/platforms/joystick" ) func main() { - joystickAdaptor := joystick.NewAdaptor() - stick := joystick.NewDriver(joystickAdaptor, "dualshock3", - ) - - work := func() { - // buttons - stick.On(joystick.SquarePress, func(data interface{}) { - fmt.Println("square_press") - }) - stick.On(joystick.SquareRelease, func(data interface{}) { - fmt.Println("square_release") - }) - stick.On(joystick.TrianglePress, func(data interface{}) { - fmt.Println("triangle_press") - }) - stick.On(joystick.TriangleRelease, func(data interface{}) { - fmt.Println("triangle_release") - }) - stick.On(joystick.CirclePress, func(data interface{}) { - fmt.Println("circle_press") - }) - stick.On(joystick.CircleRelease, func(data interface{}) { - fmt.Println("circle_release") - }) - stick.On(joystick.XPress, func(data interface{}) { - fmt.Println("x_press") - }) - stick.On(joystick.XRelease, func(data interface{}) { - fmt.Println("x_release") - }) - stick.On(joystick.StartPress, func(data interface{}) { - fmt.Println("start_press") - }) - stick.On(joystick.StartRelease, func(data interface{}) { - fmt.Println("start_release") - }) - stick.On(joystick.SelectPress, func(data interface{}) { - fmt.Println("select_press") - }) - stick.On(joystick.SelectRelease, func(data interface{}) { - fmt.Println("select_release") - }) - - // joysticks - stick.On(joystick.LeftX, func(data interface{}) { - fmt.Println("left_x", data) - }) - stick.On(joystick.LeftY, func(data interface{}) { - fmt.Println("left_y", data) - }) - stick.On(joystick.RightX, func(data interface{}) { - fmt.Println("right_x", data) - }) - stick.On(joystick.RightY, func(data interface{}) { - fmt.Println("right_y", data) - }) - - // triggers - stick.On(joystick.R1Press, func(data interface{}) { - fmt.Println("R1Press", data) - }) - stick.On(joystick.R2Press, func(data interface{}) { - fmt.Println("R2Press", data) - }) - stick.On(joystick.L1Press, func(data interface{}) { - fmt.Println("L1Press", data) - }) - stick.On(joystick.L2Press, func(data interface{}) { - fmt.Println("L2Press", data) - }) - } - - robot := gobot.NewRobot("joystickBot", - []gobot.Connection{joystickAdaptor}, - []gobot.Device{stick}, - work, - ) - - robot.Start() + joystickAdaptor := joystick.NewAdaptor() + stick := joystick.NewDriver(joystickAdaptor, "dualshock3", + ) + + work := func() { + // buttons + stick.On(joystick.SquarePress, func(data interface{}) { + fmt.Println("square_press") + }) + stick.On(joystick.SquareRelease, func(data interface{}) { + fmt.Println("square_release") + }) + stick.On(joystick.TrianglePress, func(data interface{}) { + fmt.Println("triangle_press") + }) + stick.On(joystick.TriangleRelease, func(data interface{}) { + fmt.Println("triangle_release") + }) + stick.On(joystick.CirclePress, func(data interface{}) { + fmt.Println("circle_press") + }) + stick.On(joystick.CircleRelease, func(data interface{}) { + fmt.Println("circle_release") + }) + stick.On(joystick.XPress, func(data interface{}) { + fmt.Println("x_press") + }) + stick.On(joystick.XRelease, func(data interface{}) { + fmt.Println("x_release") + }) + stick.On(joystick.StartPress, func(data interface{}) { + fmt.Println("start_press") + }) + stick.On(joystick.StartRelease, func(data interface{}) { + fmt.Println("start_release") + }) + stick.On(joystick.SelectPress, func(data interface{}) { + fmt.Println("select_press") + }) + stick.On(joystick.SelectRelease, func(data interface{}) { + fmt.Println("select_release") + }) + + // joysticks + stick.On(joystick.LeftX, func(data interface{}) { + fmt.Println("left_x", data) + }) + stick.On(joystick.LeftY, func(data interface{}) { + fmt.Println("left_y", data) + }) + stick.On(joystick.RightX, func(data interface{}) { + fmt.Println("right_x", data) + }) + stick.On(joystick.RightY, func(data interface{}) { + fmt.Println("right_y", data) + }) + + // triggers + stick.On(joystick.R1Press, func(data interface{}) { + fmt.Println("R1Press", data) + }) + stick.On(joystick.R2Press, func(data interface{}) { + fmt.Println("R2Press", data) + }) + stick.On(joystick.L1Press, func(data interface{}) { + fmt.Println("L1Press", data) + }) + stick.On(joystick.L2Press, func(data interface{}) { + fmt.Println("L2Press", data) + }) + } + + robot := gobot.NewRobot("joystickBot", + []gobot.Connection{joystickAdaptor}, + []gobot.Device{stick}, + work, + ) + + robot.Start() } ``` ## How to Add A New Joystick -In the `bin` directory for this package is a CLI utility program that scans for SDL joystick events, and displays the ID and value: +In the `bin` directory for this package is a CLI utility program that scans for SDL joystick events, and displays the ID +and value: -``` +```sh $ go run ./platforms/joystick/bin/scanner.go Joystick 0 connected [6625 ms] Axis: 1 value:-22686 @@ -172,4 +170,6 @@ Joystick 0 connected [10345 ms] Axis: 0 value:0 ``` -You can use the output from this program to create a JSON file for the various buttons and axes on your joystick/gamepad. You could also create a file similar to `joystick_dualshock3.go` and submit a pull request with the new configuration so others can use it as well. +You can use the output from this program to create a JSON file for the various buttons and axes on your joystick/gamepad. +You could also create a file similar to `joystick_dualshock3.go` and submit a pull request with the new configuration so +others can use it as well. diff --git a/platforms/joystick/doc.go b/platforms/joystick/doc.go index a42bac57a..c0f7c8f60 100644 --- a/platforms/joystick/doc.go +++ b/platforms/joystick/doc.go @@ -3,10 +3,9 @@ Package joystick provides the Gobot adaptor and drivers for game controllers tha Installing: -This package requires `sdl2` to be installed on your system -Then install package with: + This package requires `sdl2` to be installed on your system - go get gobot.io/x/gobot/v2/platforms/joystick + Please refer to the main [README.md](https://github.com/hybridgroup/gobot/blob/release/README.md) Example: diff --git a/platforms/keyboard/README.md b/platforms/keyboard/README.md index 662811f91..2044a1624 100644 --- a/platforms/keyboard/README.md +++ b/platforms/keyboard/README.md @@ -4,9 +4,7 @@ This module implements support for keyboard events, wrapping the `stty` utility. ## How to Install -``` -go get -d -u gobot.io/x/gobot/v2/... -``` +Please refer to the main [README.md](https://github.com/hybridgroup/gobot/blob/release/README.md) ## How to Use @@ -16,33 +14,33 @@ Example parsing key events package main import ( - "fmt" + "fmt" - "gobot.io/x/gobot/v2" - "gobot.io/x/gobot/v2/platforms/keyboard" + "gobot.io/x/gobot/v2" + "gobot.io/x/gobot/v2/platforms/keyboard" ) func main() { - keys := keyboard.NewDriver() - - work := func() { - keys.On(keyboard.Key, func(data interface{}) { - key := data.(keyboard.KeyEvent) - - if key.Key == keyboard.A { - fmt.Println("A pressed!") - } else { - fmt.Println("keyboard event!", key, key.Char) - } - }) - } - - robot := gobot.NewRobot("keyboardbot", - []gobot.Connection{}, - []gobot.Device{keys}, - work, - ) - - robot.Start() + keys := keyboard.NewDriver() + + work := func() { + keys.On(keyboard.Key, func(data interface{}) { + key := data.(keyboard.KeyEvent) + + if key.Key == keyboard.A { + fmt.Println("A pressed!") + } else { + fmt.Println("keyboard event!", key, key.Char) + } + }) + } + + robot := gobot.NewRobot("keyboardbot", + []gobot.Connection{}, + []gobot.Device{keys}, + work, + ) + + robot.Start() } ``` diff --git a/platforms/keyboard/doc.go b/platforms/keyboard/doc.go index 012a05b2b..e7e364c69 100644 --- a/platforms/keyboard/doc.go +++ b/platforms/keyboard/doc.go @@ -5,7 +5,7 @@ Installing: Then you can install the package with: - go get gobot.io/x/gobot/v2 && go install gobot.io/x/gobot/v2/platforms/keyboard + Please refer to the main [README.md](https://github.com/hybridgroup/gobot/blob/release/README.md) Example: diff --git a/platforms/leap/README.md b/platforms/leap/README.md index 6dc8ae996..c6132061b 100644 --- a/platforms/leap/README.md +++ b/platforms/leap/README.md @@ -1,18 +1,15 @@ # Leap -The Leap Motion is a user-interface device that tracks the user's hand motions, and translates them into events that can control robots and physical computing hardware. +The Leap Motion is a user-interface device that tracks the user's hand motions, and translates them into events that can +control robots and physical computing hardware. For more info about the Leap Motion platform click [Leap Motion](https://www.leapmotion.com/) ## How to Install -First install the [Leap Motion Software](https://www.leapmotion.com/setup) - -Now you can install the package with: +Please refer to the main [README.md](https://github.com/hybridgroup/gobot/blob/release/README.md) -``` -go get -d -u gobot.io/x/gobot/v2/... -``` +First install the [Leap Motion Software](https://www.leapmotion.com/setup) ## How to Use @@ -20,29 +17,29 @@ go get -d -u gobot.io/x/gobot/v2/... package main import ( - "fmt" + "fmt" - "gobot.io/x/gobot/v2" - "gobot.io/x/gobot/v2/platforms/leap" + "gobot.io/x/gobot/v2" + "gobot.io/x/gobot/v2/platforms/leap" ) func main() { - leapMotionAdaptor := leap.NewAdaptor("127.0.0.1:6437") - l := leap.NewDriver(leapMotionAdaptor) - - work := func() { - l.On(l.Event("message"), func(data interface{}) { - fmt.Println(data.(leap.Frame)) - }) - } - - robot := gobot.NewRobot("leapBot", - []gobot.Connection{leapMotionAdaptor}, - []gobot.Device{l}, - work, - ) - - robot.Start() + leapMotionAdaptor := leap.NewAdaptor("127.0.0.1:6437") + l := leap.NewDriver(leapMotionAdaptor) + + work := func() { + l.On(l.Event("message"), func(data interface{}) { + fmt.Println(data.(leap.Frame)) + }) + } + + robot := gobot.NewRobot("leapBot", + []gobot.Connection{leapMotionAdaptor}, + []gobot.Device{l}, + work, + ) + + robot.Start() } ``` @@ -54,16 +51,17 @@ This driver works out of the box with the vanilla installation of the Leap Motio The main steps are: -* Run Leap Motion.app to open a websocket connection in port 6437. -* Connect your Computer and Leap Motion Controller. -* Connect to the device via Gobot. +* Run Leap Motion.app to open a websocket connection in port 6437. +* Connect your Computer and Leap Motion Controller. +* Connect to the device via Gobot. ### Ubuntu -The Linux download of the Leap Motion software can be obtained from [Leap Motion Dev Center](https://developer.leapmotion.com/downloads) (requires free signup) +The Linux download of the Leap Motion software can be obtained from [Leap Motion Dev Center](https://developer.leapmotion.com/downloads) +(requires free signup). The main steps are: -* Run the leapd daemon, to open a websocket connection in port 6437. -* Connect your computer and the Leap Motion controller -* Connect to the device via Gobot +* Run the leapd daemon, to open a websocket connection in port 6437. +* Connect your computer and the Leap Motion controller +* Connect to the device via Gobot diff --git a/platforms/leap/doc.go b/platforms/leap/doc.go index 2a91d1c31..60611e88e 100644 --- a/platforms/leap/doc.go +++ b/platforms/leap/doc.go @@ -3,10 +3,9 @@ Package leap provides the Gobot adaptor and driver for the Leap Motion. Installing: -* First install the [Leap Motion Software](https://www.leapmotion.com/setup). -* Then install the package: - - go get gobot.io/x/gobot/v2/platforms/leap + Please refer to the main [README.md](https://github.com/hybridgroup/gobot/blob/release/README.md) + + Install the [Leap Motion Software](https://www.leapmotion.com/setup). Example: diff --git a/platforms/mavlink/README.md b/platforms/mavlink/README.md index 10724a82e..9e44368d8 100644 --- a/platforms/mavlink/README.md +++ b/platforms/mavlink/README.md @@ -16,10 +16,7 @@ configured to send version 1.0 frames. ## How to Install -``` -go get -d -u gobot.io/x/gobot/v2/... - -``` +Please refer to the main [README.md](https://github.com/hybridgroup/gobot/blob/release/README.md) ## How to Use @@ -27,63 +24,63 @@ go get -d -u gobot.io/x/gobot/v2/... package main import ( - "fmt" + "fmt" - "gobot.io/x/gobot/v2" - "gobot.io/x/gobot/v2/platforms/mavlink" - common "gobot.io/x/gobot/v2/platforms/mavlink/common" + "gobot.io/x/gobot/v2" + "gobot.io/x/gobot/v2/platforms/mavlink" + common "gobot.io/x/gobot/v2/platforms/mavlink/common" ) func main() { - adaptor := mavlink.NewAdaptor("/dev/ttyACM0") - iris := mavlink.NewDriver(adaptor) - - work := func() { - iris.Once(iris.Event("packet"), func(data interface{}) { - packet := data.(*common.MAVLinkPacket) - - dataStream := common.NewRequestDataStream(100, - packet.SystemID, - packet.ComponentID, - 4, - 1, - ) - iris.SendPacket(common.CraftMAVLinkPacket(packet.SystemID, - packet.ComponentID, - dataStream, - )) - }) - - iris.On(iris.Event("message"), func(data interface{}) { - if data.(common.MAVLinkMessage).Id() == 30 { - message := data.(*common.Attitude) - fmt.Println("Attitude") - fmt.Println("TIME_BOOT_MS", message.TIME_BOOT_MS) - fmt.Println("ROLL", message.ROLL) - fmt.Println("PITCH", message.PITCH) - fmt.Println("YAW", message.YAW) - fmt.Println("ROLLSPEED", message.ROLLSPEED) - fmt.Println("PITCHSPEED", message.PITCHSPEED) - fmt.Println("YAWSPEED", message.YAWSPEED) - fmt.Println("") - } - }) - } - - robot := gobot.NewRobot("mavBot", - []gobot.Connection{adaptor}, - []gobot.Device{iris}, - work, - ) - - robot.Start() + adaptor := mavlink.NewAdaptor("/dev/ttyACM0") + iris := mavlink.NewDriver(adaptor) + + work := func() { + iris.Once(iris.Event("packet"), func(data interface{}) { + packet := data.(*common.MAVLinkPacket) + + dataStream := common.NewRequestDataStream(100, + packet.SystemID, + packet.ComponentID, + 4, + 1, + ) + iris.SendPacket(common.CraftMAVLinkPacket(packet.SystemID, + packet.ComponentID, + dataStream, + )) + }) + + iris.On(iris.Event("message"), func(data interface{}) { + if data.(common.MAVLinkMessage).Id() == 30 { + message := data.(*common.Attitude) + fmt.Println("Attitude") + fmt.Println("TIME_BOOT_MS", message.TIME_BOOT_MS) + fmt.Println("ROLL", message.ROLL) + fmt.Println("PITCH", message.PITCH) + fmt.Println("YAW", message.YAW) + fmt.Println("ROLLSPEED", message.ROLLSPEED) + fmt.Println("PITCHSPEED", message.PITCHSPEED) + fmt.Println("YAWSPEED", message.YAWSPEED) + fmt.Println("") + } + }) + } + + robot := gobot.NewRobot("mavBot", + []gobot.Connection{adaptor}, + []gobot.Device{iris}, + work, + ) + + robot.Start() } ``` ## How to use: UDP ``` go - adaptor := mavlink.NewUDPAdaptor(":14550") + adaptor := mavlink.NewUDPAdaptor(":14550") ``` To test, install Mavproxy and set it up to listen on serial and repeat diff --git a/platforms/mavlink/doc.go b/platforms/mavlink/doc.go index da80cd492..b88fcf757 100644 --- a/platforms/mavlink/doc.go +++ b/platforms/mavlink/doc.go @@ -3,7 +3,7 @@ Package mavlink contains the Gobot adaptor and driver for the MAVlink Communicat Installing: - go get gobot.io/x/gobot/v2/platforms/mavlink + Please refer to the main [README.md](https://github.com/hybridgroup/gobot/blob/release/README.md) Example: diff --git a/platforms/megapi/README.md b/platforms/megapi/README.md index fa50f2628..f4200b919 100644 --- a/platforms/megapi/README.md +++ b/platforms/megapi/README.md @@ -1,14 +1,13 @@ # MegaPi -The [MegaPi](http://learn.makeblock.com/en/megapi/) is a motor controller by MakeBlock that is compatible with the Raspberry Pi. +The [MegaPi](http://learn.makeblock.com/en/megapi/) is a motor controller by MakeBlock that is compatible with the +Raspberry Pi. The code is based on a python implementation that can be found [here](https://github.com/Makeblock-official/PythonForMegaPi). ## How to Install -``` -go get -d -u gobot.io/x/gobot/v2/... -``` +Please refer to the main [README.md](https://github.com/hybridgroup/gobot/blob/release/README.md) ## How to Use @@ -16,36 +15,36 @@ go get -d -u gobot.io/x/gobot/v2/... package main import ( - "gobot.io/x/gobot/v2" - "gobot.io/x/gobot/v2/platforms/megapi" - "time" + "gobot.io/x/gobot/v2" + "gobot.io/x/gobot/v2/platforms/megapi" + "time" ) func main() { - // use "/dev/ttyUSB0" if connecting with USB cable - // use "/dev/ttyAMA0" on devices older than Raspberry Pi 3 Model B - megaPiAdaptor := megapi.NewAdaptor("/dev/ttyS0") - motor := megapi.NewMotorDriver(megaPiAdaptor, 1) - - work := func() { - speed := int16(0) - fadeAmount := int16(30) - - gobot.Every(100*time.Millisecond, func() { - motor.Speed(speed) - speed = speed + fadeAmount - if speed == 0 || speed == 300 { - fadeAmount = -fadeAmount - } - }) - } - - robot := gobot.NewRobot("megaPiBot", - []gobot.Connection{megaPiAdaptor}, - []gobot.Device{motor}, - work, - ) - - robot.Start() + // use "/dev/ttyUSB0" if connecting with USB cable + // use "/dev/ttyAMA0" on devices older than Raspberry Pi 3 Model B + megaPiAdaptor := megapi.NewAdaptor("/dev/ttyS0") + motor := megapi.NewMotorDriver(megaPiAdaptor, 1) + + work := func() { + speed := int16(0) + fadeAmount := int16(30) + + gobot.Every(100*time.Millisecond, func() { + motor.Speed(speed) + speed = speed + fadeAmount + if speed == 0 || speed == 300 { + fadeAmount = -fadeAmount + } + }) + } + + robot := gobot.NewRobot("megaPiBot", + []gobot.Connection{megaPiAdaptor}, + []gobot.Device{motor}, + work, + ) + + robot.Start() } ``` diff --git a/platforms/microbit/README.md b/platforms/microbit/README.md index fd69ce01e..f4342e64c 100644 --- a/platforms/microbit/README.md +++ b/platforms/microbit/README.md @@ -3,26 +3,28 @@ The [Microbit](http://microbit.org/) is a tiny computer with built-in Bluetooth LE aka Bluetooth 4.0. ## How to Install -``` -go get -d -u gobot.io/x/gobot/v2/... -``` -You must install the Microbit firmware from [@sandeepmistry] located at [https://github.com/sandeepmistry/node-bbc-microbit](https://github.com/sandeepmistry/node-bbc-microbit) to use the Microbit with Gobot. This firmware is based on the micro:bit template, but with a few changes. +Please refer to the main [README.md](https://github.com/hybridgroup/gobot/blob/release/README.md) + +You must install the Microbit firmware from [@sandeepmistry] located at [https://github.com/sandeepmistry/node-bbc-microbit](https://github.com/sandeepmistry/node-bbc-microbit) +to use the Microbit with Gobot. This firmware is based on the micro:bit template, but with a few changes. If you have the [Gort](https://gort.io) command line tool installed, you can install the firmware using the following commands: -``` +```sh gort microbit download gort microbit install /media/mysystem/MICROBIT ``` Substitute the proper location to your Microbit for `/media/mysystem/MICROBIT` in the previous command. -Once the firmware is installed, make sure your rotate your Microbit in a circle to calibrate the magnetometer before your try to connect to it using Gobot, or it will not respond. +Once the firmware is installed, make sure your rotate your Microbit in a circle to calibrate the magnetometer before your +try to connect to it using Gobot, or it will not respond. You can also follow the firmware installation instructions at [https://github.com/sandeepmistry/node-bbc-microbit#flashing-microbit-firmware](https://github.com/sandeepmistry/node-bbc-microbit#flashing-microbit-firmware). -The source code for the firmware is located at [https://github.com/sandeepmistry/node-bbc-microbit-firmware](https://github.com/sandeepmistry/node-bbc-microbit-firmware) however you do not need this source code to install the firmware using the installation instructions. +The source code for the firmware is located at [https://github.com/sandeepmistry/node-bbc-microbit-firmware](https://github.com/sandeepmistry/node-bbc-microbit-firmware) +however you do not need this source code to install the firmware using the installation instructions. ## How to Use @@ -41,35 +43,35 @@ The following example uses the LEDDriver: package main import ( - "os" - "time" + "os" + "time" - "gobot.io/x/gobot/v2" - "gobot.io/x/gobot/v2/platforms/ble" - "gobot.io/x/gobot/v2/platforms/microbit" + "gobot.io/x/gobot/v2" + "gobot.io/x/gobot/v2/platforms/ble" + "gobot.io/x/gobot/v2/platforms/microbit" ) func main() { - bleAdaptor := ble.NewClientAdaptor(os.Args[1]) - ubit := microbit.NewLEDDriver(bleAdaptor) - - work := func() { - ubit.Blank() - gobot.After(1*time.Second, func() { - ubit.WriteText("Hello") - }) - gobot.After(7*time.Second, func() { - ubit.Smile() - }) - } - - robot := gobot.NewRobot("blinkBot", - []gobot.Connection{bleAdaptor}, - []gobot.Device{ubit}, - work, - ) - - robot.Start() + bleAdaptor := ble.NewClientAdaptor(os.Args[1]) + ubit := microbit.NewLEDDriver(bleAdaptor) + + work := func() { + ubit.Blank() + gobot.After(1*time.Second, func() { + ubit.WriteText("Hello") + }) + gobot.After(7*time.Second, func() { + ubit.Smile() + }) + } + + robot := gobot.NewRobot("blinkBot", + []gobot.Connection{bleAdaptor}, + []gobot.Device{ubit}, + work, + ) + + robot.Start() } ``` @@ -83,37 +85,37 @@ This means you can use it with any gpio or aio Driver. In this example, we are u package main import ( - "os" + "os" - "gobot.io/x/gobot/v2" - "gobot.io/x/gobot/v2/drivers/gpio" - "gobot.io/x/gobot/v2/platforms/ble" - "gobot.io/x/gobot/v2/platforms/microbit" + "gobot.io/x/gobot/v2" + "gobot.io/x/gobot/v2/drivers/gpio" + "gobot.io/x/gobot/v2/platforms/ble" + "gobot.io/x/gobot/v2/platforms/microbit" ) func main() { - bleAdaptor := ble.NewClientAdaptor(os.Args[1]) - - ubit := microbit.NewIOPinDriver(bleAdaptor) - button := gpio.NewButtonDriver(ubit, "0") - led := gpio.NewLedDriver(ubit, "1") - - work := func() { - button.On(gpio.ButtonPush, func(data interface{}) { - led.On() - }) - button.On(gpio.ButtonRelease, func(data interface{}) { - led.Off() - }) - } - - robot := gobot.NewRobot("buttonBot", - []gobot.Connection{bleAdaptor}, - []gobot.Device{ubit, button, led}, - work, - ) - - robot.Start() + bleAdaptor := ble.NewClientAdaptor(os.Args[1]) + + ubit := microbit.NewIOPinDriver(bleAdaptor) + button := gpio.NewButtonDriver(ubit, "0") + led := gpio.NewLedDriver(ubit, "1") + + work := func() { + button.On(gpio.ButtonPush, func(data interface{}) { + led.On() + }) + button.On(gpio.ButtonRelease, func(data interface{}) { + led.Off() + }) + } + + robot := gobot.NewRobot("buttonBot", + []gobot.Connection{bleAdaptor}, + []gobot.Device{ubit, button, led}, + work, + ) + + robot.Start() } ``` @@ -125,22 +127,26 @@ You need to know the BLE ID of the Microbit that you want to connect to. ### OSX -If you connect by name, then you do not need to worry about the Bluetooth LE ID. However, if you want to connect by ID, OS X uses its own Bluetooth ID system which is different from the IDs used on Linux. The code calls thru the XPC interfaces provided by OSX, so as a result does not need to run under sudo. +If you connect by name, then you do not need to worry about the Bluetooth LE ID. However, if you want to connect by ID, +OS X uses its own Bluetooth ID system which is different from the IDs used on Linux. The code calls thru the XPC interfaces +provided by OSX, so as a result does not need to run under sudo. -For example: - - go run examples/microbit_led.go "BBC micro:bit" +For example: `go run examples/microbit_led.go "BBC micro:bit"` -OSX uses its own Bluetooth ID system which is different from the IDs used on Linux. The code calls thru the XPC interfaces provided by OSX, so as a result does not need to run under sudo. +OSX uses its own Bluetooth ID system which is different from the IDs used on Linux. The code calls thru the XPC interfaces +provided by OSX, so as a result does not need to run under sudo. ### Ubuntu -On Linux the BLE code will need to run as a root user account. The easiest way to accomplish this is probably to use `go build` to build your program, and then to run the requesting executable using `sudo`. +On Linux the BLE code will need to run as a root user account. The easiest way to accomplish this is probably to use +`go build` to build your program, and then to run the requesting executable using `sudo`. For example: - go build examples/microbit_led.go - sudo ./microbit_led "BBC micro:bit" +```sh +go build examples/microbit_led.go +sudo ./microbit_led "BBC micro:bit" +``` ### Windows diff --git a/platforms/mqtt/README.md b/platforms/mqtt/README.md index 1e23a946a..5b7555db3 100644 --- a/platforms/mqtt/README.md +++ b/platforms/mqtt/README.md @@ -10,11 +10,7 @@ For more info about the MQTT machine to machine messaging standard, go to Open Bluetooth Preferences > Sharing Setup" and make sure that "Bluetooth Sharing" is checked. +In order to allow Gobot running on your Mac to access the Mindwave, go to "Bluetooth > Open Bluetooth Preferences > Sharing Setup" +and make sure that "Bluetooth Sharing" is checked. -Now you must pair with the Mindwave. Open System Preferences > Bluetooth. Now with the Bluetooth devices windows open, hold the On/Pair button on the Mindwave towards the On/Pair text until you see "Mindwave" pop up as available devices. Pair with that device. Once paired your Mindwave will be accessable through the serial device similarly named as `/dev/tty.MindWaveMobile-DevA` +Now you must pair with the Mindwave. Open System Preferences > Bluetooth. Now with the Bluetooth devices windows open, hold +the On/Pair button on the Mindwave towards the On/Pair text until you see "Mindwave" pop up as available devices. Pair with +that device. Once paired your Mindwave will be accessable through the serial device similarly named as `/dev/tty.MindWaveMobile-DevA` ### Ubuntu -Connecting to the Mindwave from Ubuntu or any other Linux-based OS can be done entirely from the command line using [Gort](https://gobot.io/x/gort) CLI commands. Here are the steps. +Connecting to the Mindwave from Ubuntu or any other Linux-based OS can be done entirely from the command line using [Gort](https://gobot.io/x/gort) +CLI commands. Here are the steps. Find the address of the Mindwave, by using: -``` + +```sh gort scan bluetooth ``` Pair to Mindwave using this command (substituting the actual address of your Mindwave): -``` + +```sh gort bluetooth pair
``` Connect to the Mindwave using this command (substituting the actual address of your Mindwave): -``` + +```sh gort bluetooth connect
``` ### Windows -You should be able to pair your Mindwave using your normal system tray applet for Bluetooth, and then connect to the COM port that is bound to the device, such as `COM3`. +You should be able to pair your Mindwave using your normal system tray applet for Bluetooth, and then connect to the +COM port that is bound to the device, such as `COM3`. ## How to Use @@ -50,55 +56,55 @@ This small program lets you connect the Neurosky an load data. package main import ( - "fmt" + "fmt" - "gobot.io/x/gobot/v2" - "gobot.io/x/gobot/v2/platforms/neurosky" + "gobot.io/x/gobot/v2" + "gobot.io/x/gobot/v2/platforms/neurosky" ) func main() { - adaptor := neurosky.NewAdaptor("/dev/rfcomm0") - neuro := neurosky.NewDriver(adaptor) - - work := func() { - neuro.On(neuro.Event("extended"), func(data interface{}) { - fmt.Println("Extended", data) - }) - neuro.On(neuro.Event("signal"), func(data interface{}) { - fmt.Println("Signal", data) - }) - neuro.On(neuro.Event("attention"), func(data interface{}) { - fmt.Println("Attention", data) - }) - neuro.On(neuro.Event("meditation"), func(data interface{}) { - fmt.Println("Meditation", data) - }) - neuro.On(neuro.Event("blink"), func(data interface{}) { - fmt.Println("Blink", data) - }) - neuro.On(neuro.Event("wave"), func(data interface{}) { - fmt.Println("Wave", data) - }) - neuro.On(neuro.Event("eeg"), func(data interface{}) { - eeg := data.(neurosky.EEGData) - fmt.Println("Delta", eeg.Delta) - fmt.Println("Theta", eeg.Theta) - fmt.Println("LoAlpha", eeg.LoAlpha) - fmt.Println("HiAlpha", eeg.HiAlpha) - fmt.Println("LoBeta", eeg.LoBeta) - fmt.Println("HiBeta", eeg.HiBeta) - fmt.Println("LoGamma", eeg.LoGamma) - fmt.Println("MidGamma", eeg.MidGamma) - fmt.Println("\n") - }) - } - - robot := gobot.NewRobot("brainBot", - []gobot.Connection{adaptor}, - []gobot.Device{neuro}, - work, - ) - - robot.Start() + adaptor := neurosky.NewAdaptor("/dev/rfcomm0") + neuro := neurosky.NewDriver(adaptor) + + work := func() { + neuro.On(neuro.Event("extended"), func(data interface{}) { + fmt.Println("Extended", data) + }) + neuro.On(neuro.Event("signal"), func(data interface{}) { + fmt.Println("Signal", data) + }) + neuro.On(neuro.Event("attention"), func(data interface{}) { + fmt.Println("Attention", data) + }) + neuro.On(neuro.Event("meditation"), func(data interface{}) { + fmt.Println("Meditation", data) + }) + neuro.On(neuro.Event("blink"), func(data interface{}) { + fmt.Println("Blink", data) + }) + neuro.On(neuro.Event("wave"), func(data interface{}) { + fmt.Println("Wave", data) + }) + neuro.On(neuro.Event("eeg"), func(data interface{}) { + eeg := data.(neurosky.EEGData) + fmt.Println("Delta", eeg.Delta) + fmt.Println("Theta", eeg.Theta) + fmt.Println("LoAlpha", eeg.LoAlpha) + fmt.Println("HiAlpha", eeg.HiAlpha) + fmt.Println("LoBeta", eeg.LoBeta) + fmt.Println("HiBeta", eeg.HiBeta) + fmt.Println("LoGamma", eeg.LoGamma) + fmt.Println("MidGamma", eeg.MidGamma) + fmt.Println("\n") + }) + } + + robot := gobot.NewRobot("brainBot", + []gobot.Connection{adaptor}, + []gobot.Device{neuro}, + work, + ) + + robot.Start() } ``` diff --git a/platforms/neurosky/doc.go b/platforms/neurosky/doc.go index 9270f69c0..d4afbff6a 100644 --- a/platforms/neurosky/doc.go +++ b/platforms/neurosky/doc.go @@ -3,7 +3,7 @@ Package neurosky contains the Gobot adaptor and driver for the Neurosky Mindwave Installing: - go get gobot.io/x/gobot/v2/platforms/neurosky + Please refer to the main [README.md](https://github.com/hybridgroup/gobot/blob/release/README.md) Example: diff --git a/platforms/opencv/README.md b/platforms/opencv/README.md index 5b1fdff85..f45dad612 100644 --- a/platforms/opencv/README.md +++ b/platforms/opencv/README.md @@ -1,12 +1,16 @@ # OpenCV -OpenCV (Open Source Computer Vision Library) is an open source computer vision and machine learning software library. OpenCV was built to provide a common infrastructure for computer vision applications and to accelerate the use of machine perception in the commercial products. Being a BSD-licensed product, OpenCV makes it easy for businesses to utilize and modify the code. +OpenCV (Open Source Computer Vision Library) is an open source computer vision and machine learning software library. +OpenCV was built to provide a common infrastructure for computer vision applications and to accelerate the use of machine +perception in the commercial products. Being a BSD-licensed product, OpenCV makes it easy for businesses to utilize and +modify the code. For more info about OpenCV click [here](http://opencv.org/) ## How to Install -This package requires OpenCV 3.4+ be installed on your system, along with GoCV, which is the Go programming language wrapper used by Gobot. The best way is to follow the installation instructions on the GoCV website at [https://gocv.io](https://gocv.io). +This package requires OpenCV 3.4+ be installed on your system, along with GoCV, which is the Go programming language +wrapper used by Gobot. The best way is to follow the installation instructions on the GoCV website at [https://gocv.io](https://gocv.io). The instructions should automatically install OpenCV 4+ @@ -14,26 +18,21 @@ The instructions should automatically install OpenCV 4+ To install on macOS follow the instructions here: -https://gocv.io/getting-started/macos/ + ### Ubuntu To install on Ubuntu follow the instructions here: -https://gocv.io/getting-started/linux/ + ### Windows -To install on Windows follow the instructions here: - -https://gocv.io/getting-started/windows/ - +Please refer to the main [README.md](https://github.com/hybridgroup/gobot/blob/release/README.md) -Now you can install the Gobot package itself with +To install on Windows follow the instructions here: -``` -go get -d -u gobot.io/x/gobot/v2/... -``` + ## How to Use @@ -43,28 +42,28 @@ Here is an example using the camera: package main import ( - "gobot.io/x/gobot/v2" - "gobot.io/x/gobot/v2/platforms/opencv" - "gocv.io/x/gocv" + "gobot.io/x/gobot/v2" + "gobot.io/x/gobot/v2/platforms/opencv" + "gocv.io/x/gocv" ) func main() { - window := opencv.NewWindowDriver() - camera := opencv.NewCameraDriver(0) - - work := func() { - camera.On(opencv.Frame, func(data interface{}) { - img := data.(gocv.Mat) - window.ShowImage(img) - window.WaitKey(1) - }) - } - - robot := gobot.NewRobot("cameraBot", - []gobot.Device{window, camera}, - work, - ) - - robot.Start() + window := opencv.NewWindowDriver() + camera := opencv.NewCameraDriver(0) + + work := func() { + camera.On(opencv.Frame, func(data interface{}) { + img := data.(gocv.Mat) + window.ShowImage(img) + window.WaitKey(1) + }) + } + + robot := gobot.NewRobot("cameraBot", + []gobot.Device{window, camera}, + work, + ) + + robot.Start() } ``` diff --git a/platforms/opencv/doc.go b/platforms/opencv/doc.go index 95e71d6ff..ecd83ce15 100644 --- a/platforms/opencv/doc.go +++ b/platforms/opencv/doc.go @@ -7,7 +7,7 @@ Installing: Then you can install the package with: - go get gobot.io/x/gobot/v2 && go install gobot.io/x/gobot/v2/platforms/opencv + Please refer to the main [README.md](https://github.com/hybridgroup/gobot/blob/release/README.md) Example: diff --git a/platforms/parrot/ardrone/README.md b/platforms/parrot/ardrone/README.md index 81a112bb1..893e103f4 100644 --- a/platforms/parrot/ardrone/README.md +++ b/platforms/parrot/ardrone/README.md @@ -1,48 +1,50 @@ # Ardrone -The ARDrone from Parrot is an inexpensive quadcopter that is controlled using WiFi. It includes a built-in front-facing HD video camera, as well as a second lower resolution bottom facing video camera. +The ARDrone from Parrot is an inexpensive quadcopter that is controlled using WiFi. It includes a built-in front-facing +HD video camera, as well as a second lower resolution bottom facing video camera. For more info about the ARDrone platform click [here](http://ardrone2.parrot.com/). ## How to Install -``` -go get -d -u gobot.io/x/gobot/v2/... -``` + +Please refer to the main [README.md](https://github.com/hybridgroup/gobot/blob/release/README.md) ## How to Use + ```go package main import ( - "time" + "time" - "gobot.io/x/gobot/v2" - "gobot.io/x/gobot/v2/platforms/parrot/ardrone" + "gobot.io/x/gobot/v2" + "gobot.io/x/gobot/v2/platforms/parrot/ardrone" ) func main() { - ardroneAdaptor := ardrone.NewAdaptor("Drone") - drone := ardrone.NewDriver(ardroneAdaptor, "Drone") - - work := func() { - drone.On(drone.Event("flying"), func(data interface{}) { - gobot.After(3*time.Second, func() { - drone.Land() - }) - }) - drone.TakeOff() - } - - robot := gobot.NewRobot("drone", - []gobot.Connection{ardroneAdaptor}, - []gobot.Device{drone}, - work, - ) - - robot.Start() + ardroneAdaptor := ardrone.NewAdaptor("Drone") + drone := ardrone.NewDriver(ardroneAdaptor, "Drone") + + work := func() { + drone.On(drone.Event("flying"), func(data interface{}) { + gobot.After(3*time.Second, func() { + drone.Land() + }) + }) + drone.TakeOff() + } + + robot := gobot.NewRobot("drone", + []gobot.Connection{ardroneAdaptor}, + []gobot.Device{drone}, + work, + ) + + robot.Start() } ``` ## How to Connect -The ARDrone is a WiFi device, so there is no additional work to establish a connection to a single drone. However, in order to connect to multiple drones, you need to perform some configuration steps on each drone via SSH. +The ARDrone is a WiFi device, so there is no additional work to establish a connection to a single drone. However, in +order to connect to multiple drones, you need to perform some configuration steps on each drone via SSH. diff --git a/platforms/parrot/ardrone/doc.go b/platforms/parrot/ardrone/doc.go index 62e7b37dd..3ea5b032f 100644 --- a/platforms/parrot/ardrone/doc.go +++ b/platforms/parrot/ardrone/doc.go @@ -3,7 +3,7 @@ Package ardrone provides the Gobot adaptor and driver for the Parrot Ardrone. Installing: - go get -d -u gobot.io/x/gobot/v2/... && go install gobot.io/x/gobot/v2/platforms/parrot/ardrone + Please refer to the main [README.md](https://github.com/hybridgroup/gobot/blob/release/README.md) Example: diff --git a/platforms/parrot/bebop/README.md b/platforms/parrot/bebop/README.md index 51d60cf89..112c86276 100644 --- a/platforms/parrot/bebop/README.md +++ b/platforms/parrot/bebop/README.md @@ -1,52 +1,55 @@ # Bebop -The Parrot Bebop and Parrot Bebop 2 are inexpensive quadcopters that can be controlled using their built-in API commands via a WiFi connection. They include a built-in front-facing HD video camera, as well as a second lower resolution bottom-facing video camera. +The Parrot Bebop and Parrot Bebop 2 are inexpensive quadcopters that can be controlled using their built-in API commands +via a WiFi connection. They include a built-in front-facing HD video camera, as well as a second lower resolution +bottom-facing video camera. ## How to Install -``` -go get -d -u gobot.io/x/gobot/v2/... -``` + +Please refer to the main [README.md](https://github.com/hybridgroup/gobot/blob/release/README.md) ## How to Use + ```go package main import ( - "time" + "time" - "gobot.io/x/gobot/v2" - "gobot.io/x/gobot/v2/platforms/parrot/bebop" + "gobot.io/x/gobot/v2" + "gobot.io/x/gobot/v2/platforms/parrot/bebop" ) func main() { - bebopAdaptor := bebop.NewAdaptor() - drone := bebop.NewDriver(bebopAdaptor) + bebopAdaptor := bebop.NewAdaptor() + drone := bebop.NewDriver(bebopAdaptor) - work := func() { + work := func() { drone.HullProtection(true) - drone.TakeOff() - gobot.On(drone.Event("flying"), func(data interface{}) { - gobot.After(3*time.Second, func() { - drone.Land() - }) - }) - } - - robot := gobot.NewRobot("drone", - []gobot.Connection{bebopAdaptor}, - []gobot.Device{drone}, - work, - ) - - robot.Start() + drone.TakeOff() + gobot.On(drone.Event("flying"), func(data interface{}) { + gobot.After(3*time.Second, func() { + drone.Land() + }) + }) + } + + robot := gobot.NewRobot("drone", + []gobot.Connection{bebopAdaptor}, + []gobot.Device{drone}, + work, + ) + + robot.Start() } ``` ## How to Connect -By default, the Parrot Bebop is a WiFi access point, so there is no additional work to establish a connection to a single drone, you just connect to it. +By default, the Parrot Bebop is a WiFi access point, so there is no additional work to establish a connection to a single +drone, you just connect to it. Once connected, if you want to stream drone video you can either: - - Use the RTP protocol with an external player such as mplayer or VLC. - - Grab the video frames from the drone's data frames, and work with them directly. +- Use the RTP protocol with an external player such as mplayer or VLC. +- Grab the video frames from the drone's data frames, and work with them directly. diff --git a/platforms/parrot/bebop/doc.go b/platforms/parrot/bebop/doc.go index ada303036..6c3c77dc0 100644 --- a/platforms/parrot/bebop/doc.go +++ b/platforms/parrot/bebop/doc.go @@ -3,7 +3,7 @@ Package bebop provides the Gobot adaptor and driver for the Parrot Bebop. Installing: - go get -d -u gobot.io/x/gobot/v2/... && go install gobot.io/x/gobot/v2/platforms/parrot/bebop + Please refer to the main [README.md](https://github.com/hybridgroup/gobot/blob/release/README.md) For more information refer to the bebop README: https://github.com/hybridgroup/gobot/tree/master/platforms/parrot/bebop/README.md diff --git a/platforms/parrot/minidrone/README.md b/platforms/parrot/minidrone/README.md index db415181c..279d458dc 100644 --- a/platforms/parrot/minidrone/README.md +++ b/platforms/parrot/minidrone/README.md @@ -4,28 +4,26 @@ The Parrot Minidrones are very inexpensive drones that are controlled using Blue Models that are known to work with this package include: - - Parrot Rolling Spider - - Parrot Airborne Cargo Mars - - Parrot Airborne Cargo Travis - - Parrot Mambo +- Parrot Rolling Spider +- Parrot Airborne Cargo Mars +- Parrot Airborne Cargo Travis +- Parrot Mambo Models that should work now, but have not been tested by us: - - Parrot Airborne Night Swat - - Parrot Airborne Night Maclane - - Parrot Airborne Night Blaze - - Parrot HYDROFOIL Orak - - Parrot HYDROFOIL NewZ +- Parrot Airborne Night Swat +- Parrot Airborne Night Maclane +- Parrot Airborne Night Blaze +- Parrot HYDROFOIL Orak +- Parrot HYDROFOIL NewZ Models that will require additional work for compatibility: - - Parrot Swing +- Parrot Swing ## How to Install -``` -go get -d -u gobot.io/x/gobot/v2/... -``` +Please refer to the main [README.md](https://github.com/hybridgroup/gobot/blob/release/README.md) ## How to Use @@ -33,58 +31,58 @@ go get -d -u gobot.io/x/gobot/v2/... package main import ( - "fmt" - "os" - "time" + "fmt" + "os" + "time" - "gobot.io/x/gobot/v2" - "gobot.io/x/gobot/v2/platforms/ble" - "gobot.io/x/gobot/v2/platforms/parrot/minidrone" + "gobot.io/x/gobot/v2" + "gobot.io/x/gobot/v2/platforms/ble" + "gobot.io/x/gobot/v2/platforms/parrot/minidrone" ) func main() { - bleAdaptor := ble.NewClientAdaptor(os.Args[1]) - drone := minidrone.NewDriver(bleAdaptor) - - work := func() { - drone.On(minidrone.Battery, func(data interface{}) { - fmt.Printf("battery: %d\n", data) - }) - - drone.On(minidrone.FlightStatus, func(data interface{}) { - fmt.Printf("flight status: %d\n", data) - }) - - drone.On(minidrone.Takeoff, func(data interface{}) { - fmt.Println("taking off...") - }) - - drone.On(minidrone.Hovering, func(data interface{}) { - fmt.Println("hovering!") - gobot.After(5*time.Second, func() { - drone.Land() - }) - }) - - drone.On(minidrone.Landing, func(data interface{}) { - fmt.Println("landing...") - }) - - drone.On(minidrone.Landed, func(data interface{}) { - fmt.Println("landed.") - }) - - time.Sleep(1000 * time.Millisecond) - drone.TakeOff() - } - - robot := gobot.NewRobot("minidrone", - []gobot.Connection{bleAdaptor}, - []gobot.Device{drone}, - work, - ) - - robot.Start() + bleAdaptor := ble.NewClientAdaptor(os.Args[1]) + drone := minidrone.NewDriver(bleAdaptor) + + work := func() { + drone.On(minidrone.Battery, func(data interface{}) { + fmt.Printf("battery: %d\n", data) + }) + + drone.On(minidrone.FlightStatus, func(data interface{}) { + fmt.Printf("flight status: %d\n", data) + }) + + drone.On(minidrone.Takeoff, func(data interface{}) { + fmt.Println("taking off...") + }) + + drone.On(minidrone.Hovering, func(data interface{}) { + fmt.Println("hovering!") + gobot.After(5*time.Second, func() { + drone.Land() + }) + }) + + drone.On(minidrone.Landing, func(data interface{}) { + fmt.Println("landing...") + }) + + drone.On(minidrone.Landed, func(data interface{}) { + fmt.Println("landed.") + }) + + time.Sleep(1000 * time.Millisecond) + drone.TakeOff() + } + + robot := gobot.NewRobot("minidrone", + []gobot.Connection{bleAdaptor}, + []gobot.Device{drone}, + work, + ) + + robot.Start() } ``` @@ -92,26 +90,33 @@ func main() { The Parrot Minidrones are Bluetooth LE devices. -You need to know the BLE ID or name of the Minidrone you want to connect to. The Gobot BLE client adaptor also lets you connect by friendly name, aka "RS_1234". +You need to know the BLE ID or name of the Minidrone you want to connect to. The Gobot BLE client adaptor also lets you +connect by friendly name, aka "RS_1234". ### OSX -To run any of the Gobot BLE code you must use the `GODEBUG=cgocheck=0` flag in order to get around some of the issues in the CGo-based implementation. +To run any of the Gobot BLE code you must use the `GODEBUG=cgocheck=0` flag in order to get around some of the issues in +the CGo-based implementation. -If you connect by name, then you do not need to worry about the Bluetooth LE ID. However, if you want to connect by ID, OS X uses its own Bluetooth ID system which is different from the IDs used on Linux. The code calls thru the XPC interfaces provided by OSX, so as a result does not need to run under sudo. +If you connect by name, then you do not need to worry about the Bluetooth LE ID. However, if you want to connect by ID, +OS X uses its own Bluetooth ID system which is different from the IDs used on Linux. The code calls thru the XPC interfaces +provided by OSX, so as a result does not need to run under sudo. For example: - GODEBUG=cgocheck=0 go run examples/minidrone.go RS_1234 +`GODEBUG=cgocheck=0 go run examples/minidrone.go RS_1234` ### Ubuntu -On Linux the BLE code will need to run as a root user account. The easiest way to accomplish this is probably to use `go build` to build your program, and then to run the requesting executable using `sudo`. +On Linux the BLE code will need to run as a root user account. The easiest way to accomplish this is probably to use +`go build` to build your program, and then to run the requesting executable using `sudo`. For example: - go build examples/minidrone.go - sudo ./minidrone RS_1234 +```sh +go build examples/minidrone.go +sudo ./minidrone RS_1234 +``` ### Windows diff --git a/platforms/particle/README.md b/platforms/particle/README.md index f82ef4abc..50f8d2786 100644 --- a/platforms/particle/README.md +++ b/platforms/particle/README.md @@ -1,16 +1,16 @@ # Particle -The Particle Photon and Particle Electron are connected microcontrollers from Particle (http://particle.io), the company formerly known as Spark Devices. The Photon uses a Wi-Fi connection to the Particle cloud, and the Electron uses a 3G wireless connection. Once the Photon or Electron connects to the network, it automatically connects with a central server (the "Particle Cloud") and stays connected so it can be controlled from external systems, such as a Gobot program. To run Gobot programs please make sure you are running default Tinker firmware on the Photon or Electron. +The Particle Photon and Particle Electron are connected microcontrollers from Particle (), the company +formerly known as Spark Devices. The Photon uses a Wi-Fi connection to the Particle cloud, and the Electron uses a +3G wireless connection. Once the Photon or Electron connects to the network, it automatically connects with a central server +(the "Particle Cloud") and stays connected so it can be controlled from external systems, such as a Gobot program. To run +Gobot programs please make sure you are running default Tinker firmware on the Photon or Electron. -For more info about the Particle platform go to https://www.particle.io/ +For more info about the Particle platform go to ## How to Install -Installing Gobot with Particle support is pretty easy. - -``` -go get -d -u gobot.io/x/gobot/v2/... -``` +Please refer to the main [README.md](https://github.com/hybridgroup/gobot/blob/release/README.md) ## How to Use @@ -18,29 +18,29 @@ go get -d -u gobot.io/x/gobot/v2/... package main import ( - "time" + "time" - "gobot.io/x/gobot/v2" - "gobot.io/x/gobot/v2/drivers/gpio" - "gobot.io/x/gobot/v2/platforms/particle" + "gobot.io/x/gobot/v2" + "gobot.io/x/gobot/v2/drivers/gpio" + "gobot.io/x/gobot/v2/platforms/particle" ) func main() { - core := particle.NewAdaptor("device_id", "access_token") - led := gpio.NewLedDriver(core, "D7") - - work := func() { - gobot.Every(1*time.Second, func() { - led.Toggle() - }) - } - - robot := gobot.NewRobot("spark", - []gobot.Connection{core}, - []gobot.Device{led}, - work, - ) - - robot.Start() + core := particle.NewAdaptor("device_id", "access_token") + led := gpio.NewLedDriver(core, "D7") + + work := func() { + gobot.Every(1*time.Second, func() { + led.Toggle() + }) + } + + robot := gobot.NewRobot("spark", + []gobot.Connection{core}, + []gobot.Device{led}, + work, + ) + + robot.Start() } ``` diff --git a/platforms/particle/doc.go b/platforms/particle/doc.go index fd6dc2fd3..467b65dec 100644 --- a/platforms/particle/doc.go +++ b/platforms/particle/doc.go @@ -3,7 +3,7 @@ Package particle provides the Gobot adaptor for the Particle Photon and Electron Installing: - go get gobot.io/x/gobot/v2 && go install gobot.io/x/gobot/v2/platforms/particle + Please refer to the main [README.md](https://github.com/hybridgroup/gobot/blob/release/README.md) Example: diff --git a/platforms/pebble/README.md b/platforms/pebble/README.md index d5889713f..0fa25a4a5 100644 --- a/platforms/pebble/README.md +++ b/platforms/pebble/README.md @@ -2,59 +2,59 @@ This repository contains the Gobot adaptor for [Pebble smart watch](http://getpebble.com/). -It uses the Pebble 2.0 SDK, and requires the 2.0 iOS or Android app, and that the ["watchbot" app](https://gobot.io/x/watchbot) has been installed on the Pebble watch. +It uses the Pebble 2.0 SDK, and requires the 2.0 iOS or Android app, and that the ["watchbot" app](https://gobot.io/x/watchbot) +has been installed on the Pebble watch. ## How to Install -``` -go get -d -u gobot.io/x/gobot/v2/... -``` +Please refer to the main [README.md](https://github.com/hybridgroup/gobot/blob/release/README.md) * Install Pebble 2.0 iOS or Android app. (If you haven't already) -* Follow README to install and configure "watchbot" on your watch: https://gobot.io/x/watchbot +* Follow README to install and configure "watchbot" on your watch: ## How to Use -Before running the example, make sure configuration settings match with your program. In the example, api host is your computer IP, robot name is 'pebble' and robot api port is 8080 +Before running the example, make sure configuration settings match with your program. In the example, api host is your +computer IP, robot name is 'pebble' and robot api port is 8080 ```go package main import ( - "fmt" + "fmt" - "gobot.io/x/gobot/v2" - "gobot.io/x/gobot/v2/api" - "gobot.io/x/gobot/v2/platforms/pebble" + "gobot.io/x/gobot/v2" + "gobot.io/x/gobot/v2/api" + "gobot.io/x/gobot/v2/platforms/pebble" ) func main() { - master := gobot.NewMaster() - api.NewAPI(master).Start() + master := gobot.NewMaster() + api.NewAPI(master).Start() - pebbleAdaptor := pebble.NewAdaptor() - watch := pebble.NewDriver(pebbleAdaptor) + pebbleAdaptor := pebble.NewAdaptor() + watch := pebble.NewDriver(pebbleAdaptor) - work := func() { - watch.SendNotification("Hello Pebble!") - watch.On(watch.Event("button"), func(data interface{}) { - fmt.Println("Button pushed: " + data.(string)) - }) + work := func() { + watch.SendNotification("Hello Pebble!") + watch.On(watch.Event("button"), func(data interface{}) { + fmt.Println("Button pushed: " + data.(string)) + }) - watch.On(watch.Event("tap"), func(data interface{}) { - fmt.Println("Tap event detected") - }) - } + watch.On(watch.Event("tap"), func(data interface{}) { + fmt.Println("Tap event detected") + }) + } - robot := gobot.NewRobot("pebble", - []gobot.Connection{pebbleAdaptor}, - []gobot.Device{watch}, - work, - ) + robot := gobot.NewRobot("pebble", + []gobot.Connection{pebbleAdaptor}, + []gobot.Device{watch}, + work, + ) - master.AddRobot(robot) + master.AddRobot(robot) - master.Start() + master.Start() } ``` @@ -67,17 +67,19 @@ func main() { ## Documentation -We're busy adding documentation to our web site at http://gobot.io/ please check there as we continue to work on Gobot +We're busy adding documentation to our web site at please check there as we continue to work on Gobot Thank you! ## Contributing * All patches must be provided under the Apache 2.0 License -* Please use the -s option in git to "sign off" that the commit is your work and you are providing it under the Apache 2.0 License +* Please use the -s option in git to "sign off" that the commit is your work and you are providing it under the + Apache 2.0 License * Submit a Github Pull Request to the appropriate branch and ideally discuss the changes with us in IRC. * We will look at the patch, test it out, and give you feedback. -* Avoid doing minor whitespace changes, renamings, etc. along with merged content. These will be done by the maintainers from time to time but they can complicate merges and should be done seperately. +* Avoid doing minor whitespace changes, renamings, etc. along with merged content. These will be done by the maintainers + from time to time but they can complicate merges and should be done seperately. * Take care to maintain the existing coding style. * Add unit tests for any new or changed functionality * All pull requests should be "fast forward" diff --git a/platforms/pebble/doc.go b/platforms/pebble/doc.go index 784f9ef5c..7c6654555 100644 --- a/platforms/pebble/doc.go +++ b/platforms/pebble/doc.go @@ -6,7 +6,7 @@ Installing: It requires the 2.x iOS or Android app, and "watchbot" app (https://gobot.io/x/watchbot) installed on Pebble watch. Then install running: - go get gobot.io/x/gobot/v2/platforms/pebble + Please refer to the main [README.md](https://github.com/hybridgroup/gobot/blob/release/README.md) Example: diff --git a/platforms/raspi/README.md b/platforms/raspi/README.md index 3b1a89e62..34d42a34d 100644 --- a/platforms/raspi/README.md +++ b/platforms/raspi/README.md @@ -1,20 +1,20 @@ # Raspberry Pi -The Raspberry Pi is an inexpensive and popular ARM based single board computer with digital & PWM GPIO, and i2c interfaces built in. +The Raspberry Pi is an inexpensive and popular ARM based single board computer with digital & PWM GPIO, and i2c interfaces +built in. -The Gobot adaptor for the Raspberry Pi should support all of the various Raspberry Pi boards such as the Raspberry Pi 4 Model B, Raspberry Pi 3 Model B, Raspberry Pi 2 Model B, Raspberry Pi 1 Model A+, Raspberry Pi Zero, and Raspberry Pi Zero W. +The Gobot adaptor for the Raspberry Pi should support all of the various Raspberry Pi boards such as the +Raspberry Pi 4 Model B, Raspberry Pi 3 Model B, Raspberry Pi 2 Model B, Raspberry Pi 1 Model A+, Raspberry Pi Zero, +and Raspberry Pi Zero W. For more info about the Raspberry Pi platform, click [here](http://www.raspberrypi.org/). ## How to Install -We recommend updating to the latest Raspian Jessie OS when using the Raspberry Pi, however Gobot should also support older versions of the OS, should your application require this. +Please refer to the main [README.md](https://github.com/hybridgroup/gobot/blob/release/README.md) -You would normally install Go and Gobot on your workstation. Once installed, cross compile your program on your workstation, transfer the final executable to your Raspberry Pi, and run the program on the Raspberry Pi as documented here. - -``` -go get -d -u gobot.io/x/gobot/v2/... -``` +We recommend updating to the latest Raspian Jessie OS when using the Raspberry Pi, however Gobot should also support +older versions of the OS, should your application require this. ## How to Use @@ -24,30 +24,30 @@ The pin numbering used by your Gobot program should match the way your board is package main import ( - "time" +"time" - "gobot.io/x/gobot/v2" - "gobot.io/x/gobot/v2/drivers/gpio" - "gobot.io/x/gobot/v2/platforms/raspi" +"gobot.io/x/gobot/v2" +"gobot.io/x/gobot/v2/drivers/gpio" +"gobot.io/x/gobot/v2/platforms/raspi" ) func main() { - r := raspi.NewAdaptor() - led := gpio.NewLedDriver(r, "7") - - work := func() { - gobot.Every(1*time.Second, func() { - led.Toggle() - }) - } - - robot := gobot.NewRobot("blinkBot", - []gobot.Connection{r}, - []gobot.Device{led}, - work, - ) - - robot.Start() + r := raspi.NewAdaptor() + led := gpio.NewLedDriver(r, "7") + + work := func() { + gobot.Every(1*time.Second, func() { + led.Toggle() + }) + } + + robot := gobot.NewRobot("blinkBot", + []gobot.Connection{r}, + []gobot.Device{led}, + work, + ) + + robot.Start() } ``` @@ -57,8 +57,8 @@ func main() { Compile your Gobot program on your workstation like this: -```bash -$ GOARM=6 GOARCH=arm GOOS=linux go build examples/raspi_blink.go +```sh +GOARM=6 GOARCH=arm GOOS=linux go build examples/raspi_blink.go ``` Use the following `GOARM` values to compile depending on which model Raspberry Pi you are using: @@ -66,15 +66,17 @@ Use the following `GOARM` values to compile depending on which model Raspberry P `GOARM=6` (Raspberry Pi A, A+, B, B+, Zero) `GOARM=7` (Raspberry Pi 2, 3) -Once you have compiled your code, you can upload your program and execute it on the Raspberry Pi from your workstation using the `scp` and `ssh` commands like this: +Once you have compiled your code, you can upload your program and execute it on the Raspberry Pi from your workstation +using the `scp` and `ssh` commands like this: -```bash -$ scp raspi_blink pi@192.168.1.xxx:/home/pi/ -$ ssh -t pi@192.168.1.xxx "./raspi_blink" +```sh +scp raspi_blink pi@192.168.1.xxx:/home/pi/ +ssh -t pi@192.168.1.xxx "./raspi_blink" ``` -### Enabling PWM output on GPIO pins. +### Enabling PWM output on GPIO pins -For extended PWM support on the Raspberry Pi, you will need to use a program called pi-blaster. You can follow the instructions for pi-blaster install in the pi-blaster repo here: +For extended PWM support on the Raspberry Pi, you will need to use a program called pi-blaster. You can follow the +instructions for pi-blaster install in the pi-blaster repo here: [https://github.com/sarfata/pi-blaster](https://github.com/sarfata/pi-blaster) diff --git a/platforms/sphero/README.md b/platforms/sphero/README.md index f46c97407..9132c6368 100644 --- a/platforms/sphero/README.md +++ b/platforms/sphero/README.md @@ -2,39 +2,48 @@ Sphero is a sophisticated and programmable robot housed in a polycarbonate sphere shell. -The Gobot Sphero Adaptor & Driver makes it easy to interact with Sphero using Go. Once you have your Sphero setup and connected to your computer you can start writing code to make Sphero move, change direction, speed and colors, or detect Sphero events and execute some code when they occur. +The Gobot Sphero Adaptor & Driver makes it easy to interact with Sphero using Go. Once you have your Sphero setup and connected +to your computer you can start writing code to make Sphero move, change direction, speed and colors, or detect Sphero events +and execute some code when they occur. -Learn more about the Sphero robot go here: http://www.gosphero.com/ +Learn more about the Sphero robot go here: ## How to Install -``` -go get -d -u gobot.io/x/gobot/v2/... -``` + +Please refer to the main [README.md](https://github.com/hybridgroup/gobot/blob/release/README.md) ## How To Connect ### OSX -In order to allow Gobot running on your Mac to access the Sphero, go to "Bluetooth > Open Bluetooth Preferences > Sharing Setup" and make sure that "Bluetooth Sharing" is checked. +In order to allow Gobot running on your Mac to access the Sphero, go to "Bluetooth > Open Bluetooth Preferences > Sharing Setup" +and make sure that "Bluetooth Sharing" is checked. -Now you must pair with the Sphero. Open System Preferences > Bluetooth. Now with the Bluetooth devices windows open, smack the Sphero until it starts flashing three colors. You should see "Sphero-XXX" pop up as available devices where "XXX" is the first letter of the three colors the sphero is flashing. Pair with that device. Once paired your Sphero will be accessable through the serial device similarly named as `/dev/tty.Sphero-XXX-RN-SPP` +Now you must pair with the Sphero. Open System Preferences > Bluetooth. Now with the Bluetooth devices windows open, smack +the Sphero until it starts flashing three colors. You should see "Sphero-XXX" pop up as available devices where "XXX" is +the first letter of the three colors the sphero is flashing. Pair with that device. Once paired your Sphero will be accessable +through the serial device similarly named as `/dev/tty.Sphero-XXX-RN-SPP` ### Ubuntu -Connecting to the Sphero from Ubuntu or any other Linux-based OS can be done entirely from the command line using [Gort](http://gort.io/) CLI commands. Here are the steps. +Connecting to the Sphero from Ubuntu or any other Linux-based OS can be done entirely from the command line using [Gort](http://gort.io/) +CLI commands. Here are the steps. Find the address of the Sphero, by using: -``` + +```sh gort scan bluetooth ``` Pair to Sphero using this command (substituting the actual address of your Sphero): -``` + +```sh gort bluetooth pair
``` Connect to the Sphero using this command (substituting the actual address of your Sphero): -``` + +```sh gort bluetooth connect
``` @@ -50,29 +59,29 @@ Example of a simple program that makes the Sphero roll. package main import ( - "fmt" - "time" + "fmt" + "time" - "gobot.io/x/gobot/v2" - "gobot.io/x/gobot/v2/platforms/sphero" + "gobot.io/x/gobot/v2" + "gobot.io/x/gobot/v2/platforms/sphero" ) func main() { - adaptor := sphero.NewAdaptor("/dev/rfcomm0") - driver := sphero.NewSpheroDriver(adaptor) - - work := func() { - gobot.Every(3*time.Second, func() { - driver.Roll(30, uint16(gobot.Rand(360))) - }) - } - - robot := gobot.NewRobot("sphero", - []gobot.Connection{adaptor}, - []gobot.Device{driver}, - work, - ) - - robot.Start() + adaptor := sphero.NewAdaptor("/dev/rfcomm0") + driver := sphero.NewSpheroDriver(adaptor) + + work := func() { + gobot.Every(3*time.Second, func() { + driver.Roll(30, uint16(gobot.Rand(360))) + }) + } + + robot := gobot.NewRobot("sphero", + []gobot.Connection{adaptor}, + []gobot.Device{driver}, + work, + ) + + robot.Start() } ``` diff --git a/platforms/sphero/bb8/README.md b/platforms/sphero/bb8/README.md index 3ddc0ed33..b097ae57b 100644 --- a/platforms/sphero/bb8/README.md +++ b/platforms/sphero/bb8/README.md @@ -4,9 +4,7 @@ The Sphero BB-8 is a toy robot from Sphero that is controlled using Bluetooth LE ## How to Install -``` -go get -d -u gobot.io/x/gobot/v2/... -``` +Please refer to the main [README.md](https://github.com/hybridgroup/gobot/blob/release/README.md) ## How to Use @@ -14,34 +12,34 @@ go get -d -u gobot.io/x/gobot/v2/... package main import ( - "os" - "time" + "os" + "time" - "gobot.io/x/gobot/v2" - "gobot.io/x/gobot/v2/platforms/ble" - "gobot.io/x/gobot/v2/platforms/sphero/bb8" + "gobot.io/x/gobot/v2" + "gobot.io/x/gobot/v2/platforms/ble" + "gobot.io/x/gobot/v2/platforms/sphero/bb8" ) func main() { - bleAdaptor := ble.NewClientAdaptor(os.Args[1]) - bb8 := bb8.NewDriver(bleAdaptor) - - work := func() { - gobot.Every(1*time.Second, func() { - r := uint8(gobot.Rand(255)) - g := uint8(gobot.Rand(255)) - b := uint8(gobot.Rand(255)) - bb8.SetRGB(r, g, b) - }) - } - - robot := gobot.NewRobot("bb", - []gobot.Connection{bleAdaptor}, - []gobot.Device{bb8}, - work, - ) - - robot.Start() + bleAdaptor := ble.NewClientAdaptor(os.Args[1]) + bb8 := bb8.NewDriver(bleAdaptor) + + work := func() { + gobot.Every(1*time.Second, func() { + r := uint8(gobot.Rand(255)) + g := uint8(gobot.Rand(255)) + b := uint8(gobot.Rand(255)) + bb8.SetRGB(r, g, b) + }) + } + + robot := gobot.NewRobot("bb", + []gobot.Connection{bleAdaptor}, + []gobot.Device{bb8}, + work, + ) + + robot.Start() } ``` @@ -49,26 +47,33 @@ func main() { The Sphero BB-8 is a Bluetooth LE device. -You need to know the BLE ID of the BB-8 you want to connect to. The Gobot BLE client adaptor also lets you connect by friendly name, aka "BB-1247". +You need to know the BLE ID of the BB-8 you want to connect to. The Gobot BLE client adaptor also lets you connect by +friendly name, aka "BB-1247". ### OSX -To run any of the Gobot BLE code you must use the `GODEBUG=cgocheck=0` flag in order to get around some of the issues in the CGo-based implementation. +To run any of the Gobot BLE code you must use the `GODEBUG=cgocheck=0` flag in order to get around some of the issues in +the CGo-based implementation. -If you connect by name, then you do not need to worry about the Bluetooth LE ID. However, if you want to connect by ID, OS X uses its own Bluetooth ID system which is different from the IDs used on Linux. The code calls thru the XPC interfaces provided by OSX, so as a result does not need to run under sudo. +If you connect by name, then you do not need to worry about the Bluetooth LE ID. However, if you want to connect by ID, +OS X uses its own Bluetooth ID system which is different from the IDs used on Linux. The code calls thru the XPC interfaces +provided by OSX, so as a result does not need to run under sudo. For example: - GODEBUG=cgocheck=0 go run examples/bb8.go BB-1247 +`GODEBUG=cgocheck=0 go run examples/bb8.go BB-1247` ### Ubuntu -On Linux the BLE code will need to run as a root user account. The easiest way to accomplish this is probably to use `go build` to build your program, and then to run the requesting executable using `sudo`. +On Linux the BLE code will need to run as a root user account. The easiest way to accomplish this is probably to use +`go build` to build your program, and then to run the requesting executable using `sudo`. For example: - go build examples/bb8.go - sudo ./bb8 BB-1247 +```sh +go build examples/bb8.go +sudo ./bb8 BB-1247 +``` ### Windows diff --git a/platforms/sphero/doc.go b/platforms/sphero/doc.go index e9d2d1b78..bfe1f7f6c 100644 --- a/platforms/sphero/doc.go +++ b/platforms/sphero/doc.go @@ -3,7 +3,7 @@ Package sphero provides the Gobot adaptor and driver for the Sphero. Installing: - go get gobot.io/x/gobot/v2/platforms/sphero + Please refer to the main [README.md](https://github.com/hybridgroup/gobot/blob/release/README.md) Example: diff --git a/platforms/sphero/ollie/README.md b/platforms/sphero/ollie/README.md index 57eea66c8..2f2b541a8 100644 --- a/platforms/sphero/ollie/README.md +++ b/platforms/sphero/ollie/README.md @@ -4,9 +4,7 @@ The Sphero Ollie is a toy robot from Sphero that is controlled using Bluetooth L ## How to Install -``` -go get -d -u gobot.io/x/gobot/v2/... -``` +Please refer to the main [README.md](https://github.com/hybridgroup/gobot/blob/release/README.md) ## How to Use @@ -14,34 +12,34 @@ go get -d -u gobot.io/x/gobot/v2/... package main import ( - "os" - "time" + "os" + "time" - "gobot.io/x/gobot/v2" - "gobot.io/x/gobot/v2/platforms/ble" - "gobot.io/x/gobot/v2/platforms/sphero/ollie" + "gobot.io/x/gobot/v2" + "gobot.io/x/gobot/v2/platforms/ble" + "gobot.io/x/gobot/v2/platforms/sphero/ollie" ) func main() { - bleAdaptor := ble.NewClientAdaptor(os.Args[1]) - ollie := ollie.NewDriver(bleAdaptor) - - work := func() { - gobot.Every(1*time.Second, func() { - r := uint8(gobot.Rand(255)) - g := uint8(gobot.Rand(255)) - b := uint8(gobot.Rand(255)) - ollie.SetRGB(r, g, b) - }) - } - - robot := gobot.NewRobot("ollieBot", - []gobot.Connection{bleAdaptor}, - []gobot.Device{ollie}, - work, - ) - - robot.Start() + bleAdaptor := ble.NewClientAdaptor(os.Args[1]) + ollie := ollie.NewDriver(bleAdaptor) + + work := func() { + gobot.Every(1*time.Second, func() { + r := uint8(gobot.Rand(255)) + g := uint8(gobot.Rand(255)) + b := uint8(gobot.Rand(255)) + ollie.SetRGB(r, g, b) + }) + } + + robot := gobot.NewRobot("ollieBot", + []gobot.Connection{bleAdaptor}, + []gobot.Device{ollie}, + work, + ) + + robot.Start() } ``` @@ -49,26 +47,33 @@ func main() { The Sphero Ollie is a Bluetooth LE device. -You need to know the BLE ID of the Ollie you want to connect to. The Gobot BLE client adaptor also lets you connect by friendly name, aka "2B-1247". +You need to know the BLE ID of the Ollie you want to connect to. The Gobot BLE client adaptor also lets you connect by +friendly name, aka "2B-1247". ### OSX -To run any of the Gobot BLE code you must use the `GODEBUG=cgocheck=0` flag in order to get around some of the issues in the CGo-based implementation. +To run any of the Gobot BLE code you must use the `GODEBUG=cgocheck=0` flag in order to get around some of the issues in +the CGo-based implementation. -If you connect by name, then you do not need to worry about the Bluetooth LE ID. However, if you want to connect by ID, OS X uses its own Bluetooth ID system which is different from the IDs used on Linux. The code calls thru the XPC interfaces provided by OSX, so as a result does not need to run under sudo. +If you connect by name, then you do not need to worry about the Bluetooth LE ID. However, if you want to connect by ID, +OS X uses its own Bluetooth ID system which is different from the IDs used on Linux. The code calls thru the XPC interfaces +provided by OSX, so as a result does not need to run under sudo. For example: - GODEBUG=cgocheck=0 go run examples/ollie.go 2B-1247 +`GODEBUG=cgocheck=0 go run examples/ollie.go 2B-1247` ### Ubuntu -On Linux the BLE code will need to run as a root user account. The easiest way to accomplish this is probably to use `go build` to build your program, and then to run the requesting executable using `sudo`. +On Linux the BLE code will need to run as a root user account. The easiest way to accomplish this is probably to use +`go build` to build your program, and then to run the requesting executable using `sudo`. For example: - go build examples/ollie.go - sudo ./minidrone 2B-1247 +```sh +go build examples/ollie.go +sudo ./minidrone 2B-1247 +``` ### Windows diff --git a/platforms/sphero/sprkplus/README.md b/platforms/sphero/sprkplus/README.md index 7a00ccc09..64da9b203 100644 --- a/platforms/sphero/sprkplus/README.md +++ b/platforms/sphero/sprkplus/README.md @@ -4,9 +4,7 @@ The Sphero SPRK+ is a toy robot from Sphero that is controlled using Bluetooth L ## How to Install -``` -go get -d -u gobot.io/x/gobot/v2/... -``` +Please refer to the main [README.md](https://github.com/hybridgroup/gobot/blob/release/README.md) ## How to Use @@ -14,34 +12,34 @@ go get -d -u gobot.io/x/gobot/v2/... package main import ( - "os" - "time" + "os" + "time" - "gobot.io/x/gobot/v2" - "gobot.io/x/gobot/v2/platforms/ble" - "gobot.io/x/gobot/v2/platforms/sphero/sprkplus" + "gobot.io/x/gobot/v2" + "gobot.io/x/gobot/v2/platforms/ble" + "gobot.io/x/gobot/v2/platforms/sphero/sprkplus" ) func main() { - bleAdaptor := ble.NewClientAdaptor(os.Args[1]) - sprk := sprkplus.NewDriver(bleAdaptor) - - work := func() { - gobot.Every(1*time.Second, func() { - r := uint8(gobot.Rand(255)) - g := uint8(gobot.Rand(255)) - b := uint8(gobot.Rand(255)) - sprk.SetRGB(r, g, b) - }) - } - - robot := gobot.NewRobot("sprk", - []gobot.Connection{bleAdaptor}, - []gobot.Device{sprk}, - work, - ) - - robot.Start() + bleAdaptor := ble.NewClientAdaptor(os.Args[1]) + sprk := sprkplus.NewDriver(bleAdaptor) + + work := func() { + gobot.Every(1*time.Second, func() { + r := uint8(gobot.Rand(255)) + g := uint8(gobot.Rand(255)) + b := uint8(gobot.Rand(255)) + sprk.SetRGB(r, g, b) + }) + } + + robot := gobot.NewRobot("sprk", + []gobot.Connection{bleAdaptor}, + []gobot.Device{sprk}, + work, + ) + + robot.Start() } ``` @@ -49,26 +47,33 @@ func main() { The Sphero SPRK+ is a Bluetooth LE device. -You need to know the BLE ID of the SPRK+ you want to connect to. The Gobot BLE client adaptor also lets you connect by friendly name, aka "SK-1247". +You need to know the BLE ID of the SPRK+ you want to connect to. The Gobot BLE client adaptor also lets you connect by +friendly name, aka "SK-1247". ### OSX -To run any of the Gobot BLE code you must use the `GODEBUG=cgocheck=0` flag in order to get around some of the issues in the CGo-based implementation. +To run any of the Gobot BLE code you must use the `GODEBUG=cgocheck=0` flag in order to get around some of the issues in +the CGo-based implementation. -If you connect by name, then you do not need to worry about the Bluetooth LE ID. However, if you want to connect by ID, OS X uses its own Bluetooth ID system which is different from the IDs used on Linux. The code calls thru the XPC interfaces provided by OSX, so as a result does not need to run under sudo. +If you connect by name, then you do not need to worry about the Bluetooth LE ID. However, if you want to connect by ID, +OS X uses its own Bluetooth ID system which is different from the IDs used on Linux. The code calls thru the XPC interfaces +provided by OSX, so as a result does not need to run under sudo. For example: - GODEBUG=cgocheck=0 go run examples/sprkplus.go SK-1247 +`GODEBUG=cgocheck=0 go run examples/sprkplus.go SK-1247` ### Ubuntu -On Linux the BLE code will need to run as a root user account. The easiest way to accomplish this is probably to use `go build` to build your program, and then to run the requesting executable using `sudo`. +On Linux the BLE code will need to run as a root user account. The easiest way to accomplish this is probably to use +`go build` to build your program, and then to run the requesting executable using `sudo`. For example: - go build examples/sprkplus.go - sudo ./sprkplus SK-1247 +```sh +go build examples/sprkplus.go +sudo ./sprkplus SK-1247 +``` ### Windows diff --git a/platforms/tinkerboard/README.md b/platforms/tinkerboard/README.md index 8cb223105..de937eaf2 100644 --- a/platforms/tinkerboard/README.md +++ b/platforms/tinkerboard/README.md @@ -7,6 +7,8 @@ For more info about the Tinker Board, go to [https://www.asus.com/uk/Single-Boar ## How to Install +Please refer to the main [README.md](https://github.com/hybridgroup/gobot/blob/release/README.md) + Tested OS: * [Debian TinkerOS](https://github.com/TinkerBoard/debian_kernel/releases) @@ -15,13 +17,6 @@ Tested OS: > The latest "Tinker Board Debian 10 V3.0.11" is official discontinued. Nevertheless it is well tested with gobot. There > is a known i2c issue with the Kernel 4.4.194 if using block reads. armbian is known to work in this area. -You would normally install Go and Gobot on your workstation. Once installed, cross compile your program on your -workstation, transfer the final executable to your Tinker Board, and run the program on the Tinker Board as documented here. - -```sh -go get -d -u gobot.io/x/gobot/v2/... -``` - ### System access and configuration basics Some configuration steps are needed to enable drivers and simplify the interaction with your Tinker Board. Once your diff --git a/platforms/upboard/up2/README.md b/platforms/upboard/up2/README.md index 72e28323e..fe1dda9ea 100644 --- a/platforms/upboard/up2/README.md +++ b/platforms/upboard/up2/README.md @@ -1,6 +1,7 @@ # UP2 -The UP2 Board aka "Up Squared" is a single board SoC computer based on the Intel Apollo Lake processor. It has built-in GPIO, PWM, SPI, and I2C interfaces. +The UP2 Board aka "Up Squared" is a single board SoC computer based on the Intel Apollo Lake processor. It has built-in +GPIO, PWM, SPI, and I2C interfaces. For more info about the UP2 Board, go to [http://www.up-board.org/upsquared/](http://www.up-board.org/upsquared/). @@ -10,13 +11,14 @@ For more info about the UP2 Board, go to [http://www.up-board.org/upsquared/](ht We recommend updating to the latest Ubuntu 16.04 and BIOS v3.3 when using the UP2 board. To update your UP2 OS go to: -https://downloads.up-community.org/download/up-squared-iot-grove-development-kit-ubuntu-16-04-server-image/ + To update your UP2 BIOS, go to: -https://downloads.up-community.org/download/up-squared-uefi-bios-v3-3/ + -Once your UP2 has been updated, you will need to provide permission to the `upsquared` user to access the GPIO or I2C subsystems on the board. +Once your UP2 has been updated, you will need to provide permission to the `upsquared` user to access the GPIO or I2C +subsystems on the board. ### Configuring GPIO on UP2 board @@ -24,14 +26,14 @@ To access the GPIO subsystem, you will need to create a new group, add your user First, run the following commands on the board itself: -``` +```sh sudo groupadd gpio sudo adduser upsquared gpio ``` Now, add a new UDEV rule to the UP2 board. Add the following text as a new UDEV rule named `/etc/udev/rules.d/99-gpio.rules`: -``` +```sh SUBSYSTEM=="gpio*", PROGRAM="/bin/sh -c '\ chown -R root:gpiouser /sys/class/gpio && chmod -R 770 /sys/class/gpio;\ chown -R root:gpiouser /sys/devices/virtual/gpio && chmod -R 770 /sys/devices/virtual/gpio;\ @@ -45,14 +47,14 @@ To use the built-in LEDs you will need to create a new group, add your user to t First, run the following commands on the board itself: -``` +```sh sudo groupadd leds sudo adduser upsquared leds ``` Now add the following text as a new UDEV rule named `/etc/udev/rules.d/99-leds.rules`: -``` +```sh SUBSYSTEM=="leds*", PROGRAM="/bin/sh -c '\ chown -R root:leds /sys/class/leds && chmod -R 770 /sys/class/leds;\ chown -R root:leds /sys/devices/platform/up-pinctrl/leds && chmod -R 770 /sys/devices/platform/up-pinctrl/leds;\ @@ -64,22 +66,20 @@ SUBSYSTEM=="leds*", PROGRAM="/bin/sh -c '\ To access the I2C subsystem, run the following command: -``` +```sh sudo usermod -aG i2c upsquared ``` You should reboot your UP2 board after making these changes for them to take effect. -**IMPORTANT NOTE REGARDING I2C:** -The current UP2 firmware is not able to scan for I2C devices using the `i2cdetect` command line tool. If you run this tool, it will cause the I2C subsystem to malfunction until you reboot your system. That means at this time, do not use `i2cdetect` on the UP2 board. +**IMPORTANT NOTE REGARDING I2C:** +The current UP2 firmware is not able to scan for I2C devices using the `i2cdetect` command line tool. If you run this tool, +it will cause the I2C subsystem to malfunction until you reboot your system. That means at this time, do not use `i2cdetect` +on the UP2 board. ### Local setup -You would normally install Go and Gobot on your local workstation. Once installed, cross compile your program on your workstation, transfer the final executable to your UP2, and run the program on the UP2 as documented below. - -``` -go get -d -u gobot.io/x/gobot/v2/... -``` +Please refer to the main [README.md](https://github.com/hybridgroup/gobot/blob/release/README.md) ## How to Use @@ -90,7 +90,8 @@ r := up2.NewAdaptor() led := gpio.NewLedDriver(r, "13") ``` -You can also use the values `up2.LEDRed`, `up2.LEDBlue`, `up2.LEDGreen`, and `up2.LEDYellow` as pin reference to access the 4 built-in LEDs. For example: +You can also use the values `up2.LEDRed`, `up2.LEDBlue`, `up2.LEDGreen`, and `up2.LEDYellow` as pin reference to access +the 4 built-in LEDs. For example: ```go r := up2.NewAdaptor() @@ -103,13 +104,14 @@ led := gpio.NewLedDriver(r, up2.LEDRed) Compile your Gobot program on your workstation like this: -```bash -$ GOARCH=amd64 GOOS=linux go build examples/up2_blink.go +```sh +GOARCH=amd64 GOOS=linux go build examples/up2_blink.go ``` -Once you have compiled your code, you can you can upload your program and execute it on the UP2 from your workstation using the `scp` and `ssh` commands like this: +Once you have compiled your code, you can you can upload your program and execute it on the UP2 from your workstation using +the `scp` and `ssh` commands like this: -```bash -$ scp up2_blink upsquared@192.168.1.xxx:/home/upsquared/ -$ ssh -t upsquared@192.168.1.xxx "./up2_blink" +```sh +scp up2_blink upsquared@192.168.1.xxx:/home/upsquared/ +ssh -t upsquared@192.168.1.xxx "./up2_blink" ``` diff --git a/snapcraft.yaml b/snapcraft.yaml deleted file mode 100644 index ce395fa46..000000000 --- a/snapcraft.yaml +++ /dev/null @@ -1,28 +0,0 @@ -name: gobot -version: dev -summary: Gobot is a framework for robotics, physical computing, and IoT. -description: | - Gobot is a framework using the Go programming language for robotics, physical - computing, and the Internet of Things. - It provides a simple, yet powerful way to create solutions that incorporate - multiple, different hardware devices at the same time. - -grade: devel -confinement: strict - -apps: - gobot: - command: gobot - plugs: [home] - -parts: - gobot: - source: . - plugin: go - go-packages: [gobot.io/x/gobot/v2/cli] - go-importpath: gobot.io/x/gobot/v2 - organize: - bin/cli: bin/gobot - after: [go] - go: - source-tag: go1.7.5 diff --git a/version.go b/version.go deleted file mode 100644 index c238b944b..000000000 --- a/version.go +++ /dev/null @@ -1,8 +0,0 @@ -package gobot - -const version = "2.0.0" - -// Version returns the current Gobot version -func Version() string { - return version -} From 1175db315df0c0210e02dce0bf7a6428fb27bd27 Mon Sep 17 00:00:00 2001 From: dlstjq7685 <31182898+dlstjq7685@users.noreply.github.com> Date: Sun, 11 Jun 2023 02:25:01 +0900 Subject: [PATCH 09/20] all: substitute deprecated ioutil methods (#923) --- api/robeaux/robeaux.go | 3 +-- examples/bebop_ps3_video.go | 3 +-- examples/firmata_travis.go | 4 ++-- platforms/chip/chip_adaptor.go | 6 +++--- platforms/joystick/joystick_driver.go | 4 ++-- platforms/leap/leap_motion_driver_test.go | 6 +++--- platforms/mqtt/mqtt_adaptor.go | 4 ++-- platforms/parrot/bebop/client/examples/video.go | 4 ++-- platforms/particle/adaptor.go | 4 ++-- system/fs_mock.go | 5 ++--- 10 files changed, 20 insertions(+), 23 deletions(-) diff --git a/api/robeaux/robeaux.go b/api/robeaux/robeaux.go index 709526eb8..59b5242b1 100644 --- a/api/robeaux/robeaux.go +++ b/api/robeaux/robeaux.go @@ -45,7 +45,6 @@ import ( "compress/gzip" "fmt" "io" - "io/ioutil" "os" "path/filepath" "strings" @@ -1014,7 +1013,7 @@ func RestoreAsset(dir, name string) error { if err != nil { return err } - err = ioutil.WriteFile(_filePath(dir, name), data, info.Mode()) + err = os.WriteFile(_filePath(dir, name), data, info.Mode()) if err != nil { return err } diff --git a/examples/bebop_ps3_video.go b/examples/bebop_ps3_video.go index 4f31f373b..74b38b672 100644 --- a/examples/bebop_ps3_video.go +++ b/examples/bebop_ps3_video.go @@ -30,7 +30,6 @@ package main import ( "fmt" "io" - "io/ioutil" "os/exec" "sync/atomic" "time" @@ -70,7 +69,7 @@ func ffmpeg() (stdin io.WriteCloser, stderr io.ReadCloser, err error) { go func() { for { - buf, err := ioutil.ReadAll(stderr) + buf, err := io.ReadAll(stderr) if err != nil { fmt.Println(err) } diff --git a/examples/firmata_travis.go b/examples/firmata_travis.go index 4c836d2a6..970f9c8aa 100644 --- a/examples/firmata_travis.go +++ b/examples/firmata_travis.go @@ -16,7 +16,7 @@ package main import ( "encoding/json" "fmt" - "io/ioutil" + "io" "net/http" "os" "time" @@ -63,7 +63,7 @@ func checkTravis(robot *gobot.Robot) { panic(err) } defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) + body, err := io.ReadAll(resp.Body) if err != nil { panic(err) } diff --git a/platforms/chip/chip_adaptor.go b/platforms/chip/chip_adaptor.go index fc6acfc8a..4cc9eda5f 100644 --- a/platforms/chip/chip_adaptor.go +++ b/platforms/chip/chip_adaptor.go @@ -2,7 +2,7 @@ package chip import ( "fmt" - "io/ioutil" + "os" "path/filepath" "strconv" "strings" @@ -119,14 +119,14 @@ func getXIOBase() (baseAddr int, err error) { } for _, labelPath := range labels { - label, err := ioutil.ReadFile(labelPath) + label, err := os.ReadFile(labelPath) if err != nil { return baseAddr, err } if strings.HasPrefix(string(label), expanderID) { expanderPath, _ := filepath.Split(labelPath) basePath := filepath.Join(expanderPath, "base") - base, err := ioutil.ReadFile(basePath) + base, err := os.ReadFile(basePath) if err != nil { return baseAddr, err } diff --git a/platforms/joystick/joystick_driver.go b/platforms/joystick/joystick_driver.go index 85c91c38f..d473bfad3 100644 --- a/platforms/joystick/joystick_driver.go +++ b/platforms/joystick/joystick_driver.go @@ -3,7 +3,7 @@ package joystick import ( "encoding/json" "fmt" - "io/ioutil" + "os" "time" "github.com/veandco/go-sdl2/sdl" @@ -250,7 +250,7 @@ func (j *Driver) findHatName(id uint8, hat uint8, list []hat) string { // loadFile load the joystick config from a .json file func (j *Driver) loadFile() error { - file, e := ioutil.ReadFile(j.configPath) + file, e := os.ReadFile(j.configPath) if e != nil { return e } diff --git a/platforms/leap/leap_motion_driver_test.go b/platforms/leap/leap_motion_driver_test.go index e98d080be..90267ac99 100644 --- a/platforms/leap/leap_motion_driver_test.go +++ b/platforms/leap/leap_motion_driver_test.go @@ -3,7 +3,7 @@ package leap import ( "errors" "io" - "io/ioutil" + "os" "strings" "sync" "testing" @@ -47,7 +47,7 @@ func initTestLeapMotionDriver() (*Driver, *NullReadWriteCloser) { d := NewDriver(a) d.receive = func(ws io.ReadWriteCloser, buf *[]byte) { - file, _ := ioutil.ReadFile("./test/support/example_frame.json") + file, _ := os.ReadFile("./test/support/example_frame.json") copy(*buf, file) } return d, rwc @@ -82,7 +82,7 @@ func TestLeapMotionDriverHalt(t *testing.T) { func TestLeapMotionDriverParser(t *testing.T) { d, _ := initTestLeapMotionDriver() - file, _ := ioutil.ReadFile("./test/support/example_frame.json") + file, _ := os.ReadFile("./test/support/example_frame.json") parsedFrame := d.ParseFrame(file) if parsedFrame.Hands == nil || parsedFrame.Pointables == nil || parsedFrame.Gestures == nil { diff --git a/platforms/mqtt/mqtt_adaptor.go b/platforms/mqtt/mqtt_adaptor.go index 3056ab7d7..9268f2b98 100644 --- a/platforms/mqtt/mqtt_adaptor.go +++ b/platforms/mqtt/mqtt_adaptor.go @@ -3,7 +3,7 @@ package mqtt import ( "crypto/tls" "crypto/x509" - "io/ioutil" + "os" "gobot.io/x/gobot/v2" @@ -204,7 +204,7 @@ func (a *Adaptor) newTLSConfig() *tls.Config { var certpool *x509.CertPool if len(a.ServerCert()) > 0 { certpool = x509.NewCertPool() - pemCerts, err := ioutil.ReadFile(a.ServerCert()) + pemCerts, err := os.ReadFile(a.ServerCert()) if err == nil { certpool.AppendCertsFromPEM(pemCerts) } diff --git a/platforms/parrot/bebop/client/examples/video.go b/platforms/parrot/bebop/client/examples/video.go index f9d0934a9..3946c42c2 100644 --- a/platforms/parrot/bebop/client/examples/video.go +++ b/platforms/parrot/bebop/client/examples/video.go @@ -25,7 +25,7 @@ package main import ( "fmt" - "io/ioutil" + "io" "os/exec" "time" @@ -73,7 +73,7 @@ func main() { go func() { for { - buf, err := ioutil.ReadAll(ffmpegErr) + buf, err := io.ReadAll(ffmpegErr) if err != nil { fmt.Println(err) } diff --git a/platforms/particle/adaptor.go b/platforms/particle/adaptor.go index a291efca6..aed5da0d7 100644 --- a/platforms/particle/adaptor.go +++ b/platforms/particle/adaptor.go @@ -4,7 +4,7 @@ import ( "encoding/json" "errors" "fmt" - "io/ioutil" + "io" "net/http" "net/url" "strconv" @@ -262,7 +262,7 @@ func (s *Adaptor) request(method string, url string, params url.Values) (m map[s return } - buf, err := ioutil.ReadAll(resp.Body) + buf, err := io.ReadAll(resp.Body) if err != nil { return diff --git a/system/fs_mock.go b/system/fs_mock.go index 5577fb848..197bad026 100644 --- a/system/fs_mock.go +++ b/system/fs_mock.go @@ -2,7 +2,6 @@ package system import ( "fmt" - "io/ioutil" "os" "path" "regexp" @@ -135,7 +134,7 @@ func (fs *MockFilesystem) stat(name string) (os.FileInfo, error) { _, ok := fs.Files[name] if ok { // return file based mock FileInfo - tmpFile, err := ioutil.TempFile("", name) + tmpFile, err := os.CreateTemp("", name) if err != nil { return nil, err } @@ -148,7 +147,7 @@ func (fs *MockFilesystem) stat(name string) (os.FileInfo, error) { for path := range fs.Files { if strings.HasPrefix(path, dirName) { // return dir based mock FileInfo, TempDir don't like "/" in between - tmpDir, err := ioutil.TempDir("", strings.ReplaceAll(name, "/", "_")) + tmpDir, err := os.MkdirTemp("", strings.ReplaceAll(name, "/", "_")) if err != nil { return nil, err } From d459fc05ab5590df34ad44ae02b0b389839f5e93 Mon Sep 17 00:00:00 2001 From: Joey Berkovitz Date: Sun, 11 Jun 2023 05:10:17 -0400 Subject: [PATCH 10/20] tello: Fix partially #793 by initialize doneCh in NewDriverWithIP (#931) --- platforms/dji/tello/driver.go | 26 ++------------------------ 1 file changed, 2 insertions(+), 24 deletions(-) diff --git a/platforms/dji/tello/driver.go b/platforms/dji/tello/driver.go index 5578e6d3e..0553ed6eb 100644 --- a/platforms/dji/tello/driver.go +++ b/platforms/dji/tello/driver.go @@ -202,30 +202,7 @@ type Driver struct { // NewDriver creates a driver for the Tello drone. Pass in the UDP port to use for the responses // from the drone. func NewDriver(port string) *Driver { - d := &Driver{name: gobot.DefaultName("Tello"), - reqAddr: "192.168.10.1:8889", - respPort: port, - videoPort: "11111", - Eventer: gobot.NewEventer(), - doneCh: make(chan struct{}, 1), - } - - d.AddEvent(ConnectedEvent) - d.AddEvent(FlightDataEvent) - d.AddEvent(TakeoffEvent) - d.AddEvent(LandingEvent) - d.AddEvent(PalmLandingEvent) - d.AddEvent(BounceEvent) - d.AddEvent(FlipEvent) - d.AddEvent(TimeEvent) - d.AddEvent(LogEvent) - d.AddEvent(WifiDataEvent) - d.AddEvent(LightStrengthEvent) - d.AddEvent(SetExposureEvent) - d.AddEvent(VideoFrameEvent) - d.AddEvent(SetVideoEncoderRateEvent) - - return d + return NewDriverWithIP("192.168.10.1", port) } // NewDriverWithIP creates a driver for the Tello EDU drone. Pass in the ip address and UDP port to use for the responses @@ -236,6 +213,7 @@ func NewDriverWithIP(ip string, port string) *Driver { respPort: port, videoPort: "11111", Eventer: gobot.NewEventer(), + doneCh: make(chan struct{}, 1), } d.AddEvent(ConnectedEvent) From 712a21365c0f104105ecd01640078cfb2b7b3268 Mon Sep 17 00:00:00 2001 From: Thomas Kohler Date: Mon, 12 Jun 2023 19:51:25 +0200 Subject: [PATCH 11/20] all(style) : fix linter issues for errcheck, ineffassign, unused and fix errors (#950) --- .golangci.yml | 9 - api/api.go | 26 +- api/api_test.go | 52 +- drivers/aio/analog_sensor_driver_test.go | 10 +- drivers/aio/grove_drivers.go | 30 +- drivers/aio/grove_drivers_test.go | 8 +- .../grove_temperature_sensor_driver_test.go | 2 +- drivers/aio/helpers_test.go | 7 - drivers/aio/temperature_sensor_driver_test.go | 4 +- drivers/common/mfrc522/mfrc522_pcd.go | 7 +- .../common/mfrc522/mfrc522_pcd_register.go | 164 +++---- drivers/common/mfrc522/mfrc522_picc.go | 2 +- drivers/gpio/aip1640_driver.go | 88 ++-- drivers/gpio/button_driver_test.go | 12 +- drivers/gpio/buzzer_driver_test.go | 6 +- drivers/gpio/easy_driver.go | 112 +++-- drivers/gpio/easy_driver_test.go | 60 +-- drivers/gpio/grove_drivers_test.go | 8 +- drivers/gpio/hd44780_driver_test.go | 45 +- drivers/gpio/helpers_test.go | 6 - drivers/gpio/led_driver_test.go | 6 +- drivers/gpio/makey_button_driver_test.go | 8 +- drivers/gpio/max7219_driver.go | 131 +++-- drivers/gpio/motor_driver_test.go | 36 +- drivers/gpio/pir_motion_driver_test.go | 6 +- drivers/gpio/relay_driver_test.go | 12 +- drivers/gpio/rgb_led_driver_test.go | 6 +- drivers/gpio/servo_driver_test.go | 8 +- drivers/gpio/stepper_driver.go | 20 +- drivers/gpio/stepper_driver_test.go | 24 +- drivers/gpio/tm1638_driver.go | 117 +++-- drivers/i2c/adafruit1109_driver_test.go | 14 +- drivers/i2c/ads1x15_driver.go | 5 - drivers/i2c/adxl345_driver_test.go | 16 +- drivers/i2c/bme280_driver.go | 62 ++- drivers/i2c/bme280_driver_test.go | 8 +- drivers/i2c/bmp180_driver.go | 60 ++- drivers/i2c/bmp180_driver_test.go | 82 ++-- drivers/i2c/bmp280_driver.go | 110 +++-- drivers/i2c/bmp280_driver_test.go | 10 +- drivers/i2c/bmp388_driver.go | 125 +++-- drivers/i2c/bmp388_driver_test.go | 14 +- drivers/i2c/ccs811_driver.go | 58 +-- drivers/i2c/ccs811_driver_test.go | 6 +- drivers/i2c/drv2605l_driver_test.go | 2 +- drivers/i2c/grovepi_driver_test.go | 4 +- drivers/i2c/helpers_test.go | 8 - drivers/i2c/hmc5883l_driver_test.go | 4 +- drivers/i2c/i2c_driver_test.go | 4 +- drivers/i2c/ina3221_driver.go | 9 +- drivers/i2c/jhd1313m1_driver_test.go | 38 +- drivers/i2c/l3gd20h_driver.go | 23 +- drivers/i2c/l3gd20h_driver_test.go | 2 +- drivers/i2c/mcp23017_driver_test.go | 2 +- drivers/i2c/mpl115a2_driver.go | 34 +- drivers/i2c/mpl115a2_driver_test.go | 4 +- drivers/i2c/mpu6050_driver.go | 59 +-- drivers/i2c/mpu6050_driver_test.go | 8 +- drivers/i2c/pca953x_driver_test.go | 2 +- drivers/i2c/pca9685_driver_test.go | 2 +- drivers/i2c/pcf8583_driver_test.go | 2 +- drivers/i2c/sht2x_driver.go | 19 +- drivers/i2c/sht2x_driver_test.go | 16 +- drivers/i2c/sht3x_driver.go | 11 +- drivers/i2c/sht3x_driver_test.go | 4 +- drivers/i2c/ssd1306_driver.go | 25 +- drivers/i2c/ssd1306_driver_test.go | 14 +- drivers/i2c/th02_driver.go | 16 +- drivers/i2c/tsl2561_driver_test.go | 8 +- drivers/i2c/wiichuck_driver_test.go | 22 +- drivers/i2c/yl40_driver_test.go | 2 +- drivers/spi/ssd1306_driver.go | 189 ++++++-- drivers/spi/ssd1306_driver_test.go | 6 +- eventer_test.go | 4 +- master.go | 36 +- master_test.go | 74 +-- platforms/adaptors/digitalpinsadaptor_test.go | 4 +- platforms/adaptors/i2cbusadaptor_test.go | 4 +- platforms/adaptors/pwmpinsadaptor_test.go | 4 +- platforms/audio/audio_driver.go | 4 - .../beaglebone/beaglebone_adaptor_test.go | 8 +- platforms/ble/ble_client_adaptor.go | 43 +- platforms/ble/ble_client_adaptor_test.go | 5 - platforms/ble/generic_access_driver.go | 10 +- platforms/ble/serial_port.go | 14 +- platforms/chip/chip_adaptor_test.go | 10 +- platforms/dexter/gopigo3/driver.go | 78 +-- platforms/dexter/gopigo3/driver_test.go | 3 +- platforms/digispark/digispark_i2c_test.go | 1 - platforms/dji/tello/driver.go | 455 +++++++++++------- platforms/dji/tello/driver_test.go | 8 +- platforms/firmata/ble_firmata_adaptor.go | 4 +- platforms/firmata/client/client.go | 74 +-- platforms/firmata/client/client_test.go | 50 +- platforms/firmata/firmata_adaptor.go | 69 ++- platforms/firmata/firmata_adaptor_test.go | 2 +- platforms/firmata/firmata_i2c.go | 30 +- platforms/firmata/firmata_i2c_test.go | 1 - platforms/holystone/hs200/hs200_driver.go | 5 +- platforms/intel-iot/curie/imu_driver.go | 52 +- platforms/intel-iot/curie/imu_driver_test.go | 16 +- .../intel-iot/edison/edison_adaptor_test.go | 26 +- .../intel-iot/joule/joule_adaptor_test.go | 8 +- platforms/jetson/jetson_adaptor_test.go | 6 +- platforms/joystick/joystick_adaptor.go | 19 +- platforms/joystick/joystick_adaptor_test.go | 2 +- platforms/joystick/joystick_driver.go | 5 +- platforms/joystick/joystick_driver_test.go | 20 +- platforms/keyboard/keyboard_driver.go | 24 +- platforms/leap/leap_motion_driver.go | 38 +- platforms/leap/leap_motion_driver_test.go | 4 +- platforms/leap/parser.go | 74 +-- platforms/mavlink/common/common.go | 346 +------------ platforms/mavlink/common/mavlink.go | 7 +- platforms/mavlink/mavlink_driver_test.go | 8 +- platforms/mavlink/mavlink_udp_adaptor_test.go | 12 +- platforms/megapi/megapi_adaptor.go | 4 +- platforms/megapi/motor_driver.go | 25 +- platforms/microbit/accelerometer_driver.go | 24 +- .../microbit/accelerometer_driver_test.go | 4 +- platforms/microbit/button_driver.go | 18 +- platforms/microbit/button_driver_test.go | 4 +- platforms/microbit/helpers_test.go | 1 - platforms/microbit/io_pin_driver.go | 117 +++-- platforms/microbit/led_driver.go | 2 +- platforms/microbit/led_driver_test.go | 6 +- platforms/microbit/magnetometer_driver.go | 24 +- .../microbit/magnetometer_driver_test.go | 4 +- platforms/microbit/temperature_driver.go | 12 +- platforms/microbit/temperature_driver_test.go | 4 +- platforms/mqtt/mqtt_adaptor.go | 16 +- platforms/mqtt/mqtt_adaptor_test.go | 10 +- platforms/mqtt/mqtt_driver_test.go | 10 +- platforms/nanopi/nanopi_adaptor.go | 2 - platforms/nanopi/nanopi_adaptor_test.go | 2 +- platforms/nats/nats_adaptor.go | 29 +- platforms/nats/nats_adaptor_test.go | 14 +- platforms/neurosky/neurosky_adaptor_test.go | 10 +- platforms/neurosky/neurosky_driver.go | 30 +- platforms/neurosky/neurosky_driver_test.go | 34 +- .../parrot/ardrone/ardrone_driver_test.go | 2 +- platforms/parrot/bebop/bebop_adaptor.go | 7 +- platforms/parrot/bebop/bebop_adaptor_test.go | 2 +- platforms/parrot/bebop/bebop_driver.go | 40 +- platforms/parrot/bebop/client/client.go | 137 ++++-- .../parrot/minidrone/minidrone_driver.go | 157 +++--- platforms/particle/adaptor.go | 54 +-- platforms/particle/adaptor_test.go | 43 +- platforms/pebble/pebble_driver_test.go | 4 +- platforms/raspi/raspi_adaptor.go | 7 +- platforms/raspi/raspi_adaptor_test.go | 10 +- platforms/rockpi/rockpi_adaptor.go | 1 - platforms/rockpi/rockpi_adaptor_test.go | 2 +- platforms/sphero/ollie/ollie_driver.go | 85 ++-- platforms/sphero/ollie/ollie_driver_test.go | 16 +- platforms/sphero/sphero_adaptor.go | 4 +- platforms/sphero/sphero_adaptor_test.go | 10 +- platforms/sphero/sphero_driver.go | 16 +- platforms/sphero/sphero_driver_test.go | 10 +- platforms/tinkerboard/adaptor.go | 2 - platforms/tinkerboard/adaptor_test.go | 2 +- platforms/upboard/up2/adaptor_test.go | 4 +- robot.go | 80 +-- system/digitalpin_bench_test.go | 4 +- system/digitalpin_sysfs.go | 5 +- system/fs_mock_test.go | 2 +- system/spi_gpio.go | 20 +- 167 files changed, 2593 insertions(+), 2347 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 48a00cc4c..215dd56a9 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -32,15 +32,6 @@ linters: # Enable specific linter # https://golangci-lint.run/usage/linters/#enabled-by-default # note: typecheck can not be disabled, it is used to check code compilation - # - # TODO: this default linters needs to be disabled to run successfully, we have to fix - # all issues step by step to enable at least the default linters - disable: - - errcheck - - ineffassign - #- staticcheck - - unused - enable: - nolintlint diff --git a/api/api.go b/api/api.go index 4efeda1be..365d59e8f 100644 --- a/api/api.go +++ b/api/api.go @@ -38,11 +38,15 @@ func NewAPI(m *gobot.Master) *API { go func() { if a.Cert != "" && a.Key != "" { - http.ListenAndServeTLS(a.Host+":"+a.Port, a.Cert, a.Key, nil) + if err := http.ListenAndServeTLS(a.Host+":"+a.Port, a.Cert, a.Key, nil); err != nil { + panic(err) + } } else { log.Println("WARNING: API using insecure connection. " + "We recommend using an SSL certificate with Gobot.") - http.ListenAndServe(a.Host+":"+a.Port, nil) + if err := http.ListenAndServe(a.Host+":"+a.Port, nil); err != nil { + panic(err) + } } }() }, @@ -177,7 +181,9 @@ func (a *API) robeaux(res http.ResponseWriter, req *http.Request) { } else if t[len(t)-1] == "html" { res.Header().Set("Content-Type", "text/html; charset=utf-8") } - res.Write(buf) + if _, err := res.Write(buf); err != nil { + panic(err) + } } // mcp returns MCP route handler. @@ -261,10 +267,12 @@ func (a *API) robotDeviceEvent(res http.ResponseWriter, req *http.Request) { if event := a.master.Robot(req.URL.Query().Get(":robot")). Device(req.URL.Query().Get(":device")).(gobot.Eventer). Event(req.URL.Query().Get(":event")); len(event) > 0 { - device.(gobot.Eventer).On(event, func(data interface{}) { + if err := device.(gobot.Eventer).On(event, func(data interface{}) { d, _ := json.Marshal(data) dataChan <- string(d) - }) + }); err != nil { + panic(err) + } for { select { @@ -363,7 +371,9 @@ func (a *API) executeCommand(f func(map[string]interface{}) interface{}, ) { body := make(map[string]interface{}) - json.NewDecoder(req.Body).Decode(&body) + if err := json.NewDecoder(req.Body).Decode(&body); err != nil { + panic(err) + } if f != nil { a.writeJSON(map[string]interface{}{"result": f(body)}, res) @@ -376,7 +386,9 @@ func (a *API) executeCommand(f func(map[string]interface{}) interface{}, func (a *API) writeJSON(j interface{}, res http.ResponseWriter) { data, _ := json.Marshal(j) res.Header().Set("Content-Type", "application/json; charset=utf-8") - res.Write(data) + if _, err := res.Write(data); err != nil { + panic(err) + } } // Debug add handler to api that prints each request diff --git a/api/api_test.go b/api/api_test.go index 2d1939474..e7d0ce404 100644 --- a/api/api_test.go +++ b/api/api_test.go @@ -91,7 +91,7 @@ func TestMcp(t *testing.T) { a.ServeHTTP(response, request) var body map[string]interface{} - json.NewDecoder(response.Body).Decode(&body) + _ = json.NewDecoder(response.Body).Decode(&body) gobottest.Refute(t, body["MCP"].(map[string]interface{})["robots"], nil) gobottest.Refute(t, body["MCP"].(map[string]interface{})["commands"], nil) } @@ -103,7 +103,7 @@ func TestMcpCommands(t *testing.T) { a.ServeHTTP(response, request) var body map[string]interface{} - json.NewDecoder(response.Body).Decode(&body) + _ = json.NewDecoder(response.Body).Decode(&body) gobottest.Assert(t, body["commands"], []interface{}{"TestFunction"}) } @@ -120,7 +120,7 @@ func TestExecuteMcpCommand(t *testing.T) { response := httptest.NewRecorder() a.ServeHTTP(response, request) - json.NewDecoder(response.Body).Decode(&body) + _ = json.NewDecoder(response.Body).Decode(&body) gobottest.Assert(t, body.(map[string]interface{})["result"], "hey Beep Boop") // unknown command @@ -132,7 +132,7 @@ func TestExecuteMcpCommand(t *testing.T) { response = httptest.NewRecorder() a.ServeHTTP(response, request) - json.NewDecoder(response.Body).Decode(&body) + _ = json.NewDecoder(response.Body).Decode(&body) gobottest.Assert(t, body.(map[string]interface{})["error"], "Unknown Command") } @@ -143,7 +143,7 @@ func TestRobots(t *testing.T) { a.ServeHTTP(response, request) var body map[string]interface{} - json.NewDecoder(response.Body).Decode(&body) + _ = json.NewDecoder(response.Body).Decode(&body) gobottest.Assert(t, len(body["robots"].([]interface{})), 3) } @@ -156,14 +156,14 @@ func TestRobot(t *testing.T) { a.ServeHTTP(response, request) var body map[string]interface{} - json.NewDecoder(response.Body).Decode(&body) + _ = json.NewDecoder(response.Body).Decode(&body) gobottest.Assert(t, body["robot"].(map[string]interface{})["name"].(string), "Robot1") // unknown robot request, _ = http.NewRequest("GET", "/api/robots/UnknownRobot1", nil) a.ServeHTTP(response, request) - json.NewDecoder(response.Body).Decode(&body) + _ = json.NewDecoder(response.Body).Decode(&body) gobottest.Assert(t, body["error"], "No Robot found with the name UnknownRobot1") } @@ -176,14 +176,14 @@ func TestRobotDevices(t *testing.T) { a.ServeHTTP(response, request) var body map[string]interface{} - json.NewDecoder(response.Body).Decode(&body) + _ = json.NewDecoder(response.Body).Decode(&body) gobottest.Assert(t, len(body["devices"].([]interface{})), 3) // unknown robot request, _ = http.NewRequest("GET", "/api/robots/UnknownRobot1/devices", nil) a.ServeHTTP(response, request) - json.NewDecoder(response.Body).Decode(&body) + _ = json.NewDecoder(response.Body).Decode(&body) gobottest.Assert(t, body["error"], "No Robot found with the name UnknownRobot1") } @@ -196,14 +196,14 @@ func TestRobotCommands(t *testing.T) { a.ServeHTTP(response, request) var body map[string]interface{} - json.NewDecoder(response.Body).Decode(&body) + _ = json.NewDecoder(response.Body).Decode(&body) gobottest.Assert(t, body["commands"], []interface{}{"robotTestFunction"}) // unknown robot request, _ = http.NewRequest("GET", "/api/robots/UnknownRobot1/commands", nil) a.ServeHTTP(response, request) - json.NewDecoder(response.Body).Decode(&body) + _ = json.NewDecoder(response.Body).Decode(&body) gobottest.Assert(t, body["error"], "No Robot found with the name UnknownRobot1") } @@ -219,7 +219,7 @@ func TestExecuteRobotCommand(t *testing.T) { response := httptest.NewRecorder() a.ServeHTTP(response, request) - json.NewDecoder(response.Body).Decode(&body) + _ = json.NewDecoder(response.Body).Decode(&body) gobottest.Assert(t, body.(map[string]interface{})["result"], "hey Robot1, Beep Boop") // unknown command @@ -231,7 +231,7 @@ func TestExecuteRobotCommand(t *testing.T) { response = httptest.NewRecorder() a.ServeHTTP(response, request) - json.NewDecoder(response.Body).Decode(&body) + _ = json.NewDecoder(response.Body).Decode(&body) gobottest.Assert(t, body.(map[string]interface{})["error"], "Unknown Command") // uknown robot @@ -242,7 +242,7 @@ func TestExecuteRobotCommand(t *testing.T) { request.Header.Add("Content-Type", "application/json") a.ServeHTTP(response, request) - json.NewDecoder(response.Body).Decode(&body) + _ = json.NewDecoder(response.Body).Decode(&body) gobottest.Assert(t, body.(map[string]interface{})["error"], "No Robot found with the name UnknownRobot1") } @@ -258,7 +258,7 @@ func TestRobotDevice(t *testing.T) { a.ServeHTTP(response, request) var body map[string]interface{} - json.NewDecoder(response.Body).Decode(&body) + _ = json.NewDecoder(response.Body).Decode(&body) gobottest.Assert(t, body["device"].(map[string]interface{})["name"].(string), "Device1") // unknown device @@ -266,7 +266,7 @@ func TestRobotDevice(t *testing.T) { "/api/robots/Robot1/devices/UnknownDevice1", nil) a.ServeHTTP(response, request) - json.NewDecoder(response.Body).Decode(&body) + _ = json.NewDecoder(response.Body).Decode(&body) gobottest.Assert(t, body["error"], "No Device found with the name UnknownDevice1") } @@ -282,7 +282,7 @@ func TestRobotDeviceCommands(t *testing.T) { a.ServeHTTP(response, request) var body map[string]interface{} - json.NewDecoder(response.Body).Decode(&body) + _ = json.NewDecoder(response.Body).Decode(&body) gobottest.Assert(t, len(body["commands"].([]interface{})), 2) // unknown device @@ -291,7 +291,7 @@ func TestRobotDeviceCommands(t *testing.T) { nil, ) a.ServeHTTP(response, request) - json.NewDecoder(response.Body).Decode(&body) + _ = json.NewDecoder(response.Body).Decode(&body) gobottest.Assert(t, body["error"], "No Device found with the name UnknownDevice1") } @@ -308,7 +308,7 @@ func TestExecuteRobotDeviceCommand(t *testing.T) { response := httptest.NewRecorder() a.ServeHTTP(response, request) - json.NewDecoder(response.Body).Decode(&body) + _ = json.NewDecoder(response.Body).Decode(&body) gobottest.Assert(t, body.(map[string]interface{})["result"].(string), "hello human") // unknown command @@ -320,7 +320,7 @@ func TestExecuteRobotDeviceCommand(t *testing.T) { response = httptest.NewRecorder() a.ServeHTTP(response, request) - json.NewDecoder(response.Body).Decode(&body) + _ = json.NewDecoder(response.Body).Decode(&body) gobottest.Assert(t, body.(map[string]interface{})["error"], "Unknown Command") // unknown device @@ -331,7 +331,7 @@ func TestExecuteRobotDeviceCommand(t *testing.T) { request.Header.Add("Content-Type", "application/json") a.ServeHTTP(response, request) - json.NewDecoder(response.Body).Decode(&body) + _ = json.NewDecoder(response.Body).Decode(&body) gobottest.Assert(t, body.(map[string]interface{})["error"], "No Device found with the name UnknownDevice1") } @@ -345,14 +345,14 @@ func TestRobotConnections(t *testing.T) { a.ServeHTTP(response, request) var body map[string]interface{} - json.NewDecoder(response.Body).Decode(&body) + _ = json.NewDecoder(response.Body).Decode(&body) gobottest.Assert(t, len(body["connections"].([]interface{})), 3) // unknown robot request, _ = http.NewRequest("GET", "/api/robots/UnknownRobot1/connections", nil) a.ServeHTTP(response, request) - json.NewDecoder(response.Body).Decode(&body) + _ = json.NewDecoder(response.Body).Decode(&body) gobottest.Assert(t, body["error"], "No Robot found with the name UnknownRobot1") } @@ -368,7 +368,7 @@ func TestRobotConnection(t *testing.T) { a.ServeHTTP(response, request) var body map[string]interface{} - json.NewDecoder(response.Body).Decode(&body) + _ = json.NewDecoder(response.Body).Decode(&body) gobottest.Assert(t, body["connection"].(map[string]interface{})["name"].(string), "Connection1") // unknown connection @@ -377,7 +377,7 @@ func TestRobotConnection(t *testing.T) { nil, ) a.ServeHTTP(response, request) - json.NewDecoder(response.Body).Decode(&body) + _ = json.NewDecoder(response.Body).Decode(&body) gobottest.Assert(t, body["error"], "No Connection found with the name UnknownConnection1") } @@ -426,7 +426,7 @@ func TestRobotDeviceEvent(t *testing.T) { response, _ := http.Get(server.URL + eventsURL + "UnknownEvent") var body map[string]interface{} - json.NewDecoder(response.Body).Decode(&body) + _ = json.NewDecoder(response.Body).Decode(&body) gobottest.Assert(t, body["error"], "No Event found with the name UnknownEvent") } diff --git a/drivers/aio/analog_sensor_driver_test.go b/drivers/aio/analog_sensor_driver_test.go index f5f747d5d..51371689c 100644 --- a/drivers/aio/analog_sensor_driver_test.go +++ b/drivers/aio/analog_sensor_driver_test.go @@ -97,12 +97,12 @@ func TestAnalogSensorDriverStart(t *testing.T) { d.SetScaler(func(input int) float64 { return float64(input * input) }) // expect data to be received - d.Once(d.Event(Data), func(data interface{}) { + _ = d.Once(d.Event(Data), func(data interface{}) { gobottest.Assert(t, data.(int), 100) sem <- true }) - d.Once(d.Event(Value), func(data interface{}) { + _ = d.Once(d.Event(Value), func(data interface{}) { gobottest.Assert(t, data.(float64), 10000.0) sem <- true }) @@ -122,7 +122,7 @@ func TestAnalogSensorDriverStart(t *testing.T) { } // expect error to be received - d.Once(d.Event(Error), func(data interface{}) { + _ = d.Once(d.Event(Error), func(data interface{}) { gobottest.Assert(t, data.(error).Error(), "read error") sem <- true }) @@ -140,11 +140,11 @@ func TestAnalogSensorDriverStart(t *testing.T) { } // send a halt message - d.Once(d.Event(Data), func(data interface{}) { + _ = d.Once(d.Event(Data), func(data interface{}) { sem <- true }) - d.Once(d.Event(Value), func(data interface{}) { + _ = d.Once(d.Event(Value), func(data interface{}) { sem <- true }) diff --git a/drivers/aio/grove_drivers.go b/drivers/aio/grove_drivers.go index 0d86ee6f1..df6c776dc 100644 --- a/drivers/aio/grove_drivers.go +++ b/drivers/aio/grove_drivers.go @@ -13,10 +13,12 @@ type GroveRotaryDriver struct { // 10 Milliseconds given an AnalogReader and pin. // // Optionally accepts: -// time.Duration: Interval at which the AnalogSensor is polled for new information +// +// time.Duration: Interval at which the AnalogSensor is polled for new information // // Adds the following API Commands: -// "Read" - See AnalogSensor.Read +// +// "Read" - See AnalogSensor.Read func NewGroveRotaryDriver(a AnalogReader, pin string, v ...time.Duration) *GroveRotaryDriver { return &GroveRotaryDriver{ AnalogSensorDriver: NewAnalogSensorDriver(a, pin, v...), @@ -33,10 +35,12 @@ type GroveLightSensorDriver struct { // 10 Milliseconds given an AnalogReader and pin. // // Optionally accepts: -// time.Duration: Interval at which the AnalogSensor is polled for new information +// +// time.Duration: Interval at which the AnalogSensor is polled for new information // // Adds the following API Commands: -// "Read" - See AnalogSensor.Read +// +// "Read" - See AnalogSensor.Read func NewGroveLightSensorDriver(a AnalogReader, pin string, v ...time.Duration) *GroveLightSensorDriver { return &GroveLightSensorDriver{ AnalogSensorDriver: NewAnalogSensorDriver(a, pin, v...), @@ -53,10 +57,12 @@ type GrovePiezoVibrationSensorDriver struct { // 10 Milliseconds given an AnalogReader and pin. // // Optionally accepts: -// time.Duration: Interval at which the AnalogSensor is polled for new information +// +// time.Duration: Interval at which the AnalogSensor is polled for new information // // Adds the following API Commands: -// "Read" - See AnalogSensor.Read +// +// "Read" - See AnalogSensor.Read func NewGrovePiezoVibrationSensorDriver(a AnalogReader, pin string, v ...time.Duration) *GrovePiezoVibrationSensorDriver { sensor := &GrovePiezoVibrationSensorDriver{ AnalogSensorDriver: NewAnalogSensorDriver(a, pin, v...), @@ -64,11 +70,13 @@ func NewGrovePiezoVibrationSensorDriver(a AnalogReader, pin string, v ...time.Du sensor.AddEvent(Vibration) - sensor.On(sensor.Event(Data), func(data interface{}) { + if err := sensor.On(sensor.Event(Data), func(data interface{}) { if data.(int) > 1000 { sensor.Publish(sensor.Event(Vibration), data) } - }) + }); err != nil { + panic(err) + } return sensor } @@ -83,10 +91,12 @@ type GroveSoundSensorDriver struct { // 10 Milliseconds given an AnalogReader and pin. // // Optionally accepts: -// time.Duration: Interval at which the AnalogSensor is polled for new information +// +// time.Duration: Interval at which the AnalogSensor is polled for new information // // Adds the following API Commands: -// "Read" - See AnalogSensor.Read +// +// "Read" - See AnalogSensor.Read func NewGroveSoundSensorDriver(a AnalogReader, pin string, v ...time.Duration) *GroveSoundSensorDriver { return &GroveSoundSensorDriver{ AnalogSensorDriver: NewAnalogSensorDriver(a, pin, v...), diff --git a/drivers/aio/grove_drivers_test.go b/drivers/aio/grove_drivers_test.go index 42511652c..a5395a3ed 100644 --- a/drivers/aio/grove_drivers_test.go +++ b/drivers/aio/grove_drivers_test.go @@ -57,10 +57,10 @@ func TestAnalogDriverHalt(t *testing.T) { }) // Start the driver and allow for multiple digital reads - driver.Start() + _ = driver.Start() time.Sleep(20 * time.Millisecond) - driver.Halt() + _ = driver.Halt() lastCallCount := atomic.LoadInt32(&callCount) // If driver was not halted, digital reads would still continue time.Sleep(20 * time.Millisecond) @@ -93,7 +93,7 @@ func TestDriverPublishesError(t *testing.T) { gobottest.Assert(t, driver.Start(), nil) // expect error - driver.Once(driver.Event(Error), func(data interface{}) { + _ = driver.Once(driver.Event(Error), func(data interface{}) { gobottest.Assert(t, data.(error).Error(), "read error") close(sem) }) @@ -105,7 +105,7 @@ func TestDriverPublishesError(t *testing.T) { } // Cleanup - driver.Halt() + _ = driver.Halt() } } diff --git a/drivers/aio/grove_temperature_sensor_driver_test.go b/drivers/aio/grove_temperature_sensor_driver_test.go index df3585f0b..d47f0fec1 100644 --- a/drivers/aio/grove_temperature_sensor_driver_test.go +++ b/drivers/aio/grove_temperature_sensor_driver_test.go @@ -62,7 +62,7 @@ func TestGroveTempSensorPublishesTemperatureInCelsius(t *testing.T) { val = 585 return }) - d.Once(d.Event(Value), func(data interface{}) { + _ = d.Once(d.Event(Value), func(data interface{}) { gobottest.Assert(t, fmt.Sprintf("%.2f", data.(float64)), "31.62") sem <- true }) diff --git a/drivers/aio/helpers_test.go b/drivers/aio/helpers_test.go index 9c0079376..70df8edba 100644 --- a/drivers/aio/helpers_test.go +++ b/drivers/aio/helpers_test.go @@ -2,13 +2,6 @@ package aio import "sync" -type aioTestBareAdaptor struct{} - -func (t *aioTestBareAdaptor) Connect() (err error) { return } -func (t *aioTestBareAdaptor) Finalize() (err error) { return } -func (t *aioTestBareAdaptor) Name() string { return "" } -func (t *aioTestBareAdaptor) SetName(n string) {} - type aioTestAdaptor struct { name string port string diff --git a/drivers/aio/temperature_sensor_driver_test.go b/drivers/aio/temperature_sensor_driver_test.go index afc003d41..b6012b7d3 100644 --- a/drivers/aio/temperature_sensor_driver_test.go +++ b/drivers/aio/temperature_sensor_driver_test.go @@ -100,7 +100,7 @@ func TestTempSensorPublishesTemperatureInCelsius(t *testing.T) { val = 585 return }) - d.Once(d.Event(Value), func(data interface{}) { + _ = d.Once(d.Event(Value), func(data interface{}) { gobottest.Assert(t, fmt.Sprintf("%.2f", data.(float64)), "31.62") sem <- true }) @@ -129,7 +129,7 @@ func TestTempSensorPublishesError(t *testing.T) { gobottest.Assert(t, d.Start(), nil) // expect error - d.Once(d.Event(Error), func(data interface{}) { + _ = d.Once(d.Event(Error), func(data interface{}) { gobottest.Assert(t, data.(error).Error(), "read error") sem <- true }) diff --git a/drivers/common/mfrc522/mfrc522_pcd.go b/drivers/common/mfrc522/mfrc522_pcd.go index 5f8746398..34ace2574 100644 --- a/drivers/common/mfrc522/mfrc522_pcd.go +++ b/drivers/common/mfrc522/mfrc522_pcd.go @@ -41,7 +41,8 @@ type MFRC522Common struct { // The device supports SPI, I2C and UART (not implemented yet at gobot system level). // // Params: -// c BusConnection - the bus connection to use with this driver +// +// c BusConnection - the bus connection to use with this driver func NewMFRC522Common() *MFRC522Common { d := &MFRC522Common{} return d @@ -67,7 +68,9 @@ func (d *MFRC522Common) Initialize(c busConnection) error { {regMode, modeRegTxWaitRFBit | modeRegPolMFinBit | modeRegCRCPreset6363}, } for _, init := range initSequence { - d.writeByteData(init[0], init[1]) + if err := d.writeByteData(init[0], init[1]); err != nil { + return err + } } if err := d.switchAntenna(true); err != nil { diff --git a/drivers/common/mfrc522/mfrc522_pcd_register.go b/drivers/common/mfrc522/mfrc522_pcd_register.go index 85dcb89e7..416f6ff3e 100644 --- a/drivers/common/mfrc522/mfrc522_pcd_register.go +++ b/drivers/common/mfrc522/mfrc522_pcd_register.go @@ -12,8 +12,8 @@ const ( commandRegCalcCRC = 0x03 // activates the CRC coprocessor or performs a self-test commandRegTransmit = 0x04 // transmits data from the FIFO buffer // 0x05, 0x06 not used - commandRegNoCmdChange = 0x07 // no command change, can be used to modify the Command register bits without - commandRegReceive = 0x08 // activates the receiver circuits + //commandRegNoCmdChange = 0x07 // no command change, can be used to modify the Command register bits without + //commandRegReceive = 0x08 // activates the receiver circuits // 0x09..0x0B not used commandRegTransceive = 0x0C // transmits data from FIFO buffer to antenna and automatically activates the receiver after transmission // 0x0D reserved @@ -44,8 +44,8 @@ const ( ) const ( - // ------------ unused commands -------------------- - regDivIEn = 0x03 // enable and disable the passing of interrupt requests to IRQ pin +// ------------ unused commands -------------------- +// regDivIEn = 0x03 // enable and disable the passing of interrupt requests to IRQ pin ) const ( @@ -57,10 +57,10 @@ const ( comIrqRegErrIRq1anyBit = 0x02 // bit 1: error bit in the Error register is set, if 1 // Status1 register’s LoAlert bit is set in opposition to the LoAlert bit, the LoAlertIRq bit stores this event and // can only be reset as indicated by the Set1 bit in this register - comIrqRegLoAlertIRqBit = 0x04 // bit 2: if 1, see above + //comIrqRegLoAlertIRqBit = 0x04 // bit 2: if 1, see above // the Status1 register’s HiAlert bit is set in opposition to the HiAlert bit, the HiAlertIRq bit stores this event // and can only be reset as indicated by the Set1 bit in this register - comIrqRegHiAlertIRqBit = 0x08 // bit 3: if 1, see above + //comIrqRegHiAlertIRqBit = 0x08 // bit 3: if 1, see above // If a command terminates, for example, when the Command register changes its value from any command to Idle command. // If an unknown command is started, the Command register Command[3:0] value changes to the idle state and the // IdleIRq bit is set. The microcontroller starting the Idle command does not set the IdleIRq bit. @@ -71,28 +71,28 @@ const ( comIrqRegTxIRqBit = 0x40 // bit 6: set to 1, immediately after the last bit of the transmitted data was sent out // 1: indicates that the marked bits in the register are set // 0: indicates that the marked bits in the register are cleared - comIrqRegSet1Bit = 0x80 // bit 7: see above + //comIrqRegSet1Bit = 0x80 // bit 7: see above ) const ( regDivIrq = 0x05 // diverse interrupt request bits // ------------ values -------------------- - divIrqRegReset = 0x00 // see table 31 of data sheet + //divIrqRegReset = 0x00 // see table 31 of data sheet //divIrqRegReserved01 = 0x03 divIrqRegCRCIRqBit = 0x04 // bit 2: the CalcCRC command is active and all data is processed //divIrqRegReservedBit3 = 0x08 // this interrupt is set when either a rising or falling signal edge is detected - divIrqRegMfinActIRqBit = 0x10 // bit 4: MFIN is active; see above + //divIrqRegMfinActIRqBit = 0x10 // bit 4: MFIN is active; see above //divIrqRegReserved56 = 0x60 // 1: indicates that the marked bits in the register are set // 0: indicates that the marked bits in the register are cleared - divIrqRegSet2Bit = 0x80 // bit 7: see above + //divIrqRegSet2Bit = 0x80 // bit 7: see above ) const ( regError = 0x06 // error bits showing the error status of the last command executed // ------------ values -------------------- - errorRegReset = 0x00 // see table 33 of data sheet + //errorRegReset = 0x00 // see table 33 of data sheet // set to logic 1 if the SOF is incorrect automatically cleared during receiver start-up phase bit is only valid for // 106 kBd; during the MFAuthent command, the ProtocolErr bit is set to logic 1 if the number of bytes received in one // data stream is incorrect @@ -118,32 +118,32 @@ const ( ) const ( - // ------------ unused commands -------------------- - regStatus1 = 0x07 // communication status bits +// ------------ unused commands -------------------- +// regStatus1 = 0x07 // communication status bits ) const ( regStatus2 = 0x08 // receiver and transmitter status bits // ------------ values -------------------- - status2RegReset = 0x00 // see table 37 of data sheet + //status2RegReset = 0x00 // see table 37 of data sheet // bit 0..2 shows the state of the transmitter and receiver state machines - status2RegModemStateIdle = 0x00 // idle - status2RegModemStateWait = 0x01 // wait for the BitFraming register’s StartSend bit + //status2RegModemStateIdle = 0x00 // idle + //status2RegModemStateWait = 0x01 // wait for the BitFraming register’s StartSend bit // the minimum time for TxWait is defined by the TxWait register - status2RegModemStateTxWait = 0x02 // wait until RF field is present if the TMode register’s TxWaitRF bit is set to logic 1 - status2RegModemStateTransmitting = 0x03 + //status2RegModemStateTxWait = 0x02 // wait until RF field is present if the TMode register’s TxWaitRF bit is set to logic 1 + //status2RegModemStateTransmitting = 0x03 // the minimum time for RxWait is defined by the RxWait register - status2RegModemStateRxWait = 0x04 // wait until RF field is present if the TMode register’s TxWaitRF bit is set to logic 1 - status2RegModemStateWaitForData = 0x05 - status2RegModemStateReceiving = 0x06 + //status2RegModemStateRxWait = 0x04 // wait until RF field is present if the TMode register’s TxWaitRF bit is set to logic 1 + //status2RegModemStateWaitForData = 0x05 + //status2RegModemStateReceiving = 0x06 // all data communication with the card is encrypted; can only be set to logic 1 by a successful execution of the // MFAuthent command; only valid in Read/Write mode for MIFARE standard cards; this bit is cleared by software status2RegMFCrypto1OnBit = 0x08 // bit 3: indicates that the MIFARE Crypto1 unit is switched on and, see above //status2RegReserved45 = 0x30 // 1: the I2C-bus input filter is set to the High-speed mode independent of the I2C-bus protocol // 0: the I2C-bus input filter is set to the I2C-bus protocol used - status2RegI2cForceHSBit = 0x40 // I2C-bus input filter settings, see above - status2RegTempSensClear1Bit = 0x80 // clears the temperature error if the temperature is below the alarm limit of 125C + //status2RegI2cForceHSBit = 0x40 // I2C-bus input filter settings, see above + //status2RegTempSensClear1Bit = 0x80 // clears the temperature error if the temperature is below the alarm limit of 125C ) const ( @@ -153,30 +153,30 @@ const ( const ( regFIFOLevel = 0x0A // number of bytes stored in the FIFO buffer // ------------ values -------------------- - fifoLevelRegReset = 0x00 // see table 41 of data sheet + //fifoLevelRegReset = 0x00 // see table 41 of data sheet // indicates the number of bytes stored in the FIFO buffer writing to the FIFOData register increments and reading // decrements the FIFOLevel value - fifoLevelRegValue = 0x7F // bit 0..6: see above + //fifoLevelRegValue = 0x7F // bit 0..6: see above // immediately clears the internal FIFO buffer’s read and write pointer and Error register’s BufferOvfl bit reading // this bit always returns 0 fifoLevelRegFlushBufferBit = 0x80 // bit 7: see above ) const ( - // ------------ unused commands -------------------- - regWaterLevel = 0x0B // level for FIFO underflow and overflow warning +// ------------ unused commands -------------------- +// regWaterLevel = 0x0B // level for FIFO underflow and overflow warning ) const ( regControl = 0x0C // miscellaneous control registers // ------------ values -------------------- - controlRegReset = 0x10 // see table 45 of data sheet + //controlRegReset = 0x10 // see table 45 of data sheet // indicates the number of valid bits in the last received byte // if this value is 000b, the whole byte is valid controlRegRxLastBits = 0x07 // bit 0..2: see above //controlRegReserved3to5 = 0x38 - controlRegTStartNowBit = 0x40 // bit 6: timer starts immediately, if 1; reading always returns logic 0 - controlRegTStopNow = 0x80 // bit 7: timer stops immediately, if 1; reading always returns logic 0 + //controlRegTStartNowBit = 0x40 // bit 6: timer starts immediately, if 1; reading always returns logic 0 + //controlRegTStopNow = 0x80 // bit 7: timer stops immediately, if 1; reading always returns logic 0 ) const ( @@ -194,7 +194,7 @@ const ( // 7: LSB of the received bit is stored at bit position 7, the second received bit is stored in the next byte that // follows at bit position 0 // These bits are only to be used for bitwise anticollision at 106 kBd, for all other modes they are set to 0 - bitFramingRegRxAlign = 0x70 // bit 4..6: see above + //bitFramingRegRxAlign = 0x70 // bit 4..6: see above //starts the transmission of data, only valid in combination with the Transceive command bitFramingRegStartSendBit = 0x80 // bit 7: see above ) @@ -207,9 +207,9 @@ const ( // 01: indicates a bit-collision in the 1st bit // 08: indicates a bit-collision in the 8th bit // These bits will only be interpreted if the CollPosNotValid bit is set to logic 0 - collRegCollPos = 0x1F // bit 0..4: read-only, see above + //collRegCollPos = 0x1F // bit 0..4: read-only, see above // no collision detected or the position of the collision is out of the range of CollPos[4:0], if set to 1 - collRegCollPosNotValidBit = 0x20 // bit 5: read-only, see above + //collRegCollPosNotValidBit = 0x20 // bit 5: read-only, see above //collRegReservedBit6 = 0x40 // all received bits will be cleared after a collision only used during bitwise anticollision at 106 kBd, otherwise it // is set to logic 1 @@ -223,7 +223,7 @@ const ( const ( regMode = 0x11 // defines general modes for transmitting and receiving // ------------ values -------------------- - modeRegReset = 0x3F // see table 55 of data sheet + //modeRegReset = 0x3F // see table 55 of data sheet // bit 0..1: defines the preset value for the CRC coprocessor for the CalcCRC command; Remark: during any // communication, the preset values are selected automatically according to the definition of bits in the rxModeReg // and TxMode registers @@ -240,7 +240,7 @@ const ( //modeRegReservedBit6 = 0x40 // CRC coprocessor calculates the CRC with MSB first 0 in the CRCResult register the values for the CRCResultMSB[7:0] // bits and the CRCResultLSB[7:0] bits are bit reversed; Remark: during RF communication this bit is ignored - modeRegMSBFirstBit = 0x80 // bit 7: see above, if set to 1 + //modeRegMSBFirstBit = 0x80 // bit 7: see above, if set to 1 ) const ( @@ -258,28 +258,28 @@ const ( // end of a received data stream which is a copy of the Error register value. For the version 2.0 the // CRC status is reflected in the signal CRCOk, which indicates the actual status of the CRC coprocessor. For the // version 1.0 the CRC status is reflected in the signal CRCErr. - rxModeRegRxMultipleBit = 0x04 - // an invalid received data stream (less than 4 bits received) will be ignored and the receiver remains active - rxModeRegRxNoErrBit = 0x08 // bit 3 - txModeRegInvModBit = 0x08 // bit 3: modulation of transmitted data is inverted, if 1 - // bit 4..6: defines the bit rate during data transmission; the handles transfer speeds up to 848 kBd - rxtxModeRegSpeed106kBd = 0x00 //106 kBd - rxtxModeRegSpeed212kBd = 0x10 //212 kBd - rxtxModeRegSpeed424kBd = 0x20 //424 kBd - rxtxModeRegSpeed848kBd = 0x30 //848 kBd - rxtxModeRegSpeedRes1 = 0x40 //reserved - rxtxModeRegSpeedRes2 = 0x50 //reserved - rxtxModeRegSpeedRes3 = 0x60 //reserved - rxtxModeRegSpeedRes4 = 0x70 //reserved - // RX: enables the CRC calculation during reception - // TX: enables CRC generation during data transmission - rxtxModeRegTxCRCEnBit = 0x80 // bit 7: can only be set to logic 0 at 106 kBd +// rxModeRegRxMultipleBit = 0x04 +// an invalid received data stream (less than 4 bits received) will be ignored and the receiver remains active +//rxModeRegRxNoErrBit = 0x08 // bit 3 +//txModeRegInvModBit = 0x08 // bit 3: modulation of transmitted data is inverted, if 1 +// bit 4..6: defines the bit rate during data transmission; the handles transfer speeds up to 848 kBd +//rxtxModeRegSpeed106kBd = 0x00 //106 kBd +//rxtxModeRegSpeed212kBd = 0x10 //212 kBd +//rxtxModeRegSpeed424kBd = 0x20 //424 kBd +//rxtxModeRegSpeed848kBd = 0x30 //848 kBd +//rxtxModeRegSpeedRes1 = 0x40 //reserved +//rxtxModeRegSpeedRes2 = 0x50 //reserved +//rxtxModeRegSpeedRes3 = 0x60 //reserved +//rxtxModeRegSpeedRes4 = 0x70 //reserved +// RX: enables the CRC calculation during reception +// TX: enables CRC generation during data transmission +//rxtxModeRegTxCRCEnBit = 0x80 // bit 7: can only be set to logic 0 at 106 kBd ) const ( regTxControl = 0x14 // controls the logical behavior of the antenna driver pins TX1 and TX2 // ------------ values -------------------- - regtxControlRegReset = 0x80 // see table 61 of data sheet + //regtxControlRegReset = 0x80 // see table 61 of data sheet // signal on pin TX1 delivers the 13.56 MHz energy carrier modulated by the transmission data txControlRegTx1RFEn1outputBit = 0x01 // bit 0: see above // signal on pin TX2 delivers the 13.56 MHz energy carrier modulated by the transmission data @@ -287,33 +287,33 @@ const ( //txControlRegReservedBit2 = 0x04 // signal on pin TX2 continuously delivers the unmodulated 13.56 MHz energy carrier0Tx2CW bit is enabled to modulate // the 13.56 MHz energy carrier - txControlRegTx2CW1outputBit = 0x08 // bit 3: see above - txControlRegInvTx1RFOffBit = 0x10 // bit 4: output signal on pin TX1 inverted if driver TX1 is disabled, if 1 - txControlRegInvTx2RFOffBit = 0x20 // bit 5: output signal on pin TX2 inverted if driver TX2 is disabled, if 1 - txControlRegInvTx1RFOnBit = 0x40 // bit 6: output signal on pin TX1 inverted if driver TX1 is enabled, if 1 - txControlRegInvTx2RFOnBit = 0x80 // bit 7: output signal on pin TX2 inverted if driver TX2 is enabled, if 1 + //txControlRegTx2CW1outputBit = 0x08 // bit 3: see above + //txControlRegInvTx1RFOffBit = 0x10 // bit 4: output signal on pin TX1 inverted if driver TX1 is disabled, if 1 + //txControlRegInvTx2RFOffBit = 0x20 // bit 5: output signal on pin TX2 inverted if driver TX2 is disabled, if 1 + //txControlRegInvTx1RFOnBit = 0x40 // bit 6: output signal on pin TX1 inverted if driver TX1 is enabled, if 1 + //txControlRegInvTx2RFOnBit = 0x80 // bit 7: output signal on pin TX2 inverted if driver TX2 is enabled, if 1 ) const ( regTxASK = 0x15 // controls the setting of the transmission modulation // ------------ values -------------------- - txASKRegReset = 0x00 // see table 63 of data sheet + //txASKRegReset = 0x00 // see table 63 of data sheet //txASKRegReserved = 0x3F // bit 0..5 txASKRegForce100ASKBit = 0x40 // bit 6: forces a 100 % ASK modulation independent of the ModGsP register //txASKRegReservedBit7 = 0x80 ) const ( - regTxSel = 0x16 // selects the internal sources for the antenna driver - regRxSel = 0x17 // selects internal receiver settings - regRxThreshold = 0x18 // selects thresholds for the bit decoder - regDemod = 0x19 // defines demodulator settings + //regTxSel = 0x16 // selects the internal sources for the antenna driver + //regRxSel = 0x17 // selects internal receiver settings + //regRxThreshold = 0x18 // selects thresholds for the bit decoder + //regDemod = 0x19 // defines demodulator settings // 0x1A // reserved for future use // 0x1B // reserved for future use - regMfTx = 0x1C // controls some MIFARE communication transmit parameters - regMfRx = 0x1D // controls some MIFARE communication receive parameters + //regMfTx = 0x1C // controls some MIFARE communication transmit parameters + //regMfRx = 0x1D // controls some MIFARE communication receive parameters // 0x1E // reserved for future use - regSerialSpeed = 0x1F // selects the speed of the serial UART interface + //regSerialSpeed = 0x1F // selects the speed of the serial UART interface // Page 2: Configuration // 0x20 // reserved for future use @@ -333,7 +333,7 @@ const ( const ( regRFCfg = 0x26 // configures the receiver gain // ------------ values -------------------- - rfcCfgRegReset = 0x48 // see table 97 of data sheet + //rfcCfgRegReset = 0x48 // see table 97 of data sheet //rfcCfgRegReserved03 = 0x07 // bit 4..6: defines the receiver’s signal voltage gain factor rfcCfgRegRxGain18dB = 0x00 @@ -348,18 +348,18 @@ const ( ) const ( - // ------------ unused commands -------------------- - regGsN = 0x27 // selects the conductance of the antenna driver pins TX1 and TX2 for modulation - regCWGsP = 0x28 // defines the conductance of the p-driver output during periods of no modulation - regModGsP = 0x29 // defines the conductance of the p-driver output during periods of modulation +// ------------ unused commands -------------------- +//regGsN = 0x27 // selects the conductance of the antenna driver pins TX1 and TX2 for modulation +//regCWGsP = 0x28 // defines the conductance of the p-driver output during periods of no modulation +//regModGsP = 0x29 // defines the conductance of the p-driver output during periods of modulation ) const ( regTMode = 0x2A // defines settings for the internal timer regTPrescaler = 0x2B // the lower 8 bits of the TPrescaler value. The 4 high bits are in tModeReg. // ------------ values -------------------- - tModeRegReset = 0x00 // see table 105 of data sheet - tPrescalerRegReset = 0x00 // see table 107 of data sheet + //tModeRegReset = 0x00 // see table 105 of data sheet + //tPrescalerRegReset = 0x00 // see table 107 of data sheet // timer starts automatically at the end of the transmission in all communication modes at all speeds; if the // RxMode register’s RxMultiple bit is not set, the timer stops immediately after receiving the 5th bit (1 start // bit, 4 data bits); if the RxMultiple bit is set to logic 1 the timer never stops, in which case the timer can be @@ -368,22 +368,22 @@ const ( // bit 6,5: indicates that the timer is not influenced by the protocol; internal timer is running in // gated mode; Remark: in gated mode, the Status1 register’s TRunning bit is logic 1 when the timer is enabled by // the TMode register’s TGated bits; this bit does not influence the gating signal - tModeRegTGatedNon = 0x00 // non-gated mode - tModeRegTGatedMFIN = 0x20 // gated by pin MFIN - tModeRegTGatedAUX1 = 0x40 // gated by pin AUX1 + //tModeRegTGatedNon = 0x00 // non-gated mode + //tModeRegTGatedMFIN = 0x20 // gated by pin MFIN + //tModeRegTGatedAUX1 = 0x40 // gated by pin AUX1 // 1: timer automatically restarts its count-down from the 16-bit timer reload value instead of counting down to zero // 0: timer decrements to 0 and the ComIrq register’s TimerIRq bit is set to logic 1 - tModeRegTAutoRestartBit = 0x10 // bit 4, see above + //tModeRegTAutoRestartBit = 0x10 // bit 4, see above // defines the higher 4 bits of the TPrescaler value; The following formula is used to calculate the timer // frequency if the Demod register’s TPrescalEven bit in Demot register’s set to logic 0: // ftimer = 13.56 MHz / (2*TPreScaler+1); TPreScaler = [tPrescalerRegHi:tPrescalerRegLo] // TPrescaler value on 12 bits) (Default TPrescalEven bit is logic 0) // The following formula is used to calculate the timer frequency if the Demod register’s TPrescalEven bit is set // to logic 1: ftimer = 13.56 MHz / (2*TPreScaler+2). - tModeRegtPrescalerRegValue25us = 0x0A9 // 169 => fRegtimer=40kHz, timer period of 25μs. - tModeRegtPrescalerRegValue38us = 0x0FF // 255 => fRegtimer=26kHz, timer period of 38μs. - tModeRegtPrescalerRegValue500us = 0xD3E // 3390 => fRegtimer= 2kHz, timer period of 500us. - tModeRegtPrescalerRegValue604us = 0xFFF // 4095 => fRegtimer=1.65kHz, timer period of 604us. + //tModeRegtPrescalerRegValue25us = 0x0A9 // 169 => fRegtimer=40kHz, timer period of 25μs. + //tModeRegtPrescalerRegValue38us = 0x0FF // 255 => fRegtimer=26kHz, timer period of 38μs. + //tModeRegtPrescalerRegValue500us = 0xD3E // 3390 => fRegtimer= 2kHz, timer period of 500us. + //tModeRegtPrescalerRegValue604us = 0xFFF // 4095 => fRegtimer=1.65kHz, timer period of 604us. ) const ( @@ -399,8 +399,8 @@ const ( const ( // ------------ unused commands -------------------- - regTCounterValueH = 0x2E // shows the 16-bit timer value - regTCounterValueL = 0x2F + //regTCounterValueH = 0x2E // shows the 16-bit timer value + //regTCounterValueL = 0x2F // Page 3: Test Registers // 0x30 // reserved for future use diff --git a/drivers/common/mfrc522/mfrc522_picc.go b/drivers/common/mfrc522/mfrc522_picc.go index 07800f78b..3723181dc 100644 --- a/drivers/common/mfrc522/mfrc522_picc.go +++ b/drivers/common/mfrc522/mfrc522_picc.go @@ -36,7 +36,7 @@ const ( piccCommandMFRegTRANSFER = 0xB0 // Writes the contents of the internal data register to a block. // The commands used for MIFARE Ultralight (from http://www.nxp.com/documents/dataRegsheet/MF0ICU1.pdf, Section 8.6) // The piccCommandMFRegREAD and piccCommandMFRegWRITE can also be used for MIFARE Ultralight. - piccCommandULRegWRITE = 0xA2 // Writes one 4 byte page to the PICC. + //piccCommandULRegWRITE = 0xA2 // Writes one 4 byte page to the PICC. ) const piccReadWriteAuthBlock = uint8(11) diff --git a/drivers/gpio/aip1640_driver.go b/drivers/gpio/aip1640_driver.go index c8327cfa3..32b6c54e9 100644 --- a/drivers/gpio/aip1640_driver.go +++ b/drivers/gpio/aip1640_driver.go @@ -48,15 +48,15 @@ func NewAIP1640Driver(a gobot.Connection, clockPin string, dataPin string) *AIP1 } // Start initializes the tm1638, it uses a SPI-like communication protocol -func (a *AIP1640Driver) Start() (err error) { - a.pinData.On() - a.pinClock.On() - - return +func (a *AIP1640Driver) Start() error { + if err := a.pinData.On(); err != nil { + return err + } + return a.pinClock.On() } // Halt implements the Driver interface -func (a *AIP1640Driver) Halt() (err error) { return } +func (a *AIP1640Driver) Halt() error { return nil } // Name returns the AIP1640Drivers name func (a *AIP1640Driver) Name() string { return a.name } @@ -78,18 +78,28 @@ func (a *AIP1640Driver) SetIntensity(level byte) { } // Display sends the buffer to the display (ie. turns on/off the corresponding LEDs) -func (a *AIP1640Driver) Display() { +func (a *AIP1640Driver) Display() error { for i := 0; i < 8; i++ { - a.sendData(byte(i), a.buffer[i]) + if err := a.sendData(byte(i), a.buffer[i]); err != nil { + return err + } - a.pinData.Off() - a.pinClock.Off() + if err := a.pinData.Off(); err != nil { + return err + } + if err := a.pinClock.Off(); err != nil { + return err + } time.Sleep(1 * time.Millisecond) - a.pinClock.On() - a.pinData.On() + if err := a.pinClock.On(); err != nil { + return err + } + if err := a.pinData.On(); err != nil { + return err + } } - a.sendCommand(AIP1640DispCtrl | a.intensity) + return a.sendCommand(AIP1640DispCtrl | a.intensity) } // Clear empties the buffer (turns off all the LEDs) @@ -128,33 +138,55 @@ func (a *AIP1640Driver) DrawMatrix(data [8]byte) { } // sendCommand is an auxiliary function to send commands to the AIP1640Driver module -func (a *AIP1640Driver) sendCommand(cmd byte) { - a.pinData.Off() - a.send(cmd) - a.pinData.On() +func (a *AIP1640Driver) sendCommand(cmd byte) error { + if err := a.pinData.Off(); err != nil { + return err + } + if err := a.send(cmd); err != nil { + return err + } + return a.pinData.On() } // sendData is an auxiliary function to send data to the AIP1640Driver module -func (a *AIP1640Driver) sendData(address byte, data byte) { - a.sendCommand(AIP1640DataCmd | AIP1640FixedAddr) - a.pinData.Off() - a.send(AIP1640AddrCmd | address) - a.send(data) - a.pinData.On() +func (a *AIP1640Driver) sendData(address byte, data byte) error { + if err := a.sendCommand(AIP1640DataCmd | AIP1640FixedAddr); err != nil { + return err + } + if err := a.pinData.Off(); err != nil { + return err + } + if err := a.send(AIP1640AddrCmd | address); err != nil { + return err + } + if err := a.send(data); err != nil { + return err + } + return a.pinData.On() } // send writes data on the module -func (a *AIP1640Driver) send(data byte) { +func (a *AIP1640Driver) send(data byte) error { for i := 0; i < 8; i++ { - a.pinClock.Off() + if err := a.pinClock.Off(); err != nil { + return err + } if (data & 1) > 0 { - a.pinData.On() + if err := a.pinData.On(); err != nil { + return err + } } else { - a.pinData.Off() + if err := a.pinData.Off(); err != nil { + return err + } } data >>= 1 - a.pinClock.On() + if err := a.pinClock.On(); err != nil { + return err + } } + + return nil } diff --git a/drivers/gpio/button_driver_test.go b/drivers/gpio/button_driver_test.go index e1a161b1b..aa458c88c 100644 --- a/drivers/gpio/button_driver_test.go +++ b/drivers/gpio/button_driver_test.go @@ -39,7 +39,7 @@ func TestButtonDriverStart(t *testing.T) { a := newGpioTestAdaptor() d := NewButtonDriver(a, "1") - d.Once(ButtonPush, func(data interface{}) { + _ = d.Once(ButtonPush, func(data interface{}) { gobottest.Assert(t, d.Active, true) sem <- true }) @@ -57,7 +57,7 @@ func TestButtonDriverStart(t *testing.T) { t.Errorf("Button Event \"Push\" was not published") } - d.Once(ButtonRelease, func(data interface{}) { + _ = d.Once(ButtonRelease, func(data interface{}) { gobottest.Assert(t, d.Active, false) sem <- true }) @@ -73,7 +73,7 @@ func TestButtonDriverStart(t *testing.T) { t.Errorf("Button Event \"Release\" was not published") } - d.Once(Error, func(data interface{}) { + _ = d.Once(Error, func(data interface{}) { sem <- true }) @@ -88,7 +88,7 @@ func TestButtonDriverStart(t *testing.T) { t.Errorf("Button Event \"Error\" was not published") } - d.Once(ButtonPush, func(data interface{}) { + _ = d.Once(ButtonPush, func(data interface{}) { sem <- true }) @@ -112,7 +112,7 @@ func TestButtonDriverDefaultState(t *testing.T) { d := NewButtonDriver(a, "1") d.DefaultState = 1 - d.Once(ButtonPush, func(data interface{}) { + _ = d.Once(ButtonPush, func(data interface{}) { gobottest.Assert(t, d.Active, true) sem <- true }) @@ -130,7 +130,7 @@ func TestButtonDriverDefaultState(t *testing.T) { t.Errorf("Button Event \"Push\" was not published") } - d.Once(ButtonRelease, func(data interface{}) { + _ = d.Once(ButtonRelease, func(data interface{}) { gobottest.Assert(t, d.Active, false) sem <- true }) diff --git a/drivers/gpio/buzzer_driver_test.go b/drivers/gpio/buzzer_driver_test.go index 7d1fac14d..3edb43ea5 100644 --- a/drivers/gpio/buzzer_driver_test.go +++ b/drivers/gpio/buzzer_driver_test.go @@ -38,10 +38,10 @@ func TestBuzzerDriverHalt(t *testing.T) { func TestBuzzerDriverToggle(t *testing.T) { d := initTestBuzzerDriver(newGpioTestAdaptor()) - d.Off() - d.Toggle() + _ = d.Off() + _ = d.Toggle() gobottest.Assert(t, d.State(), true) - d.Toggle() + _ = d.Toggle() gobottest.Assert(t, d.State(), false) } diff --git a/drivers/gpio/easy_driver.go b/drivers/gpio/easy_driver.go index 3196b89ef..fdde14f2a 100644 --- a/drivers/gpio/easy_driver.go +++ b/drivers/gpio/easy_driver.go @@ -5,6 +5,7 @@ import ( "strconv" "time" + "github.com/hashicorp/go-multierror" "gobot.io/x/gobot/v2" ) @@ -89,19 +90,18 @@ func (d *EasyDriver) SetName(n string) { d.name = n } func (d *EasyDriver) Connection() gobot.Connection { return d.connection.(gobot.Connection) } // Start implements the Driver interface -func (d *EasyDriver) Start() (err error) { return } +func (d *EasyDriver) Start() error { return nil } // Halt implements the Driver interface; stops running the stepper -func (d *EasyDriver) Halt() (err error) { - d.Stop() - return +func (d *EasyDriver) Halt() error { + return d.Stop() } // Move the motor given number of degrees at current speed. -func (d *EasyDriver) Move(degs int) (err error) { +func (d *EasyDriver) Move(degs int) error { if d.moving { // don't do anything if already moving - return + return nil } d.moving = true @@ -113,57 +113,65 @@ func (d *EasyDriver) Move(degs int) (err error) { break } - d.Step() + if err := d.Step(); err != nil { + return err + } } d.moving = false - return + return nil } // Step the stepper 1 step -func (d *EasyDriver) Step() (err error) { +func (d *EasyDriver) Step() error { stepsPerRev := d.GetMaxSpeed() // a valid steps occurs for a low to high transition - d.connection.DigitalWrite(d.stepPin, 0) + if err := d.connection.DigitalWrite(d.stepPin, 0); err != nil { + return err + } // 1 minute / steps per revolution / revolutions per minute // let's keep it as Microseconds so we only have to do integer math time.Sleep(time.Duration(60*1000*1000/stepsPerRev/d.rpm) * time.Microsecond) - d.connection.DigitalWrite(d.stepPin, 1) + if err := d.connection.DigitalWrite(d.stepPin, 1); err != nil { + return err + } // increment or decrement the number of steps by 1 d.stepNum += int(d.dir) - return + return nil } // Run the stepper continuously -func (d *EasyDriver) Run() (err error) { +func (d *EasyDriver) Run() error { if d.moving { // don't do anything if already moving - return + return nil } d.moving = true go func() { for d.moving { - d.Step() + if err := d.Step(); err != nil { + panic(err) + } } }() - return + return nil } // Stop running the stepper -func (d *EasyDriver) Stop() (err error) { +func (d *EasyDriver) Stop() error { d.moving = false - return + return nil } // SetDirection sets the direction to be moving. Valid directions are "cw" or "ccw" -func (d *EasyDriver) SetDirection(dir string) (err error) { +func (d *EasyDriver) SetDirection(dir string) error { // can't change direct if dirPin isn't set if d.dirPin == "" { return errors.New("dirPin is not set") @@ -171,17 +179,18 @@ func (d *EasyDriver) SetDirection(dir string) (err error) { if dir == "ccw" { d.dir = -1 - d.connection.DigitalWrite(d.dirPin, 1) // high is ccw - } else { // default to cw, even if user specified wrong value - d.dir = 1 - d.connection.DigitalWrite(d.dirPin, 0) // low is cw + // high is ccw + return d.connection.DigitalWrite(d.dirPin, 1) } - return + // default to cw, even if user specified wrong value + d.dir = 1 + // low is cw + return d.connection.DigitalWrite(d.dirPin, 0) } // SetSpeed sets the speed of the motor in RPMs. 1 is the lowest and GetMaxSpeed is the highest -func (d *EasyDriver) SetSpeed(rpm uint) (err error) { +func (d *EasyDriver) SetSpeed(rpm uint) error { if rpm < 1 { d.rpm = 1 } else if rpm > d.GetMaxSpeed() { @@ -190,7 +199,7 @@ func (d *EasyDriver) SetSpeed(rpm uint) (err error) { d.rpm = rpm } - return + return nil } // GetMaxSpeed returns the max speed of the stepper @@ -209,32 +218,39 @@ func (d *EasyDriver) IsMoving() bool { } // Enable enables all motor output -func (d *EasyDriver) Enable() (err error) { +func (d *EasyDriver) Enable() error { // can't enable if enPin isn't set. This is fine normally since it will be enabled by default if d.enPin == "" { return errors.New("enPin is not set. Board is enabled by default") } - d.enabled = true - d.connection.DigitalWrite(d.enPin, 0) // enPin is active low + // enPin is active low + if err := d.connection.DigitalWrite(d.enPin, 0); err != nil { + return err + } - return + d.enabled = true + return nil } // Disable disables all motor output -func (d *EasyDriver) Disable() (err error) { +func (d *EasyDriver) Disable() error { // can't disable if enPin isn't set if d.enPin == "" { return errors.New("enPin is not set") } - // let's stop the motor first - d.Stop() + // let's stop the motor first, but do not return on error + err := d.Stop() - d.enabled = false - d.connection.DigitalWrite(d.enPin, 1) // enPin is active low + // enPin is active low + if e := d.connection.DigitalWrite(d.enPin, 1); e != nil { + err = multierror.Append(err, e) + } else { + d.enabled = false + } - return + return err } // IsEnabled returns a bool stating whether motor is enabled @@ -243,36 +259,44 @@ func (d *EasyDriver) IsEnabled() bool { } // Sleep puts the driver to sleep and disables all motor output. Low power mode. -func (d *EasyDriver) Sleep() (err error) { +func (d *EasyDriver) Sleep() error { // can't sleep if sleepPin isn't set if d.sleepPin == "" { return errors.New("sleepPin is not set") } // let's stop the motor first - d.Stop() + err := d.Stop() - d.sleeping = true - d.connection.DigitalWrite(d.sleepPin, 0) // sleepPin is active low + // sleepPin is active low + if e := d.connection.DigitalWrite(d.sleepPin, 0); e != nil { + err = multierror.Append(err, e) + } else { + d.sleeping = true + } - return + return err } // Wake wakes up the driver -func (d *EasyDriver) Wake() (err error) { +func (d *EasyDriver) Wake() error { // can't wake if sleepPin isn't set if d.sleepPin == "" { return errors.New("sleepPin is not set") } + // sleepPin is active low + if err := d.connection.DigitalWrite(d.sleepPin, 1); err != nil { + return err + } + d.sleeping = false - d.connection.DigitalWrite(d.sleepPin, 1) // sleepPin is active low // we need to wait 1ms after sleeping before doing a step to charge the step pump (according to data sheet) // this will ensure that happens time.Sleep(1 * time.Millisecond) - return + return nil } // IsSleeping returns a bool stating whether motor is enabled diff --git a/drivers/gpio/easy_driver_test.go b/drivers/gpio/easy_driver_test.go index c873009e9..baaf69170 100644 --- a/drivers/gpio/easy_driver_test.go +++ b/drivers/gpio/easy_driver_test.go @@ -38,21 +38,21 @@ func TestEasyDriverSetName(t *testing.T) { func TestEasyDriverStart(t *testing.T) { d := initEasyDriver() - d.Start() + _ = d.Start() // noop - no error occurred } func TestEasyDriverHalt(t *testing.T) { d := initEasyDriver() - d.Run() + _ = d.Run() gobottest.Assert(t, d.IsMoving(), true) - d.Halt() + _ = d.Halt() gobottest.Assert(t, d.IsMoving(), false) } func TestEasyDriverMove(t *testing.T) { d := initEasyDriver() - d.Move(2) + _ = d.Move(2) time.Sleep(2 * time.Millisecond) gobottest.Assert(t, d.GetCurrentStep(), 4) gobottest.Assert(t, d.IsMoving(), false) @@ -60,41 +60,41 @@ func TestEasyDriverMove(t *testing.T) { func TestEasyDriverRun(t *testing.T) { d := initEasyDriver() - d.Run() + _ = d.Run() gobottest.Assert(t, d.IsMoving(), true) - d.Run() + _ = d.Run() gobottest.Assert(t, d.IsMoving(), true) } func TestEasyDriverStop(t *testing.T) { d := initEasyDriver() - d.Run() + _ = d.Run() gobottest.Assert(t, d.IsMoving(), true) - d.Stop() + _ = d.Stop() gobottest.Assert(t, d.IsMoving(), false) } func TestEasyDriverStep(t *testing.T) { d := initEasyDriver() - d.Step() + _ = d.Step() gobottest.Assert(t, d.GetCurrentStep(), 1) - d.Step() - d.Step() - d.Step() + _ = d.Step() + _ = d.Step() + _ = d.Step() gobottest.Assert(t, d.GetCurrentStep(), 4) - d.SetDirection("ccw") - d.Step() + _ = d.SetDirection("ccw") + _ = d.Step() gobottest.Assert(t, d.GetCurrentStep(), 3) } func TestEasyDriverSetDirection(t *testing.T) { d := initEasyDriver() gobottest.Assert(t, d.dir, int8(1)) - d.SetDirection("cw") + _ = d.SetDirection("cw") gobottest.Assert(t, d.dir, int8(1)) - d.SetDirection("ccw") + _ = d.SetDirection("ccw") gobottest.Assert(t, d.dir, int8(-1)) - d.SetDirection("nothing") + _ = d.SetDirection("nothing") gobottest.Assert(t, d.dir, int8(1)) } @@ -108,11 +108,11 @@ func TestEasyDriverSetDirectionNoPin(t *testing.T) { func TestEasyDriverSetSpeed(t *testing.T) { d := initEasyDriver() gobottest.Assert(t, d.rpm, uint(stepsPerRev/4)) // default speed of 720/4 - d.SetSpeed(0) + _ = d.SetSpeed(0) gobottest.Assert(t, d.rpm, uint(1)) - d.SetSpeed(200) + _ = d.SetSpeed(200) gobottest.Assert(t, d.rpm, uint(200)) - d.SetSpeed(1000) + _ = d.SetSpeed(1000) gobottest.Assert(t, d.rpm, uint(stepsPerRev)) } @@ -124,13 +124,13 @@ func TestEasyDriverGetMaxSpeed(t *testing.T) { func TestEasyDriverSleep(t *testing.T) { // let's test basic functionality d := initEasyDriver() - d.Sleep() + _ = d.Sleep() gobottest.Assert(t, d.IsSleeping(), true) // let's make sure it stops first d = initEasyDriver() - d.Run() - d.Sleep() + _ = d.Run() + _ = d.Sleep() gobottest.Assert(t, d.IsSleeping(), true) gobottest.Assert(t, d.IsMoving(), false) } @@ -147,18 +147,18 @@ func TestEasyDriverSleepNoPin(t *testing.T) { func TestEasyDriverWake(t *testing.T) { // let's test basic functionality d := initEasyDriver() - d.Sleep() + _ = d.Sleep() gobottest.Assert(t, d.IsSleeping(), true) - d.Wake() + _ = d.Wake() gobottest.Assert(t, d.IsSleeping(), false) } func TestEasyDriverEnable(t *testing.T) { // let's test basic functionality d := initEasyDriver() - d.Disable() + _ = d.Disable() gobottest.Assert(t, d.IsEnabled(), false) - d.Enable() + _ = d.Enable() gobottest.Assert(t, d.IsEnabled(), true) } @@ -174,13 +174,13 @@ func TestEasyDriverEnableNoPin(t *testing.T) { func TestEasyDriverDisable(t *testing.T) { // let's test basic functionality d := initEasyDriver() - d.Disable() + _ = d.Disable() gobottest.Assert(t, d.IsEnabled(), false) // let's make sure it stops first d = initEasyDriver() - d.Run() - d.Disable() + _ = d.Run() + _ = d.Disable() gobottest.Assert(t, d.IsEnabled(), false) gobottest.Assert(t, d.IsMoving(), false) } diff --git a/drivers/gpio/grove_drivers_test.go b/drivers/gpio/grove_drivers_test.go index 3dd3e97b4..35f3ac840 100644 --- a/drivers/gpio/grove_drivers_test.go +++ b/drivers/gpio/grove_drivers_test.go @@ -59,10 +59,10 @@ func TestDigitalDriverHalt(t *testing.T) { } // Start the driver and allow for multiple digital reads - driver.Start() + _ = driver.Start() time.Sleep(20 * time.Millisecond) - driver.Halt() + _ = driver.Halt() lastCallCount := atomic.LoadInt32(&callCount) // If driver was not halted, digital reads would still continue time.Sleep(20 * time.Millisecond) @@ -94,7 +94,7 @@ func TestDriverPublishesError(t *testing.T) { gobottest.Assert(t, driver.Start(), nil) // expect error - driver.Once(driver.Event(Error), func(data interface{}) { + _ = driver.Once(driver.Event(Error), func(data interface{}) { gobottest.Assert(t, data.(error).Error(), "read error") close(sem) }) @@ -106,7 +106,7 @@ func TestDriverPublishesError(t *testing.T) { } // Cleanup - driver.Halt() + _ = driver.Halt() } } diff --git a/drivers/gpio/hd44780_driver_test.go b/drivers/gpio/hd44780_driver_test.go index d13d33a85..5a4ccadb7 100644 --- a/drivers/gpio/hd44780_driver_test.go +++ b/drivers/gpio/hd44780_driver_test.go @@ -12,9 +12,12 @@ import ( var _ gobot.Driver = (*HD44780Driver)(nil) // --------- HELPERS -func initTestHD44780Driver() (driver *HD44780Driver) { - driver, _ = initTestHD44780Driver4BitModeWithStubbedAdaptor() - return +func initTestHD44780Driver() *HD44780Driver { + d, _ := initTestHD44780Driver4BitModeWithStubbedAdaptor() + if err := d.Start(); err != nil { + panic(err) + } + return d } func initTestHD44780Driver4BitModeWithStubbedAdaptor() (*HD44780Driver, *gpioTestAdaptor) { @@ -47,7 +50,8 @@ func initTestHD44780Driver8BitModeWithStubbedAdaptor() (*HD44780Driver, *gpioTes // --------- TESTS func TestHD44780Driver(t *testing.T) { - var a interface{} = initTestHD44780Driver() + d, _ := initTestHD44780Driver4BitModeWithStubbedAdaptor() + var a interface{} = d _, ok := a.(*HD44780Driver) if !ok { t.Errorf("NewHD44780Driver() should have returned a *HD44780Driver") @@ -56,23 +60,22 @@ func TestHD44780Driver(t *testing.T) { func TestHD44780DriverHalt(t *testing.T) { d := initTestHD44780Driver() - d.Start() gobottest.Assert(t, d.Halt(), nil) } func TestHD44780DriverDefaultName(t *testing.T) { - d := initTestHD44780Driver() + d, _ := initTestHD44780Driver4BitModeWithStubbedAdaptor() gobottest.Assert(t, strings.HasPrefix(d.Name(), "HD44780Driver"), true) } func TestHD44780DriverSetName(t *testing.T) { - d := initTestHD44780Driver() + d, _ := initTestHD44780Driver4BitModeWithStubbedAdaptor() d.SetName("my driver") gobottest.Assert(t, d.Name(), "my driver") } func TestHD44780DriverStart(t *testing.T) { - d := initTestHD44780Driver() + d, _ := initTestHD44780Driver4BitModeWithStubbedAdaptor() gobottest.Assert(t, d.Start(), nil) } @@ -109,11 +112,11 @@ func TestHD44780DriverWrite(t *testing.T) { var d *HD44780Driver d, _ = initTestHD44780Driver4BitModeWithStubbedAdaptor() - d.Start() + _ = d.Start() gobottest.Assert(t, d.Write("hello gobot"), nil) d, _ = initTestHD44780Driver8BitModeWithStubbedAdaptor() - d.Start() + _ = d.Start() gobottest.Assert(t, d.Write("hello gobot"), nil) } @@ -125,38 +128,34 @@ func TestHD44780DriverWriteError(t *testing.T) { a.testAdaptorDigitalWrite = func(string, byte) (err error) { return errors.New("write error") } - d.Start() + _ = d.Start() gobottest.Assert(t, d.Write("hello gobot"), errors.New("write error")) d, a = initTestHD44780Driver8BitModeWithStubbedAdaptor() a.testAdaptorDigitalWrite = func(string, byte) (err error) { return errors.New("write error") } - d.Start() + _ = d.Start() gobottest.Assert(t, d.Write("hello gobot"), errors.New("write error")) } func TestHD44780DriverClear(t *testing.T) { d := initTestHD44780Driver() - d.Start() gobottest.Assert(t, d.Clear(), nil) } func TestHD44780DriverHome(t *testing.T) { d := initTestHD44780Driver() - d.Start() gobottest.Assert(t, d.Home(), nil) } func TestHD44780DriverSetCursor(t *testing.T) { d := initTestHD44780Driver() - d.Start() gobottest.Assert(t, d.SetCursor(0, 3), nil) } func TestHD44780DriverSetCursorInvalid(t *testing.T) { d := initTestHD44780Driver() - d.Start() gobottest.Assert(t, d.SetCursor(-1, 3), errors.New("Invalid position value (-1, 3), range (1, 15)")) gobottest.Assert(t, d.SetCursor(2, 3), errors.New("Invalid position value (2, 3), range (1, 15)")) gobottest.Assert(t, d.SetCursor(0, -1), errors.New("Invalid position value (0, -1), range (1, 15)")) @@ -165,86 +164,72 @@ func TestHD44780DriverSetCursorInvalid(t *testing.T) { func TestHD44780DriverDisplayOn(t *testing.T) { d := initTestHD44780Driver() - d.Start() gobottest.Assert(t, d.Display(true), nil) } func TestHD44780DriverDisplayOff(t *testing.T) { d := initTestHD44780Driver() - d.Start() gobottest.Assert(t, d.Display(false), nil) } func TestHD44780DriverCursorOn(t *testing.T) { d := initTestHD44780Driver() - d.Start() gobottest.Assert(t, d.Cursor(true), nil) } func TestHD44780DriverCursorOff(t *testing.T) { d := initTestHD44780Driver() - d.Start() gobottest.Assert(t, d.Cursor(false), nil) } func TestHD44780DriverBlinkOn(t *testing.T) { d := initTestHD44780Driver() - d.Start() gobottest.Assert(t, d.Blink(true), nil) } func TestHD44780DriverBlinkOff(t *testing.T) { d := initTestHD44780Driver() - d.Start() gobottest.Assert(t, d.Blink(false), nil) } func TestHD44780DriverScrollLeft(t *testing.T) { d := initTestHD44780Driver() - d.Start() gobottest.Assert(t, d.ScrollLeft(), nil) } func TestHD44780DriverScrollRight(t *testing.T) { d := initTestHD44780Driver() - d.Start() gobottest.Assert(t, d.ScrollRight(), nil) } func TestHD44780DriverLeftToRight(t *testing.T) { d := initTestHD44780Driver() - d.Start() gobottest.Assert(t, d.LeftToRight(), nil) } func TestHD44780DriverRightToLeft(t *testing.T) { d := initTestHD44780Driver() - d.Start() gobottest.Assert(t, d.RightToLeft(), nil) } func TestHD44780DriverSendCommand(t *testing.T) { d := initTestHD44780Driver() - d.Start() gobottest.Assert(t, d.SendCommand(0x33), nil) } func TestHD44780DriverWriteChar(t *testing.T) { d := initTestHD44780Driver() - d.Start() gobottest.Assert(t, d.WriteChar(0x41), nil) } func TestHD44780DriverCreateChar(t *testing.T) { d := initTestHD44780Driver() - d.Start() charMap := [8]byte{1, 2, 3, 4, 5, 6, 7, 8} gobottest.Assert(t, d.CreateChar(0, charMap), nil) } func TestHD44780DriverCreateCharError(t *testing.T) { d := initTestHD44780Driver() - d.Start() charMap := [8]byte{1, 2, 3, 4, 5, 6, 7, 8} gobottest.Assert(t, d.CreateChar(8, charMap), errors.New("can't set a custom character at a position greater than 7")) } diff --git a/drivers/gpio/helpers_test.go b/drivers/gpio/helpers_test.go index fe3849c09..959ba7c65 100644 --- a/drivers/gpio/helpers_test.go +++ b/drivers/gpio/helpers_test.go @@ -9,12 +9,6 @@ func (t *gpioTestBareAdaptor) Finalize() (err error) { return } func (t *gpioTestBareAdaptor) Name() string { return "" } func (t *gpioTestBareAdaptor) SetName(n string) {} -type gpioTestDigitalWriter struct { - gpioTestBareAdaptor -} - -func (t *gpioTestDigitalWriter) DigitalWrite(string, byte) (err error) { return } - type gpioTestAdaptor struct { name string port string diff --git a/drivers/gpio/led_driver_test.go b/drivers/gpio/led_driver_test.go index b7a3b3cbc..cd6fc57f0 100644 --- a/drivers/gpio/led_driver_test.go +++ b/drivers/gpio/led_driver_test.go @@ -63,10 +63,10 @@ func TestLedDriverHalt(t *testing.T) { func TestLedDriverToggle(t *testing.T) { d := initTestLedDriver() - d.Off() - d.Toggle() + _ = d.Off() + _ = d.Toggle() gobottest.Assert(t, d.State(), true) - d.Toggle() + _ = d.Toggle() gobottest.Assert(t, d.State(), false) } diff --git a/drivers/gpio/makey_button_driver_test.go b/drivers/gpio/makey_button_driver_test.go index cf5857fe5..0fb54c144 100644 --- a/drivers/gpio/makey_button_driver_test.go +++ b/drivers/gpio/makey_button_driver_test.go @@ -49,7 +49,7 @@ func TestMakeyButtonDriverStart(t *testing.T) { gobottest.Assert(t, d.Start(), nil) - d.Once(ButtonPush, func(data interface{}) { + _ = d.Once(ButtonPush, func(data interface{}) { gobottest.Assert(t, d.Active, true) sem <- true }) @@ -65,7 +65,7 @@ func TestMakeyButtonDriverStart(t *testing.T) { t.Errorf("MakeyButton Event \"Push\" was not published") } - d.Once(ButtonRelease, func(data interface{}) { + _ = d.Once(ButtonRelease, func(data interface{}) { gobottest.Assert(t, d.Active, false) sem <- true }) @@ -81,7 +81,7 @@ func TestMakeyButtonDriverStart(t *testing.T) { t.Errorf("MakeyButton Event \"Release\" was not published") } - d.Once(Error, func(data interface{}) { + _ = d.Once(Error, func(data interface{}) { gobottest.Assert(t, data.(error).Error(), "digital read error") sem <- true }) @@ -98,7 +98,7 @@ func TestMakeyButtonDriverStart(t *testing.T) { } // send a halt message - d.Once(ButtonRelease, func(data interface{}) { + _ = d.Once(ButtonRelease, func(data interface{}) { sem <- true }) diff --git a/drivers/gpio/max7219_driver.go b/drivers/gpio/max7219_driver.go index 9693ec304..216d7e26d 100644 --- a/drivers/gpio/max7219_driver.go +++ b/drivers/gpio/max7219_driver.go @@ -1,6 +1,7 @@ package gpio import ( + "github.com/hashicorp/go-multierror" "gobot.io/x/gobot/v2" ) @@ -53,23 +54,37 @@ func NewMAX7219Driver(a gobot.Connection, clockPin string, dataPin string, csPin } // Start initializes the max7219, it uses a SPI-like communication protocol -func (a *MAX7219Driver) Start() (err error) { - a.pinData.On() - a.pinClock.On() - a.pinCS.On() - - a.All(MAX7219ScanLimit, 0x07) - a.All(MAX7219DecodeMode, 0x00) - a.All(MAX7219Shutdown, 0x01) - a.All(MAX7219DisplayTest, 0x00) - a.ClearAll() - a.All(MAX7219Intensity, 0x0f) - - return +func (a *MAX7219Driver) Start() error { + if err := a.pinData.On(); err != nil { + return err + } + if err := a.pinClock.On(); err != nil { + return err + } + if err := a.pinCS.On(); err != nil { + return err + } + + if err := a.All(MAX7219ScanLimit, 0x07); err != nil { + return err + } + if err := a.All(MAX7219DecodeMode, 0x00); err != nil { + return err + } + if err := a.All(MAX7219Shutdown, 0x01); err != nil { + return err + } + if err := a.All(MAX7219DisplayTest, 0x00); err != nil { + return err + } + if err := a.ClearAll(); err != nil { + return err + } + return a.All(MAX7219Intensity, 0x0f) } // Halt implements the Driver interface -func (a *MAX7219Driver) Halt() (err error) { return } +func (a *MAX7219Driver) Halt() error { return nil } // Name returns the MAX7219Drivers name func (a *MAX7219Driver) Name() string { return a.name } @@ -83,74 +98,102 @@ func (a *MAX7219Driver) Connection() gobot.Connection { } // SetIntensity changes the intensity (from 1 to 7) of the display -func (a *MAX7219Driver) SetIntensity(level byte) { +func (a *MAX7219Driver) SetIntensity(level byte) error { if level > 15 { level = 15 } - a.All(MAX7219Intensity, level) + return a.All(MAX7219Intensity, level) } // ClearAll turns off all LEDs of all modules -func (a *MAX7219Driver) ClearAll() { +func (a *MAX7219Driver) ClearAll() error { + var err error for i := 1; i <= 8; i++ { - a.All(byte(i), 0) + if e := a.All(byte(i), 0); e != nil { + err = multierror.Append(err, e) + } } + + return err } // ClearOne turns off all LEDs of the given module -func (a *MAX7219Driver) ClearOne(which uint) { +func (a *MAX7219Driver) ClearOne(which uint) error { + var err error for i := 1; i <= 8; i++ { - a.One(which, byte(i), 0) + if e := a.One(which, byte(i), 0); e != nil { + err = multierror.Append(err, e) + } } -} -// sendData is an auxiliary function to send data to the MAX7219Driver module -func (a *MAX7219Driver) sendData(address byte, data byte) { - a.pinCS.Off() - a.send(address) - a.send(data) - a.pinCS.On() + return err } // send writes data on the module -func (a *MAX7219Driver) send(data byte) { +func (a *MAX7219Driver) send(data byte) error { var i byte for i = 8; i > 0; i-- { mask := byte(0x01 << (i - 1)) - a.pinClock.Off() + if err := a.pinClock.Off(); err != nil { + return err + } if data&mask > 0 { - a.pinData.On() + if err := a.pinData.On(); err != nil { + return err + } } else { - a.pinData.Off() + if err := a.pinData.Off(); err != nil { + return err + } + } + if err := a.pinClock.On(); err != nil { + return err } - a.pinClock.On() } + + return nil } // All sends the same data to all the modules -func (a *MAX7219Driver) All(address byte, data byte) { - a.pinCS.Off() +func (a *MAX7219Driver) All(address byte, data byte) error { + if err := a.pinCS.Off(); err != nil { + return err + } var c uint for c = 0; c < a.count; c++ { - a.send(address) - a.send(data) + if err := a.send(address); err != nil { + return err + } + if err := a.send(data); err != nil { + return err + } } - a.pinCS.On() + return a.pinCS.On() } // One sends data to a specific module -func (a *MAX7219Driver) One(which uint, address byte, data byte) { - a.pinCS.Off() +func (a *MAX7219Driver) One(which uint, address byte, data byte) error { + if err := a.pinCS.Off(); err != nil { + return err + } var c uint for c = 0; c < a.count; c++ { if c == which { - a.send(address) - a.send(data) + if err := a.send(address); err != nil { + return err + } + if err := a.send(data); err != nil { + return err + } } else { - a.send(0) - a.send(0) + if err := a.send(0); err != nil { + return err + } + if err := a.send(0); err != nil { + return err + } } } - a.pinCS.On() + return a.pinCS.On() } diff --git a/drivers/gpio/motor_driver_test.go b/drivers/gpio/motor_driver_test.go index e1107d6fe..aa382fec3 100644 --- a/drivers/gpio/motor_driver_test.go +++ b/drivers/gpio/motor_driver_test.go @@ -41,76 +41,76 @@ func TestMotorDriverIsOn(t *testing.T) { func TestMotorDriverIsOff(t *testing.T) { d := initTestMotorDriver() - d.Off() + _ = d.Off() gobottest.Assert(t, d.IsOff(), true) } func TestMotorDriverOn(t *testing.T) { d := initTestMotorDriver() d.CurrentMode = "digital" - d.On() + _ = d.On() gobottest.Assert(t, d.CurrentState, uint8(1)) d.CurrentMode = "analog" d.CurrentSpeed = 0 - d.On() + _ = d.On() gobottest.Assert(t, d.CurrentSpeed, uint8(255)) } func TestMotorDriverOff(t *testing.T) { d := initTestMotorDriver() d.CurrentMode = "digital" - d.Off() + _ = d.Off() gobottest.Assert(t, d.CurrentState, uint8(0)) d.CurrentMode = "analog" d.CurrentSpeed = 100 - d.Off() + _ = d.Off() gobottest.Assert(t, d.CurrentSpeed, uint8(0)) } func TestMotorDriverToggle(t *testing.T) { d := initTestMotorDriver() - d.Off() - d.Toggle() + _ = d.Off() + _ = d.Toggle() gobottest.Assert(t, d.IsOn(), true) - d.Toggle() + _ = d.Toggle() gobottest.Assert(t, d.IsOn(), false) } func TestMotorDriverMin(t *testing.T) { d := initTestMotorDriver() - d.Min() + _ = d.Min() } func TestMotorDriverMax(t *testing.T) { d := initTestMotorDriver() - d.Max() + _ = d.Max() } func TestMotorDriverSpeed(t *testing.T) { d := initTestMotorDriver() - d.Speed(100) + _ = d.Speed(100) } func TestMotorDriverForward(t *testing.T) { d := initTestMotorDriver() - d.Forward(100) + _ = d.Forward(100) gobottest.Assert(t, d.CurrentSpeed, uint8(100)) gobottest.Assert(t, d.CurrentDirection, "forward") } func TestMotorDriverBackward(t *testing.T) { d := initTestMotorDriver() - d.Backward(100) + _ = d.Backward(100) gobottest.Assert(t, d.CurrentSpeed, uint8(100)) gobottest.Assert(t, d.CurrentDirection, "backward") } func TestMotorDriverDirection(t *testing.T) { d := initTestMotorDriver() - d.Direction("none") + _ = d.Direction("none") d.DirectionPin = "2" - d.Direction("forward") - d.Direction("backward") + _ = d.Direction("forward") + _ = d.Direction("backward") } func TestMotorDriverDigital(t *testing.T) { @@ -120,9 +120,9 @@ func TestMotorDriverDigital(t *testing.T) { d.ForwardPin = "2" d.BackwardPin = "3" - d.On() + _ = d.On() gobottest.Assert(t, d.CurrentState, uint8(1)) - d.Off() + _ = d.Off() gobottest.Assert(t, d.CurrentState, uint8(0)) } diff --git a/drivers/gpio/pir_motion_driver_test.go b/drivers/gpio/pir_motion_driver_test.go index 7d73c5753..6cfc755b1 100644 --- a/drivers/gpio/pir_motion_driver_test.go +++ b/drivers/gpio/pir_motion_driver_test.go @@ -41,7 +41,7 @@ func TestPIRMotionDriverStart(t *testing.T) { gobottest.Assert(t, d.Start(), nil) - d.Once(MotionDetected, func(data interface{}) { + _ = d.Once(MotionDetected, func(data interface{}) { gobottest.Assert(t, d.Active, true) sem <- true }) @@ -57,7 +57,7 @@ func TestPIRMotionDriverStart(t *testing.T) { t.Errorf("PIRMotionDriver Event \"MotionDetected\" was not published") } - d.Once(MotionStopped, func(data interface{}) { + _ = d.Once(MotionStopped, func(data interface{}) { gobottest.Assert(t, d.Active, false) sem <- true }) @@ -73,7 +73,7 @@ func TestPIRMotionDriverStart(t *testing.T) { t.Errorf("PIRMotionDriver Event \"MotionStopped\" was not published") } - d.Once(Error, func(data interface{}) { + _ = d.Once(Error, func(data interface{}) { sem <- true }) diff --git a/drivers/gpio/relay_driver_test.go b/drivers/gpio/relay_driver_test.go index bb3475864..12160357a 100644 --- a/drivers/gpio/relay_driver_test.go +++ b/drivers/gpio/relay_driver_test.go @@ -54,13 +54,13 @@ func TestRelayDriverToggle(t *testing.T) { return nil }) - d.Off() + _ = d.Off() gobottest.Assert(t, d.State(), false) gobottest.Assert(t, lastVal, byte(0)) - d.Toggle() + _ = d.Toggle() gobottest.Assert(t, d.State(), true) gobottest.Assert(t, lastVal, byte(1)) - d.Toggle() + _ = d.Toggle() gobottest.Assert(t, d.State(), false) gobottest.Assert(t, lastVal, byte(0)) } @@ -74,13 +74,13 @@ func TestRelayDriverToggleInverted(t *testing.T) { }) d.Inverted = true - d.Off() + _ = d.Off() gobottest.Assert(t, d.State(), false) gobottest.Assert(t, lastVal, byte(1)) - d.Toggle() + _ = d.Toggle() gobottest.Assert(t, d.State(), true) gobottest.Assert(t, lastVal, byte(0)) - d.Toggle() + _ = d.Toggle() gobottest.Assert(t, d.State(), false) gobottest.Assert(t, lastVal, byte(1)) } diff --git a/drivers/gpio/rgb_led_driver_test.go b/drivers/gpio/rgb_led_driver_test.go index b4fa5e820..2e9ffc9ca 100644 --- a/drivers/gpio/rgb_led_driver_test.go +++ b/drivers/gpio/rgb_led_driver_test.go @@ -66,10 +66,10 @@ func TestRgbLedDriverHalt(t *testing.T) { func TestRgbLedDriverToggle(t *testing.T) { d := initTestRgbLedDriver() - d.Off() - d.Toggle() + _ = d.Off() + _ = d.Toggle() gobottest.Assert(t, d.State(), true) - d.Toggle() + _ = d.Toggle() gobottest.Assert(t, d.State(), false) } diff --git a/drivers/gpio/servo_driver_test.go b/drivers/gpio/servo_driver_test.go index e58c4d461..d34094d4b 100644 --- a/drivers/gpio/servo_driver_test.go +++ b/drivers/gpio/servo_driver_test.go @@ -53,7 +53,7 @@ func TestServoDriverHalt(t *testing.T) { func TestServoDriverMove(t *testing.T) { d := initTestServoDriver() - d.Move(100) + _ = d.Move(100) gobottest.Assert(t, d.CurrentAngle, uint8(100)) err := d.Move(200) gobottest.Assert(t, err, ErrServoOutOfRange) @@ -61,19 +61,19 @@ func TestServoDriverMove(t *testing.T) { func TestServoDriverMin(t *testing.T) { d := initTestServoDriver() - d.Min() + _ = d.Min() gobottest.Assert(t, d.CurrentAngle, uint8(0)) } func TestServoDriverMax(t *testing.T) { d := initTestServoDriver() - d.Max() + _ = d.Max() gobottest.Assert(t, d.CurrentAngle, uint8(180)) } func TestServoDriverCenter(t *testing.T) { d := initTestServoDriver() - d.Center() + _ = d.Center() gobottest.Assert(t, d.CurrentAngle, uint8(90)) } diff --git a/drivers/gpio/stepper_driver.go b/drivers/gpio/stepper_driver.go index 427644a03..25a3d2c20 100644 --- a/drivers/gpio/stepper_driver.go +++ b/drivers/gpio/stepper_driver.go @@ -106,13 +106,15 @@ func (s *StepperDriver) SetName(n string) { s.name = n } func (s *StepperDriver) Connection() gobot.Connection { return s.connection.(gobot.Connection) } // Start implements the Driver interface and keeps running the stepper till halt is called -func (s *StepperDriver) Start() (err error) { return } +func (s *StepperDriver) Start() error { return nil } // Run continuously runs the stepper -func (s *StepperDriver) Run() (err error) { +func (s *StepperDriver) Run() error { //halt if already moving if s.moving { - s.Halt() + if err := s.Halt(); err != nil { + return err + } } s.mutex.Lock() @@ -126,16 +128,18 @@ func (s *StepperDriver) Run() (err error) { if !s.moving { break } - s.step() + if err := s.step(); err != nil { + panic(err) + } time.Sleep(delay) } }() - return + return nil } // Halt implements the Driver interface and halts the motion of the Stepper -func (s *StepperDriver) Halt() (err error) { +func (s *StepperDriver) Halt() error { s.mutex.Lock() s.moving = false s.mutex.Unlock() @@ -193,7 +197,9 @@ func (s *StepperDriver) Move(stepsToMove int) error { if s.moving { //stop previous motion - s.Halt() + if err := s.Halt(); err != nil { + return err + } } s.mutex.Lock() diff --git a/drivers/gpio/stepper_driver_test.go b/drivers/gpio/stepper_driver_test.go index 56aefeb98..d41449c30 100644 --- a/drivers/gpio/stepper_driver_test.go +++ b/drivers/gpio/stepper_driver_test.go @@ -19,15 +19,15 @@ func initStepperMotorDriver() *StepperDriver { func TestStepperDriverRun(t *testing.T) { d := initStepperMotorDriver() - d.Run() + _ = d.Run() gobottest.Assert(t, d.IsMoving(), true) } func TestStepperDriverHalt(t *testing.T) { d := initStepperMotorDriver() - d.Run() + _ = d.Run() time.Sleep(200 * time.Millisecond) - d.Halt() + _ = d.Halt() gobottest.Assert(t, d.IsMoving(), false) } @@ -46,7 +46,7 @@ func TestStepperDriverSetName(t *testing.T) { func TestStepperDriverSetDirection(t *testing.T) { dir := "backward" d := initStepperMotorDriver() - d.SetDirection(dir) + _ = d.SetDirection(dir) gobottest.Assert(t, d.direction, dir) } @@ -63,25 +63,25 @@ func TestStepperDriverInvalidDirection(t *testing.T) { func TestStepperDriverMoveForward(t *testing.T) { d := initStepperMotorDriver() - d.Move(1) + _ = d.Move(1) gobottest.Assert(t, d.GetCurrentStep(), 1) - d.Move(10) + _ = d.Move(10) gobottest.Assert(t, d.GetCurrentStep(), 11) } func TestStepperDriverMoveBackward(t *testing.T) { d := initStepperMotorDriver() - d.Move(-1) + _ = d.Move(-1) gobottest.Assert(t, d.GetCurrentStep(), stepsInRev-1) - d.Move(-10) + _ = d.Move(-10) gobottest.Assert(t, d.GetCurrentStep(), stepsInRev-11) } func TestStepperDriverMoveFullRotation(t *testing.T) { d := initStepperMotorDriver() - d.Move(stepsInRev) + _ = d.Move(stepsInRev) gobottest.Assert(t, d.GetCurrentStep(), 0) } @@ -89,7 +89,7 @@ func TestStepperDriverMotorSetSpeedMoreThanMax(t *testing.T) { d := initStepperMotorDriver() m := d.GetMaxSpeed() - d.SetSpeed(m + 1) + _ = d.SetSpeed(m + 1) gobottest.Assert(t, m, d.speed) } @@ -97,9 +97,9 @@ func TestStepperDriverMotorSetSpeedLessOrEqualMax(t *testing.T) { d := initStepperMotorDriver() m := d.GetMaxSpeed() - d.SetSpeed(m - 1) + _ = d.SetSpeed(m - 1) gobottest.Assert(t, m-1, d.speed) - d.SetSpeed(m) + _ = d.SetSpeed(m) gobottest.Assert(t, m, d.speed) } diff --git a/drivers/gpio/tm1638_driver.go b/drivers/gpio/tm1638_driver.go index 5c34593d3..4b23bb360 100644 --- a/drivers/gpio/tm1638_driver.go +++ b/drivers/gpio/tm1638_driver.go @@ -61,26 +61,38 @@ func NewTM1638Driver(a gobot.Connection, clockPin string, dataPin string, strobe } // Start initializes the tm1638, it uses a SPI-like communication protocol -func (t *TM1638Driver) Start() (err error) { +func (t *TM1638Driver) Start() error { - t.pinStrobe.On() - t.pinClock.On() + if err := t.pinStrobe.On(); err != nil { + return err + } + if err := t.pinClock.On(); err != nil { + return err + } - t.sendCommand(TM1638DataCmd) - t.sendCommand(TM1638DispCtrl | 8 | 7) + if err := t.sendCommand(TM1638DataCmd); err != nil { + return err + } + if err := t.sendCommand(TM1638DispCtrl | 8 | 7); err != nil { + return err + } - t.pinStrobe.Off() - t.send(TM1638AddrCmd) + if err := t.pinStrobe.Off(); err != nil { + return err + } + if err := t.send(TM1638AddrCmd); err != nil { + return err + } for i := 0; i < 16; i++ { - t.send(TM1638WriteDisp) + if err := t.send(TM1638WriteDisp); err != nil { + return err + } } - t.pinStrobe.On() - - return + return t.pinStrobe.On() } // Halt implements the Driver interface -func (t *TM1638Driver) Halt() (err error) { return } +func (t *TM1638Driver) Halt() error { return nil } // Name returns the TM1638Drivers name func (t *TM1638Driver) Name() string { return t.name } @@ -94,75 +106,104 @@ func (t *TM1638Driver) Connection() gobot.Connection { } // sendCommand is an auxiliary function to send commands to the TM1638 module -func (t *TM1638Driver) sendCommand(cmd byte) { - t.pinStrobe.Off() - t.send(cmd) - t.pinStrobe.On() +func (t *TM1638Driver) sendCommand(cmd byte) error { + if err := t.pinStrobe.Off(); err != nil { + return err + } + if err := t.send(cmd); err != nil { + return err + } + return t.pinStrobe.On() } // send writes data on the module -func (t *TM1638Driver) send(data byte) { +func (t *TM1638Driver) send(data byte) error { for i := 0; i < 8; i++ { - t.pinClock.Off() + if err := t.pinClock.Off(); err != nil { + return err + } if (data & 1) > 0 { - t.pinData.On() + if err := t.pinData.On(); err != nil { + return err + } } else { - t.pinData.Off() + if err := t.pinData.Off(); err != nil { + return err + } } data >>= 1 - t.pinClock.On() + if err := t.pinClock.On(); err != nil { + return err + } } + + return nil } // sendData is an auxiliary function to send data to the TM1638 module -func (t *TM1638Driver) sendData(address byte, data byte) { - t.sendCommand(TM1638DataCmd | TM1638FixedAddr) - t.pinStrobe.Off() - t.send(TM1638AddrCmd | address) - t.send(data) - t.pinStrobe.On() +func (t *TM1638Driver) sendData(address byte, data byte) error { + if err := t.sendCommand(TM1638DataCmd | TM1638FixedAddr); err != nil { + return err + } + if err := t.pinStrobe.Off(); err != nil { + return err + } + if err := t.send(TM1638AddrCmd | address); err != nil { + return err + } + if err := t.send(data); err != nil { + return err + } + return t.pinStrobe.On() } // SetLED changes the color (TM1638None, TM1638Red, TM1638Green) of the specific LED -func (t *TM1638Driver) SetLED(color byte, pos byte) { +func (t *TM1638Driver) SetLED(color byte, pos byte) error { if pos > 7 { - return + return nil } - t.sendData((pos<<1)+1, color) + return t.sendData((pos<<1)+1, color) } // SetDisplay cuts and sends a byte array to the display (without dots) -func (t *TM1638Driver) SetDisplay(data []byte) { +func (t *TM1638Driver) SetDisplay(data []byte) error { minLength := int(math.Min(8, float64(len(data)))) for i := 0; i < minLength; i++ { - t.SendChar(byte(i), data[i], false) + if err := t.SendChar(byte(i), data[i], false); err != nil { + return err + } } + return nil } // SetDisplayText cuts and sends a string to the display (without dots) -func (t *TM1638Driver) SetDisplayText(text string) { +func (t *TM1638Driver) SetDisplayText(text string) error { data := t.fromStringToByteArray(text) minLength := int(math.Min(8, float64(len(data)))) for i := 0; i < minLength; i++ { - t.SendChar(byte(i), data[i], false) + if err := t.SendChar(byte(i), data[i], false); err != nil { + return err + } } + return nil } // SendChar sends one byte to the specific position in the display -func (t *TM1638Driver) SendChar(pos byte, data byte, dot bool) { +func (t *TM1638Driver) SendChar(pos byte, data byte, dot bool) error { if pos > 7 { - return + return nil } var dotData byte if dot { dotData = TM1638DispCtrl } - t.sendData(pos<<1, data|(dotData)) + return t.sendData(pos<<1, data|(dotData)) } -// fromStringToByteArray translates a string to a byte array with the corresponding representation for the 7-segment LCD, return and empty character if the font is not available +// fromStringToByteArray translates a string to a byte array with the corresponding representation +// for the 7-segment LCD, return and empty character if the font is not available func (t *TM1638Driver) fromStringToByteArray(str string) []byte { chars := strings.Split(str, "") data := make([]byte, len(chars)) diff --git a/drivers/i2c/adafruit1109_driver_test.go b/drivers/i2c/adafruit1109_driver_test.go index 9e9a1e3cf..8fcb5a94d 100644 --- a/drivers/i2c/adafruit1109_driver_test.go +++ b/drivers/i2c/adafruit1109_driver_test.go @@ -86,7 +86,7 @@ func TestAdafruit1109StartReadErr(t *testing.T) { func TestAdafruit1109Halt(t *testing.T) { d, _ := initTestAdafruit1109WithStubbedAdaptor() - d.Start() + _ = d.Start() gobottest.Assert(t, d.Halt(), nil) } @@ -116,7 +116,7 @@ func TestAdafruit1109DigitalRead(t *testing.T) { t.Run(name, func(t *testing.T) { // arrange d, a := initTestAdafruit1109WithStubbedAdaptor() - d.Start() + _ = d.Start() a.written = []byte{} // reset writes of Start() and former test // arrange reads numCallsRead := 0 @@ -149,7 +149,7 @@ func TestAdafruit1109SelectButton(t *testing.T) { t.Run(name, func(t *testing.T) { // arrange d, a := initTestAdafruit1109WithStubbedAdaptor() - d.Start() + _ = d.Start() // arrange reads numCallsRead := 0 a.i2cReadImpl = func(b []byte) (int, error) { @@ -179,7 +179,7 @@ func TestAdafruit1109UpButton(t *testing.T) { t.Run(name, func(t *testing.T) { // arrange d, a := initTestAdafruit1109WithStubbedAdaptor() - d.Start() + _ = d.Start() // arrange reads numCallsRead := 0 a.i2cReadImpl = func(b []byte) (int, error) { @@ -209,7 +209,7 @@ func TestAdafruit1109DownButton(t *testing.T) { t.Run(name, func(t *testing.T) { // arrange d, a := initTestAdafruit1109WithStubbedAdaptor() - d.Start() + _ = d.Start() // arrange reads numCallsRead := 0 a.i2cReadImpl = func(b []byte) (int, error) { @@ -239,7 +239,7 @@ func TestAdafruit1109LeftButton(t *testing.T) { t.Run(name, func(t *testing.T) { // arrange d, a := initTestAdafruit1109WithStubbedAdaptor() - d.Start() + _ = d.Start() // arrange reads numCallsRead := 0 a.i2cReadImpl = func(b []byte) (int, error) { @@ -269,7 +269,7 @@ func TestAdafruit1109RightButton(t *testing.T) { t.Run(name, func(t *testing.T) { // arrange d, a := initTestAdafruit1109WithStubbedAdaptor() - d.Start() + _ = d.Start() // arrange reads numCallsRead := 0 a.i2cReadImpl = func(b []byte) (int, error) { diff --git a/drivers/i2c/ads1x15_driver.go b/drivers/i2c/ads1x15_driver.go index 55d5ba555..1645f20ec 100644 --- a/drivers/i2c/ads1x15_driver.go +++ b/drivers/i2c/ads1x15_driver.go @@ -43,11 +43,6 @@ type ads1x15ChanCfg struct { dataRate int } -type ads1x15GainCfg struct { - bits uint16 - fullrange float64 -} - // ADS1x15Driver is the Gobot driver for the ADS1015/ADS1115 ADC // datasheet: // https://www.ti.com/lit/gpn/ads1115 diff --git a/drivers/i2c/adxl345_driver_test.go b/drivers/i2c/adxl345_driver_test.go index 69719f94a..d2f98f88c 100644 --- a/drivers/i2c/adxl345_driver_test.go +++ b/drivers/i2c/adxl345_driver_test.go @@ -75,7 +75,7 @@ func TestADXL345UseLowPower(t *testing.T) { // * set value in data rate structure // * write the data rate register (0x2C) d, a := initTestADXL345WithStubbedAdaptor() - d.Start() + _ = d.Start() a.written = []byte{} // reset writes of former test setVal := !d.bwRate.lowPower const ( @@ -97,7 +97,7 @@ func TestADXL345SetRate(t *testing.T) { // * set value in data rate structure // * write the data rate register (0x2C) d, a := initTestADXL345WithStubbedAdaptor() - d.Start() + _ = d.Start() a.written = []byte{} // reset writes of former test const ( setVal = ADXL345RateConfig(0x0F) // 3.2kHz @@ -119,7 +119,7 @@ func TestADXL345SetRange(t *testing.T) { // * set value in data format structure // * write the data format register (0x31) d, a := initTestADXL345WithStubbedAdaptor() - d.Start() + _ = d.Start() a.written = []byte{} // reset writes of former test const ( setVal = ADXL345FsRangeConfig(0x03) // +/- 16 g @@ -169,7 +169,7 @@ func TestADXL345RawXYZ(t *testing.T) { }, } d, a := initTestADXL345WithStubbedAdaptor() - d.Start() + _ = d.Start() for name, tc := range tests { t.Run(name, func(t *testing.T) { a.written = []byte{} // reset writes of former test and start @@ -198,7 +198,7 @@ func TestADXL345RawXYZ(t *testing.T) { func TestADXL345RawXYZError(t *testing.T) { // arrange d, a := initTestADXL345WithStubbedAdaptor() - d.Start() + _ = d.Start() a.i2cReadImpl = func(b []byte) (int, error) { return 0, errors.New("read error") } @@ -239,7 +239,7 @@ func TestADXL345XYZ(t *testing.T) { t.Run(name, func(t *testing.T) { // arrange d, a := initTestADXL345WithStubbedAdaptor() - d.Start() + _ = d.Start() a.written = []byte{} // reset writes of former test and start // arrange reads returnRead := append(append(tc.inputX, tc.inputY...), tc.inputZ...) @@ -262,7 +262,7 @@ func TestADXL345XYZ(t *testing.T) { func TestADXL345XYZError(t *testing.T) { // arrange d, a := initTestADXL345WithStubbedAdaptor() - d.Start() + _ = d.Start() a.i2cReadImpl = func(b []byte) (int, error) { return 0, errors.New("read error") } @@ -307,7 +307,7 @@ func TestADXL345_shutdown(t *testing.T) { // * reset the measurement bit in structure // * write the power control register (0x2D) d, a := initTestADXL345WithStubbedAdaptor() - d.Start() + _ = d.Start() a.written = []byte{} // reset writes of former test const ( wantReg = uint8(0x2D) diff --git a/drivers/i2c/bme280_driver.go b/drivers/i2c/bme280_driver.go index bcb3bf0be..a42a1851c 100644 --- a/drivers/i2c/bme280_driver.go +++ b/drivers/i2c/bme280_driver.go @@ -135,7 +135,7 @@ func (d *BME280Driver) Humidity() (humidity float32, err error) { return } -func (d *BME280Driver) initializationBME280() (err error) { +func (d *BME280Driver) initializationBME280() error { // call the initialization routine of base class BMP280Driver, which do: // * initializes temperature and pressure calibration coefficients // * set the control register @@ -152,13 +152,15 @@ func (d *BME280Driver) initializationBME280() (err error) { } // read the humidity calibration coefficients. -func (d *BME280Driver) initHumidity() (err error) { - var hch1 byte - if hch1, err = d.connection.ReadByteData(bme280RegCalibDigH1); err != nil { +func (d *BME280Driver) initHumidity() error { + hch1, err := d.connection.ReadByteData(bme280RegCalibDigH1) + if err != nil { return err } buf := bytes.NewBuffer([]byte{hch1}) - binary.Read(buf, binary.BigEndian, &d.humCalCoeffs.h1) + if err := binary.Read(buf, binary.BigEndian, &d.humCalCoeffs.h1); err != nil { + return err + } coefficients := make([]byte, 7) if err = d.connection.ReadBlockData(bme280RegCalibDigH2LSB, coefficients); err != nil { @@ -170,13 +172,30 @@ func (d *BME280Driver) initHumidity() (err error) { var addrE4 byte var addrE5 byte var addrE6 byte - - binary.Read(buf, binary.LittleEndian, &d.humCalCoeffs.h2) // E1 ... - binary.Read(buf, binary.BigEndian, &d.humCalCoeffs.h3) // E3 - binary.Read(buf, binary.BigEndian, &addrE4) // E4 - binary.Read(buf, binary.BigEndian, &addrE5) // E5 - binary.Read(buf, binary.BigEndian, &addrE6) // E6 - binary.Read(buf, binary.BigEndian, &d.humCalCoeffs.h6) // ... E7 + // E1 ... + if err := binary.Read(buf, binary.LittleEndian, &d.humCalCoeffs.h2); err != nil { + return err + } + // E3 + if err := binary.Read(buf, binary.BigEndian, &d.humCalCoeffs.h3); err != nil { + return err + } + // E4 + if err := binary.Read(buf, binary.BigEndian, &addrE4); err != nil { + return err + } + // E5 + if err := binary.Read(buf, binary.BigEndian, &addrE5); err != nil { + return err + } + // E6 + if err := binary.Read(buf, binary.BigEndian, &addrE6); err != nil { + return err + } + // ... E7 + if err := binary.Read(buf, binary.BigEndian, &d.humCalCoeffs.h6); err != nil { + return err + } d.humCalCoeffs.h4 = 0 + (int16(addrE4) << 4) | (int16(addrE5 & 0x0F)) d.humCalCoeffs.h5 = 0 + (int16(addrE6) << 4) | (int16(addrE5) >> 4) @@ -184,14 +203,17 @@ func (d *BME280Driver) initHumidity() (err error) { // The 'ctrl_hum' register (0xF2) sets the humidity data acquisition options of // the device. Changes to this register only become effective after a write // operation to 'ctrl_meas' (0xF4). So we read the current value in, then write it back - d.connection.WriteByteData(bme280RegControlHumidity, uint8(d.ctrlHumOversamp)) + if err := d.connection.WriteByteData(bme280RegControlHumidity, uint8(d.ctrlHumOversamp)); err != nil { + return err + } - var cmr uint8 - cmr, err = d.connection.ReadByteData(bmp280RegCtrl) - if err == nil { - err = d.connection.WriteByteData(bmp280RegCtrl, cmr) + cmr, err := d.connection.ReadByteData(bmp280RegCtrl) + if err != nil { + return err } - return err + + return d.connection.WriteByteData(bmp280RegCtrl, cmr) + } func (d *BME280Driver) rawHumidity() (uint32, error) { @@ -204,7 +226,9 @@ func (d *BME280Driver) rawHumidity() (uint32, error) { } buf := bytes.NewBuffer(ret) var rawH uint16 - binary.Read(buf, binary.BigEndian, &rawH) + if err := binary.Read(buf, binary.BigEndian, &rawH); err != nil { + return 0, err + } return uint32(rawH), nil } diff --git a/drivers/i2c/bme280_driver_test.go b/drivers/i2c/bme280_driver_test.go index f90f8a23f..80635ac87 100644 --- a/drivers/i2c/bme280_driver_test.go +++ b/drivers/i2c/bme280_driver_test.go @@ -70,7 +70,7 @@ func TestBME280Measurements(t *testing.T) { copy(b, buf.Bytes()) return buf.Len(), nil } - bme280.Start() + _ = bme280.Start() hum, err := bme280.Humidity() gobottest.Assert(t, err, nil) gobottest.Assert(t, hum, float32(51.20179)) @@ -116,7 +116,7 @@ func TestBME280InitH2Error(t *testing.T) { func TestBME280HumidityWriteError(t *testing.T) { bme280, adaptor := initTestBME280WithStubbedAdaptor() - bme280.Start() + _ = bme280.Start() adaptor.i2cWriteImpl = func([]byte) (int, error) { return 0, errors.New("write error") @@ -128,7 +128,7 @@ func TestBME280HumidityWriteError(t *testing.T) { func TestBME280HumidityReadError(t *testing.T) { bme280, adaptor := initTestBME280WithStubbedAdaptor() - bme280.Start() + _ = bme280.Start() adaptor.i2cReadImpl = func([]byte) (int, error) { return 0, errors.New("read error") @@ -157,7 +157,7 @@ func TestBME280HumidityNotEnabled(t *testing.T) { copy(b, buf.Bytes()) return buf.Len(), nil } - bme280.Start() + _ = bme280.Start() hum, err := bme280.Humidity() gobottest.Assert(t, err, errors.New("Humidity disabled")) gobottest.Assert(t, hum, float32(0.0)) diff --git a/drivers/i2c/bmp180_driver.go b/drivers/i2c/bmp180_driver.go index 545854cd3..2d52a063e 100644 --- a/drivers/i2c/bmp180_driver.go +++ b/drivers/i2c/bmp180_driver.go @@ -59,12 +59,13 @@ type BMP180Driver struct { // NewBMP180Driver creates a new driver with the i2c interface for the BMP180 device. // Params: -// conn Connector - the Adaptor to use with this Driver +// +// conn Connector - the Adaptor to use with this Driver // // Optional params: -// i2c.WithBus(int): bus to use with this driver -// i2c.WithAddress(int): address to use with this driver // +// i2c.WithBus(int): bus to use with this driver +// i2c.WithAddress(int): address to use with this driver func NewBMP180Driver(c Connector, options ...func(Config)) *BMP180Driver { d := &BMP180Driver{ Driver: NewDriver(c, "BMP180", bmp180DefaultAddress), @@ -121,26 +122,45 @@ func (d *BMP180Driver) Pressure() (pressure float32, err error) { return d.calculatePressure(rawTemp, rawPressure, d.oversampling), nil } -func (d *BMP180Driver) initialization() (err error) { +func (d *BMP180Driver) initialization() error { // read the 11 calibration coefficients. coefficients := make([]byte, 22) - if err = d.connection.ReadBlockData(bmp180RegisterAC1MSB, coefficients); err != nil { + if err := d.connection.ReadBlockData(bmp180RegisterAC1MSB, coefficients); err != nil { return err } buf := bytes.NewBuffer(coefficients) - binary.Read(buf, binary.BigEndian, &d.calCoeffs.ac1) - binary.Read(buf, binary.BigEndian, &d.calCoeffs.ac2) - binary.Read(buf, binary.BigEndian, &d.calCoeffs.ac3) - binary.Read(buf, binary.BigEndian, &d.calCoeffs.ac4) - binary.Read(buf, binary.BigEndian, &d.calCoeffs.ac5) - binary.Read(buf, binary.BigEndian, &d.calCoeffs.ac6) - binary.Read(buf, binary.BigEndian, &d.calCoeffs.b1) - binary.Read(buf, binary.BigEndian, &d.calCoeffs.b2) - binary.Read(buf, binary.BigEndian, &d.calCoeffs.mb) - binary.Read(buf, binary.BigEndian, &d.calCoeffs.mc) - binary.Read(buf, binary.BigEndian, &d.calCoeffs.md) - - return nil + if err := binary.Read(buf, binary.BigEndian, &d.calCoeffs.ac1); err != nil { + return err + } + if err := binary.Read(buf, binary.BigEndian, &d.calCoeffs.ac2); err != nil { + return err + } + if err := binary.Read(buf, binary.BigEndian, &d.calCoeffs.ac3); err != nil { + return err + } + if err := binary.Read(buf, binary.BigEndian, &d.calCoeffs.ac4); err != nil { + return err + } + if err := binary.Read(buf, binary.BigEndian, &d.calCoeffs.ac5); err != nil { + return err + } + if err := binary.Read(buf, binary.BigEndian, &d.calCoeffs.ac6); err != nil { + return err + } + if err := binary.Read(buf, binary.BigEndian, &d.calCoeffs.b1); err != nil { + return err + } + if err := binary.Read(buf, binary.BigEndian, &d.calCoeffs.b2); err != nil { + return err + } + if err := binary.Read(buf, binary.BigEndian, &d.calCoeffs.mb); err != nil { + return err + } + if err := binary.Read(buf, binary.BigEndian, &d.calCoeffs.mc); err != nil { + return err + } + return binary.Read(buf, binary.BigEndian, &d.calCoeffs.md) + } func (d *BMP180Driver) rawTemp() (int16, error) { @@ -155,7 +175,9 @@ func (d *BMP180Driver) rawTemp() (int16, error) { } buf := bytes.NewBuffer(ret) var rawTemp int16 - binary.Read(buf, binary.BigEndian, &rawTemp) + if err := binary.Read(buf, binary.BigEndian, &rawTemp); err != nil { + return 0, err + } return rawTemp, nil } diff --git a/drivers/i2c/bmp180_driver_test.go b/drivers/i2c/bmp180_driver_test.go index 882c07a7a..87dfcfca6 100644 --- a/drivers/i2c/bmp180_driver_test.go +++ b/drivers/i2c/bmp180_driver_test.go @@ -49,28 +49,28 @@ func TestBMP180Measurements(t *testing.T) { buf := new(bytes.Buffer) // Values from the datasheet example. if adaptor.written[len(adaptor.written)-1] == bmp180RegisterAC1MSB { - binary.Write(buf, binary.BigEndian, int16(408)) - binary.Write(buf, binary.BigEndian, int16(-72)) - binary.Write(buf, binary.BigEndian, int16(-14383)) - binary.Write(buf, binary.BigEndian, uint16(32741)) - binary.Write(buf, binary.BigEndian, uint16(32757)) - binary.Write(buf, binary.BigEndian, uint16(23153)) - binary.Write(buf, binary.BigEndian, int16(6190)) - binary.Write(buf, binary.BigEndian, int16(4)) - binary.Write(buf, binary.BigEndian, int16(-32768)) - binary.Write(buf, binary.BigEndian, int16(-8711)) - binary.Write(buf, binary.BigEndian, int16(2868)) + _ = binary.Write(buf, binary.BigEndian, int16(408)) + _ = binary.Write(buf, binary.BigEndian, int16(-72)) + _ = binary.Write(buf, binary.BigEndian, int16(-14383)) + _ = binary.Write(buf, binary.BigEndian, uint16(32741)) + _ = binary.Write(buf, binary.BigEndian, uint16(32757)) + _ = binary.Write(buf, binary.BigEndian, uint16(23153)) + _ = binary.Write(buf, binary.BigEndian, int16(6190)) + _ = binary.Write(buf, binary.BigEndian, int16(4)) + _ = binary.Write(buf, binary.BigEndian, int16(-32768)) + _ = binary.Write(buf, binary.BigEndian, int16(-8711)) + _ = binary.Write(buf, binary.BigEndian, int16(2868)) } else if adaptor.written[len(adaptor.written)-2] == bmp180CtlTemp && adaptor.written[len(adaptor.written)-1] == bmp180RegisterDataMSB { - binary.Write(buf, binary.BigEndian, int16(27898)) + _ = binary.Write(buf, binary.BigEndian, int16(27898)) } else if adaptor.written[len(adaptor.written)-2] == bmp180CtlPressure && adaptor.written[len(adaptor.written)-1] == bmp180RegisterDataMSB { - binary.Write(buf, binary.BigEndian, int16(23843)) + _ = binary.Write(buf, binary.BigEndian, int16(23843)) // XLSB, not used in this test. buf.WriteByte(0) } copy(b, buf.Bytes()) return buf.Len(), nil } - bmp180.Start() + _ = bmp180.Start() temp, err := bmp180.Temperature() gobottest.Assert(t, err, nil) gobottest.Assert(t, temp, float32(15.0)) @@ -85,28 +85,28 @@ func TestBMP180TemperatureError(t *testing.T) { buf := new(bytes.Buffer) // Values from the datasheet example. if adaptor.written[len(adaptor.written)-1] == bmp180RegisterAC1MSB { - binary.Write(buf, binary.BigEndian, int16(408)) - binary.Write(buf, binary.BigEndian, int16(-72)) - binary.Write(buf, binary.BigEndian, int16(-14383)) - binary.Write(buf, binary.BigEndian, uint16(32741)) - binary.Write(buf, binary.BigEndian, uint16(32757)) - binary.Write(buf, binary.BigEndian, uint16(23153)) - binary.Write(buf, binary.BigEndian, int16(6190)) - binary.Write(buf, binary.BigEndian, int16(4)) - binary.Write(buf, binary.BigEndian, int16(-32768)) - binary.Write(buf, binary.BigEndian, int16(-8711)) - binary.Write(buf, binary.BigEndian, int16(2868)) + _ = binary.Write(buf, binary.BigEndian, int16(408)) + _ = binary.Write(buf, binary.BigEndian, int16(-72)) + _ = binary.Write(buf, binary.BigEndian, int16(-14383)) + _ = binary.Write(buf, binary.BigEndian, uint16(32741)) + _ = binary.Write(buf, binary.BigEndian, uint16(32757)) + _ = binary.Write(buf, binary.BigEndian, uint16(23153)) + _ = binary.Write(buf, binary.BigEndian, int16(6190)) + _ = binary.Write(buf, binary.BigEndian, int16(4)) + _ = binary.Write(buf, binary.BigEndian, int16(-32768)) + _ = binary.Write(buf, binary.BigEndian, int16(-8711)) + _ = binary.Write(buf, binary.BigEndian, int16(2868)) } else if adaptor.written[len(adaptor.written)-2] == bmp180CtlTemp && adaptor.written[len(adaptor.written)-1] == bmp180RegisterDataMSB { return 0, errors.New("temp error") } else if adaptor.written[len(adaptor.written)-2] == bmp180CtlPressure && adaptor.written[len(adaptor.written)-1] == bmp180RegisterDataMSB { - binary.Write(buf, binary.BigEndian, int16(23843)) + _ = binary.Write(buf, binary.BigEndian, int16(23843)) // XLSB, not used in this test. buf.WriteByte(0) } copy(b, buf.Bytes()) return buf.Len(), nil } - bmp180.Start() + _ = bmp180.Start() _, err := bmp180.Temperature() gobottest.Assert(t, err, errors.New("temp error")) } @@ -117,33 +117,33 @@ func TestBMP180PressureError(t *testing.T) { buf := new(bytes.Buffer) // Values from the datasheet example. if adaptor.written[len(adaptor.written)-1] == bmp180RegisterAC1MSB { - binary.Write(buf, binary.BigEndian, int16(408)) - binary.Write(buf, binary.BigEndian, int16(-72)) - binary.Write(buf, binary.BigEndian, int16(-14383)) - binary.Write(buf, binary.BigEndian, uint16(32741)) - binary.Write(buf, binary.BigEndian, uint16(32757)) - binary.Write(buf, binary.BigEndian, uint16(23153)) - binary.Write(buf, binary.BigEndian, int16(6190)) - binary.Write(buf, binary.BigEndian, int16(4)) - binary.Write(buf, binary.BigEndian, int16(-32768)) - binary.Write(buf, binary.BigEndian, int16(-8711)) - binary.Write(buf, binary.BigEndian, int16(2868)) + _ = binary.Write(buf, binary.BigEndian, int16(408)) + _ = binary.Write(buf, binary.BigEndian, int16(-72)) + _ = binary.Write(buf, binary.BigEndian, int16(-14383)) + _ = binary.Write(buf, binary.BigEndian, uint16(32741)) + _ = binary.Write(buf, binary.BigEndian, uint16(32757)) + _ = binary.Write(buf, binary.BigEndian, uint16(23153)) + _ = binary.Write(buf, binary.BigEndian, int16(6190)) + _ = binary.Write(buf, binary.BigEndian, int16(4)) + _ = binary.Write(buf, binary.BigEndian, int16(-32768)) + _ = binary.Write(buf, binary.BigEndian, int16(-8711)) + _ = binary.Write(buf, binary.BigEndian, int16(2868)) } else if adaptor.written[len(adaptor.written)-2] == bmp180CtlTemp && adaptor.written[len(adaptor.written)-1] == bmp180RegisterDataMSB { - binary.Write(buf, binary.BigEndian, int16(27898)) + _ = binary.Write(buf, binary.BigEndian, int16(27898)) } else if adaptor.written[len(adaptor.written)-2] == bmp180CtlPressure && adaptor.written[len(adaptor.written)-1] == bmp180RegisterDataMSB { return 0, errors.New("press error") } copy(b, buf.Bytes()) return buf.Len(), nil } - bmp180.Start() + _ = bmp180.Start() _, err := bmp180.Pressure() gobottest.Assert(t, err, errors.New("press error")) } func TestBMP180PressureWriteError(t *testing.T) { bmp180, adaptor := initTestBMP180WithStubbedAdaptor() - bmp180.Start() + _ = bmp180.Start() adaptor.i2cWriteImpl = func([]byte) (int, error) { return 0, errors.New("write error") diff --git a/drivers/i2c/bmp280_driver.go b/drivers/i2c/bmp280_driver.go index 73486fa04..cea919de4 100644 --- a/drivers/i2c/bmp280_driver.go +++ b/drivers/i2c/bmp280_driver.go @@ -96,12 +96,13 @@ type BMP280Driver struct { // NewBMP280Driver creates a new driver with specified i2c interface. // Params: -// c Connector - the Adaptor to use with this Driver +// +// c Connector - the Adaptor to use with this Driver // // Optional params: -// i2c.WithBus(int): bus to use with this driver -// i2c.WithAddress(int): address to use with this driver // +// i2c.WithBus(int): bus to use with this driver +// i2c.WithAddress(int): address to use with this driver func NewBMP280Driver(c Connector, options ...func(Config)) *BMP280Driver { d := &BMP280Driver{ Driver: NewDriver(c, "BMP280", bmp280DefaultAddress), @@ -190,7 +191,8 @@ func (d *BMP280Driver) Pressure() (press float32, err error) { // Altitude returns the current altitude in meters based on the // current barometric pressure and estimated pressure at sea level. // Calculation is based on code from Adafruit BME280 library -// https://github.com/adafruit/Adafruit_BME280_Library +// +// https://github.com/adafruit/Adafruit_BME280_Library func (d *BMP280Driver) Altitude() (alt float32, err error) { atmP, _ := d.Pressure() atmP /= 100.0 @@ -200,66 +202,98 @@ func (d *BMP280Driver) Altitude() (alt float32, err error) { } // initialization reads the calibration coefficients. -func (d *BMP280Driver) initialization() (err error) { +func (d *BMP280Driver) initialization() error { coefficients := make([]byte, 24) - if err = d.connection.ReadBlockData(bmp280RegCalib00, coefficients); err != nil { + if err := d.connection.ReadBlockData(bmp280RegCalib00, coefficients); err != nil { return err } buf := bytes.NewBuffer(coefficients) - binary.Read(buf, binary.LittleEndian, &d.calCoeffs.t1) - binary.Read(buf, binary.LittleEndian, &d.calCoeffs.t2) - binary.Read(buf, binary.LittleEndian, &d.calCoeffs.t3) - binary.Read(buf, binary.LittleEndian, &d.calCoeffs.p1) - binary.Read(buf, binary.LittleEndian, &d.calCoeffs.p2) - binary.Read(buf, binary.LittleEndian, &d.calCoeffs.p3) - binary.Read(buf, binary.LittleEndian, &d.calCoeffs.p4) - binary.Read(buf, binary.LittleEndian, &d.calCoeffs.p5) - binary.Read(buf, binary.LittleEndian, &d.calCoeffs.p6) - binary.Read(buf, binary.LittleEndian, &d.calCoeffs.p7) - binary.Read(buf, binary.LittleEndian, &d.calCoeffs.p8) - binary.Read(buf, binary.LittleEndian, &d.calCoeffs.p9) + if err := binary.Read(buf, binary.LittleEndian, &d.calCoeffs.t1); err != nil { + return err + } + if err := binary.Read(buf, binary.LittleEndian, &d.calCoeffs.t2); err != nil { + return err + } + if err := binary.Read(buf, binary.LittleEndian, &d.calCoeffs.t3); err != nil { + return err + } + if err := binary.Read(buf, binary.LittleEndian, &d.calCoeffs.p1); err != nil { + return err + } + if err := binary.Read(buf, binary.LittleEndian, &d.calCoeffs.p2); err != nil { + return err + } + if err := binary.Read(buf, binary.LittleEndian, &d.calCoeffs.p3); err != nil { + return err + } + if err := binary.Read(buf, binary.LittleEndian, &d.calCoeffs.p4); err != nil { + return err + } + if err := binary.Read(buf, binary.LittleEndian, &d.calCoeffs.p5); err != nil { + return err + } + if err := binary.Read(buf, binary.LittleEndian, &d.calCoeffs.p6); err != nil { + return err + } + if err := binary.Read(buf, binary.LittleEndian, &d.calCoeffs.p7); err != nil { + return err + } + if err := binary.Read(buf, binary.LittleEndian, &d.calCoeffs.p8); err != nil { + return err + } + if err := binary.Read(buf, binary.LittleEndian, &d.calCoeffs.p9); err != nil { + return err + } ctrlReg := uint8(d.ctrlPwrMode) | uint8(d.ctrlPressOversamp)<<2 | uint8(d.ctrlTempOversamp)<<5 - d.connection.WriteByteData(bmp280RegCtrl, ctrlReg) + if err := d.connection.WriteByteData(bmp280RegCtrl, ctrlReg); err != nil { + return err + } confReg := uint8(bmp280ConfStandBy0005)<<2 | uint8(d.confFilter)<<5 - d.connection.WriteByteData(bmp280RegConf, confReg & ^uint8(bmp280ConfSPIBit)) - - return nil + return d.connection.WriteByteData(bmp280RegConf, confReg & ^uint8(bmp280ConfSPIBit)) } -func (d *BMP280Driver) rawTemp() (temp int32, err error) { +func (d *BMP280Driver) rawTemp() (int32, error) { var tp0, tp1, tp2 byte data := make([]byte, 3) - if err = d.connection.ReadBlockData(bmp280RegTempData, data); err != nil { + if err := d.connection.ReadBlockData(bmp280RegTempData, data); err != nil { return 0, err } buf := bytes.NewBuffer(data) - binary.Read(buf, binary.LittleEndian, &tp0) - binary.Read(buf, binary.LittleEndian, &tp1) - binary.Read(buf, binary.LittleEndian, &tp2) - - temp = ((int32(tp2) >> 4) | (int32(tp1) << 4) | (int32(tp0) << 12)) + if err := binary.Read(buf, binary.LittleEndian, &tp0); err != nil { + return 0, err + } + if err := binary.Read(buf, binary.LittleEndian, &tp1); err != nil { + return 0, err + } + if err := binary.Read(buf, binary.LittleEndian, &tp2); err != nil { + return 0, err + } - return + return ((int32(tp2) >> 4) | (int32(tp1) << 4) | (int32(tp0) << 12)), nil } -func (d *BMP280Driver) rawPressure() (press int32, err error) { +func (d *BMP280Driver) rawPressure() (int32, error) { var tp0, tp1, tp2 byte data := make([]byte, 3) - if err = d.connection.ReadBlockData(bmp280RegPressureData, data); err != nil { + if err := d.connection.ReadBlockData(bmp280RegPressureData, data); err != nil { return 0, err } buf := bytes.NewBuffer(data) - binary.Read(buf, binary.LittleEndian, &tp0) - binary.Read(buf, binary.LittleEndian, &tp1) - binary.Read(buf, binary.LittleEndian, &tp2) - - press = ((int32(tp2) >> 4) | (int32(tp1) << 4) | (int32(tp0) << 12)) + if err := binary.Read(buf, binary.LittleEndian, &tp0); err != nil { + return 0, err + } + if err := binary.Read(buf, binary.LittleEndian, &tp1); err != nil { + return 0, err + } + if err := binary.Read(buf, binary.LittleEndian, &tp2); err != nil { + return 0, err + } - return + return ((int32(tp2) >> 4) | (int32(tp1) << 4) | (int32(tp0) << 12)), nil } func (d *BMP280Driver) calculateTemp(rawTemp int32) (float32, int32) { diff --git a/drivers/i2c/bmp280_driver_test.go b/drivers/i2c/bmp280_driver_test.go index e312f1822..bbbe13c8c 100644 --- a/drivers/i2c/bmp280_driver_test.go +++ b/drivers/i2c/bmp280_driver_test.go @@ -86,7 +86,7 @@ func TestBMP280Measurements(t *testing.T) { copy(b, buf.Bytes()) return buf.Len(), nil } - d.Start() + _ = d.Start() temp, err := d.Temperature() gobottest.Assert(t, err, nil) gobottest.Assert(t, temp, float32(25.014637)) @@ -100,7 +100,7 @@ func TestBMP280Measurements(t *testing.T) { func TestBMP280TemperatureWriteError(t *testing.T) { d, adaptor := initTestBMP280WithStubbedAdaptor() - d.Start() + _ = d.Start() adaptor.i2cWriteImpl = func([]byte) (int, error) { return 0, errors.New("write error") @@ -112,7 +112,7 @@ func TestBMP280TemperatureWriteError(t *testing.T) { func TestBMP280TemperatureReadError(t *testing.T) { d, adaptor := initTestBMP280WithStubbedAdaptor() - d.Start() + _ = d.Start() adaptor.i2cReadImpl = func([]byte) (int, error) { return 0, errors.New("read error") @@ -124,7 +124,7 @@ func TestBMP280TemperatureReadError(t *testing.T) { func TestBMP280PressureWriteError(t *testing.T) { d, adaptor := initTestBMP280WithStubbedAdaptor() - d.Start() + _ = d.Start() adaptor.i2cWriteImpl = func([]byte) (int, error) { return 0, errors.New("write error") @@ -136,7 +136,7 @@ func TestBMP280PressureWriteError(t *testing.T) { func TestBMP280PressureReadError(t *testing.T) { d, adaptor := initTestBMP280WithStubbedAdaptor() - d.Start() + _ = d.Start() adaptor.i2cReadImpl = func([]byte) (int, error) { return 0, errors.New("read error") diff --git a/drivers/i2c/bmp388_driver.go b/drivers/i2c/bmp388_driver.go index 612cbd91e..d7bf2f30b 100644 --- a/drivers/i2c/bmp388_driver.go +++ b/drivers/i2c/bmp388_driver.go @@ -93,12 +93,13 @@ type BMP388Driver struct { // NewBMP388Driver creates a new driver with specified i2c interface. // Params: -// c Connector - the Adaptor to use with this Driver +// +// c Connector - the Adaptor to use with this Driver // // Optional params: -// i2c.WithBus(int): bus to use with this driver -// i2c.WithAddress(int): address to use with this driver // +// i2c.WithBus(int): bus to use with this driver +// i2c.WithAddress(int): address to use with this driver func NewBMP388Driver(c Connector, options ...func(Config)) *BMP388Driver { d := &BMP388Driver{ Driver: NewDriver(c, "BMP388", bmp388DefaultAddress), @@ -192,9 +193,10 @@ func (d *BMP388Driver) Altitude(accuracy BMP388Accuracy) (alt float32, err error } // initialization reads the calibration coefficients. -func (d *BMP388Driver) initialization() (err error) { - var chipID uint8 - if chipID, err = d.connection.ReadByteData(bmp388RegChipID); err != nil { +func (d *BMP388Driver) initialization() error { + + chipID, err := d.connection.ReadByteData(bmp388RegChipID) + if err != nil { return err } @@ -225,20 +227,48 @@ func (d *BMP388Driver) initialization() (err error) { } buf := bytes.NewBuffer(coefficients) - binary.Read(buf, binary.LittleEndian, &t1) - binary.Read(buf, binary.LittleEndian, &t2) - binary.Read(buf, binary.LittleEndian, &t3) - binary.Read(buf, binary.LittleEndian, &p1) - binary.Read(buf, binary.LittleEndian, &p2) - binary.Read(buf, binary.LittleEndian, &p3) - binary.Read(buf, binary.LittleEndian, &p4) - binary.Read(buf, binary.LittleEndian, &p5) - binary.Read(buf, binary.LittleEndian, &p6) - binary.Read(buf, binary.LittleEndian, &p7) - binary.Read(buf, binary.LittleEndian, &p8) - binary.Read(buf, binary.LittleEndian, &p9) - binary.Read(buf, binary.LittleEndian, &p10) - binary.Read(buf, binary.LittleEndian, &p11) + if err := binary.Read(buf, binary.LittleEndian, &t1); err != nil { + return err + } + if err := binary.Read(buf, binary.LittleEndian, &t2); err != nil { + return err + } + if err := binary.Read(buf, binary.LittleEndian, &t3); err != nil { + return err + } + if err := binary.Read(buf, binary.LittleEndian, &p1); err != nil { + return err + } + if err := binary.Read(buf, binary.LittleEndian, &p2); err != nil { + return err + } + if err := binary.Read(buf, binary.LittleEndian, &p3); err != nil { + return err + } + if err := binary.Read(buf, binary.LittleEndian, &p4); err != nil { + return err + } + if err := binary.Read(buf, binary.LittleEndian, &p5); err != nil { + return err + } + if err := binary.Read(buf, binary.LittleEndian, &p6); err != nil { + return err + } + if err := binary.Read(buf, binary.LittleEndian, &p7); err != nil { + return err + } + if err := binary.Read(buf, binary.LittleEndian, &p8); err != nil { + return err + } + if err := binary.Read(buf, binary.LittleEndian, &p9); err != nil { + return err + } + if err := binary.Read(buf, binary.LittleEndian, &p10); err != nil { + return err + } + if err := binary.Read(buf, binary.LittleEndian, &p11); err != nil { + return err + } d.calCoeffs.t1 = float32(float64(t1) / math.Pow(2, -8)) d.calCoeffs.t2 = float32(float64(t2) / math.Pow(2, 30)) @@ -255,50 +285,59 @@ func (d *BMP388Driver) initialization() (err error) { d.calCoeffs.p10 = float32(float64(p10) / math.Pow(2, 48)) d.calCoeffs.p11 = float32(float64(p11) / math.Pow(2, 65)) - if err = d.connection.WriteByteData(bmp388RegCMD, bmp388CMDSoftReset); err != nil { + if err := d.connection.WriteByteData(bmp388RegCMD, bmp388CMDSoftReset); err != nil { return err } - if err = d.connection.WriteByteData(bmp388RegConf, uint8(d.confFilter)<<1); err != nil { - return err - } - - return nil + return d.connection.WriteByteData(bmp388RegConf, uint8(d.confFilter)<<1) } -func (d *BMP388Driver) rawTemp() (temp int32, err error) { +func (d *BMP388Driver) rawTemp() (int32, error) { var tp0, tp1, tp2 byte data := make([]byte, 3) - if err = d.connection.ReadBlockData(bmp388RegTempData, data); err != nil { + if err := d.connection.ReadBlockData(bmp388RegTempData, data); err != nil { return 0, err } buf := bytes.NewBuffer(data) + // XLSB + if err := binary.Read(buf, binary.LittleEndian, &tp0); err != nil { + return 0, err + } + // LSB + if err := binary.Read(buf, binary.LittleEndian, &tp1); err != nil { + return 0, err + } + // MSB + if err := binary.Read(buf, binary.LittleEndian, &tp2); err != nil { + return 0, err + } - binary.Read(buf, binary.LittleEndian, &tp0) // XLSB - binary.Read(buf, binary.LittleEndian, &tp1) // LSB - binary.Read(buf, binary.LittleEndian, &tp2) // MSB - - temp = ((int32(tp2) << 16) | (int32(tp1) << 8) | int32(tp0)) - return + return ((int32(tp2) << 16) | (int32(tp1) << 8) | int32(tp0)), nil } -func (d *BMP388Driver) rawPressure() (press int32, err error) { +func (d *BMP388Driver) rawPressure() (int32, error) { var tp0, tp1, tp2 byte data := make([]byte, 3) - if err = d.connection.ReadBlockData(bmp388RegPressureData, data); err != nil { + if err := d.connection.ReadBlockData(bmp388RegPressureData, data); err != nil { return 0, err } buf := bytes.NewBuffer(data) + // XLSB + if err := binary.Read(buf, binary.LittleEndian, &tp0); err != nil { + return 0, err + } + // LSB + if err := binary.Read(buf, binary.LittleEndian, &tp1); err != nil { + return 0, err + } + // MSB + if err := binary.Read(buf, binary.LittleEndian, &tp2); err != nil { + return 0, err + } - binary.Read(buf, binary.LittleEndian, &tp0) // XLSB - binary.Read(buf, binary.LittleEndian, &tp1) // LSB - binary.Read(buf, binary.LittleEndian, &tp2) // MSB - - press = ((int32(tp2) << 16) | (int32(tp1) << 8) | int32(tp0)) - - return + return ((int32(tp2) << 16) | (int32(tp1) << 8) | int32(tp0)), nil } func (d *BMP388Driver) calculateTemp(rawTemp int32) float32 { diff --git a/drivers/i2c/bmp388_driver_test.go b/drivers/i2c/bmp388_driver_test.go index 7f273a975..fb0ce1b59 100644 --- a/drivers/i2c/bmp388_driver_test.go +++ b/drivers/i2c/bmp388_driver_test.go @@ -25,7 +25,7 @@ func initTestBMP388WithStubbedAdaptor() (*BMP388Driver, *i2cTestAdaptor) { buf := new(bytes.Buffer) // Simulate returning of 0x50 for the // ReadByteData(bmp388RegChipID) call in initialisation() - binary.Write(buf, binary.LittleEndian, uint8(0x50)) + _ = binary.Write(buf, binary.LittleEndian, uint8(0x50)) copy(b, buf.Bytes()) return buf.Len(), nil } @@ -69,7 +69,7 @@ func TestBMP388Measurements(t *testing.T) { case bmp388RegChipID: // Simulate returning of 0x50 for the // ReadByteData(bmp388RegChipID) call in initialisation() - binary.Write(buf, binary.LittleEndian, uint8(0x50)) + _ = binary.Write(buf, binary.LittleEndian, uint8(0x50)) case bmp388RegCalib00: // Values produced by dumping data from actual sensor buf.Write([]byte{36, 107, 156, 73, 246, 104, 255, 189, 245, 35, 0, 151, 101, 184, 122, 243, 246, 211, 64, 14, 196, 0, 0, 0}) @@ -82,7 +82,7 @@ func TestBMP388Measurements(t *testing.T) { copy(b, buf.Bytes()) return buf.Len(), nil } - d.Start() + _ = d.Start() temp, err := d.Temperature(2) gobottest.Assert(t, err, nil) gobottest.Assert(t, temp, float32(22.906143)) @@ -96,7 +96,7 @@ func TestBMP388Measurements(t *testing.T) { func TestBMP388TemperatureWriteError(t *testing.T) { d, a := initTestBMP388WithStubbedAdaptor() - d.Start() + _ = d.Start() a.i2cWriteImpl = func([]byte) (int, error) { return 0, errors.New("write error") @@ -108,7 +108,7 @@ func TestBMP388TemperatureWriteError(t *testing.T) { func TestBMP388TemperatureReadError(t *testing.T) { d, a := initTestBMP388WithStubbedAdaptor() - d.Start() + _ = d.Start() a.i2cReadImpl = func([]byte) (int, error) { return 0, errors.New("read error") @@ -120,7 +120,7 @@ func TestBMP388TemperatureReadError(t *testing.T) { func TestBMP388PressureWriteError(t *testing.T) { d, a := initTestBMP388WithStubbedAdaptor() - d.Start() + _ = d.Start() a.i2cWriteImpl = func([]byte) (int, error) { return 0, errors.New("write error") @@ -132,7 +132,7 @@ func TestBMP388PressureWriteError(t *testing.T) { func TestBMP388PressureReadError(t *testing.T) { d, a := initTestBMP388WithStubbedAdaptor() - d.Start() + _ = d.Start() a.i2cReadImpl = func([]byte) (int, error) { return 0, errors.New("read error") diff --git a/drivers/i2c/ccs811_driver.go b/drivers/i2c/ccs811_driver.go index 1d48f58f8..1d50e6b4f 100644 --- a/drivers/i2c/ccs811_driver.go +++ b/drivers/i2c/ccs811_driver.go @@ -31,9 +31,9 @@ const ( //This multi-byte read only register contains the calculated eCO2 (ppm) and eTVOC (ppb) values followed by the STATUS register, ERROR_ID register and the RAW_DATA register. ccs811RegAlgResultData = 0x02 //Two byte read only register which contains the latest readings from the sensor. - ccs811RegRawData = 0x03 + //ccs811RegRawData = 0x03 //A multi-byte register that can be written with the current Humidity and Temperature values if known. - ccs811RegEnvData = 0x05 + //ccs811RegEnvData = 0x05 //Register that holds the NTC value used for temperature calcualtions ccs811RegNtc = 0x06 //Asserting the SW_RESET will restart the CCS811 in Boot mode to enable new application firmware to be downloaded. @@ -72,7 +72,7 @@ type CCS811Status struct { FwMode byte } -//NewCCS811Status returns a new instance of the package ccs811 status definition +// NewCCS811Status returns a new instance of the package ccs811 status definition func NewCCS811Status(data uint8) *CCS811Status { return &CCS811Status{ HasError: data & 0x01, @@ -82,9 +82,9 @@ func NewCCS811Status(data uint8) *CCS811Status { } } -//CCS811MeasMode represents the current measurement configuration. -//The following definitions were taken from the bit fields of the ccs811RegMeasMode defined in -//https://ams.com/documents/20143/36005/CCS811_DS000459_6-00.pdf/c7091525-c7e5-37ac-eedb-b6c6828b0dcf#page=16 +// CCS811MeasMode represents the current measurement configuration. +// The following definitions were taken from the bit fields of the ccs811RegMeasMode defined in +// https://ams.com/documents/20143/36005/CCS811_DS000459_6-00.pdf/c7091525-c7e5-37ac-eedb-b6c6828b0dcf#page=16 type CCS811MeasMode struct { //If intThresh is 1 a data measurement will only be taken when the sensor value meets the threshold constraint. //The threshold value is set in the threshold register (0x10) @@ -95,8 +95,8 @@ type CCS811MeasMode struct { driveMode CCS811DriveMode } -//NewCCS811MeasMode returns a new instance of the package ccs811 measurement mode configuration. This represents the desired initial -//state of the measurement mode register. +// NewCCS811MeasMode returns a new instance of the package ccs811 measurement mode configuration. This represents the desired initial +// state of the measurement mode register. func NewCCS811MeasMode() *CCS811MeasMode { return &CCS811MeasMode{ // Disable this by default as this library does not contain the functionality to use the internal interrupt feature. @@ -111,14 +111,14 @@ func (mm *CCS811MeasMode) GetMeasMode() byte { return (mm.intThresh << 2) | (mm.intDataRdy << 3) | uint8((mm.driveMode << 4)) } -//CCS811Driver is the Gobot driver for the CCS811 (air quality sensor) Adafruit breakout board +// CCS811Driver is the Gobot driver for the CCS811 (air quality sensor) Adafruit breakout board type CCS811Driver struct { *Driver measMode *CCS811MeasMode ntcResistanceValue uint32 } -//NewCCS811Driver creates a new driver for the CCS811 (air quality sensor) +// NewCCS811Driver creates a new driver for the CCS811 (air quality sensor) func NewCCS811Driver(c Connector, options ...func(Config)) *CCS811Driver { d := &CCS811Driver{ Driver: NewDriver(c, "CCS811", ccs811DefaultAddress), @@ -135,7 +135,7 @@ func NewCCS811Driver(c Connector, options ...func(Config)) *CCS811Driver { return d } -//WithCCS811MeasMode sets the sampling rate of the device +// WithCCS811MeasMode sets the sampling rate of the device func WithCCS811MeasMode(mode CCS811DriveMode) func(Config) { return func(c Config) { d, _ := c.(*CCS811Driver) @@ -143,8 +143,8 @@ func WithCCS811MeasMode(mode CCS811DriveMode) func(Config) { } } -//WithCCS811NTCResistance sets reistor value used in the temperature calculations. -//This resistor must be placed between pin 4 and pin 8 of the chip +// WithCCS811NTCResistance sets reistor value used in the temperature calculations. +// This resistor must be placed between pin 4 and pin 8 of the chip func WithCCS811NTCResistance(val uint32) func(Config) { return func(c Config) { d, _ := c.(*CCS811Driver) @@ -152,7 +152,7 @@ func WithCCS811NTCResistance(val uint32) func(Config) { } } -//GetHardwareVersion returns the hardware version of the device in the form of 0x1X +// GetHardwareVersion returns the hardware version of the device in the form of 0x1X func (d *CCS811Driver) GetHardwareVersion() (uint8, error) { d.mutex.Lock() defer d.mutex.Unlock() @@ -165,7 +165,7 @@ func (d *CCS811Driver) GetHardwareVersion() (uint8, error) { return v, nil } -//GetFirmwareBootVersion returns the bootloader version +// GetFirmwareBootVersion returns the bootloader version func (d *CCS811Driver) GetFirmwareBootVersion() (uint16, error) { d.mutex.Lock() defer d.mutex.Unlock() @@ -178,7 +178,7 @@ func (d *CCS811Driver) GetFirmwareBootVersion() (uint16, error) { return v, nil } -//GetFirmwareAppVersion returns the app code version +// GetFirmwareAppVersion returns the app code version func (d *CCS811Driver) GetFirmwareAppVersion() (uint16, error) { d.mutex.Lock() defer d.mutex.Unlock() @@ -191,7 +191,7 @@ func (d *CCS811Driver) GetFirmwareAppVersion() (uint16, error) { return v, nil } -//GetStatus returns the current status of the device +// GetStatus returns the current status of the device func (d *CCS811Driver) GetStatus() (*CCS811Status, error) { d.mutex.Lock() defer d.mutex.Unlock() @@ -205,8 +205,8 @@ func (d *CCS811Driver) GetStatus() (*CCS811Status, error) { return cs, nil } -//GetTemperature returns the device temperature in celcius. -//If you do not have an NTC resistor installed, this function should not be called +// GetTemperature returns the device temperature in celcius. +// If you do not have an NTC resistor installed, this function should not be called func (d *CCS811Driver) GetTemperature() (float32, error) { d.mutex.Lock() defer d.mutex.Unlock() @@ -230,8 +230,8 @@ func (d *CCS811Driver) GetTemperature() (float32, error) { return ntcTemp, nil } -//GetGasData returns the data for the gas sensor. -//eco2 is returned in ppm and tvoc is returned in ppb +// GetGasData returns the data for the gas sensor. +// eco2 is returned in ppm and tvoc is returned in ppb func (d *CCS811Driver) GetGasData() (uint16, uint16, error) { d.mutex.Lock() defer d.mutex.Unlock() @@ -249,7 +249,7 @@ func (d *CCS811Driver) GetGasData() (uint16, uint16, error) { return eco2, tvoC, nil } -//HasData returns true if the device has not errored and temperature/gas data is available +// HasData returns true if the device has not errored and temperature/gas data is available func (d *CCS811Driver) HasData() (bool, error) { s, err := d.GetStatus() if err != nil { @@ -263,7 +263,7 @@ func (d *CCS811Driver) HasData() (bool, error) { return true, nil } -//EnableExternalInterrupt enables the external output hardware interrupt pin 3. +// EnableExternalInterrupt enables the external output hardware interrupt pin 3. func (d *CCS811Driver) EnableExternalInterrupt() error { d.mutex.Lock() defer d.mutex.Unlock() @@ -272,7 +272,7 @@ func (d *CCS811Driver) EnableExternalInterrupt() error { return d.connection.WriteByteData(ccs811RegMeasMode, d.measMode.GetMeasMode()) } -//DisableExternalInterrupt disables the external output hardware interrupt pin 3. +// DisableExternalInterrupt disables the external output hardware interrupt pin 3. func (d *CCS811Driver) DisableExternalInterrupt() error { d.mutex.Lock() defer d.mutex.Unlock() @@ -310,21 +310,21 @@ func (d *CCS811Driver) initialize() error { return nil } -//ResetDevice does a software reset of the device. After this operation is done, -//the user must start the app code before the sensor can take any measurements +// ResetDevice does a software reset of the device. After this operation is done, +// the user must start the app code before the sensor can take any measurements func (d *CCS811Driver) resetDevice() error { return d.connection.WriteBlockData(ccs811RegSwReset, ccs811SwResetSequence) } -//startApp starts the app code in the device. This operation has to be done after a -//software reset to start taking sensor measurements. +// startApp starts the app code in the device. This operation has to be done after a +// software reset to start taking sensor measurements. func (d *CCS811Driver) startApp() error { //Write without data is needed to start the app code _, err := d.connection.Write([]byte{ccs811RegAppStart}) return err } -//updateMeasMode writes the current value of measMode to the measurement mode register. +// updateMeasMode writes the current value of measMode to the measurement mode register. func (d *CCS811Driver) updateMeasMode() error { return d.connection.WriteByteData(ccs811RegMeasMode, d.measMode.GetMeasMode()) } diff --git a/drivers/i2c/ccs811_driver_test.go b/drivers/i2c/ccs811_driver_test.go index b5c23c6b4..56f01cfe6 100644 --- a/drivers/i2c/ccs811_driver_test.go +++ b/drivers/i2c/ccs811_driver_test.go @@ -86,7 +86,7 @@ func TestCCS811GetGasData(t *testing.T) { d, a := initTestCCS811WithStubbedAdaptor() // Create stub function as it is needed by read submethod in driver code a.i2cWriteImpl = func([]byte) (int, error) { return 0, nil } - d.Start() + _ = d.Start() a.i2cReadImpl = tc.readReturn // act eco2, tvoc, err := d.GetGasData() @@ -143,7 +143,7 @@ func TestCCS811GetTemperature(t *testing.T) { d, a := initTestCCS811WithStubbedAdaptor() // Create stub function as it is needed by read submethod in driver code a.i2cWriteImpl = func([]byte) (int, error) { return 0, nil } - d.Start() + _ = d.Start() a.i2cReadImpl = tc.readReturn // act temp, err := d.GetTemperature() @@ -207,7 +207,7 @@ func TestCCS811HasData(t *testing.T) { d, a := initTestCCS811WithStubbedAdaptor() // Create stub function as it is needed by read submethod in driver code a.i2cWriteImpl = func([]byte) (int, error) { return 0, nil } - d.Start() + _ = d.Start() a.i2cReadImpl = tc.readReturn // act result, err := d.HasData() diff --git a/drivers/i2c/drv2605l_driver_test.go b/drivers/i2c/drv2605l_driver_test.go index 1b5b9773c..7fd988847 100644 --- a/drivers/i2c/drv2605l_driver_test.go +++ b/drivers/i2c/drv2605l_driver_test.go @@ -20,7 +20,7 @@ func initTestDRV2605LDriverWithStubbedAdaptor() (*DRV2605LDriver, *i2cTestAdapto // Prime adapter reader to make "Start()" call happy a.i2cReadImpl = func(b []byte) (int, error) { buf := new(bytes.Buffer) - binary.Write(buf, binary.LittleEndian, uint8(42)) + _ = binary.Write(buf, binary.LittleEndian, uint8(42)) copy(b, buf.Bytes()) return buf.Len(), nil } diff --git a/drivers/i2c/grovepi_driver_test.go b/drivers/i2c/grovepi_driver_test.go index 7ccd27da0..dad364537 100644 --- a/drivers/i2c/grovepi_driver_test.go +++ b/drivers/i2c/grovepi_driver_test.go @@ -137,7 +137,7 @@ func TestGrovePiSomeRead(t *testing.T) { for name, tc := range tests { t.Run(name, func(t *testing.T) { g, a := initGrovePiDriverWithStubbedAdaptor() - g.Start() + _ = g.Start() a.written = []byte{} // reset writes of former test and start numCallsRead := 0 a.i2cReadImpl = func(bytes []byte) (i int, e error) { @@ -201,7 +201,7 @@ func TestGrovePiSomeWrite(t *testing.T) { for name, tc := range tests { t.Run(name, func(t *testing.T) { g, a := initGrovePiDriverWithStubbedAdaptor() - g.Start() + _ = g.Start() a.written = []byte{} // reset writes of former test and start a.i2cReadImpl = func(bytes []byte) (i int, e error) { copy(bytes, tc.simResponse) diff --git a/drivers/i2c/helpers_test.go b/drivers/i2c/helpers_test.go index 34c3d83be..b4378cac7 100644 --- a/drivers/i2c/helpers_test.go +++ b/drivers/i2c/helpers_test.go @@ -12,14 +12,6 @@ var rgb = map[string]interface{}{ "blue": 1.0, } -func castColor(color string) byte { - return byte(rgb[color].(float64)) -} - -var red = castColor("red") -var green = castColor("green") -var blue = castColor("blue") - type i2cTestAdaptor struct { name string bus int diff --git a/drivers/i2c/hmc5883l_driver_test.go b/drivers/i2c/hmc5883l_driver_test.go index 955ff5508..a7a88d9b0 100644 --- a/drivers/i2c/hmc5883l_driver_test.go +++ b/drivers/i2c/hmc5883l_driver_test.go @@ -111,7 +111,7 @@ func TestHMC5883LRead(t *testing.T) { for name, tc := range tests { t.Run(name, func(t *testing.T) { d := NewHMC5883LDriver(a, WithHMC5883LGain(int(tc.gain))) - d.Start() + _ = d.Start() // arrange reads returnRead := append(append(tc.inputX, tc.inputZ...), tc.inputY...) a.i2cReadImpl = func(b []byte) (int, error) { @@ -162,7 +162,7 @@ func TestHMC5883L_readRawData(t *testing.T) { }, } d, a := initTestHMC5883LWithStubbedAdaptor() - d.Start() + _ = d.Start() for name, tc := range tests { t.Run(name, func(t *testing.T) { a.written = []byte{} // reset writes of former test and start diff --git a/drivers/i2c/i2c_driver_test.go b/drivers/i2c/i2c_driver_test.go index cb2b15f7d..3fed2a785 100644 --- a/drivers/i2c/i2c_driver_test.go +++ b/drivers/i2c/i2c_driver_test.go @@ -90,7 +90,7 @@ func TestWrite(t *testing.T) { value = 0x25 ) d, a := initDriverWithStubbedAdaptor() - d.Start() + _ = d.Start() // prepare all writes numCallsWrite := 0 a.i2cWriteImpl = func([]byte) (int, error) { @@ -114,7 +114,7 @@ func TestRead(t *testing.T) { want = uint8(0x44) ) d, a := initDriverWithStubbedAdaptor() - d.Start() + _ = d.Start() // prepare all writes numCallsWrite := 0 a.i2cWriteImpl = func(b []byte) (int, error) { diff --git a/drivers/i2c/ina3221_driver.go b/drivers/i2c/ina3221_driver.go index 7c7de2406..1624325fd 100644 --- a/drivers/i2c/ina3221_driver.go +++ b/drivers/i2c/ina3221_driver.go @@ -42,16 +42,17 @@ const ( // INA3221Driver is a driver for the INA3221 three-channel current and bus voltage monitoring device. type INA3221Driver struct { *Driver - halt chan bool } // NewINA3221Driver creates a new driver with the specified i2c interface. // Params: -// c Connector - the Adaptor to use with this Driver +// +// c Connector - the Adaptor to use with this Driver // // Optional params: -// i2c.WithBus(int): bus to use with this driver -// i2c.WithAddress(int): address to use with this driver +// +// i2c.WithBus(int): bus to use with this driver +// i2c.WithAddress(int): address to use with this driver func NewINA3221Driver(c Connector, options ...func(Config)) *INA3221Driver { i := &INA3221Driver{ Driver: NewDriver(c, "INA3221", ina3221DefaultAddress), diff --git a/drivers/i2c/jhd1313m1_driver_test.go b/drivers/i2c/jhd1313m1_driver_test.go index 87acf005e..1c0c99fc9 100644 --- a/drivers/i2c/jhd1313m1_driver_test.go +++ b/drivers/i2c/jhd1313m1_driver_test.go @@ -73,19 +73,19 @@ func TestJHD1313MDriverStartWriteError(t *testing.T) { func TestJHD1313MDriverHalt(t *testing.T) { d := initTestJHD1313M1Driver() - d.Start() + _ = d.Start() gobottest.Assert(t, d.Halt(), nil) } func TestJHD1313MDriverSetRgb(t *testing.T) { d, _ := initTestJHD1313M1DriverWithStubbedAdaptor() - d.Start() + _ = d.Start() gobottest.Assert(t, d.SetRGB(0x00, 0x00, 0x00), nil) } func TestJHD1313MDriverSetRgbError(t *testing.T) { d, a := initTestJHD1313M1DriverWithStubbedAdaptor() - d.Start() + _ = d.Start() a.i2cWriteImpl = func([]byte) (int, error) { return 0, errors.New("write error") @@ -95,13 +95,13 @@ func TestJHD1313MDriverSetRgbError(t *testing.T) { func TestJHD1313MDriverClear(t *testing.T) { d, _ := initTestJHD1313M1DriverWithStubbedAdaptor() - d.Start() + _ = d.Start() gobottest.Assert(t, d.Clear(), nil) } func TestJHD1313MDriverClearError(t *testing.T) { d, a := initTestJHD1313M1DriverWithStubbedAdaptor() - d.Start() + _ = d.Start() a.i2cWriteImpl = func([]byte) (int, error) { return 0, errors.New("write error") @@ -111,19 +111,19 @@ func TestJHD1313MDriverClearError(t *testing.T) { func TestJHD1313MDriverHome(t *testing.T) { d, _ := initTestJHD1313M1DriverWithStubbedAdaptor() - d.Start() + _ = d.Start() gobottest.Assert(t, d.Home(), nil) } func TestJHD1313MDriverWrite(t *testing.T) { d, _ := initTestJHD1313M1DriverWithStubbedAdaptor() - d.Start() + _ = d.Start() gobottest.Assert(t, d.Write("Hello"), nil) } func TestJHD1313MDriverWriteError(t *testing.T) { d, a := initTestJHD1313M1DriverWithStubbedAdaptor() - d.Start() + _ = d.Start() a.i2cWriteImpl = func([]byte) (int, error) { return 0, errors.New("write error") } @@ -133,13 +133,13 @@ func TestJHD1313MDriverWriteError(t *testing.T) { func TestJHD1313MDriverWriteTwoLines(t *testing.T) { d, _ := initTestJHD1313M1DriverWithStubbedAdaptor() - d.Start() + _ = d.Start() gobottest.Assert(t, d.Write("Hello\nthere"), nil) } func TestJHD1313MDriverWriteTwoLinesError(t *testing.T) { d, a := initTestJHD1313M1DriverWithStubbedAdaptor() - d.Start() + _ = d.Start() a.i2cWriteImpl = func([]byte) (int, error) { return 0, errors.New("write error") @@ -149,52 +149,52 @@ func TestJHD1313MDriverWriteTwoLinesError(t *testing.T) { func TestJHD1313MDriverSetPosition(t *testing.T) { d, _ := initTestJHD1313M1DriverWithStubbedAdaptor() - d.Start() + _ = d.Start() gobottest.Assert(t, d.SetPosition(2), nil) } func TestJHD1313MDriverSetSecondLinePosition(t *testing.T) { d, _ := initTestJHD1313M1DriverWithStubbedAdaptor() - d.Start() + _ = d.Start() gobottest.Assert(t, d.SetPosition(18), nil) } func TestJHD1313MDriverSetPositionInvalid(t *testing.T) { d, _ := initTestJHD1313M1DriverWithStubbedAdaptor() - d.Start() + _ = d.Start() gobottest.Assert(t, d.SetPosition(-1), jhd1313m1ErrInvalidPosition) gobottest.Assert(t, d.SetPosition(32), jhd1313m1ErrInvalidPosition) } func TestJHD1313MDriverScroll(t *testing.T) { d, _ := initTestJHD1313M1DriverWithStubbedAdaptor() - d.Start() + _ = d.Start() gobottest.Assert(t, d.Scroll(true), nil) } func TestJHD1313MDriverReverseScroll(t *testing.T) { d, _ := initTestJHD1313M1DriverWithStubbedAdaptor() - d.Start() + _ = d.Start() gobottest.Assert(t, d.Scroll(false), nil) } func TestJHD1313MDriverSetCustomChar(t *testing.T) { d, _ := initTestJHD1313M1DriverWithStubbedAdaptor() data := [8]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} - d.Start() + _ = d.Start() gobottest.Assert(t, d.SetCustomChar(0, data), nil) } func TestJHD1313MDriverSetCustomCharError(t *testing.T) { d, _ := initTestJHD1313M1DriverWithStubbedAdaptor() data := [8]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} - d.Start() + _ = d.Start() gobottest.Assert(t, d.SetCustomChar(10, data), errors.New("can't set a custom character at a position greater than 7")) } func TestJHD1313MDriverSetCustomCharWriteError(t *testing.T) { d, a := initTestJHD1313M1DriverWithStubbedAdaptor() - d.Start() + _ = d.Start() a.i2cWriteImpl = func([]byte) (int, error) { return 0, errors.New("write error") @@ -205,7 +205,7 @@ func TestJHD1313MDriverSetCustomCharWriteError(t *testing.T) { func TestJHD1313MDriverCommands(t *testing.T) { d, _ := initTestJHD1313M1DriverWithStubbedAdaptor() - d.Start() + _ = d.Start() err := d.Command("SetRGB")(map[string]interface{}{"r": "1", "g": "1", "b": "1"}) gobottest.Assert(t, err, nil) diff --git a/drivers/i2c/l3gd20h_driver.go b/drivers/i2c/l3gd20h_driver.go index 14e04f4f8..f88e91b10 100644 --- a/drivers/i2c/l3gd20h_driver.go +++ b/drivers/i2c/l3gd20h_driver.go @@ -57,12 +57,13 @@ type L3GD20HDriver struct { // L3GD20H I2C Triple-Axis Gyroscope. // // Params: -// c Connector - the Adaptor to use with this Driver +// +// c Connector - the Adaptor to use with this Driver // // Optional params: -// i2c.WithBus(int): bus to use with this driver -// i2c.WithAddress(int): address to use with this driver // +// i2c.WithBus(int): bus to use with this driver +// i2c.WithAddress(int): address to use with this driver func NewL3GD20HDriver(c Connector, options ...func(Config)) *L3GD20HDriver { l := &L3GD20HDriver{ Driver: NewDriver(c, "L3GD20H", l3gd20hDefaultAddress, options...), @@ -116,7 +117,7 @@ func (d *L3GD20HDriver) XYZ() (x float32, y float32, z float32, err error) { measurements := make([]byte, 6) reg := l3gd20hReg_OutXLSB | 0x80 // set auto-increment bit - if err = d.connection.ReadBlockData(uint8(reg), measurements); err != nil { + if err := d.connection.ReadBlockData(uint8(reg), measurements); err != nil { return 0, 0, 0, err } @@ -124,16 +125,22 @@ func (d *L3GD20HDriver) XYZ() (x float32, y float32, z float32, err error) { var rawY int16 var rawZ int16 buf := bytes.NewBuffer(measurements) - binary.Read(buf, binary.LittleEndian, &rawX) - binary.Read(buf, binary.LittleEndian, &rawY) - binary.Read(buf, binary.LittleEndian, &rawZ) + if err := binary.Read(buf, binary.LittleEndian, &rawX); err != nil { + return 0, 0, 0, err + } + if err := binary.Read(buf, binary.LittleEndian, &rawY); err != nil { + return 0, 0, 0, err + } + if err := binary.Read(buf, binary.LittleEndian, &rawZ); err != nil { + return 0, 0, 0, err + } sensitivity := l3gdhSensibility[d.scale] return float32(rawX) * sensitivity, float32(rawY) * sensitivity, float32(rawZ) * sensitivity, nil } -func (d *L3GD20HDriver) initialize() (err error) { +func (d *L3GD20HDriver) initialize() error { // reset the gyroscope. if err := d.connection.WriteByteData(l3gd20hReg_Ctl1, 0x00); err != nil { return err diff --git a/drivers/i2c/l3gd20h_driver_test.go b/drivers/i2c/l3gd20h_driver_test.go index e0816f848..892891698 100644 --- a/drivers/i2c/l3gd20h_driver_test.go +++ b/drivers/i2c/l3gd20h_driver_test.go @@ -212,7 +212,7 @@ func TestL3GD20HMeasurementError(t *testing.T) { return 0, errors.New("read error") } - d.Start() + _ = d.Start() _, _, _, err := d.XYZ() gobottest.Assert(t, err, errors.New("read error")) } diff --git a/drivers/i2c/mcp23017_driver_test.go b/drivers/i2c/mcp23017_driver_test.go index 2026e1e4f..a682c0caf 100644 --- a/drivers/i2c/mcp23017_driver_test.go +++ b/drivers/i2c/mcp23017_driver_test.go @@ -35,7 +35,7 @@ func initTestMCP23017WithStubbedAdaptor(b uint8) (*MCP23017Driver, *i2cTestAdapt // create the driver, ready to use for tests a := newI2cTestAdaptor() d := NewMCP23017Driver(a, WithMCP23017Bank(b)) - d.Start() + _ = d.Start() return d, a } diff --git a/drivers/i2c/mpl115a2_driver.go b/drivers/i2c/mpl115a2_driver.go index 40ea3fcce..0791a55ae 100644 --- a/drivers/i2c/mpl115a2_driver.go +++ b/drivers/i2c/mpl115a2_driver.go @@ -89,10 +89,10 @@ func (d *MPL115A2Driver) Temperature() (t float32, err error) { return } -func (d *MPL115A2Driver) initialization() (err error) { +func (d *MPL115A2Driver) initialization() error { data := make([]byte, 8) - if err = d.connection.ReadBlockData(mpl115A2Reg_A0_MSB, data); err != nil { - return + if err := d.connection.ReadBlockData(mpl115A2Reg_A0_MSB, data); err != nil { + return err } var coA0 int16 @@ -101,10 +101,18 @@ func (d *MPL115A2Driver) initialization() (err error) { var coC12 int16 buf := bytes.NewBuffer(data) - binary.Read(buf, binary.BigEndian, &coA0) - binary.Read(buf, binary.BigEndian, &coB1) - binary.Read(buf, binary.BigEndian, &coB2) - binary.Read(buf, binary.BigEndian, &coC12) + if err := binary.Read(buf, binary.BigEndian, &coA0); err != nil { + return err + } + if err := binary.Read(buf, binary.BigEndian, &coB1); err != nil { + return err + } + if err := binary.Read(buf, binary.BigEndian, &coB2); err != nil { + return err + } + if err := binary.Read(buf, binary.BigEndian, &coC12); err != nil { + return err + } coC12 = coC12 >> 2 @@ -113,7 +121,7 @@ func (d *MPL115A2Driver) initialization() (err error) { d.b2 = float32(coB2) / 16384.0 d.c12 = float32(coC12) / 4194304.0 - return + return nil } // getData fetches the latest data from the MPL115A2 @@ -123,7 +131,7 @@ func (d *MPL115A2Driver) getData() (p, t float32, err error) { var pressureComp float32 if err = d.connection.WriteByteData(mpl115A2Reg_StartConversion, 0); err != nil { - return + return 0, 0, err } time.Sleep(5 * time.Millisecond) @@ -133,8 +141,12 @@ func (d *MPL115A2Driver) getData() (p, t float32, err error) { } buf := bytes.NewBuffer(data) - binary.Read(buf, binary.BigEndian, &pressure) - binary.Read(buf, binary.BigEndian, &temperature) + if err := binary.Read(buf, binary.BigEndian, &pressure); err != nil { + return 0, 0, err + } + if err := binary.Read(buf, binary.BigEndian, &temperature); err != nil { + return 0, 0, err + } temperature = temperature >> 6 pressure = pressure >> 6 diff --git a/drivers/i2c/mpl115a2_driver_test.go b/drivers/i2c/mpl115a2_driver_test.go index 19871514c..6891e9e47 100644 --- a/drivers/i2c/mpl115a2_driver_test.go +++ b/drivers/i2c/mpl115a2_driver_test.go @@ -53,7 +53,7 @@ func TestMPL115A2ReadData(t *testing.T) { // // arrange d, a := initTestMPL115A2DriverWithStubbedAdaptor() - d.Start() + _ = d.Start() a.written = []byte{} // arrange coefficients according the example from data sheet d.a0 = 2009.75 @@ -94,7 +94,7 @@ func TestMPL115A2ReadData(t *testing.T) { func TestMPL115A2ReadDataError(t *testing.T) { d, a := initTestMPL115A2DriverWithStubbedAdaptor() - d.Start() + _ = d.Start() a.i2cWriteImpl = func([]byte) (int, error) { return 0, errors.New("write error") diff --git a/drivers/i2c/mpu6050_driver.go b/drivers/i2c/mpu6050_driver.go index 0aa1784dc..38b294945 100644 --- a/drivers/i2c/mpu6050_driver.go +++ b/drivers/i2c/mpu6050_driver.go @@ -120,12 +120,13 @@ var mpu6050GyroGain = map[MPU6050GyroFsConfig]float64{ // NewMPU6050Driver creates a new Gobot Driver for an MPU6050 I2C Accelerometer/Gyroscope/Temperature sensor. // // Params: -// conn Connector - the Adaptor to use with this Driver +// +// conn Connector - the Adaptor to use with this Driver // // Optional params: -// i2c.WithBus(int): bus to use with this driver -// i2c.WithAddress(int): address to use with this driver // +// i2c.WithBus(int): bus to use with this driver +// i2c.WithAddress(int): address to use with this driver func NewMPU6050Driver(a Connector, options ...func(Config)) *MPU6050Driver { m := &MPU6050Driver{ Driver: NewDriver(a, "MPU6050", mpu6050DefaultAddress), @@ -219,14 +220,13 @@ func WithMPU6050Gravity(val float64) func(Config) { } // GetData fetches the latest data from the MPU6050 -func (m *MPU6050Driver) GetData() (err error) { +func (m *MPU6050Driver) GetData() error { m.mutex.Lock() defer m.mutex.Unlock() data := make([]byte, 14) - err = m.connection.ReadBlockData(mpu6050Reg_AccelXoutH, data) - if err != nil { - return + if err := m.connection.ReadBlockData(mpu6050Reg_AccelXoutH, data); err != nil { + return err } var accel struct { @@ -242,9 +242,15 @@ func (m *MPU6050Driver) GetData() (err error) { } buf := bytes.NewBuffer(data) - binary.Read(buf, binary.BigEndian, &accel) - binary.Read(buf, binary.BigEndian, &temp) - binary.Read(buf, binary.BigEndian, &gyro) + if err := binary.Read(buf, binary.BigEndian, &accel); err != nil { + return err + } + if err := binary.Read(buf, binary.BigEndian, &temp); err != nil { + return err + } + if err := binary.Read(buf, binary.BigEndian, &gyro); err != nil { + return err + } ag := float64(mpu6050AccelGain[m.accelFs]) / m.gravity m.Accelerometer.X = float64(accel.X) / ag @@ -258,7 +264,7 @@ func (m *MPU6050Driver) GetData() (err error) { m.Gyroscope.Y = float64(gyro.Y) / gg m.Gyroscope.Z = float64(gyro.Z) / gg - return + return nil } func (m *MPU6050Driver) waitForReset() error { @@ -275,43 +281,40 @@ func (m *MPU6050Driver) waitForReset() error { } } -func (m *MPU6050Driver) initialize() (err error) { +func (m *MPU6050Driver) initialize() error { // reset device and wait for reset is finished - if err = m.connection.WriteByteData(mpu6050Reg_PwrMgmt1, mpu6050Pwr1_DeviceResetBit); err != nil { - return + if err := m.connection.WriteByteData(mpu6050Reg_PwrMgmt1, mpu6050Pwr1_DeviceResetBit); err != nil { + return err } - if err = m.waitForReset(); err != nil { - return + if err := m.waitForReset(); err != nil { + return err } // reset signal path register reset := uint8(mpu6050SignalReset_TempBit | mpu6050SignalReset_AccelBit | mpu6050SignalReset_GyroBit) - if err = m.connection.WriteByteData(mpu6050Reg_SignalPathReset, reset); err != nil { - return + if err := m.connection.WriteByteData(mpu6050Reg_SignalPathReset, reset); err != nil { + return err } time.Sleep(100 * time.Millisecond) // configure digital filter bandwidth and external frame synchronization (bits 3...5 are used) generalConf := uint8(m.dlpf) | uint8(m.frameSync)<<3 - if err = m.connection.WriteByteData(mpu6050Reg_GeneralConfig, generalConf); err != nil { - return + if err := m.connection.WriteByteData(mpu6050Reg_GeneralConfig, generalConf); err != nil { + return err } // set full scale range of gyroscope (bits 3 and 4 are used) - if err = m.connection.WriteByteData(mpu6050Reg_GyroConfig, uint8(m.gyroFs)<<3); err != nil { - return + if err := m.connection.WriteByteData(mpu6050Reg_GyroConfig, uint8(m.gyroFs)<<3); err != nil { + return err } // set full scale range of accelerometer (bits 3 and 4 are used) - if err = m.connection.WriteByteData(mpu6050Reg_AccelConfig, uint8(m.accelFs)<<3); err != nil { - return + if err := m.connection.WriteByteData(mpu6050Reg_AccelConfig, uint8(m.accelFs)<<3); err != nil { + return err } // set clock source and reset sleep pwr1 := uint8(m.clock) & ^uint8(mpu6050Pwr1_SleepOnBit) - if err = m.connection.WriteByteData(mpu6050Reg_PwrMgmt1, pwr1); err != nil { - return - } - return + return m.connection.WriteByteData(mpu6050Reg_PwrMgmt1, pwr1) } diff --git a/drivers/i2c/mpu6050_driver_test.go b/drivers/i2c/mpu6050_driver_test.go index 79c052d99..ac9a3ec9a 100644 --- a/drivers/i2c/mpu6050_driver_test.go +++ b/drivers/i2c/mpu6050_driver_test.go @@ -86,7 +86,7 @@ func TestMPU6050GetData(t *testing.T) { // arrange d, adaptor := initTestMPU6050WithStubbedAdaptor() - d.Start() + _ = d.Start() accData := []byte{0x00, 0x01, 0x02, 0x04, 0x08, 0x16} tempData := []byte{0x32, 0x64} @@ -109,7 +109,7 @@ func TestMPU6050GetData(t *testing.T) { return len(b), nil } // act - d.GetData() + _ = d.GetData() // assert gobottest.Assert(t, d.Accelerometer, wantAccel) gobottest.Assert(t, d.Gyroscope, wantGyro) @@ -118,7 +118,7 @@ func TestMPU6050GetData(t *testing.T) { func TestMPU6050GetDataReadError(t *testing.T) { d, adaptor := initTestMPU6050WithStubbedAdaptor() - d.Start() + _ = d.Start() adaptor.i2cReadImpl = func(b []byte) (int, error) { return 0, errors.New("read error") @@ -129,7 +129,7 @@ func TestMPU6050GetDataReadError(t *testing.T) { func TestMPU6050GetDataWriteError(t *testing.T) { d, adaptor := initTestMPU6050WithStubbedAdaptor() - d.Start() + _ = d.Start() adaptor.i2cWriteImpl = func(b []byte) (int, error) { return 0, errors.New("write error") diff --git a/drivers/i2c/pca953x_driver_test.go b/drivers/i2c/pca953x_driver_test.go index 1c0a65dcb..0dfd3aa64 100644 --- a/drivers/i2c/pca953x_driver_test.go +++ b/drivers/i2c/pca953x_driver_test.go @@ -17,7 +17,7 @@ var _ gobot.Driver = (*PCA953xDriver)(nil) func initPCA953xTestDriverWithStubbedAdaptor() (*PCA953xDriver, *i2cTestAdaptor) { a := newI2cTestAdaptor() d := NewPCA953xDriver(a) - d.Start() + _ = d.Start() return d, a } diff --git a/drivers/i2c/pca9685_driver_test.go b/drivers/i2c/pca9685_driver_test.go index 4fcae5a8f..d77484449 100644 --- a/drivers/i2c/pca9685_driver_test.go +++ b/drivers/i2c/pca9685_driver_test.go @@ -137,7 +137,7 @@ func TestPCA9685Commands(t *testing.T) { copy(b, []byte{0x01}) return 1, nil } - d.Start() + _ = d.Start() err := d.Command("PwmWrite")(map[string]interface{}{"pin": "1", "val": "1"}) gobottest.Assert(t, err, nil) diff --git a/drivers/i2c/pcf8583_driver_test.go b/drivers/i2c/pcf8583_driver_test.go index 95439e040..c0a6db1d9 100644 --- a/drivers/i2c/pcf8583_driver_test.go +++ b/drivers/i2c/pcf8583_driver_test.go @@ -16,7 +16,7 @@ var _ gobot.Driver = (*PCF8583Driver)(nil) func initTestPCF8583WithStubbedAdaptor() (*PCF8583Driver, *i2cTestAdaptor) { a := newI2cTestAdaptor() d := NewPCF8583Driver(a) - d.Start() + _ = d.Start() return d, a } diff --git a/drivers/i2c/sht2x_driver.go b/drivers/i2c/sht2x_driver.go index fddaa48ca..3c1e36e1e 100644 --- a/drivers/i2c/sht2x_driver.go +++ b/drivers/i2c/sht2x_driver.go @@ -68,21 +68,20 @@ const ( // SHT2xDriver is a Driver for a SHT2x humidity and temperature sensor type SHT2xDriver struct { *Driver - Units string - sht2xAddress int - accuracy byte - delay time.Duration - crcTable *crc8.Table + Units string + accuracy byte + crcTable *crc8.Table } // NewSHT2xDriver creates a new driver with specified i2c interface // Params: -// c Connector - the Adaptor to use with this Driver +// +// c Connector - the Adaptor to use with this Driver // // Optional params: -// i2c.WithBus(int): bus to use with this driver -// i2c.WithAddress(int): address to use with this driver // +// i2c.WithBus(int): bus to use with this driver +// i2c.WithAddress(int): address to use with this driver func NewSHT2xDriver(c Connector, options ...func(Config)) *SHT2xDriver { // From the document "CRC Checksum Calculation -- For Safe Communication with SHT2x Sensors": crc8Params := crc8.Params{ @@ -206,7 +205,9 @@ func (d *SHT2xDriver) initialize() error { return err } - d.sendAccuracy() + if err := d.sendAccuracy(); err != nil { + return err + } return nil } diff --git a/drivers/i2c/sht2x_driver_test.go b/drivers/i2c/sht2x_driver_test.go index d2d21d174..2578c6757 100644 --- a/drivers/i2c/sht2x_driver_test.go +++ b/drivers/i2c/sht2x_driver_test.go @@ -56,7 +56,7 @@ func TestSHT2xReset(t *testing.T) { a.i2cReadImpl = func(b []byte) (int, error) { return 0, nil } - d.Start() + _ = d.Start() err := d.Reset() gobottest.Assert(t, err, nil) } @@ -74,7 +74,7 @@ func TestSHT2xMeasurements(t *testing.T) { copy(b, buf.Bytes()) return buf.Len(), nil } - d.Start() + _ = d.Start() temp, err := d.Temperature() gobottest.Assert(t, err, nil) gobottest.Assert(t, temp, float32(18.809052)) @@ -97,8 +97,8 @@ func TestSHT2xAccuracy(t *testing.T) { copy(b, buf.Bytes()) return buf.Len(), nil } - d.Start() - d.SetAccuracy(SHT2xAccuracyLow) + _ = d.Start() + _ = d.SetAccuracy(SHT2xAccuracyLow) gobottest.Assert(t, d.Accuracy(), SHT2xAccuracyLow) err := d.sendAccuracy() gobottest.Assert(t, err, nil) @@ -106,7 +106,7 @@ func TestSHT2xAccuracy(t *testing.T) { func TestSHT2xTemperatureCrcError(t *testing.T) { d, a := initTestSHT2xDriverWithStubbedAdaptor() - d.Start() + _ = d.Start() a.i2cReadImpl = func(b []byte) (int, error) { buf := new(bytes.Buffer) @@ -123,7 +123,7 @@ func TestSHT2xTemperatureCrcError(t *testing.T) { func TestSHT2xHumidityCrcError(t *testing.T) { d, a := initTestSHT2xDriverWithStubbedAdaptor() - d.Start() + _ = d.Start() a.i2cReadImpl = func(b []byte) (int, error) { buf := new(bytes.Buffer) @@ -140,7 +140,7 @@ func TestSHT2xHumidityCrcError(t *testing.T) { func TestSHT2xTemperatureLengthError(t *testing.T) { d, a := initTestSHT2xDriverWithStubbedAdaptor() - d.Start() + _ = d.Start() a.i2cReadImpl = func(b []byte) (int, error) { buf := new(bytes.Buffer) @@ -157,7 +157,7 @@ func TestSHT2xTemperatureLengthError(t *testing.T) { func TestSHT2xHumidityLengthError(t *testing.T) { d, a := initTestSHT2xDriverWithStubbedAdaptor() - d.Start() + _ = d.Start() a.i2cReadImpl = func(b []byte) (int, error) { buf := new(bytes.Buffer) diff --git a/drivers/i2c/sht3x_driver.go b/drivers/i2c/sht3x_driver.go index b906a146a..c9d16220a 100644 --- a/drivers/i2c/sht3x_driver.go +++ b/drivers/i2c/sht3x_driver.go @@ -63,19 +63,22 @@ type SHT3xDriver struct { // NewSHT3xDriver creates a new driver with specified i2c interface // Params: -// c Connector - the Adaptor to use with this Driver +// +// c Connector - the Adaptor to use with this Driver // // Optional params: -// i2c.WithBus(int): bus to use with this driver -// i2c.WithAddress(int): address to use with this driver // +// i2c.WithBus(int): bus to use with this driver +// i2c.WithAddress(int): address to use with this driver func NewSHT3xDriver(c Connector, options ...func(Config)) *SHT3xDriver { s := &SHT3xDriver{ Driver: NewDriver(c, "SHT3x", SHT3xAddressA), Units: "C", crcTable: crc8.MakeTable(crc8Params), } - s.SetAccuracy(SHT3xAccuracyHigh) + if err := s.SetAccuracy(SHT3xAccuracyHigh); err != nil { + panic(err) + } for _, option := range options { option(s) diff --git a/drivers/i2c/sht3x_driver_test.go b/drivers/i2c/sht3x_driver_test.go index e9a0a9a16..522b66b9f 100644 --- a/drivers/i2c/sht3x_driver_test.go +++ b/drivers/i2c/sht3x_driver_test.go @@ -189,8 +189,8 @@ func TestSHT3xHeater(t *testing.T) { func TestSHT3xSetHeater(t *testing.T) { d, _ := initTestSHT3xDriverWithStubbedAdaptor() - d.SetHeater(false) - d.SetHeater(true) + _ = d.SetHeater(false) + _ = d.SetHeater(true) } func TestSHT3xSetAccuracy(t *testing.T) { diff --git a/drivers/i2c/ssd1306_driver.go b/drivers/i2c/ssd1306_driver.go index 920b523bb..157d21536 100644 --- a/drivers/i2c/ssd1306_driver.go +++ b/drivers/i2c/ssd1306_driver.go @@ -26,12 +26,12 @@ const ( ssd1306SetComOutput8 = 0xC8 ssd1306SetContrast = 0x81 // scrolling commands - ssd1306ContinuousHScrollRight = 0x26 - ssd1306ContinuousHScrollLeft = 0x27 - ssd1306ContinuousVHScrollRight = 0x29 - ssd1306ContinuousVHScrollLeft = 0x2A - ssd1306StopScroll = 0x2E - ssd1306StartScroll = 0x2F + //ssd1306ContinuousHScrollRight = 0x26 + //ssd1306ContinuousHScrollLeft = 0x27 + //ssd1306ContinuousVHScrollRight = 0x29 + //ssd1306ContinuousVHScrollLeft = 0x2A + //ssd1306StopScroll = 0x2E + //ssd1306StartScroll = 0x2F // adressing settings commands ssd1306SetMemoryAddressingMode = 0x20 ssd1306ColumnAddr = 0x21 @@ -190,15 +190,16 @@ type SSD1306Driver struct { // NewSSD1306Driver creates a new SSD1306Driver. // // Params: -// c Connector - the Adaptor to use with this Driver +// +// c Connector - the Adaptor to use with this Driver // // Optional params: -// WithBus(int): bus to use with this driver -// WithAddress(int): address to use with this driver -// WithSSD1306DisplayWidth(int): width of display (defaults to 128) -// WithSSD1306DisplayHeight(int): height of display (defaults to 64) -// WithSSD1306ExternalVCC: set true when using an external OLED supply (defaults to false) // +// WithBus(int): bus to use with this driver +// WithAddress(int): address to use with this driver +// WithSSD1306DisplayWidth(int): width of display (defaults to 128) +// WithSSD1306DisplayHeight(int): height of display (defaults to 64) +// WithSSD1306ExternalVCC: set true when using an external OLED supply (defaults to false) func NewSSD1306Driver(c Connector, options ...func(Config)) *SSD1306Driver { s := &SSD1306Driver{ Driver: NewDriver(c, "SSD1306", ssd1306DefaultAddress), diff --git a/drivers/i2c/ssd1306_driver_test.go b/drivers/i2c/ssd1306_driver_test.go index b9dfd0109..420446a4b 100644 --- a/drivers/i2c/ssd1306_driver_test.go +++ b/drivers/i2c/ssd1306_driver_test.go @@ -105,13 +105,13 @@ func TestSSD1306Options(t *testing.T) { func TestSSD1306Display(t *testing.T) { s, _ := initTestSSD1306DriverWithStubbedAdaptor(96, 16, false) - s.Start() + _ = s.Start() gobottest.Assert(t, s.Display(), nil) } func TestSSD1306ShowImage(t *testing.T) { s, _ := initTestSSD1306DriverWithStubbedAdaptor(128, 64, false) - s.Start() + _ = s.Start() img := image.NewRGBA(image.Rect(0, 0, 640, 480)) gobottest.Assert(t, s.ShowImage(img), errors.New("image must match display width and height: 128x64")) @@ -121,7 +121,7 @@ func TestSSD1306ShowImage(t *testing.T) { func TestSSD1306Command(t *testing.T) { s, a := initTestSSD1306DriverWithStubbedAdaptor(128, 64, false) - s.Start() + _ = s.Start() a.i2cWriteImpl = func(got []byte) (int, error) { expected := []byte{0x80, 0xFF} @@ -137,7 +137,7 @@ func TestSSD1306Command(t *testing.T) { func TestSSD1306Commands(t *testing.T) { s, a := initTestSSD1306DriverWithStubbedAdaptor(128, 64, false) - s.Start() + _ = s.Start() a.i2cWriteImpl = func(got []byte) (int, error) { expected := []byte{0x80, 0x00, 0x80, 0xFF} @@ -153,7 +153,7 @@ func TestSSD1306Commands(t *testing.T) { func TestSSD1306On(t *testing.T) { s, a := initTestSSD1306DriverWithStubbedAdaptor(128, 64, false) - s.Start() + _ = s.Start() a.i2cWriteImpl = func(got []byte) (int, error) { expected := []byte{0x80, ssd1306SetDisplayOn} @@ -169,7 +169,7 @@ func TestSSD1306On(t *testing.T) { func TestSSD1306Off(t *testing.T) { s, a := initTestSSD1306DriverWithStubbedAdaptor(128, 64, false) - s.Start() + _ = s.Start() a.i2cWriteImpl = func(got []byte) (int, error) { expected := []byte{0x80, ssd1306SetDisplayOff} @@ -185,7 +185,7 @@ func TestSSD1306Off(t *testing.T) { func TestSSD1306Reset(t *testing.T) { s, a := initTestSSD1306DriverWithStubbedAdaptor(128, 64, false) - s.Start() + _ = s.Start() a.i2cWriteImpl = func(got []byte) (int, error) { expectedOff := []byte{0x80, ssd1306SetDisplayOff} diff --git a/drivers/i2c/th02_driver.go b/drivers/i2c/th02_driver.go index 1b1707896..4edee7900 100644 --- a/drivers/i2c/th02_driver.go +++ b/drivers/i2c/th02_driver.go @@ -40,7 +40,7 @@ const ( th02Reg_Config = 0x03 th02Reg_ID = 0x11 - th02Status_ReadyBit = 0x01 // D0 is /RDY + //th02Status_ReadyBit = 0x01 // D0 is /RDY th02Config_StartBit = 0x01 // D0 is START th02Config_HeatBit = 0x02 // D1 is HEAT @@ -48,7 +48,7 @@ const ( th02Config_FastBit = 0x20 // D5 is FAST (if set use 18 ms, but lower accuracy T: 13 bit, H: 11 bit) ) -//Accuracy constants for the TH02 devices (deprecated, use WithFastMode() instead) +// Accuracy constants for the TH02 devices (deprecated, use WithFastMode() instead) const ( TH02HighAccuracy = 0 //High Accuracy (T: 14 bit, H: 12 bit), normal (35 ms) TH02LowAccuracy = 1 //Lower Accuracy (T: 13 bit, H: 11 bit), fast (18 ms) @@ -64,15 +64,17 @@ type TH02Driver struct { // NewTH02Driver creates a new driver with specified i2c interface. // Defaults to: -// - Using high accuracy (lower speed) measurements cycles. -// - Emitting values in "C". If you want F, set Units to "F" +// - Using high accuracy (lower speed) measurements cycles. +// - Emitting values in "C". If you want F, set Units to "F" +// // Params: -// conn Connector - the Adaptor to use with this Driver +// +// conn Connector - the Adaptor to use with this Driver // // Optional params: -// i2c.WithBus(int): bus to use with this driver -// i2c.WithAddress(int): address to use with this driver // +// i2c.WithBus(int): bus to use with this driver +// i2c.WithAddress(int): address to use with this driver func NewTH02Driver(a Connector, options ...func(Config)) *TH02Driver { s := &TH02Driver{ Driver: NewDriver(a, "TH02", th02DefaultAddress, options...), diff --git a/drivers/i2c/tsl2561_driver_test.go b/drivers/i2c/tsl2561_driver_test.go index d5918d22a..276c484fd 100644 --- a/drivers/i2c/tsl2561_driver_test.go +++ b/drivers/i2c/tsl2561_driver_test.go @@ -18,7 +18,7 @@ var _ gobot.Driver = (*TSL2561Driver)(nil) func testIDReader(b []byte) (int, error) { buf := new(bytes.Buffer) // Mock device responding 0xA - binary.Write(buf, binary.LittleEndian, uint8(0x0A)) + _ = binary.Write(buf, binary.LittleEndian, uint8(0x0A)) copy(b, buf.Bytes()) return buf.Len(), nil } @@ -86,9 +86,9 @@ func TestTSL2561DriverRead16(t *testing.T) { a.i2cReadImpl = func(b []byte) (int, error) { buf := new(bytes.Buffer) // send low - binary.Write(buf, binary.LittleEndian, uint8(0xEA)) + _ = binary.Write(buf, binary.LittleEndian, uint8(0xEA)) // send high - binary.Write(buf, binary.LittleEndian, uint8(0xAE)) + _ = binary.Write(buf, binary.LittleEndian, uint8(0xAE)) copy(b, buf.Bytes()) return buf.Len(), nil } @@ -200,7 +200,7 @@ func TestTSL2561DriverGetLuminocityAutoGain(t *testing.T) { return buf.Len(), nil } - d.Start() + _ = d.Start() bb, ir, err := d.GetLuminocity() gobottest.Assert(t, err, nil) gobottest.Assert(t, bb, uint16(12365)) diff --git a/drivers/i2c/wiichuck_driver_test.go b/drivers/i2c/wiichuck_driver_test.go index 0758cbbf6..458d5d607 100644 --- a/drivers/i2c/wiichuck_driver_test.go +++ b/drivers/i2c/wiichuck_driver_test.go @@ -76,7 +76,7 @@ func TestWiichuckDriverCanParse(t *testing.T) { // ------ When value is not encrypted decryptedValue := []byte{1, 2, 3, 4, 5, 6} - d.update(decryptedValue) + _ = d.update(decryptedValue) // - This should be done by WiichuckDriver.parse gobottest.Assert(t, d.data["sx"], float64(45)) @@ -90,7 +90,7 @@ func TestWiichuckDriverCanAdjustOrigins(t *testing.T) { // ------ When value is not encrypted decryptedValue := []byte{1, 2, 3, 4, 5, 6} - d.update(decryptedValue) + _ = d.update(decryptedValue) // - This should be done by WiichuckDriver.adjustOrigins gobottest.Assert(t, d.Joystick()["sx_origin"], float64(45)) @@ -102,17 +102,17 @@ func TestWiichuckDriverCButton(t *testing.T) { // ------ When value is not encrypted decryptedValue := []byte{1, 2, 3, 4, 5, 6} - d.update(decryptedValue) + _ = d.update(decryptedValue) // - This should be done by WiichuckDriver.updateButtons done := make(chan bool) - d.On(d.Event(C), func(data interface{}) { + _ = d.On(d.Event(C), func(data interface{}) { gobottest.Assert(t, data, true) done <- true }) - d.update(decryptedValue) + _ = d.update(decryptedValue) select { case <-done: @@ -126,16 +126,16 @@ func TestWiichuckDriverZButton(t *testing.T) { // ------ When value is not encrypted decryptedValue := []byte{1, 2, 3, 4, 5, 6} - d.update(decryptedValue) + _ = d.update(decryptedValue) done := make(chan bool) - d.On(d.Event(Z), func(data interface{}) { + _ = d.On(d.Event(Z), func(data interface{}) { gobottest.Assert(t, data, true) done <- true }) - d.update(decryptedValue) + _ = d.update(decryptedValue) select { case <-done: @@ -158,12 +158,12 @@ func TestWiichuckDriverUpdateJoystick(t *testing.T) { done := make(chan bool) - d.On(d.Event(Joystick), func(data interface{}) { + _ = d.On(d.Event(Joystick), func(data interface{}) { gobottest.Assert(t, data, expectedData) done <- true }) - d.update(decryptedValue) + _ = d.update(decryptedValue) select { case <-done: @@ -176,7 +176,7 @@ func TestWiichuckDriverEncrypted(t *testing.T) { d := initTestWiichuckDriverWithStubbedAdaptor() encryptedValue := []byte{1, 1, 2, 2, 3, 3} - d.update(encryptedValue) + _ = d.update(encryptedValue) gobottest.Assert(t, d.data["sx"], float64(0)) gobottest.Assert(t, d.data["sy"], float64(0)) diff --git a/drivers/i2c/yl40_driver_test.go b/drivers/i2c/yl40_driver_test.go index 1ee183b13..86ce7714e 100644 --- a/drivers/i2c/yl40_driver_test.go +++ b/drivers/i2c/yl40_driver_test.go @@ -12,7 +12,7 @@ func initTestYL40DriverWithStubbedAdaptor() (*YL40Driver, *i2cTestAdaptor) { adaptor := newI2cTestAdaptor() yl := NewYL40Driver(adaptor, WithPCF8591With400kbitStabilization(0, 2)) WithPCF8591ForceRefresh(1)(yl.PCF8591Driver) - yl.Start() + _ = yl.Start() return yl, adaptor } diff --git a/drivers/spi/ssd1306_driver.go b/drivers/spi/ssd1306_driver.go index 9c8bb94f7..377a0a5be 100644 --- a/drivers/spi/ssd1306_driver.go +++ b/drivers/spi/ssd1306_driver.go @@ -267,11 +267,17 @@ func (s *SSD1306Driver) Set(x, y, c int) { // Reset re-initializes the device to a clean state. func (s *SSD1306Driver) Reset() error { - s.rstDriver.DigitalWrite(1) + if err := s.rstDriver.DigitalWrite(1); err != nil { + return err + } time.Sleep(10 * time.Millisecond) - s.rstDriver.DigitalWrite(0) + if err := s.rstDriver.DigitalWrite(0); err != nil { + return err + } time.Sleep(10 * time.Millisecond) - s.rstDriver.DigitalWrite(1) + if err := s.rstDriver.DigitalWrite(1); err != nil { + return err + } return nil } @@ -291,12 +297,24 @@ func (s *SSD1306Driver) SetContrast(contrast byte) error { // Display sends the memory buffer to the display. func (s *SSD1306Driver) Display() error { - s.command(ssd1306ColumnAddr) - s.command(0) - s.command(uint8(s.DisplayWidth) - 1) - s.command(ssd1306PageAddr) - s.command(0) - s.command(uint8(s.pageSize) - 1) + if err := s.command(ssd1306ColumnAddr); err != nil { + return err + } + if err := s.command(0); err != nil { + return err + } + if err := s.command(uint8(s.DisplayWidth) - 1); err != nil { + return err + } + if err := s.command(ssd1306PageAddr); err != nil { + return err + } + if err := s.command(0); err != nil { + return err + } + if err := s.command(uint8(s.pageSize) - 1); err != nil { + return err + } if err := s.dcDriver.DigitalWrite(1); err != nil { return err } @@ -309,7 +327,9 @@ func (s *SSD1306Driver) ShowImage(img image.Image) error { return fmt.Errorf("Image must match the display width and height") } - s.Clear() + if err := s.Clear(); err != nil { + return err + } for y, w, h := 0, img.Bounds().Dx(), img.Bounds().Dy(); y < h; y++ { for x := 0; x < w; x++ { c := img.At(x, y) @@ -331,64 +351,129 @@ func (s *SSD1306Driver) command(b byte) error { // initialize configures the ssd1306 based on the options passed in when the driver was created func (s *SSD1306Driver) initialize() error { - s.command(ssd1306SetDisplayOff) - s.command(ssd1306SetDisplayClock) + if err := s.command(ssd1306SetDisplayOff); err != nil { + return err + } + if err := s.command(ssd1306SetDisplayClock); err != nil { + return err + } if s.DisplayHeight == 16 { - s.command(0x60) + if err := s.command(0x60); err != nil { + return err + } } else { - s.command(0x80) - } - s.command(ssd1306SetMultiplexRatio) - s.command(uint8(s.DisplayHeight) - 1) - s.command(ssd1306SetDisplayOffset) - s.command(0x0) - s.command(ssd1306SetStartLine) - s.command(0x0) - s.command(ssd1306ChargePumpSetting) + if err := s.command(0x80); err != nil { + return err + } + } + if err := s.command(ssd1306SetMultiplexRatio); err != nil { + return err + } + if err := s.command(uint8(s.DisplayHeight) - 1); err != nil { + return err + } + if err := s.command(ssd1306SetDisplayOffset); err != nil { + return err + } + if err := s.command(0x0); err != nil { + return err + } + if err := s.command(ssd1306SetStartLine); err != nil { + return err + } + if err := s.command(0x0); err != nil { + return err + } + if err := s.command(ssd1306ChargePumpSetting); err != nil { + return err + } if s.ExternalVcc { - s.command(0x10) + if err := s.command(0x10); err != nil { + return err + } } else { - s.command(0x14) - } - s.command(ssd1306SetMemoryAddressingMode) - s.command(0x00) - s.command(ssd1306SetSegmentRemap0) - s.command(0x01) - s.command(ssd1306ComScanInc) - s.command(ssd1306SetComPins) + if err := s.command(0x14); err != nil { + return err + } + } + if err := s.command(ssd1306SetMemoryAddressingMode); err != nil { + return err + } + if err := s.command(0x00); err != nil { + return err + } + if err := s.command(ssd1306SetSegmentRemap0); err != nil { + return err + } + if err := s.command(0x01); err != nil { + return err + } + if err := s.command(ssd1306ComScanInc); err != nil { + return err + } + if err := s.command(ssd1306SetComPins); err != nil { + return err + } if s.DisplayHeight == 64 { - s.command(0x12) + if err := s.command(0x12); err != nil { + return err + } } else { - s.command(0x02) + if err := s.command(0x02); err != nil { + return err + } + } + if err := s.command(ssd1306SetContrast); err != nil { + return err } - s.command(ssd1306SetContrast) if s.DisplayHeight == 64 { if s.ExternalVcc { - s.command(0x9F) + if err := s.command(0x9F); err != nil { + return err + } } else { - s.command(0xCF) + if err := s.command(0xCF); err != nil { + return err + } } } else { - s.command(0x8F) + if err := s.command(0x8F); err != nil { + return err + } + } + if err := s.command(ssd1306SetPrechargePeriod); err != nil { + return err } - s.command(ssd1306SetPrechargePeriod) if s.ExternalVcc { - s.command(0x22) + if err := s.command(0x22); err != nil { + return err + } } else { - s.command(0xF1) - } - s.command(ssd1306SetVComDeselectLevel) - s.command(0x40) - s.command(ssd1306DisplayOnResumeToRAM) - s.command(ssd1306SetDisplayNormal) - s.command(ssd1306DeactivateScroll) - s.command(ssd1306SetDisplayOn) - - return nil + if err := s.command(0xF1); err != nil { + return err + } + } + if err := s.command(ssd1306SetVComDeselectLevel); err != nil { + return err + } + if err := s.command(0x40); err != nil { + return err + } + if err := s.command(ssd1306DisplayOnResumeToRAM); err != nil { + return err + } + if err := s.command(ssd1306SetDisplayNormal); err != nil { + return err + } + if err := s.command(ssd1306DeactivateScroll); err != nil { + return err + } + return s.command(ssd1306SetDisplayOn) } func (s *SSD1306Driver) shutdown() error { - s.Reset() - s.Off() - return nil + if err := s.Reset(); err != nil { + return err + } + return s.Off() } diff --git a/drivers/spi/ssd1306_driver_test.go b/drivers/spi/ssd1306_driver_test.go index d63642443..3e87b9997 100644 --- a/drivers/spi/ssd1306_driver_test.go +++ b/drivers/spi/ssd1306_driver_test.go @@ -25,19 +25,19 @@ func TestDriverSSDStart(t *testing.T) { func TestDriverSSDHalt(t *testing.T) { d := initTestSSDDriver() - d.Start() + _ = d.Start() gobottest.Assert(t, d.Halt(), nil) } func TestDriverSSDDisplay(t *testing.T) { d := initTestSSDDriver() - d.Start() + _ = d.Start() gobottest.Assert(t, d.Display(), nil) } func TestSSD1306DriverShowImage(t *testing.T) { d := initTestSSDDriver() - d.Start() + _ = d.Start() img := image.NewRGBA(image.Rect(0, 0, 640, 480)) gobottest.Assert(t, d.ShowImage(img), errors.New("Image must match the display width and height")) diff --git a/eventer_test.go b/eventer_test.go index 862d58bfc..009dd121c 100644 --- a/eventer_test.go +++ b/eventer_test.go @@ -32,7 +32,7 @@ func TestEventerOn(t *testing.T) { e.AddEvent("test") sem := make(chan bool) - e.On("test", func(data interface{}) { + _ = e.On("test", func(data interface{}) { sem <- true }) @@ -52,7 +52,7 @@ func TestEventerOnce(t *testing.T) { e.AddEvent("test") sem := make(chan bool) - e.Once("test", func(data interface{}) { + _ = e.Once("test", func(data interface{}) { sem <- true }) diff --git a/master.go b/master.go index 10db52f4c..9e16b269d 100644 --- a/master.go +++ b/master.go @@ -4,8 +4,6 @@ import ( "os" "os/signal" "sync/atomic" - - multierror "github.com/hashicorp/go-multierror" ) // JSONMaster is a JSON representation of a Gobot Master. @@ -60,36 +58,32 @@ func NewMaster() *Master { // Start calls the Start method on each robot in its collection of robots. On // error, call Stop to ensure that all robots are returned to a sane, stopped // state. -func (g *Master) Start() (err error) { - if rerr := g.robots.Start(!g.AutoRun); rerr != nil { - err = multierror.Append(err, rerr) - return +func (g *Master) Start() error { + if err := g.robots.Start(!g.AutoRun); err != nil { + return err } g.running.Store(true) - if g.AutoRun { - c := make(chan os.Signal, 1) - g.trap(c) + if !g.AutoRun { + return nil + } - // waiting for interrupt coming on the channel - <-c + c := make(chan os.Signal, 1) + g.trap(c) - // Stop calls the Stop method on each robot in its collection of robots. - g.Stop() - } + // waiting for interrupt coming on the channel + <-c - return err + // Stop calls the Stop method on each robot in its collection of robots. + return g.Stop() } // Stop calls the Stop method on each robot in its collection of robots. -func (g *Master) Stop() (err error) { - if rerr := g.robots.Stop(); rerr != nil { - err = multierror.Append(err, rerr) - } - +func (g *Master) Stop() error { + err := g.robots.Stop() g.running.Store(false) - return + return err } // Running returns if the Master is currently started or not diff --git a/master_test.go b/master_test.go index 3df73ca2f..f6c9159de 100644 --- a/master_test.go +++ b/master_test.go @@ -2,6 +2,7 @@ package gobot import ( "errors" + "fmt" "log" "os" "testing" @@ -76,7 +77,7 @@ func TestMasterStart(t *testing.T) { func TestMasterStartAutoRun(t *testing.T) { g := NewMaster() g.AddRobot(newTestRobot("Robot99")) - go g.Start() + go func() { _ = g.Start() }() time.Sleep(10 * time.Millisecond) gobottest.Assert(t, g.Running(), true) @@ -92,12 +93,12 @@ func TestMasterStartDriverErrors(t *testing.T) { return e } - var expected error - expected = multierror.Append(expected, e) - expected = multierror.Append(expected, e) - expected = multierror.Append(expected, e) + var want error + want = multierror.Append(want, e) + want = multierror.Append(want, e) + want = multierror.Append(want, e) - gobottest.Assert(t, g.Start(), expected) + gobottest.Assert(t, g.Start(), want) gobottest.Assert(t, g.Stop(), nil) testDriverStart = func() (err error) { return } @@ -105,36 +106,38 @@ func TestMasterStartDriverErrors(t *testing.T) { func TestMasterHaltFromRobotDriverErrors(t *testing.T) { g := initTestMaster1Robot() - e := errors.New("driver halt error 1") + var ec int testDriverHalt = func() (err error) { - return e + ec++ + return fmt.Errorf("driver halt error %d", ec) } + defer func() { testDriverHalt = func() error { return nil } }() - var expected error - expected = multierror.Append(expected, e) - expected = multierror.Append(expected, e) - expected = multierror.Append(expected, e) - - gobottest.Assert(t, g.Start(), nil) - gobottest.Assert(t, g.Stop(), expected) + var want error + for i := 1; i <= 3; i++ { + e := fmt.Errorf("driver halt error %d", i) + want = multierror.Append(want, e) + } - testDriverHalt = func() (err error) { return } + gobottest.Assert(t, g.Start(), want) } func TestMasterStartRobotAdaptorErrors(t *testing.T) { g := initTestMaster1Robot() - e := errors.New("adaptor start error 1") - + var ec int testAdaptorConnect = func() (err error) { - return e + ec++ + return fmt.Errorf("adaptor start error %d", ec) } + defer func() { testAdaptorConnect = func() error { return nil } }() - var expected error - expected = multierror.Append(expected, e) - expected = multierror.Append(expected, e) - expected = multierror.Append(expected, e) + var want error + for i := 1; i <= 3; i++ { + e := fmt.Errorf("adaptor start error %d", i) + want = multierror.Append(want, e) + } - gobottest.Assert(t, g.Start(), expected) + gobottest.Assert(t, g.Start(), want) gobottest.Assert(t, g.Stop(), nil) testAdaptorConnect = func() (err error) { return } @@ -142,21 +145,18 @@ func TestMasterStartRobotAdaptorErrors(t *testing.T) { func TestMasterFinalizeErrors(t *testing.T) { g := initTestMaster1Robot() - e := errors.New("adaptor finalize error 2") - + var ec int testAdaptorFinalize = func() (err error) { - return e + ec++ + return fmt.Errorf("adaptor finalize error %d", ec) } + defer func() { testAdaptorFinalize = func() error { return nil } }() - var expected error - expected = multierror.Append(expected, e) - expected = multierror.Append(expected, e) - expected = multierror.Append(expected, e) - - gobottest.Assert(t, g.Start(), nil) - gobottest.Assert(t, g.Stop(), expected) - - testAdaptorFinalize = func() (err error) { - return nil + var want error + for i := 1; i <= 3; i++ { + e := fmt.Errorf("adaptor finalize error %d", i) + want = multierror.Append(want, e) } + + gobottest.Assert(t, g.Start(), want) } diff --git a/platforms/adaptors/digitalpinsadaptor_test.go b/platforms/adaptors/digitalpinsadaptor_test.go index df0f56741..954898ecf 100644 --- a/platforms/adaptors/digitalpinsadaptor_test.go +++ b/platforms/adaptors/digitalpinsadaptor_test.go @@ -268,7 +268,7 @@ func TestDigitalPinConcurrency(t *testing.T) { for retry := 0; retry < 20; retry++ { a := NewDigitalPinsAdaptor(sys, translate) - a.Connect() + _ = a.Connect() var wg sync.WaitGroup for i := 0; i < 20; i++ { @@ -276,7 +276,7 @@ func TestDigitalPinConcurrency(t *testing.T) { pinAsString := strconv.Itoa(i) go func(pin string) { defer wg.Done() - a.DigitalPin(pin) + _, _ = a.DigitalPin(pin) }(pinAsString) } diff --git a/platforms/adaptors/i2cbusadaptor_test.go b/platforms/adaptors/i2cbusadaptor_test.go index b0cab6f8d..b76ee0fd5 100644 --- a/platforms/adaptors/i2cbusadaptor_test.go +++ b/platforms/adaptors/i2cbusadaptor_test.go @@ -80,7 +80,7 @@ func TestI2cFinalize(t *testing.T) { gobottest.Assert(t, a.Finalize(), nil) // arrange gobottest.Assert(t, a.Connect(), nil) - a.GetI2cConnection(0xaf, 1) + _, _ = a.GetI2cConnection(0xaf, 1) gobottest.Assert(t, len(a.buses), 1) // assert that Finalize after GetI2cConnection is working and clean up gobottest.Assert(t, a.Finalize(), nil) @@ -91,7 +91,7 @@ func TestI2cFinalize(t *testing.T) { gobottest.Assert(t, a.Connect(), nil) con, _ := a.GetI2cConnection(0xbf, 1) gobottest.Assert(t, len(a.buses), 1) - con.Write([]byte{0xbf}) + _, _ = con.Write([]byte{0xbf}) fs.WithCloseError = true err := a.Finalize() gobottest.Assert(t, strings.Contains(err.Error(), "close error"), true) diff --git a/platforms/adaptors/pwmpinsadaptor_test.go b/platforms/adaptors/pwmpinsadaptor_test.go index 016301d41..87f8f2f58 100644 --- a/platforms/adaptors/pwmpinsadaptor_test.go +++ b/platforms/adaptors/pwmpinsadaptor_test.go @@ -352,7 +352,7 @@ func TestPWMPinConcurrency(t *testing.T) { for retry := 0; retry < 20; retry++ { a := NewPWMPinsAdaptor(sys, translate) - a.Connect() + _ = a.Connect() var wg sync.WaitGroup for i := 0; i < 20; i++ { @@ -360,7 +360,7 @@ func TestPWMPinConcurrency(t *testing.T) { pinAsString := strconv.Itoa(i) go func(pin string) { defer wg.Done() - a.PWMPin(pin) + _, _ = a.PWMPin(pin) }(pinAsString) } diff --git a/platforms/audio/audio_driver.go b/platforms/audio/audio_driver.go index 025180501..8027a3e54 100644 --- a/platforms/audio/audio_driver.go +++ b/platforms/audio/audio_driver.go @@ -61,10 +61,6 @@ func (d *Driver) Play() []error { return d.Sound(d.Filename()) } -func (d *Driver) adaptor() *Adaptor { - return d.Connection().(*Adaptor) -} - // Start starts the Driver func (d *Driver) Start() (err error) { return diff --git a/platforms/beaglebone/beaglebone_adaptor_test.go b/platforms/beaglebone/beaglebone_adaptor_test.go index 008f896d1..ed5e5a38f 100644 --- a/platforms/beaglebone/beaglebone_adaptor_test.go +++ b/platforms/beaglebone/beaglebone_adaptor_test.go @@ -56,7 +56,7 @@ func TestPWM(t *testing.T) { a, fs := initTestAdaptorWithMockedFilesystem(mockPaths) gobottest.Assert(t, a.PwmWrite("P9_99", 175), errors.New("'P9_99' is not a valid id for a PWM pin")) - a.PwmWrite("P9_21", 175) + _ = a.PwmWrite("P9_21", 175) gobottest.Assert( t, fs.Files["/sys/devices/platform/ocp/48300000.epwmss/48300200.pwm/pwm/pwmchip0/pwm1/period"].Contents, @@ -68,7 +68,7 @@ func TestPWM(t *testing.T) { "343137", ) - a.ServoWrite("P9_21", 100) + _ = a.ServoWrite("P9_21", 100) gobottest.Assert( t, fs.Files["/sys/devices/platform/ocp/48300000.epwmss/48300200.pwm/pwm/pwmchip0/pwm1/period"].Contents, @@ -127,7 +127,7 @@ func TestDigitalIO(t *testing.T) { a, fs := initTestAdaptorWithMockedFilesystem(mockPaths) // DigitalIO - a.DigitalWrite("usr1", 1) + _ = a.DigitalWrite("usr1", 1) gobottest.Assert(t, fs.Files["/sys/class/leds/beaglebone:green:usr1/brightness"].Contents, "1", @@ -137,7 +137,7 @@ func TestDigitalIO(t *testing.T) { err := a.DigitalWrite("usr10101", 1) gobottest.Assert(t, err.Error(), " : /sys/class/leds/beaglebone:green:usr10101/brightness: no such file") - a.DigitalWrite("P9_12", 1) + _ = a.DigitalWrite("P9_12", 1) gobottest.Assert(t, fs.Files["/sys/class/gpio/gpio60/value"].Contents, "1") gobottest.Assert(t, a.DigitalWrite("P9_99", 1), errors.New("'P9_99' is not a valid id for a digital pin")) diff --git a/platforms/ble/ble_client_adaptor.go b/platforms/ble/ble_client_adaptor.go index 7f61414a6..7d815acde 100644 --- a/platforms/ble/ble_client_adaptor.go +++ b/platforms/ble/ble_client_adaptor.go @@ -42,7 +42,6 @@ type ClientAdaptor struct { characteristics map[string]bluetooth.DeviceCharacteristic connected bool - ready chan struct{} withoutResponses bool } @@ -72,10 +71,11 @@ func (b *ClientAdaptor) Address() string { return b.address } func (b *ClientAdaptor) WithoutResponses(use bool) { b.withoutResponses = use } // Connect initiates a connection to the BLE peripheral. Returns true on successful connection. -func (b *ClientAdaptor) Connect() (err error) { +func (b *ClientAdaptor) Connect() error { bleMutex.Lock() defer bleMutex.Unlock() + var err error // enable adaptor b.adpt, err = getBLEAdapter(b.AdapterName) if err != nil { @@ -89,7 +89,9 @@ func (b *ClientAdaptor) Connect() (err error) { ch := make(chan bluetooth.ScanResult, 1) err = b.adpt.Scan(func(adapter *bluetooth.Adapter, result bluetooth.ScanResult) { if result.Address.String() == b.Address() { - b.adpt.StopScan() + if err := b.adpt.StopScan(); err != nil { + panic(err) + } b.SetName(result.LocalName()) ch <- result } @@ -108,6 +110,9 @@ func (b *ClientAdaptor) Connect() (err error) { // get all services/characteristics srvcs, err := b.device.DiscoverServices(nil) + if err != nil { + return err + } for _, srvc := range srvcs { chars, err := srvc.DiscoverCharacteristics(nil) if err != nil { @@ -120,28 +125,30 @@ func (b *ClientAdaptor) Connect() (err error) { } b.connected = true - return + return nil } // Reconnect attempts to reconnect to the BLE peripheral. If it has an active connection // it will first close that connection and then establish a new connection. // Returns true on Successful reconnection -func (b *ClientAdaptor) Reconnect() (err error) { +func (b *ClientAdaptor) Reconnect() error { if b.connected { - b.Disconnect() + if err := b.Disconnect(); err != nil { + return err + } } return b.Connect() } // Disconnect terminates the connection to the BLE peripheral. Returns true on successful disconnect. -func (b *ClientAdaptor) Disconnect() (err error) { - err = b.device.Disconnect() +func (b *ClientAdaptor) Disconnect() error { + err := b.device.Disconnect() time.Sleep(500 * time.Millisecond) - return + return err } // Finalize finalizes the BLEAdaptor -func (b *ClientAdaptor) Finalize() (err error) { +func (b *ClientAdaptor) Finalize() error { return b.Disconnect() } @@ -149,8 +156,7 @@ func (b *ClientAdaptor) Finalize() (err error) { // requested characteristic uuid func (b *ClientAdaptor) ReadCharacteristic(cUUID string) (data []byte, err error) { if !b.connected { - log.Fatalf("Cannot read from BLE device until connected") - return + return nil, fmt.Errorf("Cannot read from BLE device until connected") } cUUID = convertUUID(cUUID) @@ -169,10 +175,9 @@ func (b *ClientAdaptor) ReadCharacteristic(cUUID string) (data []byte, err error // WriteCharacteristic writes bytes to the BLE device for the // requested service and characteristic -func (b *ClientAdaptor) WriteCharacteristic(cUUID string, data []byte) (err error) { +func (b *ClientAdaptor) WriteCharacteristic(cUUID string, data []byte) error { if !b.connected { - log.Println("Cannot write to BLE device until connected") - return + return fmt.Errorf("Cannot write to BLE device until connected") } cUUID = convertUUID(cUUID) @@ -190,10 +195,9 @@ func (b *ClientAdaptor) WriteCharacteristic(cUUID string, data []byte) (err erro // Subscribe subscribes to notifications from the BLE device for the // requested service and characteristic -func (b *ClientAdaptor) Subscribe(cUUID string, f func([]byte, error)) (err error) { +func (b *ClientAdaptor) Subscribe(cUUID string, f func([]byte, error)) error { if !b.connected { - log.Fatalf("Cannot subscribe to BLE device until connected") - return + return fmt.Errorf("Cannot subscribe to BLE device until connected") } cUUID = convertUUID(cUUID) @@ -202,8 +206,7 @@ func (b *ClientAdaptor) Subscribe(cUUID string, f func([]byte, error)) (err erro fn := func(d []byte) { f(d, nil) } - err = char.EnableNotifications(fn) - return + return char.EnableNotifications(fn) } return fmt.Errorf("Unknown characteristic: %s", cUUID) diff --git a/platforms/ble/ble_client_adaptor_test.go b/platforms/ble/ble_client_adaptor_test.go index e3b0e7a53..59bd8e981 100644 --- a/platforms/ble/ble_client_adaptor_test.go +++ b/platforms/ble/ble_client_adaptor_test.go @@ -10,11 +10,6 @@ import ( var _ gobot.Adaptor = (*ClientAdaptor)(nil) -func initTestBLEClientAdaptor() *ClientAdaptor { - a := NewClientAdaptor("D7:99:5A:26:EC:38") - return a -} - func TestBLEClientAdaptor(t *testing.T) { a := NewClientAdaptor("D7:99:5A:26:EC:38") gobottest.Assert(t, a.Address(), "D7:99:5A:26:EC:38") diff --git a/platforms/ble/generic_access_driver.go b/platforms/ble/generic_access_driver.go index 431f20df0..7e4f9d59f 100644 --- a/platforms/ble/generic_access_driver.go +++ b/platforms/ble/generic_access_driver.go @@ -41,12 +41,10 @@ func (b *GenericAccessDriver) adaptor() BLEConnector { } // Start tells driver to get ready to do work -func (b *GenericAccessDriver) Start() (err error) { - return -} +func (b *GenericAccessDriver) Start() error { return nil } // Halt stops driver (void) -func (b *GenericAccessDriver) Halt() (err error) { return } +func (b *GenericAccessDriver) Halt() error { return nil } // GetDeviceName returns the device name for the BLE Peripheral func (b *GenericAccessDriver) GetDeviceName() string { @@ -72,7 +70,9 @@ func (b *GenericAccessDriver) GetAppearance() string { buf := bytes.NewBuffer(c) var val uint16 - binary.Read(buf, binary.LittleEndian, &val) + if err := binary.Read(buf, binary.LittleEndian, &val); err != nil { + panic(err) + } return appearances[val] } diff --git a/platforms/ble/serial_port.go b/platforms/ble/serial_port.go index c783e1dad..db6307591 100644 --- a/platforms/ble/serial_port.go +++ b/platforms/ble/serial_port.go @@ -21,18 +21,19 @@ func NewSerialPort(address string, rid string, tid string) *SerialPort { } // Open opens a connection to a BLE serial device -func (p *SerialPort) Open() (err error) { +func (p *SerialPort) Open() error { p.client = NewClientAdaptor(p.address) - err = p.client.Connect() + if err := p.client.Connect(); err != nil { + return err + } // subscribe to response notifications - p.client.Subscribe(p.rid, func(data []byte, e error) { + return p.client.Subscribe(p.rid, func(data []byte, e error) { p.responseMutex.Lock() p.responseData = append(p.responseData, data...) p.responseMutex.Unlock() }) - return } // Read reads bytes from BLE serial port connection @@ -66,9 +67,8 @@ func (p *SerialPort) Write(b []byte) (n int, err error) { } // Close closes the BLE serial port connection -func (p *SerialPort) Close() (err error) { - p.client.Disconnect() - return +func (p *SerialPort) Close() error { + return p.client.Disconnect() } // Address returns the BLE address diff --git a/platforms/chip/chip_adaptor_test.go b/platforms/chip/chip_adaptor_test.go index e49b9b2cb..612b22164 100644 --- a/platforms/chip/chip_adaptor_test.go +++ b/platforms/chip/chip_adaptor_test.go @@ -92,9 +92,9 @@ func TestFinalizeErrorAfterPWM(t *testing.T) { func TestDigitalIO(t *testing.T) { a, fs := initTestAdaptorWithMockedFilesystem() - a.Connect() + _ = a.Connect() - a.DigitalWrite("CSID7", 1) + _ = a.DigitalWrite("CSID7", 1) gobottest.Assert(t, fs.Files["/sys/class/gpio/gpio139/value"].Contents, "1") fs.Files["/sys/class/gpio/gpio50/value"].Contents = "1" @@ -107,9 +107,9 @@ func TestDigitalIO(t *testing.T) { func TestProDigitalIO(t *testing.T) { a, fs := initTestProAdaptorWithMockedFilesystem() - a.Connect() + _ = a.Connect() - a.DigitalWrite("CSID7", 1) + _ = a.DigitalWrite("CSID7", 1) gobottest.Assert(t, fs.Files["/sys/class/gpio/gpio139/value"].Contents, "1") fs.Files["/sys/class/gpio/gpio50/value"].Contents = "1" @@ -122,7 +122,7 @@ func TestProDigitalIO(t *testing.T) { func TestPWM(t *testing.T) { a, fs := initTestAdaptorWithMockedFilesystem() - a.Connect() + _ = a.Connect() err := a.PwmWrite("PWM0", 100) gobottest.Assert(t, err, nil) diff --git a/platforms/dexter/gopigo3/driver.go b/platforms/dexter/gopigo3/driver.go index 4574372f2..bbed8c56a 100644 --- a/platforms/dexter/gopigo3/driver.go +++ b/platforms/dexter/gopigo3/driver.go @@ -11,6 +11,7 @@ import ( "math" "time" + "github.com/hashicorp/go-multierror" "gobot.io/x/gobot/v2" "gobot.io/x/gobot/v2/drivers/spi" ) @@ -202,25 +203,23 @@ func (g *Driver) SetName(n string) { g.name = n } func (g *Driver) Connection() gobot.Connection { return g.connection.(gobot.Connection) } // Halt stops the driver. -func (g *Driver) Halt() (err error) { - g.resetAll() +func (g *Driver) Halt() error { + err := g.resetAll() time.Sleep(10 * time.Millisecond) - return + return err } // Start initializes the GoPiGo3 -func (g *Driver) Start() (err error) { +func (g *Driver) Start() error { bus := g.GetBusNumberOrDefault(g.connector.SpiDefaultBusNumber()) chip := g.GetChipNumberOrDefault(g.connector.SpiDefaultChipNumber()) mode := g.GetModeOrDefault(g.connector.SpiDefaultMode()) bits := g.GetBitCountOrDefault(g.connector.SpiDefaultBitCount()) maxSpeed := g.GetSpeedOrDefault(g.connector.SpiDefaultMaxSpeed()) + var err error g.connection, err = g.connector.GetSpiConnection(bus, chip, mode, bits, maxSpeed) - if err != nil { - return err - } - return nil + return err } // GetManufacturerName returns the manufacturer from the firmware. @@ -486,7 +485,7 @@ func (g *Driver) SetGroveMode(port Grove, mode GroveMode) error { } // SetPWMDuty sets the pwm duty cycle for the given pin/port. -func (g *Driver) SetPWMDuty(port Grove, duty uint16) (err error) { +func (g *Driver) SetPWMDuty(port Grove, duty uint16) error { if duty > 100 { duty = 100 } @@ -518,26 +517,23 @@ func (g *Driver) SetPWMFreq(port Grove, freq uint16) error { } // PwmWrite implents the pwm interface for the gopigo3. -func (g *Driver) PwmWrite(pin string, val byte) (err error) { +func (g *Driver) PwmWrite(pin string, val byte) error { var ( grovePin, grovePort Grove + err error ) - grovePin, grovePort, _, _, err = getGroveAddresses(pin) - if err != nil { + if grovePin, grovePort, _, _, err = getGroveAddresses(pin); err != nil { return err } - err = g.SetGroveType(grovePort, CUSTOM) - if err != nil { + if err := g.SetGroveType(grovePort, CUSTOM); err != nil { return err } time.Sleep(10 * time.Millisecond) - err = g.SetGroveMode(grovePin, GROVE_OUTPUT_PWM) - if err != nil { + if err = g.SetGroveMode(grovePin, GROVE_OUTPUT_PWM); err != nil { return err } time.Sleep(10 * time.Millisecond) - err = g.SetPWMFreq(grovePin, 24000) - if err != nil { + if err = g.SetPWMFreq(grovePin, 24000); err != nil { return err } val64 := math.Float64frombits(uint64(val)) @@ -555,13 +551,11 @@ func (g *Driver) AnalogRead(pin string) (value int, err error) { if err != nil { return value, err } - err = g.SetGroveType(grovePort, CUSTOM) - if err != nil { + if err := g.SetGroveType(grovePort, CUSTOM); err != nil { return value, err } time.Sleep(10 * time.Millisecond) - err = g.SetGroveMode(grovePin, GROVE_INPUT_ANALOG) - if err != nil { + if err := g.SetGroveMode(grovePin, GROVE_INPUT_ANALOG); err != nil { return value, err } time.Sleep(10 * time.Millisecond) @@ -581,31 +575,29 @@ func (g *Driver) AnalogRead(pin string) (value int, err error) { } // DigitalWrite writes a 0/1 value to the given pin. -func (g *Driver) DigitalWrite(pin string, val byte) (err error) { +func (g *Driver) DigitalWrite(pin string, val byte) error { var ( grovePin, grovePort Grove + err error ) grovePin, grovePort, _, _, err = getGroveAddresses(pin) if err != nil { return err } - err = g.SetGroveType(grovePort, CUSTOM) - if err != nil { + if err := g.SetGroveType(grovePort, CUSTOM); err != nil { return err } time.Sleep(10 * time.Millisecond) - err = g.SetGroveMode(grovePin, GROVE_OUTPUT_DIGITAL) - if err != nil { + if err := g.SetGroveMode(grovePin, GROVE_OUTPUT_DIGITAL); err != nil { return err } time.Sleep(10 * time.Millisecond) - err = g.writeBytes([]byte{ + return g.writeBytes([]byte{ goPiGo3Address, SET_GROVE_STATE, byte(grovePin), byte(val), }) - return err } // DigitalRead reads the 0/1 value from the given pin. @@ -717,17 +709,29 @@ func (g *Driver) readUint32(address, msg byte) (val uint32, err error) { return uint32(r[4])<<24 | uint32(r[5])<<16 | uint32(r[6])<<8 | uint32(r[7]), nil } -func (g *Driver) writeBytes(w []byte) (err error) { +func (g *Driver) writeBytes(w []byte) error { return g.connection.WriteBytes(w) } -func (g *Driver) resetAll() { - g.SetGroveType(AD_1_G+AD_2_G, CUSTOM) +func (g *Driver) resetAll() error { + err := g.SetGroveType(AD_1_G+AD_2_G, CUSTOM) time.Sleep(10 * time.Millisecond) - g.SetGroveMode(AD_1_G+AD_2_G, GROVE_INPUT_DIGITAL) + if e := g.SetGroveMode(AD_1_G+AD_2_G, GROVE_INPUT_DIGITAL); e != nil { + err = multierror.Append(err, e) + } time.Sleep(10 * time.Millisecond) - g.SetMotorPower(MOTOR_LEFT+MOTOR_RIGHT, 0.0) - g.SetMotorLimits(MOTOR_LEFT+MOTOR_RIGHT, 0, 0) - g.SetServo(SERVO_1+SERVO_2, 0) - g.SetLED(LED_EYE_LEFT+LED_EYE_RIGHT+LED_BLINKER_LEFT+LED_BLINKER_RIGHT, 0, 0, 0) + if e := g.SetMotorPower(MOTOR_LEFT+MOTOR_RIGHT, 0.0); e != nil { + err = multierror.Append(err, e) + } + if e := g.SetMotorLimits(MOTOR_LEFT+MOTOR_RIGHT, 0, 0); e != nil { + err = multierror.Append(err, e) + } + if e := g.SetServo(SERVO_1+SERVO_2, 0); e != nil { + err = multierror.Append(err, e) + } + if e := g.SetLED(LED_EYE_LEFT+LED_EYE_RIGHT+LED_BLINKER_LEFT+LED_BLINKER_RIGHT, 0, 0, 0); e != nil { + err = multierror.Append(err, e) + } + + return err } diff --git a/platforms/dexter/gopigo3/driver_test.go b/platforms/dexter/gopigo3/driver_test.go index ee55d7d9e..466376ae4 100644 --- a/platforms/dexter/gopigo3/driver_test.go +++ b/platforms/dexter/gopigo3/driver_test.go @@ -14,7 +14,7 @@ var negativeEncoder = false func initTestDriver() *Driver { d := NewDriver(&TestConnector{}) - d.Start() + _ = d.Start() return d } @@ -273,7 +273,6 @@ func (ctr *TestConnector) SpiDefaultMaxSpeed() int64 { } type TestSpiDevice struct { - bus spi.Connection } func (c TestSpiDevice) Close() error { diff --git a/platforms/digispark/digispark_i2c_test.go b/platforms/digispark/digispark_i2c_test.go index 484931408..d2e1f12cb 100644 --- a/platforms/digispark/digispark_i2c_test.go +++ b/platforms/digispark/digispark_i2c_test.go @@ -16,7 +16,6 @@ var _ i2c.Connector = (*Adaptor)(nil) var i2cData = []byte{5, 4, 3, 2, 1, 0} type i2cMock struct { - address int duration uint direction uint8 dataWritten []byte diff --git a/platforms/dji/tello/driver.go b/platforms/dji/tello/driver.go index 0553ed6eb..b4cb4c647 100644 --- a/platforms/dji/tello/driver.go +++ b/platforms/dji/tello/driver.go @@ -267,11 +267,19 @@ func (d *Driver) Start() error { go func() { defer d.addDoneChReaderCount(-1) - d.On(d.Event(ConnectedEvent), func(interface{}) { - d.SendDateTime() - d.processVideo() + err := d.On(d.Event(ConnectedEvent), func(interface{}) { + if err := d.SendDateTime(); err != nil { + panic(err) + } + if err := d.processVideo(); err != nil { + panic(err) + } }) + if err != nil { + panic(err) + } + cmdLoop: for { select { @@ -287,7 +295,9 @@ func (d *Driver) Start() error { }() // starts notifications coming from drone to video port normally 11111 - d.SendCommand(d.connectionString()) + if err := d.SendCommand(d.connectionString()); err != nil { + return err + } // send stick commands d.addDoneChReaderCount(1) @@ -300,8 +310,7 @@ func (d *Driver) Start() error { case <-d.doneCh: break stickCmdLoop default: - err := d.SendStickCommand() - if err != nil { + if err := d.SendStickCommand(); err != nil { fmt.Println("stick command error:", err) } time.Sleep(20 * time.Millisecond) @@ -313,10 +322,12 @@ func (d *Driver) Start() error { } // Halt stops the driver. -func (d *Driver) Halt() (err error) { +func (d *Driver) Halt() error { // send a landing command when we disconnect, and give it 500ms to be received before we shutdown if d.cmdConn != nil { - d.Land() + if err := d.Land(); err != nil { + return err + } } time.Sleep(500 * time.Millisecond) @@ -332,103 +343,146 @@ func (d *Driver) Halt() (err error) { d.doneCh <- struct{}{} } - return + return nil } // TakeOff tells drones to liftoff and start flying. -func (d *Driver) TakeOff() (err error) { +func (d *Driver) TakeOff() error { buf, _ := d.createPacket(takeoffCommand, 0x68, 0) d.seq++ - binary.Write(buf, binary.LittleEndian, d.seq) - binary.Write(buf, binary.LittleEndian, CalculateCRC16(buf.Bytes())) + if err := binary.Write(buf, binary.LittleEndian, d.seq); err != nil { + return err + } + if err := binary.Write(buf, binary.LittleEndian, CalculateCRC16(buf.Bytes())); err != nil { + return err + } - _, err = d.cmdConn.Write(buf.Bytes()) - return + _, err := d.cmdConn.Write(buf.Bytes()) + return err } // Throw & Go support -func (d *Driver) ThrowTakeOff() (err error) { +func (d *Driver) ThrowTakeOff() error { buf, _ := d.createPacket(throwtakeoffCommand, 0x48, 0) d.seq++ - binary.Write(buf, binary.LittleEndian, d.seq) - binary.Write(buf, binary.LittleEndian, CalculateCRC16(buf.Bytes())) + if err := binary.Write(buf, binary.LittleEndian, d.seq); err != nil { + return err + } + if err := binary.Write(buf, binary.LittleEndian, CalculateCRC16(buf.Bytes())); err != nil { + return err + } - _, err = d.cmdConn.Write(buf.Bytes()) - return + _, err := d.cmdConn.Write(buf.Bytes()) + return err } // Land tells drone to come in for landing. -func (d *Driver) Land() (err error) { +func (d *Driver) Land() error { buf, _ := d.createPacket(landCommand, 0x68, 1) d.seq++ - binary.Write(buf, binary.LittleEndian, d.seq) - binary.Write(buf, binary.LittleEndian, byte(0x00)) - binary.Write(buf, binary.LittleEndian, CalculateCRC16(buf.Bytes())) + if err := binary.Write(buf, binary.LittleEndian, d.seq); err != nil { + return err + } + if err := binary.Write(buf, binary.LittleEndian, byte(0x00)); err != nil { + return err + } + if err := binary.Write(buf, binary.LittleEndian, CalculateCRC16(buf.Bytes())); err != nil { + return err + } - _, err = d.cmdConn.Write(buf.Bytes()) - return + _, err := d.cmdConn.Write(buf.Bytes()) + return err } // StopLanding tells drone to stop landing. -func (d *Driver) StopLanding() (err error) { +func (d *Driver) StopLanding() error { buf, _ := d.createPacket(landCommand, 0x68, 1) d.seq++ - binary.Write(buf, binary.LittleEndian, d.seq) - binary.Write(buf, binary.LittleEndian, byte(0x01)) - binary.Write(buf, binary.LittleEndian, CalculateCRC16(buf.Bytes())) + if err := binary.Write(buf, binary.LittleEndian, d.seq); err != nil { + return err + } + if err := binary.Write(buf, binary.LittleEndian, byte(0x01)); err != nil { + return err + } + if err := binary.Write(buf, binary.LittleEndian, CalculateCRC16(buf.Bytes())); err != nil { + return err + } - _, err = d.cmdConn.Write(buf.Bytes()) - return + _, err := d.cmdConn.Write(buf.Bytes()) + return err } // PalmLand tells drone to come in for a hand landing. -func (d *Driver) PalmLand() (err error) { +func (d *Driver) PalmLand() error { buf, _ := d.createPacket(palmLandCommand, 0x68, 1) d.seq++ - binary.Write(buf, binary.LittleEndian, d.seq) - binary.Write(buf, binary.LittleEndian, byte(0x00)) - binary.Write(buf, binary.LittleEndian, CalculateCRC16(buf.Bytes())) + if err := binary.Write(buf, binary.LittleEndian, d.seq); err != nil { + return err + } + if err := binary.Write(buf, binary.LittleEndian, byte(0x00)); err != nil { + return err + } + if err := binary.Write(buf, binary.LittleEndian, CalculateCRC16(buf.Bytes())); err != nil { + return err + } - _, err = d.cmdConn.Write(buf.Bytes()) - return + _, err := d.cmdConn.Write(buf.Bytes()) + return err } // StartVideo tells Tello to send start info (SPS/PPS) for video stream. -func (d *Driver) StartVideo() (err error) { +func (d *Driver) StartVideo() error { buf, _ := d.createPacket(videoStartCommand, 0x60, 0) - binary.Write(buf, binary.LittleEndian, int16(0x00)) // seq = 0 - binary.Write(buf, binary.LittleEndian, CalculateCRC16(buf.Bytes())) + // seq = 0 + if err := binary.Write(buf, binary.LittleEndian, int16(0x00)); err != nil { + return err + } + if err := binary.Write(buf, binary.LittleEndian, CalculateCRC16(buf.Bytes())); err != nil { + return err + } - _, err = d.cmdConn.Write(buf.Bytes()) - return + _, err := d.cmdConn.Write(buf.Bytes()) + return err } // SetExposure sets the drone camera exposure level. Valid levels are 0, 1, and 2. -func (d *Driver) SetExposure(level int) (err error) { +func (d *Driver) SetExposure(level int) error { if level < 0 || level > 2 { return errors.New("Invalid exposure level") } buf, _ := d.createPacket(exposureCommand, 0x48, 1) d.seq++ - binary.Write(buf, binary.LittleEndian, d.seq) - binary.Write(buf, binary.LittleEndian, byte(level)) - binary.Write(buf, binary.LittleEndian, CalculateCRC16(buf.Bytes())) + if err := binary.Write(buf, binary.LittleEndian, d.seq); err != nil { + return err + } + if err := binary.Write(buf, binary.LittleEndian, byte(level)); err != nil { + return err + } + if err := binary.Write(buf, binary.LittleEndian, CalculateCRC16(buf.Bytes())); err != nil { + return err + } - _, err = d.cmdConn.Write(buf.Bytes()) - return + _, err := d.cmdConn.Write(buf.Bytes()) + return err } // SetVideoEncoderRate sets the drone video encoder rate. -func (d *Driver) SetVideoEncoderRate(rate VideoBitRate) (err error) { +func (d *Driver) SetVideoEncoderRate(rate VideoBitRate) error { buf, _ := d.createPacket(videoEncoderRateCommand, 0x68, 1) d.seq++ - binary.Write(buf, binary.LittleEndian, d.seq) - binary.Write(buf, binary.LittleEndian, byte(rate)) - binary.Write(buf, binary.LittleEndian, CalculateCRC16(buf.Bytes())) + if err := binary.Write(buf, binary.LittleEndian, d.seq); err != nil { + return err + } + if err := binary.Write(buf, binary.LittleEndian, byte(rate)); err != nil { + return err + } + if err := binary.Write(buf, binary.LittleEndian, CalculateCRC16(buf.Bytes())); err != nil { + return err + } - _, err = d.cmdConn.Write(buf.Bytes()) - return + _, err := d.cmdConn.Write(buf.Bytes()) + return err } // SetFastMode sets the drone throttle to 1. @@ -450,14 +504,18 @@ func (d *Driver) SetSlowMode() error { } // Rate queries the current video bit rate. -func (d *Driver) Rate() (err error) { +func (d *Driver) Rate() error { buf, _ := d.createPacket(videoRateQuery, 0x48, 0) d.seq++ - binary.Write(buf, binary.LittleEndian, d.seq) - binary.Write(buf, binary.LittleEndian, CalculateCRC16(buf.Bytes())) + if err := binary.Write(buf, binary.LittleEndian, d.seq); err != nil { + return err + } + if err := binary.Write(buf, binary.LittleEndian, CalculateCRC16(buf.Bytes())); err != nil { + return err + } - _, err = d.cmdConn.Write(buf.Bytes()) - return + _, err := d.cmdConn.Write(buf.Bytes()) + return err } // bound is a naive implementation that returns the smaller of x or y. @@ -650,89 +708,98 @@ func (d *Driver) CeaseRotation() { } // Bounce tells drone to start/stop performing the bouncing action -func (d *Driver) Bounce() (err error) { +func (d *Driver) Bounce() error { buf, _ := d.createPacket(bounceCommand, 0x68, 1) d.seq++ - binary.Write(buf, binary.LittleEndian, d.seq) + if err := binary.Write(buf, binary.LittleEndian, d.seq); err != nil { + return err + } + if d.bouncing { - binary.Write(buf, binary.LittleEndian, byte(0x31)) + if err := binary.Write(buf, binary.LittleEndian, byte(0x31)); err != nil { + return err + } } else { - binary.Write(buf, binary.LittleEndian, byte(0x30)) + if err := binary.Write(buf, binary.LittleEndian, byte(0x30)); err != nil { + return err + } + } + if err := binary.Write(buf, binary.LittleEndian, CalculateCRC16(buf.Bytes())); err != nil { + return err } - binary.Write(buf, binary.LittleEndian, CalculateCRC16(buf.Bytes())) - _, err = d.cmdConn.Write(buf.Bytes()) + _, err := d.cmdConn.Write(buf.Bytes()) d.bouncing = !d.bouncing - return + return err } // Flip tells drone to flip -func (d *Driver) Flip(direction FlipType) (err error) { +func (d *Driver) Flip(direction FlipType) error { buf, _ := d.createPacket(flipCommand, 0x70, 1) d.seq++ - binary.Write(buf, binary.LittleEndian, d.seq) - binary.Write(buf, binary.LittleEndian, byte(direction)) - binary.Write(buf, binary.LittleEndian, CalculateCRC16(buf.Bytes())) + if err := binary.Write(buf, binary.LittleEndian, d.seq); err != nil { + return err + } + if err := binary.Write(buf, binary.LittleEndian, byte(direction)); err != nil { + return err + } + if err := binary.Write(buf, binary.LittleEndian, CalculateCRC16(buf.Bytes())); err != nil { + return err + } - _, err = d.cmdConn.Write(buf.Bytes()) - return + _, err := d.cmdConn.Write(buf.Bytes()) + return err } // FrontFlip tells the drone to perform a front flip. -func (d *Driver) FrontFlip() (err error) { +func (d *Driver) FrontFlip() error { return d.Flip(FlipFront) } // BackFlip tells the drone to perform a back flip. -func (d *Driver) BackFlip() (err error) { +func (d *Driver) BackFlip() error { return d.Flip(FlipBack) } // RightFlip tells the drone to perform a flip to the right. -func (d *Driver) RightFlip() (err error) { +func (d *Driver) RightFlip() error { return d.Flip(FlipRight) } // LeftFlip tells the drone to perform a flip to the left. -func (d *Driver) LeftFlip() (err error) { +func (d *Driver) LeftFlip() error { return d.Flip(FlipLeft) } // ParseFlightData from drone -func (d *Driver) ParseFlightData(b []byte) (fd *FlightData, err error) { +func (d *Driver) ParseFlightData(b []byte) (*FlightData, error) { buf := bytes.NewReader(b) - fd = &FlightData{} + fd := &FlightData{} var data byte if buf.Len() < 24 { - err = errors.New("Invalid buffer length for flight data packet") + err := errors.New("Invalid buffer length for flight data packet") fmt.Println(err) - return + return fd, err } - err = binary.Read(buf, binary.LittleEndian, &fd.Height) - if err != nil { - return + if err := binary.Read(buf, binary.LittleEndian, &fd.Height); err != nil { + return fd, err } - err = binary.Read(buf, binary.LittleEndian, &fd.NorthSpeed) - if err != nil { - return + if err := binary.Read(buf, binary.LittleEndian, &fd.NorthSpeed); err != nil { + return fd, err } - err = binary.Read(buf, binary.LittleEndian, &fd.EastSpeed) - if err != nil { - return + if err := binary.Read(buf, binary.LittleEndian, &fd.EastSpeed); err != nil { + return fd, err } - err = binary.Read(buf, binary.LittleEndian, &fd.VerticalSpeed) - if err != nil { - return + if err := binary.Read(buf, binary.LittleEndian, &fd.VerticalSpeed); err != nil { + return fd, err } - err = binary.Read(buf, binary.LittleEndian, &fd.FlyTime) - if err != nil { - return + if err := binary.Read(buf, binary.LittleEndian, &fd.FlyTime); err != nil { + return fd, err } - err = binary.Read(buf, binary.LittleEndian, &data) - if err != nil { - return + if err := binary.Read(buf, binary.LittleEndian, &data); err != nil { + return fd, err } fd.ImuState = (data >> 0 & 0x1) == 1 fd.PressureState = (data >> 1 & 0x1) == 1 @@ -742,26 +809,21 @@ func (d *Driver) ParseFlightData(b []byte) (fd *FlightData, err error) { fd.GravityState = (data >> 5 & 0x1) == 1 fd.WindState = (data >> 7 & 0x1) == 1 - err = binary.Read(buf, binary.LittleEndian, &fd.ImuCalibrationState) - if err != nil { - return + if err := binary.Read(buf, binary.LittleEndian, &fd.ImuCalibrationState); err != nil { + return fd, err } - err = binary.Read(buf, binary.LittleEndian, &fd.BatteryPercentage) - if err != nil { - return + if err := binary.Read(buf, binary.LittleEndian, &fd.BatteryPercentage); err != nil { + return fd, err } - err = binary.Read(buf, binary.LittleEndian, &fd.DroneFlyTimeLeft) - if err != nil { - return + if err := binary.Read(buf, binary.LittleEndian, &fd.DroneFlyTimeLeft); err != nil { + return fd, err } - err = binary.Read(buf, binary.LittleEndian, &fd.DroneBatteryLeft) - if err != nil { - return + if err := binary.Read(buf, binary.LittleEndian, &fd.DroneBatteryLeft); err != nil { + return fd, err } - err = binary.Read(buf, binary.LittleEndian, &data) - if err != nil { - return + if err := binary.Read(buf, binary.LittleEndian, &data); err != nil { + return fd, err } fd.Flying = (data >> 0 & 0x1) == 1 fd.OnGround = (data >> 1 & 0x1) == 1 @@ -772,49 +834,46 @@ func (d *Driver) ParseFlightData(b []byte) (fd *FlightData, err error) { fd.BatteryLower = (data >> 6 & 0x1) == 1 fd.FactoryMode = (data >> 7 & 0x1) == 1 - err = binary.Read(buf, binary.LittleEndian, &fd.FlyMode) - if err != nil { - return + if err := binary.Read(buf, binary.LittleEndian, &fd.FlyMode); err != nil { + return fd, err } - err = binary.Read(buf, binary.LittleEndian, &fd.ThrowFlyTimer) - if err != nil { - return + if err := binary.Read(buf, binary.LittleEndian, &fd.ThrowFlyTimer); err != nil { + return fd, err } - err = binary.Read(buf, binary.LittleEndian, &fd.CameraState) - if err != nil { - return + if err := binary.Read(buf, binary.LittleEndian, &fd.CameraState); err != nil { + return fd, err } - err = binary.Read(buf, binary.LittleEndian, &data) - if err != nil { - return + if err := binary.Read(buf, binary.LittleEndian, &data); err != nil { + return fd, err } fd.ElectricalMachineryState = int16(data & 0xff) - err = binary.Read(buf, binary.LittleEndian, &data) - if err != nil { - return + if err := binary.Read(buf, binary.LittleEndian, &data); err != nil { + return fd, err } fd.FrontIn = (data >> 0 & 0x1) == 1 fd.FrontOut = (data >> 1 & 0x1) == 1 fd.FrontLSC = (data >> 2 & 0x1) == 1 - err = binary.Read(buf, binary.LittleEndian, &data) - if err != nil { - return + if err := binary.Read(buf, binary.LittleEndian, &data); err != nil { + return fd, err } fd.TemperatureHigh = (data >> 0 & 0x1) == 1 - return + return fd, nil } // SendStickCommand sends the joystick command packet to the drone. -func (d *Driver) SendStickCommand() (err error) { +func (d *Driver) SendStickCommand() error { d.cmdMutex.Lock() defer d.cmdMutex.Unlock() buf, _ := d.createPacket(stickCommand, 0x60, 11) - binary.Write(buf, binary.LittleEndian, int16(0x00)) // seq = 0 + // seq = 0 + if err := binary.Write(buf, binary.LittleEndian, int16(0x00)); err != nil { + return err + } // RightX center=1024 left =364 right =-364 axis1 := int16(660.0*d.rx + 1024.0) @@ -832,54 +891,94 @@ func (d *Driver) SendStickCommand() (err error) { axis5 := int16(d.throttle) packedAxis := int64(axis1)&0x7FF | int64(axis2&0x7FF)<<11 | 0x7FF&int64(axis3)<<22 | 0x7FF&int64(axis4)<<33 | int64(axis5)<<44 - binary.Write(buf, binary.LittleEndian, byte(0xFF&packedAxis)) - binary.Write(buf, binary.LittleEndian, byte(packedAxis>>8&0xFF)) - binary.Write(buf, binary.LittleEndian, byte(packedAxis>>16&0xFF)) - binary.Write(buf, binary.LittleEndian, byte(packedAxis>>24&0xFF)) - binary.Write(buf, binary.LittleEndian, byte(packedAxis>>32&0xFF)) - binary.Write(buf, binary.LittleEndian, byte(packedAxis>>40&0xFF)) + if err := binary.Write(buf, binary.LittleEndian, byte(0xFF&packedAxis)); err != nil { + return err + } + if err := binary.Write(buf, binary.LittleEndian, byte(packedAxis>>8&0xFF)); err != nil { + return err + } + if err := binary.Write(buf, binary.LittleEndian, byte(packedAxis>>16&0xFF)); err != nil { + return err + } + if err := binary.Write(buf, binary.LittleEndian, byte(packedAxis>>24&0xFF)); err != nil { + return err + } + if err := binary.Write(buf, binary.LittleEndian, byte(packedAxis>>32&0xFF)); err != nil { + return err + } + if err := binary.Write(buf, binary.LittleEndian, byte(packedAxis>>40&0xFF)); err != nil { + return err + } now := time.Now() - binary.Write(buf, binary.LittleEndian, byte(now.Hour())) - binary.Write(buf, binary.LittleEndian, byte(now.Minute())) - binary.Write(buf, binary.LittleEndian, byte(now.Second())) - binary.Write(buf, binary.LittleEndian, byte(now.UnixNano()/int64(time.Millisecond)&0xff)) - binary.Write(buf, binary.LittleEndian, byte(now.UnixNano()/int64(time.Millisecond)>>8)) + if err := binary.Write(buf, binary.LittleEndian, byte(now.Hour())); err != nil { + return err + } + if err := binary.Write(buf, binary.LittleEndian, byte(now.Minute())); err != nil { + return err + } + if err := binary.Write(buf, binary.LittleEndian, byte(now.Second())); err != nil { + return err + } + if err := binary.Write(buf, binary.LittleEndian, byte(now.UnixNano()/int64(time.Millisecond)&0xff)); err != nil { + return err + } + if err := binary.Write(buf, binary.LittleEndian, byte(now.UnixNano()/int64(time.Millisecond)>>8)); err != nil { + return err + } - binary.Write(buf, binary.LittleEndian, CalculateCRC16(buf.Bytes())) + if err := binary.Write(buf, binary.LittleEndian, CalculateCRC16(buf.Bytes())); err != nil { + return err + } - _, err = d.cmdConn.Write(buf.Bytes()) + _, err := d.cmdConn.Write(buf.Bytes()) - return + return err } // SendDateTime sends the current date/time to the drone. -func (d *Driver) SendDateTime() (err error) { +func (d *Driver) SendDateTime() error { d.cmdMutex.Lock() defer d.cmdMutex.Unlock() buf, _ := d.createPacket(timeCommand, 0x50, 11) d.seq++ - binary.Write(buf, binary.LittleEndian, d.seq) + if err := binary.Write(buf, binary.LittleEndian, d.seq); err != nil { + return err + } now := time.Now() - binary.Write(buf, binary.LittleEndian, byte(0x00)) - binary.Write(buf, binary.LittleEndian, int16(now.Hour())) - binary.Write(buf, binary.LittleEndian, int16(now.Minute())) - binary.Write(buf, binary.LittleEndian, int16(now.Second())) - binary.Write(buf, binary.LittleEndian, int16(now.UnixNano()/int64(time.Millisecond)&0xff)) - binary.Write(buf, binary.LittleEndian, int16(now.UnixNano()/int64(time.Millisecond)>>8)) + if err := binary.Write(buf, binary.LittleEndian, byte(0x00)); err != nil { + return err + } + if err := binary.Write(buf, binary.LittleEndian, int16(now.Hour())); err != nil { + return err + } + if err := binary.Write(buf, binary.LittleEndian, int16(now.Minute())); err != nil { + return err + } + if err := binary.Write(buf, binary.LittleEndian, int16(now.Second())); err != nil { + return err + } + if err := binary.Write(buf, binary.LittleEndian, int16(now.UnixNano()/int64(time.Millisecond)&0xff)); err != nil { + return err + } + if err := binary.Write(buf, binary.LittleEndian, int16(now.UnixNano()/int64(time.Millisecond)>>8)); err != nil { + return err + } - binary.Write(buf, binary.LittleEndian, CalculateCRC16(buf.Bytes())) + if err := binary.Write(buf, binary.LittleEndian, CalculateCRC16(buf.Bytes())); err != nil { + return err + } - _, err = d.cmdConn.Write(buf.Bytes()) - return + _, err := d.cmdConn.Write(buf.Bytes()) + return err } // SendCommand is used to send a text command such as the initial connection request to the drone. -func (d *Driver) SendCommand(cmd string) (err error) { - _, err = d.cmdConn.Write([]byte(cmd)) - return +func (d *Driver) SendCommand(cmd string) error { + _, err := d.cmdConn.Write([]byte(cmd)) + return err } func (d *Driver) handleResponse(r io.Reader) error { @@ -897,13 +996,15 @@ func (d *Driver) handleResponse(r io.Reader) error { case wifiMessage: buf := bytes.NewReader(buf[9:10]) wd := &WifiData{} - binary.Read(buf, binary.LittleEndian, &wd.Strength) - binary.Read(buf, binary.LittleEndian, &wd.Disturb) + // TODO: do not drop err, see #948 + _ = binary.Read(buf, binary.LittleEndian, &wd.Strength) + _ = binary.Read(buf, binary.LittleEndian, &wd.Disturb) d.Publish(d.Event(WifiDataEvent), wd) case lightMessage: buf := bytes.NewReader(buf[9:9]) var ld int8 - binary.Read(buf, binary.LittleEndian, &ld) + // TODO: do not drop err, see #948 + _ = binary.Read(buf, binary.LittleEndian, &ld) d.Publish(d.Event(LightStrengthEvent), ld) case logMessage: d.Publish(d.Event(LogEvent), buf[9:]) @@ -975,15 +1076,25 @@ func (d *Driver) processVideo() error { return nil } -func (d *Driver) createPacket(cmd int16, pktType byte, len int16) (buf *bytes.Buffer, err error) { +func (d *Driver) createPacket(cmd int16, pktType byte, len int16) (*bytes.Buffer, error) { l := len + 11 - buf = &bytes.Buffer{} + buf := &bytes.Buffer{} - binary.Write(buf, binary.LittleEndian, byte(messageStart)) - binary.Write(buf, binary.LittleEndian, l<<3) - binary.Write(buf, binary.LittleEndian, CalculateCRC8(buf.Bytes()[0:3])) - binary.Write(buf, binary.LittleEndian, pktType) - binary.Write(buf, binary.LittleEndian, cmd) + if err := binary.Write(buf, binary.LittleEndian, byte(messageStart)); err != nil { + return buf, err + } + if err := binary.Write(buf, binary.LittleEndian, l<<3); err != nil { + return buf, err + } + if err := binary.Write(buf, binary.LittleEndian, CalculateCRC8(buf.Bytes()[0:3])); err != nil { + return buf, err + } + if err := binary.Write(buf, binary.LittleEndian, pktType); err != nil { + return buf, err + } + if err := binary.Write(buf, binary.LittleEndian, cmd); err != nil { + return buf, err + } return buf, nil } diff --git a/platforms/dji/tello/driver_test.go b/platforms/dji/tello/driver_test.go index d7ff5346c..12f270ba8 100644 --- a/platforms/dji/tello/driver_test.go +++ b/platforms/dji/tello/driver_test.go @@ -176,7 +176,7 @@ func TestHaltShouldTerminateAllTheRelatedGoroutines(t *testing.T) { fmt.Println("Done routine 3.") }() - d.Halt() + _ = d.Halt() wg.Wait() gobottest.Assert(t, d.doneChReaderCount, int32(0)) @@ -186,7 +186,7 @@ func TestHaltNotWaitForeverWhenCalledMultipleTimes(t *testing.T) { d := NewDriver("8888") d.cmdConn = &WriteCloserDoNothing{} - d.Halt() - d.Halt() - d.Halt() + _ = d.Halt() + _ = d.Halt() + _ = d.Halt() } diff --git a/platforms/firmata/ble_firmata_adaptor.go b/platforms/firmata/ble_firmata_adaptor.go index fc90ea22d..2aa8d2a6c 100644 --- a/platforms/firmata/ble_firmata_adaptor.go +++ b/platforms/firmata/ble_firmata_adaptor.go @@ -40,7 +40,9 @@ func NewBLEAdaptor(args ...interface{}) *BLEAdaptor { a.SetName(gobot.DefaultName("BLEFirmata")) a.PortOpener = func(port string) (io.ReadWriteCloser, error) { sp := ble.NewSerialPort(address, rid, wid) - sp.Open() + if err := sp.Open(); err != nil { + return sp, err + } return sp, nil } diff --git a/platforms/firmata/client/client.go b/platforms/firmata/client/client.go index 0dea4217e..5b770265d 100644 --- a/platforms/firmata/client/client.go +++ b/platforms/firmata/client/client.go @@ -7,7 +7,6 @@ import ( "fmt" "io" "math" - "sync" "sync/atomic" "time" @@ -71,8 +70,6 @@ type Client struct { connection io.ReadWriteCloser analogPins []int ConnectTimeout time.Duration - initFunc func() error - initMutex sync.Mutex gobot.Eventer } @@ -131,7 +128,7 @@ func (b *Client) setConnected(c bool) { } // Disconnect disconnects the Client -func (b *Client) Disconnect() (err error) { +func (b *Client) Disconnect() error { b.setConnected(false) return b.connection.Close() } @@ -154,51 +151,67 @@ func (b *Client) Pins() []Pin { // Connect connects to the Client given conn. It first resets the firmata board // then continuously polls the firmata board for new information when it's // available. -func (b *Client) Connect(conn io.ReadWriteCloser) (err error) { +func (b *Client) Connect(conn io.ReadWriteCloser) error { if b.Connected() { return ErrConnected } b.connection = conn - b.Reset() + if err := b.Reset(); err != nil { + return err + } connected := make(chan bool, 1) connectError := make(chan error, 1) - b.Once(b.Event("ProtocolVersion"), func(data interface{}) { + if err := b.Once(b.Event("ProtocolVersion"), func(data interface{}) { e := b.FirmwareQuery() if e != nil { b.setConnecting(false) connectError <- e } - }) + }); err != nil { + return err + } - b.Once(b.Event("FirmwareQuery"), func(data interface{}) { + if err := b.Once(b.Event("FirmwareQuery"), func(data interface{}) { e := b.CapabilitiesQuery() if e != nil { b.setConnecting(false) connectError <- e } - }) + }); err != nil { + return err + } - b.Once(b.Event("CapabilityQuery"), func(data interface{}) { + if err := b.Once(b.Event("CapabilityQuery"), func(data interface{}) { e := b.AnalogMappingQuery() if e != nil { b.setConnecting(false) connectError <- e } - }) + }); err != nil { + return err + } - b.Once(b.Event("AnalogMappingQuery"), func(data interface{}) { - b.ReportDigital(0, 1) - b.ReportDigital(1, 1) + if err := b.Once(b.Event("AnalogMappingQuery"), func(data interface{}) { + if err := b.ReportDigital(0, 1); err != nil { + panic(err) + } + if err := b.ReportDigital(1, 1); err != nil { + panic(err) + } b.setConnecting(false) b.setConnected(true) connected <- true - }) + }); err != nil { + return err + } // start it off... b.setConnecting(true) - b.ProtocolVersionQuery() + if err := b.ProtocolVersionQuery(); err != nil { + return err + } go func() { for { @@ -233,7 +246,7 @@ func (b *Client) Connect(conn io.ReadWriteCloser) (err error) { } }() - return + return nil } // Reset sends the SystemReset sysex code. @@ -340,34 +353,33 @@ func (b *Client) I2cConfig(delay int) error { return b.WriteSysex([]byte{I2CConfig, byte(delay & 0xFF), byte((delay >> 8) & 0xFF)}) } -func (b *Client) togglePinReporting(pin int, state int, mode byte) (err error) { +func (b *Client) togglePinReporting(pin int, state int, mode byte) error { if state != 0 { state = 1 } else { state = 0 } - err = b.write([]byte{byte(mode) | byte(pin), byte(state)}) - return + return b.write([]byte{byte(mode) | byte(pin), byte(state)}) } // WriteSysex writes an arbitrary Sysex command to the microcontroller. -func (b *Client) WriteSysex(data []byte) (err error) { +func (b *Client) WriteSysex(data []byte) error { return b.write(append([]byte{StartSysex}, append(data, EndSysex)...)) } -func (b *Client) write(data []byte) (err error) { - _, err = b.connection.Write(data[:]) - return +func (b *Client) write(data []byte) error { + _, err := b.connection.Write(data[:]) + return err } -func (b *Client) read(n int) (buf []byte, err error) { - buf = make([]byte, n) - _, err = io.ReadFull(b.connection, buf) - return +func (b *Client) read(n int) ([]byte, error) { + buf := make([]byte, n) + _, err := io.ReadFull(b.connection, buf) + return buf, err } -func (b *Client) process() (err error) { +func (b *Client) process() error { msgBuf, err := b.read(1) if err != nil { return err @@ -527,5 +539,5 @@ func (b *Client) process() (err error) { b.Publish("SysexResponse", data) } } - return + return nil } diff --git a/platforms/firmata/client/client_test.go b/platforms/firmata/client/client_test.go index fb5b2b32c..b3d557c2a 100644 --- a/platforms/firmata/client/client_test.go +++ b/platforms/firmata/client/client_test.go @@ -95,7 +95,7 @@ func initTestFirmataWithReadWriteCloser(name string, data ...[]byte) (*Client, r for _, d := range data { rwc.addTestReadData(d) - b.process() + _ = b.process() } b.setConnected(true) @@ -128,12 +128,12 @@ func TestProcessProtocolVersion(t *testing.T) { b, rwc := initTestFirmataWithReadWriteCloser(t.Name()) rwc.addTestReadData(testDataProtocolResponse) - b.Once(b.Event("ProtocolVersion"), func(data interface{}) { + _ = b.Once(b.Event("ProtocolVersion"), func(data interface{}) { gobottest.Assert(t, data, "2.3") sem <- true }) - b.process() + _ = b.process() select { case <-sem: @@ -147,12 +147,12 @@ func TestProcessAnalogRead0(t *testing.T) { b, rwc := initTestFirmataWithReadWriteCloser(t.Name(), testDataCapabilitiesResponse, testDataAnalogMappingResponse) rwc.addTestReadData([]byte{0xE0, 0x23, 0x05}) - b.Once(b.Event("AnalogRead0"), func(data interface{}) { + _ = b.Once(b.Event("AnalogRead0"), func(data interface{}) { gobottest.Assert(t, data, 675) sem <- true }) - b.process() + _ = b.process() select { case <-sem: @@ -166,12 +166,12 @@ func TestProcessAnalogRead1(t *testing.T) { b, rwc := initTestFirmataWithReadWriteCloser(t.Name(), testDataCapabilitiesResponse, testDataAnalogMappingResponse) rwc.addTestReadData([]byte{0xE1, 0x23, 0x06}) - b.Once(b.Event("AnalogRead1"), func(data interface{}) { + _ = b.Once(b.Event("AnalogRead1"), func(data interface{}) { gobottest.Assert(t, data, 803) sem <- true }) - b.process() + _ = b.process() select { case <-sem: @@ -186,12 +186,12 @@ func TestProcessDigitalRead2(t *testing.T) { b.pins[2].Mode = Input rwc.addTestReadData([]byte{0x90, 0x04, 0x00}) - b.Once(b.Event("DigitalRead2"), func(data interface{}) { + _ = b.Once(b.Event("DigitalRead2"), func(data interface{}) { gobottest.Assert(t, data, 1) sem <- true }) - b.process() + _ = b.process() select { case <-sem: @@ -206,12 +206,12 @@ func TestProcessDigitalRead4(t *testing.T) { b.pins[4].Mode = Input rwc.addTestReadData([]byte{0x90, 0x16, 0x00}) - b.Once(b.Event("DigitalRead4"), func(data interface{}) { + _ = b.Once(b.Event("DigitalRead4"), func(data interface{}) { gobottest.Assert(t, data, 1) sem <- true }) - b.process() + _ = b.process() select { case <-sem: @@ -246,12 +246,12 @@ func TestProcessPinState13(t *testing.T) { b, rwc := initTestFirmataWithReadWriteCloser(t.Name(), testDataCapabilitiesResponse, testDataAnalogMappingResponse) rwc.addTestReadData([]byte{240, 110, 13, 1, 1, 247}) - b.Once(b.Event("PinState13"), func(data interface{}) { + _ = b.Once(b.Event("PinState13"), func(data interface{}) { gobottest.Assert(t, data, Pin{[]int{0, 1, 4}, 1, 0, 1, 127}) sem <- true }) - b.process() + _ = b.process() select { case <-sem: @@ -285,7 +285,7 @@ func TestProcessI2cReply(t *testing.T) { b, rwc := initTestFirmataWithReadWriteCloser(t.Name()) rwc.addTestReadData([]byte{240, 119, 9, 0, 0, 0, 24, 1, 1, 0, 26, 1, 247}) - b.Once(b.Event("I2cReply"), func(data interface{}) { + _ = b.Once(b.Event("I2cReply"), func(data interface{}) { gobottest.Assert(t, data, I2cReply{ Address: 9, Register: 0, @@ -294,7 +294,7 @@ func TestProcessI2cReply(t *testing.T) { sem <- true }) - b.process() + _ = b.process() select { case <-sem: @@ -308,12 +308,12 @@ func TestProcessFirmwareQuery(t *testing.T) { b, rwc := initTestFirmataWithReadWriteCloser(t.Name()) rwc.addTestReadData(testDataFirmwareResponse) - b.Once(b.Event("FirmwareQuery"), func(data interface{}) { + _ = b.Once(b.Event("FirmwareQuery"), func(data interface{}) { gobottest.Assert(t, data, "StandardFirmata.ino") sem <- true }) - b.process() + _ = b.process() select { case <-sem: @@ -327,12 +327,12 @@ func TestProcessStringData(t *testing.T) { b, rwc := initTestFirmataWithReadWriteCloser(t.Name()) rwc.addTestReadData(append([]byte{240, 0x71}, append([]byte("Hello Firmata!"), 247)...)) - b.Once(b.Event("StringData"), func(data interface{}) { + _ = b.Once(b.Event("StringData"), func(data interface{}) { gobottest.Assert(t, data, "Hello Firmata!") sem <- true }) - b.process() + _ = b.process() select { case <-sem: @@ -347,19 +347,19 @@ func TestConnect(t *testing.T) { rwc.addTestReadData(testDataProtocolResponse) - b.Once(b.Event("ProtocolVersion"), func(data interface{}) { + _ = b.Once(b.Event("ProtocolVersion"), func(data interface{}) { rwc.addTestReadData(testDataFirmwareResponse) }) - b.Once(b.Event("FirmwareQuery"), func(data interface{}) { + _ = b.Once(b.Event("FirmwareQuery"), func(data interface{}) { rwc.addTestReadData(testDataCapabilitiesResponse) }) - b.Once(b.Event("CapabilityQuery"), func(data interface{}) { + _ = b.Once(b.Event("CapabilityQuery"), func(data interface{}) { rwc.addTestReadData(testDataAnalogMappingResponse) }) - b.Once(b.Event("AnalogMappingQuery"), func(data interface{}) { + _ = b.Once(b.Event("AnalogMappingQuery"), func(data interface{}) { rwc.addTestReadData(testDataProtocolResponse) }) @@ -412,12 +412,12 @@ func TestProcessSysexData(t *testing.T) { b, rwc := initTestFirmataWithReadWriteCloser(t.Name()) rwc.addTestReadData([]byte{240, 17, 1, 2, 3, 247}) - b.Once("SysexResponse", func(data interface{}) { + _ = b.Once("SysexResponse", func(data interface{}) { gobottest.Assert(t, data, []byte{240, 17, 1, 2, 3, 247}) sem <- true }) - b.process() + _ = b.process() select { case <-sem: diff --git a/platforms/firmata/firmata_adaptor.go b/platforms/firmata/firmata_adaptor.go index 679c965ba..5686c2bc2 100644 --- a/platforms/firmata/firmata_adaptor.go +++ b/platforms/firmata/firmata_adaptor.go @@ -30,8 +30,8 @@ type firmataBoard interface { } type FirmataAdaptor interface { - Connect() (err error) - Finalize() (err error) + Connect() error + Finalize() error Name() string SetName(n string) WriteSysex(data []byte) error @@ -82,27 +82,25 @@ func NewAdaptor(args ...interface{}) *Adaptor { } // Connect starts a connection to the board. -func (f *Adaptor) Connect() (err error) { +func (f *Adaptor) Connect() error { if f.conn == nil { - sp, e := f.PortOpener(f.Port()) - if e != nil { - return e + sp, err := f.PortOpener(f.Port()) + if err != nil { + return err } f.conn = sp } - if err = f.Board.Connect(f.conn); err != nil { + if err := f.Board.Connect(f.conn); err != nil { return err } - f.Board.On("SysexResponse", func(data interface{}) { + return f.Board.On("SysexResponse", func(data interface{}) { f.Publish("SysexResponse", data) }) - - return } // Disconnect closes the io connection to the Board -func (f *Adaptor) Disconnect() (err error) { +func (f *Adaptor) Disconnect() error { if f.Board != nil { return f.Board.Disconnect() } @@ -110,9 +108,8 @@ func (f *Adaptor) Disconnect() (err error) { } // Finalize terminates the firmata connection -func (f *Adaptor) Finalize() (err error) { - err = f.Disconnect() - return err +func (f *Adaptor) Finalize() error { + return f.Disconnect() } // Port returns the Firmata Adaptors port @@ -135,7 +132,7 @@ func (f *Adaptor) ServoConfig(pin string, min, max int) error { } // ServoWrite writes the 0-180 degree angle to the specified pin. -func (f *Adaptor) ServoWrite(pin string, angle byte) (err error) { +func (f *Adaptor) ServoWrite(pin string, angle byte) error { p, err := strconv.Atoi(pin) if err != nil { return err @@ -147,12 +144,12 @@ func (f *Adaptor) ServoWrite(pin string, angle byte) (err error) { return err } } - err = f.Board.AnalogWrite(p, int(angle)) - return + + return f.Board.AnalogWrite(p, int(angle)) } // PwmWrite writes the 0-254 value to the specified pin -func (f *Adaptor) PwmWrite(pin string, level byte) (err error) { +func (f *Adaptor) PwmWrite(pin string, level byte) error { p, err := strconv.Atoi(pin) if err != nil { return err @@ -164,26 +161,24 @@ func (f *Adaptor) PwmWrite(pin string, level byte) (err error) { return err } } - err = f.Board.AnalogWrite(p, int(level)) - return + + return f.Board.AnalogWrite(p, int(level)) } // DigitalWrite writes a value to the pin. Acceptable values are 1 or 0. -func (f *Adaptor) DigitalWrite(pin string, level byte) (err error) { +func (f *Adaptor) DigitalWrite(pin string, level byte) error { p, err := strconv.Atoi(pin) if err != nil { - return + return err } if f.Board.Pins()[p].Mode != client.Output { - err = f.Board.SetPinMode(p, client.Output) - if err != nil { - return + if err = f.Board.SetPinMode(p, client.Output); err != nil { + return err } } - err = f.Board.DigitalWrite(p, int(level)) - return + return f.Board.DigitalWrite(p, int(level)) } // DigitalRead retrieves digital value from specified pin. @@ -209,21 +204,21 @@ func (f *Adaptor) DigitalRead(pin string) (val int, err error) { // AnalogRead retrieves value from analog pin. // Returns -1 if the response from the board has timed out -func (f *Adaptor) AnalogRead(pin string) (val int, err error) { +func (f *Adaptor) AnalogRead(pin string) (int, error) { p, err := strconv.Atoi(pin) if err != nil { - return + return 0, err } p = f.digitalPin(p) if f.Board.Pins()[p].Mode != client.Analog { - if err = f.Board.SetPinMode(p, client.Analog); err != nil { - return + if err := f.Board.SetPinMode(p, client.Analog); err != nil { + return 0, err } - if err = f.Board.ReportAnalog(p, 1); err != nil { - return + if err := f.Board.ReportAnalog(p, 1); err != nil { + return 0, err } <-time.After(10 * time.Millisecond) } @@ -242,12 +237,14 @@ func (f *Adaptor) digitalPin(pin int) int { // GetI2cConnection returns an i2c connection to a device on a specified bus. // Only supports bus number 0 -func (f *Adaptor) GetI2cConnection(address int, bus int) (connection i2c.Connection, err error) { +func (f *Adaptor) GetI2cConnection(address int, bus int) (i2c.Connection, error) { if bus != 0 { return nil, fmt.Errorf("Invalid bus number %d, only 0 is supported", bus) } - err = f.Board.I2cConfig(0) - return NewFirmataI2cConnection(f, address), err + if err := f.Board.I2cConfig(0); err != nil { + return nil, err + } + return NewFirmataI2cConnection(f, address), nil } // DefaultI2cBus returns the default i2c bus for this platform diff --git a/platforms/firmata/firmata_adaptor_test.go b/platforms/firmata/firmata_adaptor_test.go index 190c11387..e02fc1a10 100644 --- a/platforms/firmata/firmata_adaptor_test.go +++ b/platforms/firmata/firmata_adaptor_test.go @@ -94,7 +94,7 @@ func initTestAdaptor() *Adaptor { a.PortOpener = func(port string) (io.ReadWriteCloser, error) { return &readWriteCloser{}, nil } - a.Connect() + _ = a.Connect() return a } diff --git a/platforms/firmata/firmata_i2c.go b/platforms/firmata/firmata_i2c.go index fc74e48c8..ef7f67d02 100644 --- a/platforms/firmata/firmata_i2c.go +++ b/platforms/firmata/firmata_i2c.go @@ -194,38 +194,40 @@ func (c *firmataI2cConnection) writeAndCheckCount(buf []byte) error { return nil } -func (c *firmataI2cConnection) readInternal(b []byte) (read int, err error) { +func (c *firmataI2cConnection) readInternal(b []byte) (int, error) { ret := make(chan []byte) - if err = c.adaptor.Board.I2cRead(c.address, len(b)); err != nil { - return + if err := c.adaptor.Board.I2cRead(c.address, len(b)); err != nil { + return 0, err } - c.adaptor.Board.Once(c.adaptor.Board.Event("I2cReply"), func(data interface{}) { + if err := c.adaptor.Board.Once(c.adaptor.Board.Event("I2cReply"), func(data interface{}) { ret <- data.(client.I2cReply).Data - }) + }); err != nil { + return 0, err + } result := <-ret copy(b, result) - read = len(result) - - return + return len(result), nil } -func (c *firmataI2cConnection) writeInternal(data []byte) (written int, err error) { +func (c *firmataI2cConnection) writeInternal(data []byte) (int, error) { var chunk []byte + var written int for len(data) >= 16 { chunk, data = data[:16], data[16:] - err = c.adaptor.Board.I2cWrite(c.address, chunk) - if err != nil { - return + if err := c.adaptor.Board.I2cWrite(c.address, chunk); err != nil { + return written, err } written += len(chunk) } if len(data) > 0 { - err = c.adaptor.Board.I2cWrite(c.address, data[:]) + if err := c.adaptor.Board.I2cWrite(c.address, data[:]); err != nil { + return written, err + } written += len(data) } - return + return written, nil } diff --git a/platforms/firmata/firmata_i2c_test.go b/platforms/firmata/firmata_i2c_test.go index 131345c64..92d5169a6 100644 --- a/platforms/firmata/firmata_i2c_test.go +++ b/platforms/firmata/firmata_i2c_test.go @@ -20,7 +20,6 @@ type i2cMockFirmataBoard struct { i2cDataForRead []byte numBytesToRead int i2cWritten []byte - i2cWriteImpl func([]byte) (int, error) } // setup mock for i2c tests diff --git a/platforms/holystone/hs200/hs200_driver.go b/platforms/holystone/hs200/hs200_driver.go index 62fa1e747..c9f2808ef 100644 --- a/platforms/holystone/hs200/hs200_driver.go +++ b/platforms/holystone/hs200/hs200_driver.go @@ -116,7 +116,10 @@ func checksum(c []byte) byte { func (d *Driver) sendUDP() { d.mutex.RLock() defer d.mutex.RUnlock() - d.udpconn.Write(d.cmd) + + if _, err := d.udpconn.Write(d.cmd); err != nil { + panic(err) + } } // Enable enables the drone to start flying. diff --git a/platforms/intel-iot/curie/imu_driver.go b/platforms/intel-iot/curie/imu_driver.go index b9daf6108..ea1e7852f 100644 --- a/platforms/intel-iot/curie/imu_driver.go +++ b/platforms/intel-iot/curie/imu_driver.go @@ -73,18 +73,17 @@ func NewIMUDriver(a *firmata.Adaptor) *IMUDriver { } // Start starts up the IMUDriver -func (imu *IMUDriver) Start() (err error) { - imu.connection.On("SysexResponse", func(res interface{}) { +func (imu *IMUDriver) Start() error { + return imu.connection.On("SysexResponse", func(res interface{}) { data := res.([]byte) - imu.handleEvent(data) + if err := imu.handleEvent(data); err != nil { + panic(err) + } }) - return } // Halt stops the IMUDriver -func (imu *IMUDriver) Halt() (err error) { - return -} +func (imu *IMUDriver) Halt() error { return nil } // Name returns the IMUDriver's name func (imu *IMUDriver) Name() string { return imu.name } @@ -149,47 +148,54 @@ func (imu *IMUDriver) ReadMotion() error { return imu.connection.WriteSysex([]byte{CURIE_IMU, CURIE_IMU_READ_MOTION}) } -func (imu *IMUDriver) handleEvent(data []byte) (err error) { +func (imu *IMUDriver) handleEvent(data []byte) error { if data[1] == CURIE_IMU { switch data[2] { case CURIE_IMU_READ_ACCEL: - val, err := parseAccelerometerData(data) - if err == nil { + if val, err := parseAccelerometerData(data); err == nil { imu.Publish("Accelerometer", val) + } else { + return err } case CURIE_IMU_READ_GYRO: - val, err := parseGyroscopeData(data) - if err == nil { + if val, err := parseGyroscopeData(data); err == nil { imu.Publish("Gyroscope", val) + } else { + return err } case CURIE_IMU_READ_TEMP: - val, err := parseTemperatureData(data) - if err == nil { + if val, err := parseTemperatureData(data); err == nil { imu.Publish("Temperature", val) + } else { + return err } case CURIE_IMU_SHOCK_DETECT: - val, err := parseShockData(data) - if err == nil { + if val, err := parseShockData(data); err == nil { imu.Publish("Shock", val) + } else { + return err } case CURIE_IMU_STEP_COUNTER: - val, err := parseStepData(data) - if err == nil { + if val, err := parseStepData(data); err == nil { imu.Publish("Steps", val) + } else { + return err } case CURIE_IMU_TAP_DETECT: - val, err := parseTapData(data) - if err == nil { + if val, err := parseTapData(data); err == nil { imu.Publish("Tap", val) + } else { + return err } case CURIE_IMU_READ_MOTION: - val, err := parseMotionData(data) - if err == nil { + if val, err := parseMotionData(data); err == nil { imu.Publish("Motion", val) + } else { + return err } } } - return + return nil } func parseAccelerometerData(data []byte) (*AccelerometerData, error) { diff --git a/platforms/intel-iot/curie/imu_driver_test.go b/platforms/intel-iot/curie/imu_driver_test.go index 0d76e1719..845604931 100644 --- a/platforms/intel-iot/curie/imu_driver_test.go +++ b/platforms/intel-iot/curie/imu_driver_test.go @@ -115,7 +115,7 @@ func TestIMUDriverConnection(t *testing.T) { func TestIMUDriverReadAccelerometer(t *testing.T) { d := initTestIMUDriver() - d.Start() + _ = d.Start() gobottest.Assert(t, d.ReadAccelerometer(), nil) } @@ -130,7 +130,7 @@ func TestIMUDriverReadAccelerometerData(t *testing.T) { func TestIMUDriverReadGyroscope(t *testing.T) { d := initTestIMUDriver() - d.Start() + _ = d.Start() gobottest.Assert(t, d.ReadGyroscope(), nil) } @@ -145,7 +145,7 @@ func TestIMUDriverReadGyroscopeData(t *testing.T) { func TestIMUDriverReadTemperature(t *testing.T) { d := initTestIMUDriver() - d.Start() + _ = d.Start() gobottest.Assert(t, d.ReadTemperature(), nil) } @@ -160,7 +160,7 @@ func TestIMUDriverReadTemperatureData(t *testing.T) { func TestIMUDriverEnableShockDetection(t *testing.T) { d := initTestIMUDriver() - d.Start() + _ = d.Start() gobottest.Assert(t, d.EnableShockDetection(true), nil) } @@ -175,7 +175,7 @@ func TestIMUDriverShockDetectData(t *testing.T) { func TestIMUDriverEnableStepCounter(t *testing.T) { d := initTestIMUDriver() - d.Start() + _ = d.Start() gobottest.Assert(t, d.EnableStepCounter(true), nil) } @@ -190,7 +190,7 @@ func TestIMUDriverStepCountData(t *testing.T) { func TestIMUDriverEnableTapDetection(t *testing.T) { d := initTestIMUDriver() - d.Start() + _ = d.Start() gobottest.Assert(t, d.EnableTapDetection(true), nil) } @@ -205,7 +205,7 @@ func TestIMUDriverTapDetectData(t *testing.T) { func TestIMUDriverEnableReadMotion(t *testing.T) { d := initTestIMUDriver() - d.Start() + _ = d.Start() gobottest.Assert(t, d.ReadMotion(), nil) } @@ -220,7 +220,7 @@ func TestIMUDriverReadMotionData(t *testing.T) { func TestIMUDriverHandleEvents(t *testing.T) { d := initTestIMUDriver() - d.Start() + _ = d.Start() gobottest.Assert(t, d.handleEvent([]byte{0xF0, 0x11, 0x00, 0x00, 0x0f, 0x00, 0x0f, 0x00, 0x0f, 0xf7}), nil) gobottest.Assert(t, d.handleEvent([]byte{0xF0, 0x11, 0x01, 0x00, 0x0f, 0x00, 0x0f, 0x00, 0x0f, 0xf7}), nil) diff --git a/platforms/intel-iot/edison/edison_adaptor_test.go b/platforms/intel-iot/edison/edison_adaptor_test.go index 6c373a19a..68baab0d7 100644 --- a/platforms/intel-iot/edison/edison_adaptor_test.go +++ b/platforms/intel-iot/edison/edison_adaptor_test.go @@ -359,17 +359,17 @@ func TestConnectUnknown(t *testing.T) { func TestFinalize(t *testing.T) { a, fs := initTestAdaptorWithMockedFilesystem("arduino") - a.DigitalWrite("3", 1) - a.PwmWrite("5", 100) + _ = a.DigitalWrite("3", 1) + _ = a.PwmWrite("5", 100) - a.GetI2cConnection(0xff, 6) + _, _ = a.GetI2cConnection(0xff, 6) gobottest.Assert(t, a.Finalize(), nil) // assert that finalize after finalize is working gobottest.Assert(t, a.Finalize(), nil) // assert that re-connect is working - a.Connect() + _ = a.Connect() // remove one file to force Finalize error delete(fs.Files, "/sys/class/gpio/unexport") err := a.Finalize() @@ -380,7 +380,7 @@ func TestFinalize(t *testing.T) { func TestFinalizeError(t *testing.T) { a, fs := initTestAdaptorWithMockedFilesystem("arduino") - a.PwmWrite("5", 100) + _ = a.PwmWrite("5", 100) fs.WithWriteError = true err := a.Finalize() @@ -393,10 +393,10 @@ func TestFinalizeError(t *testing.T) { func TestDigitalIO(t *testing.T) { a, fs := initTestAdaptorWithMockedFilesystem("arduino") - a.DigitalWrite("13", 1) + _ = a.DigitalWrite("13", 1) gobottest.Assert(t, fs.Files["/sys/class/gpio/gpio40/value"].Contents, "1") - a.DigitalWrite("2", 0) + _ = a.DigitalWrite("2", 0) i, err := a.DigitalRead("2") gobottest.Assert(t, err, nil) gobottest.Assert(t, i, 0) @@ -407,7 +407,7 @@ func TestDigitalPinInFileError(t *testing.T) { fs := a.sys.UseMockFilesystem(pwmMockPathsMux40) delete(fs.Files, "/sys/class/gpio/gpio40/value") delete(fs.Files, "/sys/class/gpio/gpio40/direction") - a.Connect() + _ = a.Connect() _, err := a.DigitalPin("13") gobottest.Assert(t, strings.Contains(err.Error(), "no such file"), true) @@ -419,7 +419,7 @@ func TestDigitalPinInResistorFileError(t *testing.T) { fs := a.sys.UseMockFilesystem(pwmMockPathsMux40) delete(fs.Files, "/sys/class/gpio/gpio229/value") delete(fs.Files, "/sys/class/gpio/gpio229/direction") - a.Connect() + _ = a.Connect() _, err := a.DigitalPin("13") gobottest.Assert(t, strings.Contains(err.Error(), "no such file"), true) @@ -430,7 +430,7 @@ func TestDigitalPinInLevelShifterFileError(t *testing.T) { fs := a.sys.UseMockFilesystem(pwmMockPathsMux40) delete(fs.Files, "/sys/class/gpio/gpio261/value") delete(fs.Files, "/sys/class/gpio/gpio261/direction") - a.Connect() + _ = a.Connect() _, err := a.DigitalPin("13") gobottest.Assert(t, strings.Contains(err.Error(), "no such file"), true) @@ -441,7 +441,7 @@ func TestDigitalPinInMuxFileError(t *testing.T) { fs := a.sys.UseMockFilesystem(pwmMockPathsMux40) delete(fs.Files, "/sys/class/gpio/gpio243/value") delete(fs.Files, "/sys/class/gpio/gpio243/direction") - a.Connect() + _ = a.Connect() _, err := a.DigitalPin("13") gobottest.Assert(t, strings.Contains(err.Error(), "no such file"), true) @@ -489,7 +489,7 @@ func TestPwmEnableError(t *testing.T) { a := NewAdaptor() fs := a.sys.UseMockFilesystem(pwmMockPathsMux13) delete(fs.Files, "/sys/class/pwm/pwmchip0/pwm1/enable") - a.Connect() + _ = a.Connect() err := a.PwmWrite("5", 100) gobottest.Assert(t, strings.Contains(err.Error(), "/sys/class/pwm/pwmchip0/pwm1/enable: no such file"), true) @@ -609,7 +609,7 @@ func Test_validateI2cBusNumber(t *testing.T) { // arrange a := NewAdaptor(tc.board) a.sys.UseMockFilesystem(pwmMockPathsMux13ArduinoI2c) - a.Connect() + _ = a.Connect() // act err := a.validateAndSetupI2cBusNumber(tc.busNr) // assert diff --git a/platforms/intel-iot/joule/joule_adaptor_test.go b/platforms/intel-iot/joule/joule_adaptor_test.go index b25a8a7bb..43771dc06 100644 --- a/platforms/intel-iot/joule/joule_adaptor_test.go +++ b/platforms/intel-iot/joule/joule_adaptor_test.go @@ -107,8 +107,8 @@ func TestName(t *testing.T) { func TestFinalize(t *testing.T) { a, _ := initTestAdaptorWithMockedFilesystem() - a.DigitalWrite("J12_1", 1) - a.PwmWrite("J12_26", 100) + _ = a.DigitalWrite("J12_1", 1) + _ = a.PwmWrite("J12_26", 100) gobottest.Assert(t, a.Finalize(), nil) @@ -122,10 +122,10 @@ func TestFinalize(t *testing.T) { func TestDigitalIO(t *testing.T) { a, fs := initTestAdaptorWithMockedFilesystem() - a.DigitalWrite("J12_1", 1) + _ = a.DigitalWrite("J12_1", 1) gobottest.Assert(t, fs.Files["/sys/class/gpio/gpio451/value"].Contents, "1") - a.DigitalWrite("J12_1", 0) + _ = a.DigitalWrite("J12_1", 0) i, err := a.DigitalRead("J12_1") gobottest.Assert(t, err, nil) diff --git a/platforms/jetson/jetson_adaptor_test.go b/platforms/jetson/jetson_adaptor_test.go index 994083529..cc44db01a 100644 --- a/platforms/jetson/jetson_adaptor_test.go +++ b/platforms/jetson/jetson_adaptor_test.go @@ -56,9 +56,9 @@ func TestFinalize(t *testing.T) { } a, _ := initTestAdaptorWithMockedFilesystem(mockPaths) - a.DigitalWrite("3", 1) + _ = a.DigitalWrite("3", 1) - a.GetI2cConnection(0xff, 0) + _, _ = a.GetI2cConnection(0xff, 0) gobottest.Assert(t, a.Finalize(), nil) } @@ -136,7 +136,7 @@ func TestDigitalPinConcurrency(t *testing.T) { pinAsString := strconv.Itoa(i) go func(pin string) { defer wg.Done() - a.DigitalPin(pin) + _, _ = a.DigitalPin(pin) }(pinAsString) } diff --git a/platforms/joystick/joystick_adaptor.go b/platforms/joystick/joystick_adaptor.go index b5cdd5beb..2d5f93789 100644 --- a/platforms/joystick/joystick_adaptor.go +++ b/platforms/joystick/joystick_adaptor.go @@ -17,18 +17,20 @@ type joystick interface { type Adaptor struct { name string joystick joystick - connect func(*Adaptor) (err error) + connect func(*Adaptor) error } // NewAdaptor returns a new Joystick Adaptor. func NewAdaptor() *Adaptor { return &Adaptor{ name: gobot.DefaultName("Joystick"), - connect: func(j *Adaptor) (err error) { - sdl.Init(sdl.INIT_JOYSTICK) + connect: func(j *Adaptor) error { + if err := sdl.Init(sdl.INIT_JOYSTICK); err != nil { + return err + } if sdl.NumJoysticks() > 0 { j.joystick = sdl.JoystickOpen(0) - return + return nil } return errors.New("No joystick available") }, @@ -42,13 +44,12 @@ func (j *Adaptor) Name() string { return j.name } func (j *Adaptor) SetName(n string) { j.name = n } // Connect connects to the joystick -func (j *Adaptor) Connect() (err error) { - err = j.connect(j) - return +func (j *Adaptor) Connect() error { + return j.connect(j) } // Finalize closes connection to joystick -func (j *Adaptor) Finalize() (err error) { +func (j *Adaptor) Finalize() error { j.joystick.Close() - return + return nil } diff --git a/platforms/joystick/joystick_adaptor_test.go b/platforms/joystick/joystick_adaptor_test.go index 80bf5a0f3..4f11ca06a 100644 --- a/platforms/joystick/joystick_adaptor_test.go +++ b/platforms/joystick/joystick_adaptor_test.go @@ -37,6 +37,6 @@ func TestAdaptorConnect(t *testing.T) { func TestAdaptorFinalize(t *testing.T) { a := initTestAdaptor() - a.Connect() + _ = a.Connect() gobottest.Assert(t, a.Finalize(), nil) } diff --git a/platforms/joystick/joystick_driver.go b/platforms/joystick/joystick_driver.go index d473bfad3..09634c234 100644 --- a/platforms/joystick/joystick_driver.go +++ b/platforms/joystick/joystick_driver.go @@ -256,7 +256,10 @@ func (j *Driver) loadFile() error { } var jsontype joystickConfig - json.Unmarshal(file, &jsontype) + if err := json.Unmarshal(file, &jsontype); err != nil { + return err + } + j.config = jsontype return nil } diff --git a/platforms/joystick/joystick_driver_test.go b/platforms/joystick/joystick_driver_test.go index fa4ea047e..8084e8365 100644 --- a/platforms/joystick/joystick_driver_test.go +++ b/platforms/joystick/joystick_driver_test.go @@ -18,7 +18,7 @@ func initTestDriver(config string) *Driver { j.joystick = &testJoystick{} return nil } - a.Connect() + _ = a.Connect() d := NewDriver(a, config) d.poll = func() sdl.Event { return nil @@ -51,14 +51,14 @@ func TestDriverHalt(t *testing.T) { func TestDriverHandleEvent(t *testing.T) { sem := make(chan bool) d := initTestDriver("./configs/xbox360_power_a_mini_proex.json") - d.Start() + _ = d.Start() // left x stick - d.On(d.Event("left_x"), func(data interface{}) { + _ = d.On(d.Event("left_x"), func(data interface{}) { gobottest.Assert(t, int16(100), data.(int16)) sem <- true }) - d.handleEvent(&sdl.JoyAxisEvent{ + _ = d.handleEvent(&sdl.JoyAxisEvent{ Which: 0, Axis: 0, Value: 100, @@ -70,10 +70,10 @@ func TestDriverHandleEvent(t *testing.T) { } // x button press - d.On(d.Event("x_press"), func(data interface{}) { + _ = d.On(d.Event("x_press"), func(data interface{}) { sem <- true }) - d.handleEvent(&sdl.JoyButtonEvent{ + _ = d.handleEvent(&sdl.JoyButtonEvent{ Which: 0, Button: 2, State: 1, @@ -85,10 +85,10 @@ func TestDriverHandleEvent(t *testing.T) { } // x button release - d.On(d.Event("x_release"), func(data interface{}) { + _ = d.On(d.Event("x_release"), func(data interface{}) { sem <- true }) - d.handleEvent(&sdl.JoyButtonEvent{ + _ = d.handleEvent(&sdl.JoyButtonEvent{ Which: 0, Button: 2, State: 0, @@ -100,10 +100,10 @@ func TestDriverHandleEvent(t *testing.T) { } // down button press - d.On(d.Event("down_press"), func(data interface{}) { + _ = d.On(d.Event("down_press"), func(data interface{}) { sem <- true }) - d.handleEvent(&sdl.JoyHatEvent{ + _ = d.handleEvent(&sdl.JoyHatEvent{ Which: 0, Hat: 0, Value: 4, diff --git a/platforms/keyboard/keyboard_driver.go b/platforms/keyboard/keyboard_driver.go index fbfe856db..1e8dd0aec 100644 --- a/platforms/keyboard/keyboard_driver.go +++ b/platforms/keyboard/keyboard_driver.go @@ -15,7 +15,7 @@ const ( // Driver is gobot software device to the keyboard type Driver struct { name string - connect func(*Driver) (err error) + connect func(*Driver) error listen func(*Driver) stdin *os.File gobot.Eventer @@ -25,20 +25,22 @@ type Driver struct { func NewDriver() *Driver { k := &Driver{ name: gobot.DefaultName("Keyboard"), - connect: func(k *Driver) (err error) { + connect: func(k *Driver) error { if err := configure(); err != nil { return err } k.stdin = os.Stdin - return + return nil }, listen: func(k *Driver) { ctrlc := bytes{3} for { var keybuf bytes - k.stdin.Read(keybuf[0:3]) + if _, err := k.stdin.Read(keybuf[0:3]); err != nil { + panic(err) + } if keybuf == ctrlc { proc, err := os.FindProcess(os.Getpid()) @@ -46,7 +48,9 @@ func NewDriver() *Driver { log.Fatal(err) } - proc.Signal(os.Interrupt) + if err := proc.Signal(os.Interrupt); err != nil { + panic(err) + } break } @@ -73,20 +77,20 @@ func (k *Driver) Connection() gobot.Connection { return nil } // Start initializes keyboard by grabbing key events as they come in and // publishing each as a key event -func (k *Driver) Start() (err error) { - if err = k.connect(k); err != nil { +func (k *Driver) Start() error { + if err := k.connect(k); err != nil { return err } go k.listen(k) - return + return nil } // Halt stops keyboard driver -func (k *Driver) Halt() (err error) { +func (k *Driver) Halt() error { if originalState != "" { return restore() } - return + return nil } diff --git a/platforms/leap/leap_motion_driver.go b/platforms/leap/leap_motion_driver.go index a31025db1..f420d475f 100644 --- a/platforms/leap/leap_motion_driver.go +++ b/platforms/leap/leap_motion_driver.go @@ -3,6 +3,7 @@ package leap import ( "encoding/json" "io" + "log" "gobot.io/x/gobot/v2" "golang.org/x/net/websocket" @@ -38,7 +39,9 @@ func NewDriver(a *Adaptor) *Driver { connection: a, Eventer: gobot.NewEventer(), receive: func(ws io.ReadWriteCloser, msg *[]byte) { - websocket.Message.Receive(ws.(*websocket.Conn), msg) + if err := websocket.Message.Receive(ws.(*websocket.Conn), msg); err != nil { + panic(err) + } }, } @@ -62,15 +65,14 @@ func (l *Driver) adaptor() *Adaptor { return l.Connection().(*Adaptor) } -func enableFeature(l *Driver, feature string) (err error) { +func enableFeature(l *Driver, feature string) error { command := map[string]bool{feature: true} - b, e := json.Marshal(command) - if e != nil { - return e + b, err := json.Marshal(command) + if err != nil { + return err } - _, e = l.adaptor().ws.Write(b) - if e != nil { - return e + if _, err = l.adaptor().ws.Write(b); err != nil { + return err } return nil @@ -84,22 +86,26 @@ func enableFeature(l *Driver, feature string) (err error) { // "message" - Emits Frame on new message received from Leap. // "hand" - Emits Hand when detected in message from Leap. // "gesture" - Emits Gesture when detected in message from Leap. -func (l *Driver) Start() (err error) { - err = enableFeature(l, "enableGestures") - if err != nil { +func (l *Driver) Start() error { + if err := enableFeature(l, "enableGestures"); err != nil { return err } - err = enableFeature(l, "background") - if err != nil { + if err := enableFeature(l, "background"); err != nil { return err } go func() { var msg []byte var frame Frame + var err error for { l.receive(l.adaptor().ws, &msg) - frame = l.ParseFrame(msg) + frame, err = l.ParseFrame(msg) + if err != nil { + log.Println(err) + continue + } + l.Publish(MessageEvent, frame) for _, hand := range frame.Hands { @@ -112,8 +118,8 @@ func (l *Driver) Start() (err error) { } }() - return + return nil } // Halt returns nil if driver is halted successfully -func (l *Driver) Halt() (errs error) { return } +func (l *Driver) Halt() error { return nil } diff --git a/platforms/leap/leap_motion_driver_test.go b/platforms/leap/leap_motion_driver_test.go index 90267ac99..73dc0cd8c 100644 --- a/platforms/leap/leap_motion_driver_test.go +++ b/platforms/leap/leap_motion_driver_test.go @@ -43,7 +43,7 @@ func initTestLeapMotionDriver() (*Driver, *NullReadWriteCloser) { a.connect = func(port string) (io.ReadWriteCloser, error) { return rwc, nil } - a.Connect() + _ = a.Connect() d := NewDriver(a) d.receive = func(ws io.ReadWriteCloser, buf *[]byte) { @@ -83,7 +83,7 @@ func TestLeapMotionDriverHalt(t *testing.T) { func TestLeapMotionDriverParser(t *testing.T) { d, _ := initTestLeapMotionDriver() file, _ := os.ReadFile("./test/support/example_frame.json") - parsedFrame := d.ParseFrame(file) + parsedFrame, _ := d.ParseFrame(file) if parsedFrame.Hands == nil || parsedFrame.Pointables == nil || parsedFrame.Gestures == nil { t.Errorf("ParseFrame incorrectly parsed frame") diff --git a/platforms/leap/parser.go b/platforms/leap/parser.go index 53d615a90..ed10d81bf 100644 --- a/platforms/leap/parser.go +++ b/platforms/leap/parser.go @@ -6,20 +6,20 @@ import ( // Gesture is a Leap Motion gesture that has been detected type Gesture struct { - Center []float64 `json:"center"` - Direction []float64 `json:"direction"` - Duration int `json:"duration"` - HandIDs []int `json:"handIds"` - ID int `json:"id"` - Normal []float64 `json:"normal"` - PointableIDs []int `json:"pointableIds"` - Position []float64 `json:"position"` - Progress float64 `json:"progress"` - Radius float64 `json:"radius"` - Speed float64 `json:"speed"` - StartPosition []float64 `json:"StartPosition"` - State string `json:"state"` - Type string `json:"type"` + Center []float64 `json:"center"` + Direction []float64 `json:"direction"` + Duration int `json:"duration"` + HandIDs []int `json:"handIds"` + ID int `json:"id"` + Normal []float64 `json:"normal"` + PointableIDs []int `json:"pointableIds"` + Position []float64 `json:"position"` + Progress float64 `json:"progress"` + Radius float64 `json:"radius"` + Speed float64 `json:"speed"` + StartPosition []float64 `json:"StartPosition"` + State string `json:"state"` + Type string `json:"type"` } // Hand is a Leap Motion hand that has been detected @@ -48,26 +48,26 @@ type Hand struct { // Pointable is a Leap Motion pointing motion that has been detected type Pointable struct { - Bases [][][]float64 `json:"bases"` - BTipPosition []float64 `json:"btipPosition"` - CarpPosition []float64 `json:"carpPosition"` - DipPosition []float64 `json:"dipPosition"` - Direction []float64 `json:"direction"` - Extended bool `json:"extended"` - HandID int `json:"handId"` - ID int `json:"id"` - Length float64 `json:"length"` - MCPPosition []float64 `json:"mcpPosition"` - PIPPosition []float64 `json:"pipPosition"` - StabilizedTipPosition []float64 `json:"stabilizedTipPosition"` - TimeVisible float64 `json:"timeVisible"` - TipPosition []float64 `json:"tipPosition"` - TipVelocity []float64 `json:"tipVelocity"` - Tool bool `json:"tool"` - TouchDistance float64 `json:"touchDistance"` - TouchZone string `json:"touchZone"` - Type int `json:"type"` - Width float64 `json:"width"` + Bases [][][]float64 `json:"bases"` + BTipPosition []float64 `json:"btipPosition"` + CarpPosition []float64 `json:"carpPosition"` + DipPosition []float64 `json:"dipPosition"` + Direction []float64 `json:"direction"` + Extended bool `json:"extended"` + HandID int `json:"handId"` + ID int `json:"id"` + Length float64 `json:"length"` + MCPPosition []float64 `json:"mcpPosition"` + PIPPosition []float64 `json:"pipPosition"` + StabilizedTipPosition []float64 `json:"stabilizedTipPosition"` + TimeVisible float64 `json:"timeVisible"` + TipPosition []float64 `json:"tipPosition"` + TipVelocity []float64 `json:"tipVelocity"` + Tool bool `json:"tool"` + TouchDistance float64 `json:"touchDistance"` + TouchZone string `json:"touchZone"` + Type int `json:"type"` + Width float64 `json:"width"` } // InteractionBox is the area within which the gestural interaction has been detected @@ -106,8 +106,8 @@ func (h *Hand) Z() float64 { } // ParseFrame converts json data to a Frame -func (l *Driver) ParseFrame(data []byte) Frame { +func (l *Driver) ParseFrame(data []byte) (Frame, error) { var frame Frame - json.Unmarshal(data, &frame) - return frame + err := json.Unmarshal(data, &frame) + return frame, err } diff --git a/platforms/mavlink/common/common.go b/platforms/mavlink/common/common.go index 3ef977e2b..9b624b29c 100644 --- a/platforms/mavlink/common/common.go +++ b/platforms/mavlink/common/common.go @@ -1,3 +1,4 @@ +//nolint:errcheck // to much code to fix it immediately package mavlink // @@ -634,7 +635,6 @@ const ( MAV_DISTANCE_SENSOR_ENUM_END = 2 // | ) -// // MESSAGE HEARTBEAT // // MAVLINK_MSG_ID_HEARTBEAT 0 @@ -642,8 +642,6 @@ const ( // MAVLINK_MSG_ID_HEARTBEAT_LEN 9 // // MAVLINK_MSG_ID_HEARTBEAT_CRC 50 -// -// type Heartbeat struct { CUSTOM_MODE uint32 // A bitfield for use for autopilot-specific flags. TYPE uint8 // Type of the MAV (quadrotor, helicopter, etc., up to 15 types, defined in MAV_TYPE ENUM) @@ -703,7 +701,6 @@ func (m *Heartbeat) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.MAVLINK_VERSION) } -// // MESSAGE SYS_STATUS // // MAVLINK_MSG_ID_SYS_STATUS 1 @@ -711,8 +708,6 @@ func (m *Heartbeat) Decode(buf []byte) { // MAVLINK_MSG_ID_SYS_STATUS_LEN 31 // // MAVLINK_MSG_ID_SYS_STATUS_CRC 124 -// -// type SysStatus struct { ONBOARD_CONTROL_SENSORS_PRESENT uint32 // Bitmask showing which onboard controllers and sensors are present. Value of 0: not present. Value of 1: present. Indices defined by ENUM MAV_SYS_STATUS_SENSOR ONBOARD_CONTROL_SENSORS_ENABLED uint32 // Bitmask showing which onboard controllers and sensors are enabled: Value of 0: not enabled. Value of 1: enabled. Indices defined by ENUM MAV_SYS_STATUS_SENSOR @@ -800,7 +795,6 @@ func (m *SysStatus) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.BATTERY_REMAINING) } -// // MESSAGE SYSTEM_TIME // // MAVLINK_MSG_ID_SYSTEM_TIME 2 @@ -808,8 +802,6 @@ func (m *SysStatus) Decode(buf []byte) { // MAVLINK_MSG_ID_SYSTEM_TIME_LEN 12 // // MAVLINK_MSG_ID_SYSTEM_TIME_CRC 137 -// -// type SystemTime struct { TIME_UNIX_USEC uint64 // Timestamp of the master clock in microseconds since UNIX epoch. TIME_BOOT_MS uint32 // Timestamp of the component clock since boot time in milliseconds. @@ -853,7 +845,6 @@ func (m *SystemTime) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.TIME_BOOT_MS) } -// // MESSAGE PING // // MAVLINK_MSG_ID_PING 4 @@ -861,8 +852,6 @@ func (m *SystemTime) Decode(buf []byte) { // MAVLINK_MSG_ID_PING_LEN 14 // // MAVLINK_MSG_ID_PING_CRC 237 -// -// type Ping struct { TIME_USEC uint64 // Unix timestamp in microseconds SEQ uint32 // PING sequence @@ -914,7 +903,6 @@ func (m *Ping) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.TARGET_COMPONENT) } -// // MESSAGE CHANGE_OPERATOR_CONTROL // // MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL 5 @@ -922,8 +910,6 @@ func (m *Ping) Decode(buf []byte) { // MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_LEN 28 // // MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_CRC 217 -// -// type ChangeOperatorControl struct { TARGET_SYSTEM uint8 // System the GCS requests control for CONTROL_REQUEST uint8 // 0: request control of this MAV, 1: Release control of this MAV @@ -979,7 +965,6 @@ const ( MAVLINK_MSG_CHANGE_OPERATOR_CONTROL_FIELD_passkey_LEN = 25 ) -// // MESSAGE CHANGE_OPERATOR_CONTROL_ACK // // MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK 6 @@ -987,8 +972,6 @@ const ( // MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_LEN 3 // // MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_CRC 104 -// -// type ChangeOperatorControlAck struct { GCS_SYSTEM_ID uint8 // ID of the GCS this message CONTROL_REQUEST uint8 // 0: request control of this MAV, 1: Release control of this MAV @@ -1036,7 +1019,6 @@ func (m *ChangeOperatorControlAck) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.ACK) } -// // MESSAGE AUTH_KEY // // MAVLINK_MSG_ID_AUTH_KEY 7 @@ -1044,8 +1026,6 @@ func (m *ChangeOperatorControlAck) Decode(buf []byte) { // MAVLINK_MSG_ID_AUTH_KEY_LEN 32 // // MAVLINK_MSG_ID_AUTH_KEY_CRC 119 -// -// type AuthKey struct { KEY [32]uint8 // key } @@ -1089,7 +1069,6 @@ const ( MAVLINK_MSG_AUTH_KEY_FIELD_key_LEN = 32 ) -// // MESSAGE SET_MODE // // MAVLINK_MSG_ID_SET_MODE 11 @@ -1097,8 +1076,6 @@ const ( // MAVLINK_MSG_ID_SET_MODE_LEN 6 // // MAVLINK_MSG_ID_SET_MODE_CRC 89 -// -// type SetMode struct { CUSTOM_MODE uint32 // The new autopilot-specific mode. This field can be ignored by an autopilot. TARGET_SYSTEM uint8 // The system setting the mode @@ -1146,7 +1123,6 @@ func (m *SetMode) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.BASE_MODE) } -// // MESSAGE PARAM_REQUEST_READ // // MAVLINK_MSG_ID_PARAM_REQUEST_READ 20 @@ -1154,8 +1130,6 @@ func (m *SetMode) Decode(buf []byte) { // MAVLINK_MSG_ID_PARAM_REQUEST_READ_LEN 20 // // MAVLINK_MSG_ID_PARAM_REQUEST_READ_CRC 214 -// -// type ParamRequestRead struct { PARAM_INDEX int16 // Parameter index. Send -1 to use the param ID field as identifier (else the param id will be ignored) TARGET_SYSTEM uint8 // System ID @@ -1211,7 +1185,6 @@ const ( MAVLINK_MSG_PARAM_REQUEST_READ_FIELD_param_id_LEN = 16 ) -// // MESSAGE PARAM_REQUEST_LIST // // MAVLINK_MSG_ID_PARAM_REQUEST_LIST 21 @@ -1219,8 +1192,6 @@ const ( // MAVLINK_MSG_ID_PARAM_REQUEST_LIST_LEN 2 // // MAVLINK_MSG_ID_PARAM_REQUEST_LIST_CRC 159 -// -// type ParamRequestList struct { TARGET_SYSTEM uint8 // System ID TARGET_COMPONENT uint8 // Component ID @@ -1264,7 +1235,6 @@ func (m *ParamRequestList) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.TARGET_COMPONENT) } -// // MESSAGE PARAM_VALUE // // MAVLINK_MSG_ID_PARAM_VALUE 22 @@ -1272,8 +1242,6 @@ func (m *ParamRequestList) Decode(buf []byte) { // MAVLINK_MSG_ID_PARAM_VALUE_LEN 25 // // MAVLINK_MSG_ID_PARAM_VALUE_CRC 220 -// -// type ParamValue struct { PARAM_VALUE float32 // Onboard parameter value PARAM_COUNT uint16 // Total number of onboard parameters @@ -1333,7 +1301,6 @@ const ( MAVLINK_MSG_PARAM_VALUE_FIELD_param_id_LEN = 16 ) -// // MESSAGE PARAM_SET // // MAVLINK_MSG_ID_PARAM_SET 23 @@ -1341,8 +1308,6 @@ const ( // MAVLINK_MSG_ID_PARAM_SET_LEN 23 // // MAVLINK_MSG_ID_PARAM_SET_CRC 168 -// -// type ParamSet struct { PARAM_VALUE float32 // Onboard parameter value TARGET_SYSTEM uint8 // System ID @@ -1402,7 +1367,6 @@ const ( MAVLINK_MSG_PARAM_SET_FIELD_param_id_LEN = 16 ) -// // MESSAGE GPS_RAW_INT // // MAVLINK_MSG_ID_GPS_RAW_INT 24 @@ -1410,8 +1374,6 @@ const ( // MAVLINK_MSG_ID_GPS_RAW_INT_LEN 30 // // MAVLINK_MSG_ID_GPS_RAW_INT_CRC 24 -// -// type GpsRawInt struct { TIME_USEC uint64 // Timestamp (microseconds since UNIX epoch or microseconds since system boot) LAT int32 // Latitude (WGS84), in degrees * 1E7 @@ -1487,7 +1449,6 @@ func (m *GpsRawInt) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.SATELLITES_VISIBLE) } -// // MESSAGE GPS_STATUS // // MAVLINK_MSG_ID_GPS_STATUS 25 @@ -1495,8 +1456,6 @@ func (m *GpsRawInt) Decode(buf []byte) { // MAVLINK_MSG_ID_GPS_STATUS_LEN 101 // // MAVLINK_MSG_ID_GPS_STATUS_CRC 23 -// -// type GpsStatus struct { SATELLITES_VISIBLE uint8 // Number of satellites visible SATELLITE_PRN [20]uint8 // Global satellite ID @@ -1564,7 +1523,6 @@ const ( MAVLINK_MSG_GPS_STATUS_FIELD_satellite_snr_LEN = 20 ) -// // MESSAGE SCALED_IMU // // MAVLINK_MSG_ID_SCALED_IMU 26 @@ -1572,8 +1530,6 @@ const ( // MAVLINK_MSG_ID_SCALED_IMU_LEN 22 // // MAVLINK_MSG_ID_SCALED_IMU_CRC 170 -// -// type ScaledImu struct { TIME_BOOT_MS uint32 // Timestamp (milliseconds since system boot) XACC int16 // X acceleration (mg) @@ -1649,7 +1605,6 @@ func (m *ScaledImu) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.ZMAG) } -// // MESSAGE RAW_IMU // // MAVLINK_MSG_ID_RAW_IMU 27 @@ -1657,8 +1612,6 @@ func (m *ScaledImu) Decode(buf []byte) { // MAVLINK_MSG_ID_RAW_IMU_LEN 26 // // MAVLINK_MSG_ID_RAW_IMU_CRC 144 -// -// type RawImu struct { TIME_USEC uint64 // Timestamp (microseconds since UNIX epoch or microseconds since system boot) XACC int16 // X acceleration (raw) @@ -1734,7 +1687,6 @@ func (m *RawImu) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.ZMAG) } -// // MESSAGE RAW_PRESSURE // // MAVLINK_MSG_ID_RAW_PRESSURE 28 @@ -1742,8 +1694,6 @@ func (m *RawImu) Decode(buf []byte) { // MAVLINK_MSG_ID_RAW_PRESSURE_LEN 16 // // MAVLINK_MSG_ID_RAW_PRESSURE_CRC 67 -// -// type RawPressure struct { TIME_USEC uint64 // Timestamp (microseconds since UNIX epoch or microseconds since system boot) PRESS_ABS int16 // Absolute pressure (raw) @@ -1799,7 +1749,6 @@ func (m *RawPressure) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.TEMPERATURE) } -// // MESSAGE SCALED_PRESSURE // // MAVLINK_MSG_ID_SCALED_PRESSURE 29 @@ -1807,8 +1756,6 @@ func (m *RawPressure) Decode(buf []byte) { // MAVLINK_MSG_ID_SCALED_PRESSURE_LEN 14 // // MAVLINK_MSG_ID_SCALED_PRESSURE_CRC 115 -// -// type ScaledPressure struct { TIME_BOOT_MS uint32 // Timestamp (milliseconds since system boot) PRESS_ABS float32 // Absolute pressure (hectopascal) @@ -1860,7 +1807,6 @@ func (m *ScaledPressure) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.TEMPERATURE) } -// // MESSAGE ATTITUDE // // MAVLINK_MSG_ID_ATTITUDE 30 @@ -1868,8 +1814,6 @@ func (m *ScaledPressure) Decode(buf []byte) { // MAVLINK_MSG_ID_ATTITUDE_LEN 28 // // MAVLINK_MSG_ID_ATTITUDE_CRC 39 -// -// type Attitude struct { TIME_BOOT_MS uint32 // Timestamp (milliseconds since system boot) ROLL float32 // Roll angle (rad, -pi..+pi) @@ -1933,7 +1877,6 @@ func (m *Attitude) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.YAWSPEED) } -// // MESSAGE ATTITUDE_QUATERNION // // MAVLINK_MSG_ID_ATTITUDE_QUATERNION 31 @@ -1941,8 +1884,6 @@ func (m *Attitude) Decode(buf []byte) { // MAVLINK_MSG_ID_ATTITUDE_QUATERNION_LEN 32 // // MAVLINK_MSG_ID_ATTITUDE_QUATERNION_CRC 246 -// -// type AttitudeQuaternion struct { TIME_BOOT_MS uint32 // Timestamp (milliseconds since system boot) Q1 float32 // Quaternion component 1, w (1 in null-rotation) @@ -2010,7 +1951,6 @@ func (m *AttitudeQuaternion) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.YAWSPEED) } -// // MESSAGE LOCAL_POSITION_NED // // MAVLINK_MSG_ID_LOCAL_POSITION_NED 32 @@ -2018,8 +1958,6 @@ func (m *AttitudeQuaternion) Decode(buf []byte) { // MAVLINK_MSG_ID_LOCAL_POSITION_NED_LEN 28 // // MAVLINK_MSG_ID_LOCAL_POSITION_NED_CRC 185 -// -// type LocalPositionNed struct { TIME_BOOT_MS uint32 // Timestamp (milliseconds since system boot) X float32 // X Position @@ -2083,7 +2021,6 @@ func (m *LocalPositionNed) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.VZ) } -// // MESSAGE GLOBAL_POSITION_INT // // MAVLINK_MSG_ID_GLOBAL_POSITION_INT 33 @@ -2091,8 +2028,6 @@ func (m *LocalPositionNed) Decode(buf []byte) { // MAVLINK_MSG_ID_GLOBAL_POSITION_INT_LEN 28 // // MAVLINK_MSG_ID_GLOBAL_POSITION_INT_CRC 104 -// -// type GlobalPositionInt struct { TIME_BOOT_MS uint32 // Timestamp (milliseconds since system boot) LAT int32 // Latitude, expressed as * 1E7 @@ -2164,7 +2099,6 @@ func (m *GlobalPositionInt) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.HDG) } -// // MESSAGE RC_CHANNELS_SCALED // // MAVLINK_MSG_ID_RC_CHANNELS_SCALED 34 @@ -2172,8 +2106,6 @@ func (m *GlobalPositionInt) Decode(buf []byte) { // MAVLINK_MSG_ID_RC_CHANNELS_SCALED_LEN 22 // // MAVLINK_MSG_ID_RC_CHANNELS_SCALED_CRC 237 -// -// type RcChannelsScaled struct { TIME_BOOT_MS uint32 // Timestamp (milliseconds since system boot) CHAN1_SCALED int16 // RC channel 1 value scaled, (-100%) -10000, (0%) 0, (100%) 10000, (invalid) INT16_MAX. @@ -2253,7 +2185,6 @@ func (m *RcChannelsScaled) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.RSSI) } -// // MESSAGE RC_CHANNELS_RAW // // MAVLINK_MSG_ID_RC_CHANNELS_RAW 35 @@ -2261,8 +2192,6 @@ func (m *RcChannelsScaled) Decode(buf []byte) { // MAVLINK_MSG_ID_RC_CHANNELS_RAW_LEN 22 // // MAVLINK_MSG_ID_RC_CHANNELS_RAW_CRC 244 -// -// type RcChannelsRaw struct { TIME_BOOT_MS uint32 // Timestamp (milliseconds since system boot) CHAN1_RAW uint16 // RC channel 1 value, in microseconds. A value of UINT16_MAX implies the channel is unused. @@ -2342,7 +2271,6 @@ func (m *RcChannelsRaw) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.RSSI) } -// // MESSAGE SERVO_OUTPUT_RAW // // MAVLINK_MSG_ID_SERVO_OUTPUT_RAW 36 @@ -2350,8 +2278,6 @@ func (m *RcChannelsRaw) Decode(buf []byte) { // MAVLINK_MSG_ID_SERVO_OUTPUT_RAW_LEN 21 // // MAVLINK_MSG_ID_SERVO_OUTPUT_RAW_CRC 222 -// -// type ServoOutputRaw struct { TIME_USEC uint32 // Timestamp (microseconds since system boot) SERVO1_RAW uint16 // Servo output 1 value, in microseconds @@ -2427,7 +2353,6 @@ func (m *ServoOutputRaw) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.PORT) } -// // MESSAGE MISSION_REQUEST_PARTIAL_LIST // // MAVLINK_MSG_ID_MISSION_REQUEST_PARTIAL_LIST 37 @@ -2435,8 +2360,6 @@ func (m *ServoOutputRaw) Decode(buf []byte) { // MAVLINK_MSG_ID_MISSION_REQUEST_PARTIAL_LIST_LEN 6 // // MAVLINK_MSG_ID_MISSION_REQUEST_PARTIAL_LIST_CRC 212 -// -// type MissionRequestPartialList struct { START_INDEX int16 // Start index, 0 by default END_INDEX int16 // End index, -1 by default (-1: send list to end). Else a valid index of the list @@ -2488,7 +2411,6 @@ func (m *MissionRequestPartialList) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.TARGET_COMPONENT) } -// // MESSAGE MISSION_WRITE_PARTIAL_LIST // // MAVLINK_MSG_ID_MISSION_WRITE_PARTIAL_LIST 38 @@ -2496,8 +2418,6 @@ func (m *MissionRequestPartialList) Decode(buf []byte) { // MAVLINK_MSG_ID_MISSION_WRITE_PARTIAL_LIST_LEN 6 // // MAVLINK_MSG_ID_MISSION_WRITE_PARTIAL_LIST_CRC 9 -// -// type MissionWritePartialList struct { START_INDEX int16 // Start index, 0 by default and smaller / equal to the largest index of the current onboard list. END_INDEX int16 // End index, equal or greater than start index. @@ -2549,7 +2469,6 @@ func (m *MissionWritePartialList) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.TARGET_COMPONENT) } -// // MESSAGE MISSION_ITEM // // MAVLINK_MSG_ID_MISSION_ITEM 39 @@ -2557,8 +2476,6 @@ func (m *MissionWritePartialList) Decode(buf []byte) { // MAVLINK_MSG_ID_MISSION_ITEM_LEN 37 // // MAVLINK_MSG_ID_MISSION_ITEM_CRC 254 -// -// type MissionItem struct { PARAM1 float32 // PARAM1, see MAV_CMD enum PARAM2 float32 // PARAM2, see MAV_CMD enum @@ -2650,7 +2567,6 @@ func (m *MissionItem) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.AUTOCONTINUE) } -// // MESSAGE MISSION_REQUEST // // MAVLINK_MSG_ID_MISSION_REQUEST 40 @@ -2658,8 +2574,6 @@ func (m *MissionItem) Decode(buf []byte) { // MAVLINK_MSG_ID_MISSION_REQUEST_LEN 4 // // MAVLINK_MSG_ID_MISSION_REQUEST_CRC 230 -// -// type MissionRequest struct { SEQ uint16 // Sequence TARGET_SYSTEM uint8 // System ID @@ -2707,7 +2621,6 @@ func (m *MissionRequest) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.TARGET_COMPONENT) } -// // MESSAGE MISSION_SET_CURRENT // // MAVLINK_MSG_ID_MISSION_SET_CURRENT 41 @@ -2715,8 +2628,6 @@ func (m *MissionRequest) Decode(buf []byte) { // MAVLINK_MSG_ID_MISSION_SET_CURRENT_LEN 4 // // MAVLINK_MSG_ID_MISSION_SET_CURRENT_CRC 28 -// -// type MissionSetCurrent struct { SEQ uint16 // Sequence TARGET_SYSTEM uint8 // System ID @@ -2764,7 +2675,6 @@ func (m *MissionSetCurrent) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.TARGET_COMPONENT) } -// // MESSAGE MISSION_CURRENT // // MAVLINK_MSG_ID_MISSION_CURRENT 42 @@ -2772,8 +2682,6 @@ func (m *MissionSetCurrent) Decode(buf []byte) { // MAVLINK_MSG_ID_MISSION_CURRENT_LEN 2 // // MAVLINK_MSG_ID_MISSION_CURRENT_CRC 28 -// -// type MissionCurrent struct { SEQ uint16 // Sequence } @@ -2813,7 +2721,6 @@ func (m *MissionCurrent) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.SEQ) } -// // MESSAGE MISSION_REQUEST_LIST // // MAVLINK_MSG_ID_MISSION_REQUEST_LIST 43 @@ -2821,8 +2728,6 @@ func (m *MissionCurrent) Decode(buf []byte) { // MAVLINK_MSG_ID_MISSION_REQUEST_LIST_LEN 2 // // MAVLINK_MSG_ID_MISSION_REQUEST_LIST_CRC 132 -// -// type MissionRequestList struct { TARGET_SYSTEM uint8 // System ID TARGET_COMPONENT uint8 // Component ID @@ -2866,7 +2771,6 @@ func (m *MissionRequestList) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.TARGET_COMPONENT) } -// // MESSAGE MISSION_COUNT // // MAVLINK_MSG_ID_MISSION_COUNT 44 @@ -2874,8 +2778,6 @@ func (m *MissionRequestList) Decode(buf []byte) { // MAVLINK_MSG_ID_MISSION_COUNT_LEN 4 // // MAVLINK_MSG_ID_MISSION_COUNT_CRC 221 -// -// type MissionCount struct { COUNT uint16 // Number of mission items in the sequence TARGET_SYSTEM uint8 // System ID @@ -2923,7 +2825,6 @@ func (m *MissionCount) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.TARGET_COMPONENT) } -// // MESSAGE MISSION_CLEAR_ALL // // MAVLINK_MSG_ID_MISSION_CLEAR_ALL 45 @@ -2931,8 +2832,6 @@ func (m *MissionCount) Decode(buf []byte) { // MAVLINK_MSG_ID_MISSION_CLEAR_ALL_LEN 2 // // MAVLINK_MSG_ID_MISSION_CLEAR_ALL_CRC 232 -// -// type MissionClearAll struct { TARGET_SYSTEM uint8 // System ID TARGET_COMPONENT uint8 // Component ID @@ -2976,7 +2875,6 @@ func (m *MissionClearAll) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.TARGET_COMPONENT) } -// // MESSAGE MISSION_ITEM_REACHED // // MAVLINK_MSG_ID_MISSION_ITEM_REACHED 46 @@ -2984,8 +2882,6 @@ func (m *MissionClearAll) Decode(buf []byte) { // MAVLINK_MSG_ID_MISSION_ITEM_REACHED_LEN 2 // // MAVLINK_MSG_ID_MISSION_ITEM_REACHED_CRC 11 -// -// type MissionItemReached struct { SEQ uint16 // Sequence } @@ -3025,7 +2921,6 @@ func (m *MissionItemReached) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.SEQ) } -// // MESSAGE MISSION_ACK // // MAVLINK_MSG_ID_MISSION_ACK 47 @@ -3033,8 +2928,6 @@ func (m *MissionItemReached) Decode(buf []byte) { // MAVLINK_MSG_ID_MISSION_ACK_LEN 3 // // MAVLINK_MSG_ID_MISSION_ACK_CRC 153 -// -// type MissionAck struct { TARGET_SYSTEM uint8 // System ID TARGET_COMPONENT uint8 // Component ID @@ -3082,7 +2975,6 @@ func (m *MissionAck) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.TYPE) } -// // MESSAGE SET_GPS_GLOBAL_ORIGIN // // MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN 48 @@ -3090,8 +2982,6 @@ func (m *MissionAck) Decode(buf []byte) { // MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN_LEN 13 // // MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN_CRC 41 -// -// type SetGpsGlobalOrigin struct { LATITUDE int32 // Latitude (WGS84), in degrees * 1E7 LONGITUDE int32 // Longitude (WGS84, in degrees * 1E7 @@ -3143,7 +3033,6 @@ func (m *SetGpsGlobalOrigin) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.TARGET_SYSTEM) } -// // MESSAGE GPS_GLOBAL_ORIGIN // // MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN 49 @@ -3151,8 +3040,6 @@ func (m *SetGpsGlobalOrigin) Decode(buf []byte) { // MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN_LEN 12 // // MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN_CRC 39 -// -// type GpsGlobalOrigin struct { LATITUDE int32 // Latitude (WGS84), in degrees * 1E7 LONGITUDE int32 // Longitude (WGS84), in degrees * 1E7 @@ -3200,7 +3087,6 @@ func (m *GpsGlobalOrigin) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.ALTITUDE) } -// // MESSAGE SET_LOCAL_POSITION_SETPOINT // // MAVLINK_MSG_ID_SET_LOCAL_POSITION_SETPOINT 50 @@ -3208,8 +3094,6 @@ func (m *GpsGlobalOrigin) Decode(buf []byte) { // MAVLINK_MSG_ID_SET_LOCAL_POSITION_SETPOINT_LEN 19 // // MAVLINK_MSG_ID_SET_LOCAL_POSITION_SETPOINT_CRC 214 -// -// type SetLocalPositionSetpoint struct { X float32 // x position Y float32 // y position @@ -3273,7 +3157,6 @@ func (m *SetLocalPositionSetpoint) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.COORDINATE_FRAME) } -// // MESSAGE LOCAL_POSITION_SETPOINT // // MAVLINK_MSG_ID_LOCAL_POSITION_SETPOINT 51 @@ -3281,8 +3164,6 @@ func (m *SetLocalPositionSetpoint) Decode(buf []byte) { // MAVLINK_MSG_ID_LOCAL_POSITION_SETPOINT_LEN 17 // // MAVLINK_MSG_ID_LOCAL_POSITION_SETPOINT_CRC 223 -// -// type LocalPositionSetpoint struct { X float32 // x position Y float32 // y position @@ -3338,7 +3219,6 @@ func (m *LocalPositionSetpoint) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.COORDINATE_FRAME) } -// // MESSAGE GLOBAL_POSITION_SETPOINT_INT // // MAVLINK_MSG_ID_GLOBAL_POSITION_SETPOINT_INT 52 @@ -3346,8 +3226,6 @@ func (m *LocalPositionSetpoint) Decode(buf []byte) { // MAVLINK_MSG_ID_GLOBAL_POSITION_SETPOINT_INT_LEN 15 // // MAVLINK_MSG_ID_GLOBAL_POSITION_SETPOINT_INT_CRC 141 -// -// type GlobalPositionSetpointInt struct { LATITUDE int32 // Latitude (WGS84), in degrees * 1E7 LONGITUDE int32 // Longitude (WGS84), in degrees * 1E7 @@ -3403,7 +3281,6 @@ func (m *GlobalPositionSetpointInt) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.COORDINATE_FRAME) } -// // MESSAGE SET_GLOBAL_POSITION_SETPOINT_INT // // MAVLINK_MSG_ID_SET_GLOBAL_POSITION_SETPOINT_INT 53 @@ -3411,8 +3288,6 @@ func (m *GlobalPositionSetpointInt) Decode(buf []byte) { // MAVLINK_MSG_ID_SET_GLOBAL_POSITION_SETPOINT_INT_LEN 15 // // MAVLINK_MSG_ID_SET_GLOBAL_POSITION_SETPOINT_INT_CRC 33 -// -// type SetGlobalPositionSetpointInt struct { LATITUDE int32 // Latitude (WGS84), in degrees * 1E7 LONGITUDE int32 // Longitude (WGS84), in degrees * 1E7 @@ -3468,7 +3343,6 @@ func (m *SetGlobalPositionSetpointInt) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.COORDINATE_FRAME) } -// // MESSAGE SAFETY_SET_ALLOWED_AREA // // MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA 54 @@ -3476,8 +3350,6 @@ func (m *SetGlobalPositionSetpointInt) Decode(buf []byte) { // MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN 27 // // MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_CRC 15 -// -// type SafetySetAllowedArea struct { P1X float32 // x position 1 / Latitude 1 P1Y float32 // y position 1 / Longitude 1 @@ -3549,7 +3421,6 @@ func (m *SafetySetAllowedArea) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.FRAME) } -// // MESSAGE SAFETY_ALLOWED_AREA // // MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA 55 @@ -3557,8 +3428,6 @@ func (m *SafetySetAllowedArea) Decode(buf []byte) { // MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN 25 // // MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_CRC 3 -// -// type SafetyAllowedArea struct { P1X float32 // x position 1 / Latitude 1 P1Y float32 // y position 1 / Longitude 1 @@ -3622,7 +3491,6 @@ func (m *SafetyAllowedArea) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.FRAME) } -// // MESSAGE SET_ROLL_PITCH_YAW_THRUST // // MAVLINK_MSG_ID_SET_ROLL_PITCH_YAW_THRUST 56 @@ -3630,8 +3498,6 @@ func (m *SafetyAllowedArea) Decode(buf []byte) { // MAVLINK_MSG_ID_SET_ROLL_PITCH_YAW_THRUST_LEN 18 // // MAVLINK_MSG_ID_SET_ROLL_PITCH_YAW_THRUST_CRC 100 -// -// type SetRollPitchYawThrust struct { ROLL float32 // Desired roll angle in radians PITCH float32 // Desired pitch angle in radians @@ -3691,7 +3557,6 @@ func (m *SetRollPitchYawThrust) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.TARGET_COMPONENT) } -// // MESSAGE SET_ROLL_PITCH_YAW_SPEED_THRUST // // MAVLINK_MSG_ID_SET_ROLL_PITCH_YAW_SPEED_THRUST 57 @@ -3699,8 +3564,6 @@ func (m *SetRollPitchYawThrust) Decode(buf []byte) { // MAVLINK_MSG_ID_SET_ROLL_PITCH_YAW_SPEED_THRUST_LEN 18 // // MAVLINK_MSG_ID_SET_ROLL_PITCH_YAW_SPEED_THRUST_CRC 24 -// -// type SetRollPitchYawSpeedThrust struct { ROLL_SPEED float32 // Desired roll angular speed in rad/s PITCH_SPEED float32 // Desired pitch angular speed in rad/s @@ -3760,7 +3623,6 @@ func (m *SetRollPitchYawSpeedThrust) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.TARGET_COMPONENT) } -// // MESSAGE ROLL_PITCH_YAW_THRUST_SETPOINT // // MAVLINK_MSG_ID_ROLL_PITCH_YAW_THRUST_SETPOINT 58 @@ -3768,8 +3630,6 @@ func (m *SetRollPitchYawSpeedThrust) Decode(buf []byte) { // MAVLINK_MSG_ID_ROLL_PITCH_YAW_THRUST_SETPOINT_LEN 20 // // MAVLINK_MSG_ID_ROLL_PITCH_YAW_THRUST_SETPOINT_CRC 239 -// -// type RollPitchYawThrustSetpoint struct { TIME_BOOT_MS uint32 // Timestamp in milliseconds since system boot ROLL float32 // Desired roll angle in radians @@ -3825,7 +3685,6 @@ func (m *RollPitchYawThrustSetpoint) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.THRUST) } -// // MESSAGE ROLL_PITCH_YAW_SPEED_THRUST_SETPOINT // // MAVLINK_MSG_ID_ROLL_PITCH_YAW_SPEED_THRUST_SETPOINT 59 @@ -3833,8 +3692,6 @@ func (m *RollPitchYawThrustSetpoint) Decode(buf []byte) { // MAVLINK_MSG_ID_ROLL_PITCH_YAW_SPEED_THRUST_SETPOINT_LEN 20 // // MAVLINK_MSG_ID_ROLL_PITCH_YAW_SPEED_THRUST_SETPOINT_CRC 238 -// -// type RollPitchYawSpeedThrustSetpoint struct { TIME_BOOT_MS uint32 // Timestamp in milliseconds since system boot ROLL_SPEED float32 // Desired roll angular speed in rad/s @@ -3890,7 +3747,6 @@ func (m *RollPitchYawSpeedThrustSetpoint) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.THRUST) } -// // MESSAGE SET_QUAD_MOTORS_SETPOINT // // MAVLINK_MSG_ID_SET_QUAD_MOTORS_SETPOINT 60 @@ -3898,8 +3754,6 @@ func (m *RollPitchYawSpeedThrustSetpoint) Decode(buf []byte) { // MAVLINK_MSG_ID_SET_QUAD_MOTORS_SETPOINT_LEN 9 // // MAVLINK_MSG_ID_SET_QUAD_MOTORS_SETPOINT_CRC 30 -// -// type SetQuadMotorsSetpoint struct { MOTOR_FRONT_NW uint16 // Front motor in + configuration, front left motor in x configuration MOTOR_RIGHT_NE uint16 // Right motor in + configuration, front right motor in x configuration @@ -3955,7 +3809,6 @@ func (m *SetQuadMotorsSetpoint) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.TARGET_SYSTEM) } -// // MESSAGE SET_QUAD_SWARM_ROLL_PITCH_YAW_THRUST // // MAVLINK_MSG_ID_SET_QUAD_SWARM_ROLL_PITCH_YAW_THRUST 61 @@ -3963,8 +3816,6 @@ func (m *SetQuadMotorsSetpoint) Decode(buf []byte) { // MAVLINK_MSG_ID_SET_QUAD_SWARM_ROLL_PITCH_YAW_THRUST_LEN 34 // // MAVLINK_MSG_ID_SET_QUAD_SWARM_ROLL_PITCH_YAW_THRUST_CRC 240 -// -// type SetQuadSwarmRollPitchYawThrust struct { ROLL [4]int16 // Desired roll angle in radians +-PI (+-INT16_MAX) PITCH [4]int16 // Desired pitch angle in radians +-PI (+-INT16_MAX) @@ -4031,7 +3882,6 @@ const ( MAVLINK_MSG_SET_QUAD_SWARM_ROLL_PITCH_YAW_THRUST_FIELD_thrust_LEN = 4 ) -// // MESSAGE NAV_CONTROLLER_OUTPUT // // MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT 62 @@ -4039,8 +3889,6 @@ const ( // MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT_LEN 26 // // MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT_CRC 183 -// -// type NavControllerOutput struct { NAV_ROLL float32 // Current desired roll in degrees NAV_PITCH float32 // Current desired pitch in degrees @@ -4108,7 +3956,6 @@ func (m *NavControllerOutput) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.WP_DIST) } -// // MESSAGE SET_QUAD_SWARM_LED_ROLL_PITCH_YAW_THRUST // // MAVLINK_MSG_ID_SET_QUAD_SWARM_LED_ROLL_PITCH_YAW_THRUST 63 @@ -4116,8 +3963,6 @@ func (m *NavControllerOutput) Decode(buf []byte) { // MAVLINK_MSG_ID_SET_QUAD_SWARM_LED_ROLL_PITCH_YAW_THRUST_LEN 46 // // MAVLINK_MSG_ID_SET_QUAD_SWARM_LED_ROLL_PITCH_YAW_THRUST_CRC 130 -// -// type SetQuadSwarmLedRollPitchYawThrust struct { ROLL [4]int16 // Desired roll angle in radians +-PI (+-INT16_MAX) PITCH [4]int16 // Desired pitch angle in radians +-PI (+-INT16_MAX) @@ -4199,7 +4044,6 @@ const ( MAVLINK_MSG_SET_QUAD_SWARM_LED_ROLL_PITCH_YAW_THRUST_FIELD_led_green_LEN = 4 ) -// // MESSAGE STATE_CORRECTION // // MAVLINK_MSG_ID_STATE_CORRECTION 64 @@ -4207,8 +4051,6 @@ const ( // MAVLINK_MSG_ID_STATE_CORRECTION_LEN 36 // // MAVLINK_MSG_ID_STATE_CORRECTION_CRC 130 -// -// type StateCorrection struct { XERR float32 // x position error YERR float32 // y position error @@ -4280,7 +4122,6 @@ func (m *StateCorrection) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.VZERR) } -// // MESSAGE RC_CHANNELS // // MAVLINK_MSG_ID_RC_CHANNELS 65 @@ -4288,8 +4129,6 @@ func (m *StateCorrection) Decode(buf []byte) { // MAVLINK_MSG_ID_RC_CHANNELS_LEN 42 // // MAVLINK_MSG_ID_RC_CHANNELS_CRC 118 -// -// type RcChannels struct { TIME_BOOT_MS uint32 // Timestamp (milliseconds since system boot) CHAN1_RAW uint16 // RC channel 1 value, in microseconds. A value of UINT16_MAX implies the channel is unused. @@ -4409,7 +4248,6 @@ func (m *RcChannels) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.RSSI) } -// // MESSAGE REQUEST_DATA_STREAM // // MAVLINK_MSG_ID_REQUEST_DATA_STREAM 66 @@ -4417,8 +4255,6 @@ func (m *RcChannels) Decode(buf []byte) { // MAVLINK_MSG_ID_REQUEST_DATA_STREAM_LEN 6 // // MAVLINK_MSG_ID_REQUEST_DATA_STREAM_CRC 148 -// -// type RequestDataStream struct { REQ_MESSAGE_RATE uint16 // The requested interval between two messages of this type TARGET_SYSTEM uint8 // The target requested to send the message stream. @@ -4474,7 +4310,6 @@ func (m *RequestDataStream) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.START_STOP) } -// // MESSAGE DATA_STREAM // // MAVLINK_MSG_ID_DATA_STREAM 67 @@ -4482,8 +4317,6 @@ func (m *RequestDataStream) Decode(buf []byte) { // MAVLINK_MSG_ID_DATA_STREAM_LEN 4 // // MAVLINK_MSG_ID_DATA_STREAM_CRC 21 -// -// type DataStream struct { MESSAGE_RATE uint16 // The requested interval between two messages of this type STREAM_ID uint8 // The ID of the requested data stream @@ -4531,7 +4364,6 @@ func (m *DataStream) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.ON_OFF) } -// // MESSAGE MANUAL_CONTROL // // MAVLINK_MSG_ID_MANUAL_CONTROL 69 @@ -4539,8 +4371,6 @@ func (m *DataStream) Decode(buf []byte) { // MAVLINK_MSG_ID_MANUAL_CONTROL_LEN 11 // // MAVLINK_MSG_ID_MANUAL_CONTROL_CRC 243 -// -// type ManualControl struct { X int16 // X-axis, normalized to the range [-1000,1000]. A value of INT16_MAX indicates that this axis is invalid. Generally corresponds to forward(1000)-backward(-1000) movement on a joystick and the pitch of a vehicle. Y int16 // Y-axis, normalized to the range [-1000,1000]. A value of INT16_MAX indicates that this axis is invalid. Generally corresponds to left(-1000)-right(1000) movement on a joystick and the roll of a vehicle. @@ -4600,7 +4430,6 @@ func (m *ManualControl) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.TARGET) } -// // MESSAGE RC_CHANNELS_OVERRIDE // // MAVLINK_MSG_ID_RC_CHANNELS_OVERRIDE 70 @@ -4608,8 +4437,6 @@ func (m *ManualControl) Decode(buf []byte) { // MAVLINK_MSG_ID_RC_CHANNELS_OVERRIDE_LEN 18 // // MAVLINK_MSG_ID_RC_CHANNELS_OVERRIDE_CRC 124 -// -// type RcChannelsOverride struct { CHAN1_RAW uint16 // RC channel 1 value, in microseconds. A value of UINT16_MAX means to ignore this field. CHAN2_RAW uint16 // RC channel 2 value, in microseconds. A value of UINT16_MAX means to ignore this field. @@ -4685,7 +4512,6 @@ func (m *RcChannelsOverride) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.TARGET_COMPONENT) } -// // MESSAGE VFR_HUD // // MAVLINK_MSG_ID_VFR_HUD 74 @@ -4693,8 +4519,6 @@ func (m *RcChannelsOverride) Decode(buf []byte) { // MAVLINK_MSG_ID_VFR_HUD_LEN 20 // // MAVLINK_MSG_ID_VFR_HUD_CRC 20 -// -// type VfrHud struct { AIRSPEED float32 // Current airspeed in m/s GROUNDSPEED float32 // Current ground speed in m/s @@ -4754,7 +4578,6 @@ func (m *VfrHud) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.THROTTLE) } -// // MESSAGE COMMAND_LONG // // MAVLINK_MSG_ID_COMMAND_LONG 76 @@ -4762,8 +4585,6 @@ func (m *VfrHud) Decode(buf []byte) { // MAVLINK_MSG_ID_COMMAND_LONG_LEN 33 // // MAVLINK_MSG_ID_COMMAND_LONG_CRC 152 -// -// type CommandLong struct { PARAM1 float32 // Parameter 1, as defined by MAV_CMD enum. PARAM2 float32 // Parameter 2, as defined by MAV_CMD enum. @@ -4843,7 +4664,6 @@ func (m *CommandLong) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.CONFIRMATION) } -// // MESSAGE COMMAND_ACK // // MAVLINK_MSG_ID_COMMAND_ACK 77 @@ -4851,8 +4671,6 @@ func (m *CommandLong) Decode(buf []byte) { // MAVLINK_MSG_ID_COMMAND_ACK_LEN 3 // // MAVLINK_MSG_ID_COMMAND_ACK_CRC 143 -// -// type CommandAck struct { COMMAND uint16 // Command ID, as defined by MAV_CMD enum. RESULT uint8 // See MAV_RESULT enum @@ -4896,7 +4714,6 @@ func (m *CommandAck) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.RESULT) } -// // MESSAGE ROLL_PITCH_YAW_RATES_THRUST_SETPOINT // // MAVLINK_MSG_ID_ROLL_PITCH_YAW_RATES_THRUST_SETPOINT 80 @@ -4904,8 +4721,6 @@ func (m *CommandAck) Decode(buf []byte) { // MAVLINK_MSG_ID_ROLL_PITCH_YAW_RATES_THRUST_SETPOINT_LEN 20 // // MAVLINK_MSG_ID_ROLL_PITCH_YAW_RATES_THRUST_SETPOINT_CRC 127 -// -// type RollPitchYawRatesThrustSetpoint struct { TIME_BOOT_MS uint32 // Timestamp in milliseconds since system boot ROLL_RATE float32 // Desired roll rate in radians per second @@ -4961,7 +4776,6 @@ func (m *RollPitchYawRatesThrustSetpoint) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.THRUST) } -// // MESSAGE MANUAL_SETPOINT // // MAVLINK_MSG_ID_MANUAL_SETPOINT 81 @@ -4969,8 +4783,6 @@ func (m *RollPitchYawRatesThrustSetpoint) Decode(buf []byte) { // MAVLINK_MSG_ID_MANUAL_SETPOINT_LEN 22 // // MAVLINK_MSG_ID_MANUAL_SETPOINT_CRC 106 -// -// type ManualSetpoint struct { TIME_BOOT_MS uint32 // Timestamp in milliseconds since system boot ROLL float32 // Desired roll rate in radians per second @@ -5034,7 +4846,6 @@ func (m *ManualSetpoint) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.MANUAL_OVERRIDE_SWITCH) } -// // MESSAGE ATTITUDE_SETPOINT_EXTERNAL // // MAVLINK_MSG_ID_ATTITUDE_SETPOINT_EXTERNAL 82 @@ -5042,8 +4853,6 @@ func (m *ManualSetpoint) Decode(buf []byte) { // MAVLINK_MSG_ID_ATTITUDE_SETPOINT_EXTERNAL_LEN 39 // // MAVLINK_MSG_ID_ATTITUDE_SETPOINT_EXTERNAL_CRC 147 -// -// type AttitudeSetpointExternal struct { TIME_BOOT_MS uint32 // Timestamp in milliseconds since system boot Q [4]float32 // Attitude quaternion (w, x, y, z order, zero-rotation is 1, 0, 0, 0) @@ -5119,7 +4928,6 @@ const ( MAVLINK_MSG_ATTITUDE_SETPOINT_EXTERNAL_FIELD_q_LEN = 4 ) -// // MESSAGE LOCAL_NED_POSITION_SETPOINT_EXTERNAL // // MAVLINK_MSG_ID_LOCAL_NED_POSITION_SETPOINT_EXTERNAL 83 @@ -5127,8 +4935,6 @@ const ( // MAVLINK_MSG_ID_LOCAL_NED_POSITION_SETPOINT_EXTERNAL_LEN 45 // // MAVLINK_MSG_ID_LOCAL_NED_POSITION_SETPOINT_EXTERNAL_CRC 211 -// -// type LocalNedPositionSetpointExternal struct { TIME_BOOT_MS uint32 // Timestamp in milliseconds since system boot X float32 // X Position in NED frame in meters @@ -5220,7 +5026,6 @@ func (m *LocalNedPositionSetpointExternal) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.COORDINATE_FRAME) } -// // MESSAGE GLOBAL_POSITION_SETPOINT_EXTERNAL_INT // // MAVLINK_MSG_ID_GLOBAL_POSITION_SETPOINT_EXTERNAL_INT 84 @@ -5228,8 +5033,6 @@ func (m *LocalNedPositionSetpointExternal) Decode(buf []byte) { // MAVLINK_MSG_ID_GLOBAL_POSITION_SETPOINT_EXTERNAL_INT_LEN 44 // // MAVLINK_MSG_ID_GLOBAL_POSITION_SETPOINT_EXTERNAL_INT_CRC 198 -// -// type GlobalPositionSetpointExternalInt struct { TIME_BOOT_MS uint32 // Timestamp in milliseconds since system boot. The rationale for the timestamp in the setpoint is to allow the system to compensate for the transport delay of the setpoint. This allows the system to compensate processing latency. LAT_INT int32 // X Position in WGS84 frame in 1e7 * meters @@ -5317,7 +5120,6 @@ func (m *GlobalPositionSetpointExternalInt) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.TARGET_COMPONENT) } -// // MESSAGE LOCAL_POSITION_NED_SYSTEM_GLOBAL_OFFSET // // MAVLINK_MSG_ID_LOCAL_POSITION_NED_SYSTEM_GLOBAL_OFFSET 89 @@ -5325,8 +5127,6 @@ func (m *GlobalPositionSetpointExternalInt) Decode(buf []byte) { // MAVLINK_MSG_ID_LOCAL_POSITION_NED_SYSTEM_GLOBAL_OFFSET_LEN 28 // // MAVLINK_MSG_ID_LOCAL_POSITION_NED_SYSTEM_GLOBAL_OFFSET_CRC 231 -// -// type LocalPositionNedSystemGlobalOffset struct { TIME_BOOT_MS uint32 // Timestamp (milliseconds since system boot) X float32 // X Position @@ -5390,7 +5190,6 @@ func (m *LocalPositionNedSystemGlobalOffset) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.YAW) } -// // MESSAGE HIL_STATE // // MAVLINK_MSG_ID_HIL_STATE 90 @@ -5398,8 +5197,6 @@ func (m *LocalPositionNedSystemGlobalOffset) Decode(buf []byte) { // MAVLINK_MSG_ID_HIL_STATE_LEN 56 // // MAVLINK_MSG_ID_HIL_STATE_CRC 183 -// -// type HilState struct { TIME_USEC uint64 // Timestamp (microseconds since UNIX epoch or microseconds since system boot) ROLL float32 // Roll angle (rad) @@ -5499,7 +5296,6 @@ func (m *HilState) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.ZACC) } -// // MESSAGE HIL_CONTROLS // // MAVLINK_MSG_ID_HIL_CONTROLS 91 @@ -5507,8 +5303,6 @@ func (m *HilState) Decode(buf []byte) { // MAVLINK_MSG_ID_HIL_CONTROLS_LEN 42 // // MAVLINK_MSG_ID_HIL_CONTROLS_CRC 63 -// -// type HilControls struct { TIME_USEC uint64 // Timestamp (microseconds since UNIX epoch or microseconds since system boot) ROLL_AILERONS float32 // Control output -1 .. 1 @@ -5588,7 +5382,6 @@ func (m *HilControls) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.NAV_MODE) } -// // MESSAGE HIL_RC_INPUTS_RAW // // MAVLINK_MSG_ID_HIL_RC_INPUTS_RAW 92 @@ -5596,8 +5389,6 @@ func (m *HilControls) Decode(buf []byte) { // MAVLINK_MSG_ID_HIL_RC_INPUTS_RAW_LEN 33 // // MAVLINK_MSG_ID_HIL_RC_INPUTS_RAW_CRC 54 -// -// type HilRcInputsRaw struct { TIME_USEC uint64 // Timestamp (microseconds since UNIX epoch or microseconds since system boot) CHAN1_RAW uint16 // RC channel 1 value, in microseconds @@ -5689,7 +5480,6 @@ func (m *HilRcInputsRaw) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.RSSI) } -// // MESSAGE OPTICAL_FLOW // // MAVLINK_MSG_ID_OPTICAL_FLOW 100 @@ -5697,8 +5487,6 @@ func (m *HilRcInputsRaw) Decode(buf []byte) { // MAVLINK_MSG_ID_OPTICAL_FLOW_LEN 26 // // MAVLINK_MSG_ID_OPTICAL_FLOW_CRC 175 -// -// type OpticalFlow struct { TIME_USEC uint64 // Timestamp (UNIX) FLOW_COMP_M_X float32 // Flow in meters in x-sensor direction, angular-speed compensated @@ -5766,7 +5554,6 @@ func (m *OpticalFlow) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.QUALITY) } -// // MESSAGE GLOBAL_VISION_POSITION_ESTIMATE // // MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE 101 @@ -5774,8 +5561,6 @@ func (m *OpticalFlow) Decode(buf []byte) { // MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE_LEN 32 // // MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE_CRC 102 -// -// type GlobalVisionPositionEstimate struct { USEC uint64 // Timestamp (microseconds, synced to UNIX time or since system boot) X float32 // Global X position @@ -5839,7 +5624,6 @@ func (m *GlobalVisionPositionEstimate) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.YAW) } -// // MESSAGE VISION_POSITION_ESTIMATE // // MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE 102 @@ -5847,8 +5631,6 @@ func (m *GlobalVisionPositionEstimate) Decode(buf []byte) { // MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE_LEN 32 // // MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE_CRC 158 -// -// type VisionPositionEstimate struct { USEC uint64 // Timestamp (microseconds, synced to UNIX time or since system boot) X float32 // Global X position @@ -5912,7 +5694,6 @@ func (m *VisionPositionEstimate) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.YAW) } -// // MESSAGE VISION_SPEED_ESTIMATE // // MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE 103 @@ -5920,8 +5701,6 @@ func (m *VisionPositionEstimate) Decode(buf []byte) { // MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE_LEN 20 // // MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE_CRC 208 -// -// type VisionSpeedEstimate struct { USEC uint64 // Timestamp (microseconds, synced to UNIX time or since system boot) X float32 // Global X speed @@ -5973,7 +5752,6 @@ func (m *VisionSpeedEstimate) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.Z) } -// // MESSAGE VICON_POSITION_ESTIMATE // // MAVLINK_MSG_ID_VICON_POSITION_ESTIMATE 104 @@ -5981,8 +5759,6 @@ func (m *VisionSpeedEstimate) Decode(buf []byte) { // MAVLINK_MSG_ID_VICON_POSITION_ESTIMATE_LEN 32 // // MAVLINK_MSG_ID_VICON_POSITION_ESTIMATE_CRC 56 -// -// type ViconPositionEstimate struct { USEC uint64 // Timestamp (microseconds, synced to UNIX time or since system boot) X float32 // Global X position @@ -6046,7 +5822,6 @@ func (m *ViconPositionEstimate) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.YAW) } -// // MESSAGE HIGHRES_IMU // // MAVLINK_MSG_ID_HIGHRES_IMU 105 @@ -6054,8 +5829,6 @@ func (m *ViconPositionEstimate) Decode(buf []byte) { // MAVLINK_MSG_ID_HIGHRES_IMU_LEN 62 // // MAVLINK_MSG_ID_HIGHRES_IMU_CRC 93 -// -// type HighresImu struct { TIME_USEC uint64 // Timestamp (microseconds, synced to UNIX time or since system boot) XACC float32 // X acceleration (m/s^2) @@ -6151,7 +5924,6 @@ func (m *HighresImu) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.FIELDS_UPDATED) } -// // MESSAGE OMNIDIRECTIONAL_FLOW // // MAVLINK_MSG_ID_OMNIDIRECTIONAL_FLOW 106 @@ -6159,8 +5931,6 @@ func (m *HighresImu) Decode(buf []byte) { // MAVLINK_MSG_ID_OMNIDIRECTIONAL_FLOW_LEN 54 // // MAVLINK_MSG_ID_OMNIDIRECTIONAL_FLOW_CRC 211 -// -// type OmnidirectionalFlow struct { TIME_USEC uint64 // Timestamp (microseconds, synced to UNIX time or since system boot) FRONT_DISTANCE_M float32 // Front distance in meters. Positive value (including zero): distance known. Negative value: Unknown distance @@ -6225,7 +5995,6 @@ const ( MAVLINK_MSG_OMNIDIRECTIONAL_FLOW_FIELD_right_LEN = 10 ) -// // MESSAGE HIL_SENSOR // // MAVLINK_MSG_ID_HIL_SENSOR 107 @@ -6233,8 +6002,6 @@ const ( // MAVLINK_MSG_ID_HIL_SENSOR_LEN 64 // // MAVLINK_MSG_ID_HIL_SENSOR_CRC 108 -// -// type HilSensor struct { TIME_USEC uint64 // Timestamp (microseconds, synced to UNIX time or since system boot) XACC float32 // X acceleration (m/s^2) @@ -6330,7 +6097,6 @@ func (m *HilSensor) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.FIELDS_UPDATED) } -// // MESSAGE SIM_STATE // // MAVLINK_MSG_ID_SIM_STATE 108 @@ -6338,8 +6104,6 @@ func (m *HilSensor) Decode(buf []byte) { // MAVLINK_MSG_ID_SIM_STATE_LEN 84 // // MAVLINK_MSG_ID_SIM_STATE_CRC 32 -// -// type SimState struct { Q1 float32 // True attitude quaternion component 1, w (1 in null-rotation) Q2 float32 // True attitude quaternion component 2, x (0 in null-rotation) @@ -6459,7 +6223,6 @@ func (m *SimState) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.VD) } -// // MESSAGE RADIO_STATUS // // MAVLINK_MSG_ID_RADIO_STATUS 109 @@ -6467,8 +6230,6 @@ func (m *SimState) Decode(buf []byte) { // MAVLINK_MSG_ID_RADIO_STATUS_LEN 9 // // MAVLINK_MSG_ID_RADIO_STATUS_CRC 185 -// -// type RadioStatus struct { RXERRORS uint16 // receive errors FIXED uint16 // count of error corrected packets @@ -6532,7 +6293,6 @@ func (m *RadioStatus) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.REMNOISE) } -// // MESSAGE FILE_TRANSFER_START // // MAVLINK_MSG_ID_FILE_TRANSFER_START 110 @@ -6540,8 +6300,6 @@ func (m *RadioStatus) Decode(buf []byte) { // MAVLINK_MSG_ID_FILE_TRANSFER_START_LEN 254 // // MAVLINK_MSG_ID_FILE_TRANSFER_START_CRC 235 -// -// type FileTransferStart struct { TRANSFER_UID uint64 // Unique transfer ID FILE_SIZE uint32 // File size in bytes @@ -6601,7 +6359,6 @@ const ( MAVLINK_MSG_FILE_TRANSFER_START_FIELD_dest_path_LEN = 240 ) -// // MESSAGE FILE_TRANSFER_DIR_LIST // // MAVLINK_MSG_ID_FILE_TRANSFER_DIR_LIST 111 @@ -6609,8 +6366,6 @@ const ( // MAVLINK_MSG_ID_FILE_TRANSFER_DIR_LIST_LEN 249 // // MAVLINK_MSG_ID_FILE_TRANSFER_DIR_LIST_CRC 93 -// -// type FileTransferDirList struct { TRANSFER_UID uint64 // Unique transfer ID DIR_PATH [240]uint8 // Directory path to list @@ -6662,7 +6417,6 @@ const ( MAVLINK_MSG_FILE_TRANSFER_DIR_LIST_FIELD_dir_path_LEN = 240 ) -// // MESSAGE FILE_TRANSFER_RES // // MAVLINK_MSG_ID_FILE_TRANSFER_RES 112 @@ -6670,8 +6424,6 @@ const ( // MAVLINK_MSG_ID_FILE_TRANSFER_RES_LEN 9 // // MAVLINK_MSG_ID_FILE_TRANSFER_RES_CRC 124 -// -// type FileTransferRes struct { TRANSFER_UID uint64 // Unique transfer ID RESULT uint8 // 0: OK, 1: not permitted, 2: bad path / file name, 3: no space left on device @@ -6715,7 +6467,6 @@ func (m *FileTransferRes) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.RESULT) } -// // MESSAGE HIL_GPS // // MAVLINK_MSG_ID_HIL_GPS 113 @@ -6723,8 +6474,6 @@ func (m *FileTransferRes) Decode(buf []byte) { // MAVLINK_MSG_ID_HIL_GPS_LEN 36 // // MAVLINK_MSG_ID_HIL_GPS_CRC 124 -// -// type HilGps struct { TIME_USEC uint64 // Timestamp (microseconds since UNIX epoch or microseconds since system boot) LAT int32 // Latitude (WGS84), in degrees * 1E7 @@ -6812,7 +6561,6 @@ func (m *HilGps) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.SATELLITES_VISIBLE) } -// // MESSAGE HIL_OPTICAL_FLOW // // MAVLINK_MSG_ID_HIL_OPTICAL_FLOW 114 @@ -6820,8 +6568,6 @@ func (m *HilGps) Decode(buf []byte) { // MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN 26 // // MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_CRC 119 -// -// type HilOpticalFlow struct { TIME_USEC uint64 // Timestamp (UNIX) FLOW_COMP_M_X float32 // Flow in meters in x-sensor direction, angular-speed compensated @@ -6889,7 +6635,6 @@ func (m *HilOpticalFlow) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.QUALITY) } -// // MESSAGE HIL_STATE_QUATERNION // // MAVLINK_MSG_ID_HIL_STATE_QUATERNION 115 @@ -6897,8 +6642,6 @@ func (m *HilOpticalFlow) Decode(buf []byte) { // MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN 64 // // MAVLINK_MSG_ID_HIL_STATE_QUATERNION_CRC 4 -// -// type HilStateQuaternion struct { TIME_USEC uint64 // Timestamp (microseconds since UNIX epoch or microseconds since system boot) ATTITUDE_QUATERNION [4]float32 // Vehicle attitude expressed as normalized quaternion in w, x, y, z order (with 1 0 0 0 being the null-rotation) @@ -7002,7 +6745,6 @@ const ( MAVLINK_MSG_HIL_STATE_QUATERNION_FIELD_attitude_quaternion_LEN = 4 ) -// // MESSAGE SCALED_IMU2 // // MAVLINK_MSG_ID_SCALED_IMU2 116 @@ -7010,8 +6752,6 @@ const ( // MAVLINK_MSG_ID_SCALED_IMU2_LEN 22 // // MAVLINK_MSG_ID_SCALED_IMU2_CRC 76 -// -// type ScaledImu2 struct { TIME_BOOT_MS uint32 // Timestamp (milliseconds since system boot) XACC int16 // X acceleration (mg) @@ -7087,7 +6827,6 @@ func (m *ScaledImu2) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.ZMAG) } -// // MESSAGE LOG_REQUEST_LIST // // MAVLINK_MSG_ID_LOG_REQUEST_LIST 117 @@ -7095,8 +6834,6 @@ func (m *ScaledImu2) Decode(buf []byte) { // MAVLINK_MSG_ID_LOG_REQUEST_LIST_LEN 6 // // MAVLINK_MSG_ID_LOG_REQUEST_LIST_CRC 128 -// -// type LogRequestList struct { START uint16 // First log id (0 for first available) END uint16 // Last log id (0xffff for last available) @@ -7148,7 +6885,6 @@ func (m *LogRequestList) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.TARGET_COMPONENT) } -// // MESSAGE LOG_ENTRY // // MAVLINK_MSG_ID_LOG_ENTRY 118 @@ -7156,8 +6892,6 @@ func (m *LogRequestList) Decode(buf []byte) { // MAVLINK_MSG_ID_LOG_ENTRY_LEN 14 // // MAVLINK_MSG_ID_LOG_ENTRY_CRC 56 -// -// type LogEntry struct { TIME_UTC uint32 // UTC timestamp of log in seconds since 1970, or 0 if not available SIZE uint32 // Size of the log (may be approximate) in bytes @@ -7213,7 +6947,6 @@ func (m *LogEntry) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.LAST_LOG_NUM) } -// // MESSAGE LOG_REQUEST_DATA // // MAVLINK_MSG_ID_LOG_REQUEST_DATA 119 @@ -7221,8 +6954,6 @@ func (m *LogEntry) Decode(buf []byte) { // MAVLINK_MSG_ID_LOG_REQUEST_DATA_LEN 12 // // MAVLINK_MSG_ID_LOG_REQUEST_DATA_CRC 116 -// -// type LogRequestData struct { OFS uint32 // Offset into the log COUNT uint32 // Number of bytes @@ -7278,7 +7009,6 @@ func (m *LogRequestData) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.TARGET_COMPONENT) } -// // MESSAGE LOG_DATA // // MAVLINK_MSG_ID_LOG_DATA 120 @@ -7286,8 +7016,6 @@ func (m *LogRequestData) Decode(buf []byte) { // MAVLINK_MSG_ID_LOG_DATA_LEN 97 // // MAVLINK_MSG_ID_LOG_DATA_CRC 134 -// -// type LogData struct { OFS uint32 // Offset into the log ID uint16 // Log id (from LOG_ENTRY reply) @@ -7343,7 +7071,6 @@ const ( MAVLINK_MSG_LOG_DATA_FIELD_data_LEN = 90 ) -// // MESSAGE LOG_ERASE // // MAVLINK_MSG_ID_LOG_ERASE 121 @@ -7351,8 +7078,6 @@ const ( // MAVLINK_MSG_ID_LOG_ERASE_LEN 2 // // MAVLINK_MSG_ID_LOG_ERASE_CRC 237 -// -// type LogErase struct { TARGET_SYSTEM uint8 // System ID TARGET_COMPONENT uint8 // Component ID @@ -7396,7 +7121,6 @@ func (m *LogErase) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.TARGET_COMPONENT) } -// // MESSAGE LOG_REQUEST_END // // MAVLINK_MSG_ID_LOG_REQUEST_END 122 @@ -7404,8 +7128,6 @@ func (m *LogErase) Decode(buf []byte) { // MAVLINK_MSG_ID_LOG_REQUEST_END_LEN 2 // // MAVLINK_MSG_ID_LOG_REQUEST_END_CRC 203 -// -// type LogRequestEnd struct { TARGET_SYSTEM uint8 // System ID TARGET_COMPONENT uint8 // Component ID @@ -7449,7 +7171,6 @@ func (m *LogRequestEnd) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.TARGET_COMPONENT) } -// // MESSAGE GPS_INJECT_DATA // // MAVLINK_MSG_ID_GPS_INJECT_DATA 123 @@ -7457,8 +7178,6 @@ func (m *LogRequestEnd) Decode(buf []byte) { // MAVLINK_MSG_ID_GPS_INJECT_DATA_LEN 113 // // MAVLINK_MSG_ID_GPS_INJECT_DATA_CRC 250 -// -// type GpsInjectData struct { TARGET_SYSTEM uint8 // System ID TARGET_COMPONENT uint8 // Component ID @@ -7514,7 +7233,6 @@ const ( MAVLINK_MSG_GPS_INJECT_DATA_FIELD_data_LEN = 110 ) -// // MESSAGE GPS2_RAW // // MAVLINK_MSG_ID_GPS2_RAW 124 @@ -7522,8 +7240,6 @@ const ( // MAVLINK_MSG_ID_GPS2_RAW_LEN 35 // // MAVLINK_MSG_ID_GPS2_RAW_CRC 87 -// -// type Gps2Raw struct { TIME_USEC uint64 // Timestamp (microseconds since UNIX epoch or microseconds since system boot) LAT int32 // Latitude (WGS84), in degrees * 1E7 @@ -7607,7 +7323,6 @@ func (m *Gps2Raw) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.DGPS_NUMCH) } -// // MESSAGE POWER_STATUS // // MAVLINK_MSG_ID_POWER_STATUS 125 @@ -7615,8 +7330,6 @@ func (m *Gps2Raw) Decode(buf []byte) { // MAVLINK_MSG_ID_POWER_STATUS_LEN 6 // // MAVLINK_MSG_ID_POWER_STATUS_CRC 203 -// -// type PowerStatus struct { VCC uint16 // 5V rail voltage in millivolts VSERVO uint16 // servo rail voltage in millivolts @@ -7664,7 +7377,6 @@ func (m *PowerStatus) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.FLAGS) } -// // MESSAGE SERIAL_CONTROL // // MAVLINK_MSG_ID_SERIAL_CONTROL 126 @@ -7672,8 +7384,6 @@ func (m *PowerStatus) Decode(buf []byte) { // MAVLINK_MSG_ID_SERIAL_CONTROL_LEN 79 // // MAVLINK_MSG_ID_SERIAL_CONTROL_CRC 220 -// -// type SerialControl struct { BAUDRATE uint32 // Baudrate of transfer. Zero means no change. TIMEOUT uint16 // Timeout for reply data in milliseconds @@ -7737,7 +7447,6 @@ const ( MAVLINK_MSG_SERIAL_CONTROL_FIELD_data_LEN = 70 ) -// // MESSAGE GPS_RTK // // MAVLINK_MSG_ID_GPS_RTK 127 @@ -7745,8 +7454,6 @@ const ( // MAVLINK_MSG_ID_GPS_RTK_LEN 35 // // MAVLINK_MSG_ID_GPS_RTK_CRC 25 -// -// type GpsRtk struct { TIME_LAST_BASELINE_MS uint32 // Time since boot of last baseline message received in ms. TOW uint32 // GPS Time of Week of last baseline @@ -7834,7 +7541,6 @@ func (m *GpsRtk) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.BASELINE_COORDS_TYPE) } -// // MESSAGE GPS2_RTK // // MAVLINK_MSG_ID_GPS2_RTK 128 @@ -7842,8 +7548,6 @@ func (m *GpsRtk) Decode(buf []byte) { // MAVLINK_MSG_ID_GPS2_RTK_LEN 35 // // MAVLINK_MSG_ID_GPS2_RTK_CRC 226 -// -// type Gps2Rtk struct { TIME_LAST_BASELINE_MS uint32 // Time since boot of last baseline message received in ms. TOW uint32 // GPS Time of Week of last baseline @@ -7931,7 +7635,6 @@ func (m *Gps2Rtk) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.BASELINE_COORDS_TYPE) } -// // MESSAGE DATA_TRANSMISSION_HANDSHAKE // // MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE 130 @@ -7939,8 +7642,6 @@ func (m *Gps2Rtk) Decode(buf []byte) { // MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_LEN 13 // // MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_CRC 29 -// -// type DataTransmissionHandshake struct { SIZE uint32 // total data size in bytes (set on ACK only) WIDTH uint16 // Width of a matrix or image @@ -8004,7 +7705,6 @@ func (m *DataTransmissionHandshake) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.JPG_QUALITY) } -// // MESSAGE ENCAPSULATED_DATA // // MAVLINK_MSG_ID_ENCAPSULATED_DATA 131 @@ -8012,8 +7712,6 @@ func (m *DataTransmissionHandshake) Decode(buf []byte) { // MAVLINK_MSG_ID_ENCAPSULATED_DATA_LEN 255 // // MAVLINK_MSG_ID_ENCAPSULATED_DATA_CRC 223 -// -// type EncapsulatedData struct { SEQNR uint16 // sequence number (starting with 0 on every transmission) DATA [253]uint8 // image data bytes @@ -8061,7 +7759,6 @@ const ( MAVLINK_MSG_ENCAPSULATED_DATA_FIELD_data_LEN = 253 ) -// // MESSAGE DISTANCE_SENSOR // // MAVLINK_MSG_ID_DISTANCE_SENSOR 132 @@ -8069,8 +7766,6 @@ const ( // MAVLINK_MSG_ID_DISTANCE_SENSOR_LEN 14 // // MAVLINK_MSG_ID_DISTANCE_SENSOR_CRC 85 -// -// type DistanceSensor struct { TIME_BOOT_MS uint32 // Time since system boot MIN_DISTANCE uint16 // Minimum distance the sensor can measure in centimeters @@ -8138,7 +7833,6 @@ func (m *DistanceSensor) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.COVARIANCE) } -// // MESSAGE TERRAIN_REQUEST // // MAVLINK_MSG_ID_TERRAIN_REQUEST 133 @@ -8146,8 +7840,6 @@ func (m *DistanceSensor) Decode(buf []byte) { // MAVLINK_MSG_ID_TERRAIN_REQUEST_LEN 18 // // MAVLINK_MSG_ID_TERRAIN_REQUEST_CRC 6 -// -// type TerrainRequest struct { MASK uint64 // Bitmask of requested 4x4 grids (row major 8x7 array of grids, 56 bits) LAT int32 // Latitude of SW corner of first grid (degrees *10^7) @@ -8199,7 +7891,6 @@ func (m *TerrainRequest) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.GRID_SPACING) } -// // MESSAGE TERRAIN_DATA // // MAVLINK_MSG_ID_TERRAIN_DATA 134 @@ -8207,8 +7898,6 @@ func (m *TerrainRequest) Decode(buf []byte) { // MAVLINK_MSG_ID_TERRAIN_DATA_LEN 43 // // MAVLINK_MSG_ID_TERRAIN_DATA_CRC 229 -// -// type TerrainData struct { LAT int32 // Latitude of SW corner of first grid (degrees *10^7) LON int32 // Longitude of SW corner of first grid (in degrees *10^7) @@ -8268,7 +7957,6 @@ const ( MAVLINK_MSG_TERRAIN_DATA_FIELD_data_LEN = 16 ) -// // MESSAGE TERRAIN_CHECK // // MAVLINK_MSG_ID_TERRAIN_CHECK 135 @@ -8276,8 +7964,6 @@ const ( // MAVLINK_MSG_ID_TERRAIN_CHECK_LEN 8 // // MAVLINK_MSG_ID_TERRAIN_CHECK_CRC 203 -// -// type TerrainCheck struct { LAT int32 // Latitude (degrees *10^7) LON int32 // Longitude (degrees *10^7) @@ -8321,7 +8007,6 @@ func (m *TerrainCheck) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.LON) } -// // MESSAGE TERRAIN_REPORT // // MAVLINK_MSG_ID_TERRAIN_REPORT 136 @@ -8329,8 +8014,6 @@ func (m *TerrainCheck) Decode(buf []byte) { // MAVLINK_MSG_ID_TERRAIN_REPORT_LEN 22 // // MAVLINK_MSG_ID_TERRAIN_REPORT_CRC 1 -// -// type TerrainReport struct { LAT int32 // Latitude (degrees *10^7) LON int32 // Longitude (degrees *10^7) @@ -8394,7 +8077,6 @@ func (m *TerrainReport) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.LOADED) } -// // MESSAGE BATTERY_STATUS // // MAVLINK_MSG_ID_BATTERY_STATUS 147 @@ -8402,8 +8084,6 @@ func (m *TerrainReport) Decode(buf []byte) { // MAVLINK_MSG_ID_BATTERY_STATUS_LEN 24 // // MAVLINK_MSG_ID_BATTERY_STATUS_CRC 177 -// -// type BatteryStatus struct { CURRENT_CONSUMED int32 // Consumed charge, in milliampere hours (1 = 1 mAh), -1: autopilot does not provide mAh consumption estimate ENERGY_CONSUMED int32 // Consumed energy, in 100*Joules (integrated U*I*dt) (1 = 100 Joule), -1: autopilot does not provide energy consumption estimate @@ -8483,7 +8163,6 @@ func (m *BatteryStatus) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.BATTERY_REMAINING) } -// // MESSAGE SETPOINT_8DOF // // MAVLINK_MSG_ID_SETPOINT_8DOF 148 @@ -8491,8 +8170,6 @@ func (m *BatteryStatus) Decode(buf []byte) { // MAVLINK_MSG_ID_SETPOINT_8DOF_LEN 33 // // MAVLINK_MSG_ID_SETPOINT_8DOF_CRC 241 -// -// type Setpoint8Dof struct { VAL1 float32 // Value 1 VAL2 float32 // Value 2 @@ -8564,7 +8241,6 @@ func (m *Setpoint8Dof) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.TARGET_SYSTEM) } -// // MESSAGE SETPOINT_6DOF // // MAVLINK_MSG_ID_SETPOINT_6DOF 149 @@ -8572,8 +8248,6 @@ func (m *Setpoint8Dof) Decode(buf []byte) { // MAVLINK_MSG_ID_SETPOINT_6DOF_LEN 25 // // MAVLINK_MSG_ID_SETPOINT_6DOF_CRC 15 -// -// type Setpoint6Dof struct { TRANS_X float32 // Translational Component in x TRANS_Y float32 // Translational Component in y @@ -8637,7 +8311,6 @@ func (m *Setpoint6Dof) Decode(buf []byte) { binary.Read(data, binary.LittleEndian, &m.TARGET_SYSTEM) } -// // MESSAGE MEMORY_VECT // // MAVLINK_MSG_ID_MEMORY_VECT 249 @@ -8645,8 +8318,6 @@ func (m *Setpoint6Dof) Decode(buf []byte) { // MAVLINK_MSG_ID_MEMORY_VECT_LEN 36 // // MAVLINK_MSG_ID_MEMORY_VECT_CRC 204 -// -// type MemoryVect struct { ADDRESS uint16 // Starting address of the debug variables VER uint8 // Version code of the type variable. 0=unknown, type ignored and assumed int16_t. 1=as below @@ -8702,7 +8373,6 @@ const ( MAVLINK_MSG_MEMORY_VECT_FIELD_value_LEN = 32 ) -// // MESSAGE DEBUG_VECT // // MAVLINK_MSG_ID_DEBUG_VECT 250 @@ -8710,8 +8380,6 @@ const ( // MAVLINK_MSG_ID_DEBUG_VECT_LEN 30 // // MAVLINK_MSG_ID_DEBUG_VECT_CRC 49 -// -// type DebugVect struct { TIME_USEC uint64 // Timestamp X float32 // x @@ -8771,7 +8439,6 @@ const ( MAVLINK_MSG_DEBUG_VECT_FIELD_name_LEN = 10 ) -// // MESSAGE NAMED_VALUE_FLOAT // // MAVLINK_MSG_ID_NAMED_VALUE_FLOAT 251 @@ -8779,8 +8446,6 @@ const ( // MAVLINK_MSG_ID_NAMED_VALUE_FLOAT_LEN 18 // // MAVLINK_MSG_ID_NAMED_VALUE_FLOAT_CRC 170 -// -// type NamedValueFloat struct { TIME_BOOT_MS uint32 // Timestamp (milliseconds since system boot) VALUE float32 // Floating point value @@ -8832,7 +8497,6 @@ const ( MAVLINK_MSG_NAMED_VALUE_FLOAT_FIELD_name_LEN = 10 ) -// // MESSAGE NAMED_VALUE_INT // // MAVLINK_MSG_ID_NAMED_VALUE_INT 252 @@ -8840,8 +8504,6 @@ const ( // MAVLINK_MSG_ID_NAMED_VALUE_INT_LEN 18 // // MAVLINK_MSG_ID_NAMED_VALUE_INT_CRC 44 -// -// type NamedValueInt struct { TIME_BOOT_MS uint32 // Timestamp (milliseconds since system boot) VALUE int32 // Signed integer value @@ -8893,7 +8555,6 @@ const ( MAVLINK_MSG_NAMED_VALUE_INT_FIELD_name_LEN = 10 ) -// // MESSAGE STATUSTEXT // // MAVLINK_MSG_ID_STATUSTEXT 253 @@ -8901,8 +8562,6 @@ const ( // MAVLINK_MSG_ID_STATUSTEXT_LEN 51 // // MAVLINK_MSG_ID_STATUSTEXT_CRC 83 -// -// type Statustext struct { SEVERITY uint8 // Severity of status. Relies on the definitions within RFC-5424. See enum MAV_SEVERITY. TEXT [50]uint8 // Status text message, without null termination character @@ -8950,7 +8609,6 @@ const ( MAVLINK_MSG_STATUSTEXT_FIELD_text_LEN = 50 ) -// // MESSAGE DEBUG // // MAVLINK_MSG_ID_DEBUG 254 @@ -8958,8 +8616,6 @@ const ( // MAVLINK_MSG_ID_DEBUG_LEN 9 // // MAVLINK_MSG_ID_DEBUG_CRC 46 -// -// type Debug struct { TIME_BOOT_MS uint32 // Timestamp (milliseconds since system boot) VALUE float32 // DEBUG value diff --git a/platforms/mavlink/common/mavlink.go b/platforms/mavlink/common/mavlink.go index dfd961281..b48748713 100644 --- a/platforms/mavlink/common/mavlink.go +++ b/platforms/mavlink/common/mavlink.go @@ -1,3 +1,4 @@ +//nolint:errcheck // to much code to fix it immediately package mavlink // @@ -160,7 +161,6 @@ func read(r io.Reader, length int) ([]byte, error) { return buf, nil } -// // Accumulate the X.25 CRC by adding one char at a time. // // The checksum function adds the hash of one char at a time to the @@ -168,7 +168,6 @@ func read(r io.Reader, length int) ([]byte, error) { // // data to hash // crcAccum the already accumulated checksum -// func crcAccumulate(data uint8, crcAccum uint16) uint16 { /*Accumulate one byte of data into the CRC*/ var tmp uint8 @@ -179,18 +178,14 @@ func crcAccumulate(data uint8, crcAccum uint16) uint16 { return crcAccum } -// // Initiliaze the buffer for the X.25 CRC -// func crcInit() uint16 { return X25_INIT_CRC } -// // Calculates the X.25 checksum on a byte buffer // // return the checksum over the buffer bytes -// func crcCalculate(m *MAVLinkPacket) uint16 { crc := crcInit() diff --git a/platforms/mavlink/mavlink_driver_test.go b/platforms/mavlink/mavlink_driver_test.go index 5e7eca898..4ac9c5cb4 100644 --- a/platforms/mavlink/mavlink_driver_test.go +++ b/platforms/mavlink/mavlink_driver_test.go @@ -46,16 +46,16 @@ func TestMavlinkDriverStart(t *testing.T) { packet := make(chan *common.MAVLinkPacket) message := make(chan common.MAVLinkMessage) - d.On(PacketEvent, func(data interface{}) { + _ = d.On(PacketEvent, func(data interface{}) { packet <- data.(*common.MAVLinkPacket) }) - d.On(MessageEvent, func(data interface{}) { + _ = d.On(MessageEvent, func(data interface{}) { message <- data.(common.MAVLinkMessage) }) - d.On(ErrorIOEvent, func(data interface{}) { + _ = d.On(ErrorIOEvent, func(data interface{}) { err <- data.(error) }) - d.On(ErrorMAVLinkEvent, func(data interface{}) { + _ = d.On(ErrorMAVLinkEvent, func(data interface{}) { err <- data.(error) }) diff --git a/platforms/mavlink/mavlink_udp_adaptor_test.go b/platforms/mavlink/mavlink_udp_adaptor_test.go index 84f47bd7e..5e9f1dd00 100644 --- a/platforms/mavlink/mavlink_udp_adaptor_test.go +++ b/platforms/mavlink/mavlink_udp_adaptor_test.go @@ -71,8 +71,8 @@ func TestMavlinkUDPAdaptorConnectAndFinalize(t *testing.T) { func TestMavlinkUDPAdaptorWrite(t *testing.T) { a := initTestMavlinkUDPAdaptor() - a.Connect() - defer a.Finalize() + _ = a.Connect() + defer func() { _ = a.Finalize() }() m := NewMockUDPConnection() m.TestWriteTo = func([]byte, net.Addr) (int, error) { @@ -87,8 +87,8 @@ func TestMavlinkUDPAdaptorWrite(t *testing.T) { func TestMavlinkReadMAVLinkReadDefaultPacket(t *testing.T) { a := initTestMavlinkUDPAdaptor() - a.Connect() - defer a.Finalize() + _ = a.Connect() + defer func() { _ = a.Finalize() }() m := NewMockUDPConnection() @@ -106,8 +106,8 @@ func TestMavlinkReadMAVLinkReadDefaultPacket(t *testing.T) { func TestMavlinkReadMAVLinkPacketReadError(t *testing.T) { a := initTestMavlinkUDPAdaptor() - a.Connect() - defer a.Finalize() + _ = a.Connect() + defer func() { _ = a.Finalize() }() m := NewMockUDPConnection() diff --git a/platforms/megapi/megapi_adaptor.go b/platforms/megapi/megapi_adaptor.go index f2b6fdaa4..bdbf61063 100644 --- a/platforms/megapi/megapi_adaptor.go +++ b/platforms/megapi/megapi_adaptor.go @@ -61,7 +61,9 @@ func (megaPi *Adaptor) Connect() error { for { select { case bytes := <-megaPi.writeBytesChannel: - megaPi.connection.Write(bytes) + if _, err := megaPi.connection.Write(bytes); err != nil { + panic(err) + } time.Sleep(10 * time.Millisecond) case <-megaPi.finalizeChannel: megaPi.finalizeChannel <- struct{}{} diff --git a/platforms/megapi/motor_driver.go b/platforms/megapi/motor_driver.go index 47d08d7db..1efce6f9a 100644 --- a/platforms/megapi/motor_driver.go +++ b/platforms/megapi/motor_driver.go @@ -45,8 +45,7 @@ func (m *MotorDriver) Start() error { m.syncRoot.Lock() defer m.syncRoot.Unlock() m.halted = false - m.speedHelper(0) - return nil + return m.speedHelper(0) } // Halt terminates the Driver interface @@ -54,8 +53,7 @@ func (m *MotorDriver) Halt() error { m.syncRoot.Lock() defer m.syncRoot.Unlock() m.halted = true - m.speedHelper(0) - return nil + return m.speedHelper(0) } // Connection returns the Connection associated with the Driver @@ -70,25 +68,30 @@ func (m *MotorDriver) Speed(speed int16) error { if m.halted { return nil } - m.speedHelper(speed) - return nil + return m.speedHelper(speed) } // there is some sort of bug on the hardware such that you cannot // send the exact same speed to 2 different motors consecutively // hence we ensure we always alternate speeds -func (m *MotorDriver) speedHelper(speed int16) { - m.sendSpeed(speed - 1) - m.sendSpeed(speed) +func (m *MotorDriver) speedHelper(speed int16) error { + if err := m.sendSpeed(speed - 1); err != nil { + return err + } + return m.sendSpeed(speed) } // sendSpeed sets the motors speed to the specified value -func (m *MotorDriver) sendSpeed(speed int16) { +func (m *MotorDriver) sendSpeed(speed int16) error { bufOut := new(bytes.Buffer) // byte sequence: 0xff, 0x55, id, action, device, port bufOut.Write([]byte{0xff, 0x55, 0x6, 0x0, 0x2, 0xa, m.port}) - binary.Write(bufOut, binary.LittleEndian, speed) + if err := binary.Write(bufOut, binary.LittleEndian, speed); err != nil { + return err + } bufOut.Write([]byte{0xa}) m.megaPi.writeBytesChannel <- bufOut.Bytes() + + return nil } diff --git a/platforms/microbit/accelerometer_driver.go b/platforms/microbit/accelerometer_driver.go index a8da09462..b1cc4e3a9 100644 --- a/platforms/microbit/accelerometer_driver.go +++ b/platforms/microbit/accelerometer_driver.go @@ -29,7 +29,7 @@ type AccelerometerData struct { const ( // BLE services - accelerometerService = "e95d0753251d470aa062fa1922dfa9a8" + //accelerometerService = "e95d0753251d470aa062fa1922dfa9a8" // BLE characteristics accelerometerCharacteristic = "e95dca4b251d470aa062fa1922dfa9a8" @@ -66,15 +66,21 @@ func (b *AccelerometerDriver) adaptor() ble.BLEConnector { } // Start tells driver to get ready to do work -func (b *AccelerometerDriver) Start() (err error) { +func (b *AccelerometerDriver) Start() error { // subscribe to accelerometer notifications - b.adaptor().Subscribe(accelerometerCharacteristic, func(data []byte, e error) { + return b.adaptor().Subscribe(accelerometerCharacteristic, func(data []byte, e error) { a := &RawAccelerometerData{X: 0, Y: 0, Z: 0} buf := bytes.NewBuffer(data) - binary.Read(buf, binary.LittleEndian, &a.X) - binary.Read(buf, binary.LittleEndian, &a.Y) - binary.Read(buf, binary.LittleEndian, &a.Z) + if err := binary.Read(buf, binary.LittleEndian, &a.X); err != nil { + panic(err) + } + if err := binary.Read(buf, binary.LittleEndian, &a.Y); err != nil { + panic(err) + } + if err := binary.Read(buf, binary.LittleEndian, &a.Z); err != nil { + panic(err) + } result := &AccelerometerData{ X: float32(a.X) / 1000.0, @@ -83,11 +89,7 @@ func (b *AccelerometerDriver) Start() (err error) { b.Publish(b.Event(Accelerometer), result) }) - - return } // Halt stops LED driver (void) -func (b *AccelerometerDriver) Halt() (err error) { - return -} +func (b *AccelerometerDriver) Halt() error { return nil } diff --git a/platforms/microbit/accelerometer_driver_test.go b/platforms/microbit/accelerometer_driver_test.go index 36db696e0..7e1786c11 100644 --- a/platforms/microbit/accelerometer_driver_test.go +++ b/platforms/microbit/accelerometer_driver_test.go @@ -33,8 +33,8 @@ func TestAccelerometerDriverReadData(t *testing.T) { sem := make(chan bool) a := NewBleTestAdaptor() d := NewAccelerometerDriver(a) - d.Start() - d.On(Accelerometer, func(data interface{}) { + _ = d.Start() + _ = d.On(Accelerometer, func(data interface{}) { gobottest.Assert(t, data.(*AccelerometerData).X, float32(8.738)) gobottest.Assert(t, data.(*AccelerometerData).Y, float32(8.995)) gobottest.Assert(t, data.(*AccelerometerData).Z, float32(9.252)) diff --git a/platforms/microbit/button_driver.go b/platforms/microbit/button_driver.go index b91c61120..09b17107a 100644 --- a/platforms/microbit/button_driver.go +++ b/platforms/microbit/button_driver.go @@ -14,7 +14,7 @@ type ButtonDriver struct { const ( // BLE services - buttonService = "e95d9882251d470aa062fa1922dfa9a8" + //buttonService = "e95d9882251d470aa062fa1922dfa9a8" // BLE characteristics buttonACharacteristic = "e95dda90251d470aa062fa1922dfa9a8" @@ -56,21 +56,19 @@ func (b *ButtonDriver) adaptor() ble.BLEConnector { } // Start tells driver to get ready to do work -func (b *ButtonDriver) Start() (err error) { +func (b *ButtonDriver) Start() error { // subscribe to button A notifications - b.adaptor().Subscribe(buttonACharacteristic, func(data []byte, e error) { + if err := b.adaptor().Subscribe(buttonACharacteristic, func(data []byte, e error) { b.Publish(b.Event(ButtonA), data) - }) + }); err != nil { + return err + } // subscribe to button B notifications - b.adaptor().Subscribe(buttonBCharacteristic, func(data []byte, e error) { + return b.adaptor().Subscribe(buttonBCharacteristic, func(data []byte, e error) { b.Publish(b.Event(ButtonB), data) }) - - return } // Halt stops LED driver (void) -func (b *ButtonDriver) Halt() (err error) { - return -} +func (b *ButtonDriver) Halt() error { return nil } diff --git a/platforms/microbit/button_driver_test.go b/platforms/microbit/button_driver_test.go index d2a488f6d..007f3881c 100644 --- a/platforms/microbit/button_driver_test.go +++ b/platforms/microbit/button_driver_test.go @@ -33,8 +33,8 @@ func TestButtonDriverReadData(t *testing.T) { sem := make(chan bool) a := NewBleTestAdaptor() d := NewButtonDriver(a) - d.Start() - d.On(ButtonB, func(data interface{}) { + _ = d.Start() + _ = d.On(ButtonB, func(data interface{}) { sem <- true }) diff --git a/platforms/microbit/helpers_test.go b/platforms/microbit/helpers_test.go index e056ebcca..8c94a9615 100644 --- a/platforms/microbit/helpers_test.go +++ b/platforms/microbit/helpers_test.go @@ -40,7 +40,6 @@ func (t *bleTestClientAdaptor) WriteCharacteristic(cUUID string, data []byte) (e return t.testWriteCharacteristic(cUUID, data) } -//nolint:revive // in tests it is be helpful to see the meaning of the parameters by name func (t *bleTestClientAdaptor) Subscribe(cUUID string, f func([]byte, error)) (err error) { t.testSubscribe = f return diff --git a/platforms/microbit/io_pin_driver.go b/platforms/microbit/io_pin_driver.go index 363bac786..b855c16bc 100644 --- a/platforms/microbit/io_pin_driver.go +++ b/platforms/microbit/io_pin_driver.go @@ -22,7 +22,7 @@ type IOPinDriver struct { const ( // BLE services - ioPinService = "e95d127b251d470aa062fa1922dfa9a8" + //ioPinService = "e95d127b251d470aa062fa1922dfa9a8" // BLE characteristics pinDataCharacteristic = "e95d8d00251d470aa062fa1922dfa9a8" @@ -62,19 +62,16 @@ func (b *IOPinDriver) adaptor() ble.BLEConnector { } // Start tells driver to get ready to do work -func (b *IOPinDriver) Start() (err error) { - _, err = b.ReadPinADConfig() - if err != nil { - return +func (b *IOPinDriver) Start() error { + if _, err := b.ReadPinADConfig(); err != nil { + return err } - _, err = b.ReadPinIOConfig() - return + _, err := b.ReadPinIOConfig() + return err } // Halt stops driver (void) -func (b *IOPinDriver) Halt() (err error) { - return -} +func (b *IOPinDriver) Halt() error { return nil } // ReadAllPinData reads and returns the pin data for all pins func (b *IOPinDriver) ReadAllPinData() (pins []PinData) { @@ -93,10 +90,10 @@ func (b *IOPinDriver) ReadAllPinData() (pins []PinData) { } // WritePinData writes the pin data for a single pin -func (b *IOPinDriver) WritePinData(pin string, data byte) (err error) { +func (b *IOPinDriver) WritePinData(pin string, data byte) error { i, err := strconv.Atoi(pin) if err != nil { - return + return err } buf := []byte{byte(i), data} @@ -105,10 +102,10 @@ func (b *IOPinDriver) WritePinData(pin string, data byte) (err error) { } // ReadPinADConfig reads and returns the pin A/D config mask for all pins -func (b *IOPinDriver) ReadPinADConfig() (config int, err error) { - c, e := b.adaptor().ReadCharacteristic(pinADConfigCharacteristic) - if e != nil { - return 0, e +func (b *IOPinDriver) ReadPinADConfig() (int, error) { + c, err := b.adaptor().ReadCharacteristic(pinADConfigCharacteristic) + if err != nil { + return 0, err } var result byte for i := 0; i < 4; i++ { @@ -120,19 +117,21 @@ func (b *IOPinDriver) ReadPinADConfig() (config int, err error) { } // WritePinADConfig writes the pin A/D config mask for all pins -func (b *IOPinDriver) WritePinADConfig(config int) (err error) { +func (b *IOPinDriver) WritePinADConfig(config int) error { b.adMask = config data := &bytes.Buffer{} - binary.Write(data, binary.LittleEndian, uint32(config)) - err = b.adaptor().WriteCharacteristic(pinADConfigCharacteristic, data.Bytes()) - return + if err := binary.Write(data, binary.LittleEndian, uint32(config)); err != nil { + return err + } + + return b.adaptor().WriteCharacteristic(pinADConfigCharacteristic, data.Bytes()) } // ReadPinIOConfig reads and returns the pin IO config mask for all pins -func (b *IOPinDriver) ReadPinIOConfig() (config int, err error) { - c, e := b.adaptor().ReadCharacteristic(pinIOConfigCharacteristic) - if e != nil { - return 0, e +func (b *IOPinDriver) ReadPinIOConfig() (int, error) { + c, err := b.adaptor().ReadCharacteristic(pinIOConfigCharacteristic) + if err != nil { + return 0, err } var result byte @@ -145,77 +144,99 @@ func (b *IOPinDriver) ReadPinIOConfig() (config int, err error) { } // WritePinIOConfig writes the pin I/O config mask for all pins -func (b *IOPinDriver) WritePinIOConfig(config int) (err error) { +func (b *IOPinDriver) WritePinIOConfig(config int) error { b.ioMask = config data := &bytes.Buffer{} - binary.Write(data, binary.LittleEndian, uint32(config)) - err = b.adaptor().WriteCharacteristic(pinIOConfigCharacteristic, data.Bytes()) - return + if err := binary.Write(data, binary.LittleEndian, uint32(config)); err != nil { + return err + } + + return b.adaptor().WriteCharacteristic(pinIOConfigCharacteristic, data.Bytes()) } // DigitalRead reads from a pin -func (b *IOPinDriver) DigitalRead(pin string) (val int, err error) { +func (b *IOPinDriver) DigitalRead(pin string) (int, error) { p, err := validatedPin(pin) if err != nil { - return + return 0, err } - b.ensureDigital(p) - b.ensureInput(p) + if err := b.ensureDigital(p); err != nil { + return 0, err + } + if err := b.ensureInput(p); err != nil { + return 0, err + } pins := b.ReadAllPinData() return int(pins[p].value), nil } // DigitalWrite writes to a pin -func (b *IOPinDriver) DigitalWrite(pin string, level byte) (err error) { +func (b *IOPinDriver) DigitalWrite(pin string, level byte) error { p, err := validatedPin(pin) if err != nil { - return + return err } - b.ensureDigital(p) - b.ensureOutput(p) + if err := b.ensureDigital(p); err != nil { + return err + } + if err := b.ensureOutput(p); err != nil { + return err + } return b.WritePinData(pin, level) } // AnalogRead reads from a pin -func (b *IOPinDriver) AnalogRead(pin string) (val int, err error) { +func (b *IOPinDriver) AnalogRead(pin string) (int, error) { p, err := validatedPin(pin) if err != nil { - return + return 0, err } - b.ensureAnalog(p) - b.ensureInput(p) + if err := b.ensureAnalog(p); err != nil { + return 0, err + } + if err := b.ensureInput(p); err != nil { + return 0, err + } pins := b.ReadAllPinData() return int(pins[p].value), nil } -func (b *IOPinDriver) ensureDigital(pin int) { +func (b *IOPinDriver) ensureDigital(pin int) error { if hasBit(b.adMask, pin) { - b.WritePinADConfig(clearBit(b.adMask, pin)) + return b.WritePinADConfig(clearBit(b.adMask, pin)) } + + return nil } -func (b *IOPinDriver) ensureAnalog(pin int) { +func (b *IOPinDriver) ensureAnalog(pin int) error { if !hasBit(b.adMask, pin) { - b.WritePinADConfig(setBit(b.adMask, pin)) + return b.WritePinADConfig(setBit(b.adMask, pin)) } + + return nil } -func (b *IOPinDriver) ensureInput(pin int) { +func (b *IOPinDriver) ensureInput(pin int) error { if !hasBit(b.ioMask, pin) { - b.WritePinIOConfig(setBit(b.ioMask, pin)) + return b.WritePinIOConfig(setBit(b.ioMask, pin)) } + + return nil } -func (b *IOPinDriver) ensureOutput(pin int) { +func (b *IOPinDriver) ensureOutput(pin int) error { if hasBit(b.ioMask, pin) { - b.WritePinIOConfig(clearBit(b.ioMask, pin)) + return b.WritePinIOConfig(clearBit(b.ioMask, pin)) } + + return nil } func validatedPin(pin string) (int, error) { diff --git a/platforms/microbit/led_driver.go b/platforms/microbit/led_driver.go index 877a5441e..3c9af03de 100644 --- a/platforms/microbit/led_driver.go +++ b/platforms/microbit/led_driver.go @@ -14,7 +14,7 @@ type LEDDriver struct { const ( // BLE services - ledService = "e95dd91d251d470aa062fa1922dfa9a8" + //ledService = "e95dd91d251d470aa062fa1922dfa9a8" // BLE characteristics ledMatrixStateCharacteristic = "e95d7b77251d470aa062fa1922dfa9a8" diff --git a/platforms/microbit/led_driver_test.go b/platforms/microbit/led_driver_test.go index 7e02da79f..9d4003c20 100644 --- a/platforms/microbit/led_driver_test.go +++ b/platforms/microbit/led_driver_test.go @@ -30,19 +30,19 @@ func TestLEDDriverStartAndHalt(t *testing.T) { func TestLEDDriverWriteMatrix(t *testing.T) { d := initTestLEDDriver() - d.Start() + _ = d.Start() gobottest.Assert(t, d.WriteMatrix([]byte{0x01, 0x02}), nil) } func TestLEDDriverWriteText(t *testing.T) { d := initTestLEDDriver() - d.Start() + _ = d.Start() gobottest.Assert(t, d.WriteText("Hello"), nil) } func TestLEDDriverCommands(t *testing.T) { d := initTestLEDDriver() - d.Start() + _ = d.Start() gobottest.Assert(t, d.Blank(), nil) gobottest.Assert(t, d.Solid(), nil) gobottest.Assert(t, d.UpRightArrow(), nil) diff --git a/platforms/microbit/magnetometer_driver.go b/platforms/microbit/magnetometer_driver.go index 148ceb5b2..c899be683 100644 --- a/platforms/microbit/magnetometer_driver.go +++ b/platforms/microbit/magnetometer_driver.go @@ -29,7 +29,7 @@ type MagnetometerData struct { const ( // BLE services - magnetometerService = "e95df2d8251d470aa062fa1922dfa9a8" + //magnetometerService = "e95df2d8251d470aa062fa1922dfa9a8" // BLE characteristics magnetometerCharacteristic = "e95dfb11251d470aa062fa1922dfa9a8" @@ -66,15 +66,21 @@ func (b *MagnetometerDriver) adaptor() ble.BLEConnector { } // Start tells driver to get ready to do work -func (b *MagnetometerDriver) Start() (err error) { +func (b *MagnetometerDriver) Start() error { // subscribe to magnetometer notifications - b.adaptor().Subscribe(magnetometerCharacteristic, func(data []byte, e error) { + return b.adaptor().Subscribe(magnetometerCharacteristic, func(data []byte, e error) { a := &RawMagnetometerData{X: 0, Y: 0, Z: 0} buf := bytes.NewBuffer(data) - binary.Read(buf, binary.LittleEndian, &a.X) - binary.Read(buf, binary.LittleEndian, &a.Y) - binary.Read(buf, binary.LittleEndian, &a.Z) + if err := binary.Read(buf, binary.LittleEndian, &a.X); err != nil { + panic(err) + } + if err := binary.Read(buf, binary.LittleEndian, &a.Y); err != nil { + panic(err) + } + if err := binary.Read(buf, binary.LittleEndian, &a.Z); err != nil { + panic(err) + } result := &MagnetometerData{ X: float32(a.X) / 1000.0, @@ -83,11 +89,7 @@ func (b *MagnetometerDriver) Start() (err error) { b.Publish(b.Event(Magnetometer), result) }) - - return } // Halt stops LED driver (void) -func (b *MagnetometerDriver) Halt() (err error) { - return -} +func (b *MagnetometerDriver) Halt() error { return nil } diff --git a/platforms/microbit/magnetometer_driver_test.go b/platforms/microbit/magnetometer_driver_test.go index 8e5c59c98..03ef4145f 100644 --- a/platforms/microbit/magnetometer_driver_test.go +++ b/platforms/microbit/magnetometer_driver_test.go @@ -33,8 +33,8 @@ func TestMagnetometerDriverReadData(t *testing.T) { sem := make(chan bool) a := NewBleTestAdaptor() d := NewMagnetometerDriver(a) - d.Start() - d.On(Magnetometer, func(data interface{}) { + _ = d.Start() + _ = d.On(Magnetometer, func(data interface{}) { gobottest.Assert(t, data.(*MagnetometerData).X, float32(8.738)) gobottest.Assert(t, data.(*MagnetometerData).Y, float32(8.995)) gobottest.Assert(t, data.(*MagnetometerData).Z, float32(9.252)) diff --git a/platforms/microbit/temperature_driver.go b/platforms/microbit/temperature_driver.go index c14420493..0e7ca7ea1 100644 --- a/platforms/microbit/temperature_driver.go +++ b/platforms/microbit/temperature_driver.go @@ -16,7 +16,7 @@ type TemperatureDriver struct { const ( // BLE services - temperatureService = "e95d6100251d470aa062fa1922dfa9a8" + //temperatureService = "e95d6100251d470aa062fa1922dfa9a8" // BLE characteristics temperatureCharacteristic = "e95d9250251d470aa062fa1922dfa9a8" @@ -53,9 +53,9 @@ func (b *TemperatureDriver) adaptor() ble.BLEConnector { } // Start tells driver to get ready to do work -func (b *TemperatureDriver) Start() (err error) { +func (b *TemperatureDriver) Start() error { // subscribe to temperature notifications - b.adaptor().Subscribe(temperatureCharacteristic, func(data []byte, e error) { + return b.adaptor().Subscribe(temperatureCharacteristic, func(data []byte, e error) { var l int8 buf := bytes.NewBuffer(data) val, _ := buf.ReadByte() @@ -63,11 +63,7 @@ func (b *TemperatureDriver) Start() (err error) { b.Publish(b.Event(Temperature), l) }) - - return } // Halt stops Temperature driver (void) -func (b *TemperatureDriver) Halt() (err error) { - return -} +func (b *TemperatureDriver) Halt() error { return nil } diff --git a/platforms/microbit/temperature_driver_test.go b/platforms/microbit/temperature_driver_test.go index 6bd40ca4e..8abeef661 100644 --- a/platforms/microbit/temperature_driver_test.go +++ b/platforms/microbit/temperature_driver_test.go @@ -33,8 +33,8 @@ func TestTemperatureDriverReadData(t *testing.T) { sem := make(chan bool) a := NewBleTestAdaptor() d := NewTemperatureDriver(a) - d.Start() - d.On(Temperature, func(data interface{}) { + _ = d.Start() + _ = d.On(Temperature, func(data interface{}) { gobottest.Assert(t, data, int8(0x22)) sem <- true }) diff --git a/platforms/mqtt/mqtt_adaptor.go b/platforms/mqtt/mqtt_adaptor.go index 9268f2b98..d70badb05 100644 --- a/platforms/mqtt/mqtt_adaptor.go +++ b/platforms/mqtt/mqtt_adaptor.go @@ -8,7 +8,6 @@ import ( "gobot.io/x/gobot/v2" paho "github.com/eclipse/paho.mqtt.golang" - multierror "github.com/hashicorp/go-multierror" "github.com/pkg/errors" ) @@ -112,27 +111,26 @@ func (a *Adaptor) ClientKey() string { return a.clientKey } func (a *Adaptor) SetClientKey(val string) { a.clientKey = val } // Connect returns true if connection to mqtt is established -func (a *Adaptor) Connect() (err error) { +func (a *Adaptor) Connect() error { a.client = paho.NewClient(a.createClientOptions()) if token := a.client.Connect(); token.Wait() && token.Error() != nil { - err = multierror.Append(err, token.Error()) + return token.Error() } - return + return nil } // Disconnect returns true if connection to mqtt is closed -func (a *Adaptor) Disconnect() (err error) { +func (a *Adaptor) Disconnect() error { if a.client != nil { a.client.Disconnect(500) } - return + return nil } // Finalize returns true if connection to mqtt is finalized successfully -func (a *Adaptor) Finalize() (err error) { - a.Disconnect() - return +func (a *Adaptor) Finalize() error { + return a.Disconnect() } // Publish a message under a specific topic diff --git a/platforms/mqtt/mqtt_adaptor_test.go b/platforms/mqtt/mqtt_adaptor_test.go index 638ad0bdc..db27ec67e 100644 --- a/platforms/mqtt/mqtt_adaptor_test.go +++ b/platforms/mqtt/mqtt_adaptor_test.go @@ -6,7 +6,6 @@ import ( "strings" "testing" - multierror "github.com/hashicorp/go-multierror" "gobot.io/x/gobot/v2" "gobot.io/x/gobot/v2/gobottest" ) @@ -87,10 +86,7 @@ func TestMqttAdaptorConnectSSLError(t *testing.T) { func TestMqttAdaptorConnectWithAuthError(t *testing.T) { a := NewAdaptorWithAuth("xyz://localhost:1883", "client", "user", "pass") - var expected error - expected = multierror.Append(expected, errors.New("network Error : unknown protocol")) - - gobottest.Assert(t, a.Connect(), expected) + gobottest.Assert(t, a.Connect(), errors.New("network Error : unknown protocol")) } func TestMqttAdaptorFinalize(t *testing.T) { @@ -106,7 +102,7 @@ func TestMqttAdaptorCannotPublishUnlessConnected(t *testing.T) { func TestMqttAdaptorPublishWhenConnected(t *testing.T) { a := initTestMqttAdaptor() - a.Connect() + _ = a.Connect() data := []byte("o") gobottest.Assert(t, a.Publish("test", data), true) } @@ -120,7 +116,7 @@ func TestMqttAdaptorCannotOnUnlessConnected(t *testing.T) { func TestMqttAdaptorOnWhenConnected(t *testing.T) { a := initTestMqttAdaptor() - a.Connect() + _ = a.Connect() gobottest.Assert(t, a.On("hola", func(msg Message) { fmt.Println("hola") }), true) diff --git a/platforms/mqtt/mqtt_driver_test.go b/platforms/mqtt/mqtt_driver_test.go index 8f8fb778d..028838db7 100644 --- a/platforms/mqtt/mqtt_driver_test.go +++ b/platforms/mqtt/mqtt_driver_test.go @@ -37,16 +37,16 @@ func TestMqttDriverTopic(t *testing.T) { func TestMqttDriverPublish(t *testing.T) { a := initTestMqttAdaptor() d := NewDriver(a, "/test/topic") - a.Connect() - d.Start() - defer d.Halt() + _ = a.Connect() + _ = d.Start() + defer func() { _ = d.Halt() }() gobottest.Assert(t, d.Publish([]byte{0x01, 0x02, 0x03}), true) } func TestMqttDriverPublishError(t *testing.T) { a := initTestMqttAdaptor() d := NewDriver(a, "/test/topic") - d.Start() - defer d.Halt() + _ = d.Start() + defer func() { _ = d.Halt() }() gobottest.Assert(t, d.Publish([]byte{0x01, 0x02, 0x03}), false) } diff --git a/platforms/nanopi/nanopi_adaptor.go b/platforms/nanopi/nanopi_adaptor.go index 65f244c97..46b67c85d 100644 --- a/platforms/nanopi/nanopi_adaptor.go +++ b/platforms/nanopi/nanopi_adaptor.go @@ -11,8 +11,6 @@ import ( ) const ( - debug = false - pwmInvertedIdentifier = "inversed" defaultI2cBusNumber = 0 diff --git a/platforms/nanopi/nanopi_adaptor_test.go b/platforms/nanopi/nanopi_adaptor_test.go index e506ef67c..e6681c047 100644 --- a/platforms/nanopi/nanopi_adaptor_test.go +++ b/platforms/nanopi/nanopi_adaptor_test.go @@ -83,7 +83,7 @@ func TestDigitalIO(t *testing.T) { // only basic tests needed, further tests are done in "digitalpinsadaptor.go" a, fs := initTestAdaptorWithMockedFilesystem(gpioMockPaths) - a.DigitalWrite("7", 1) + _ = a.DigitalWrite("7", 1) gobottest.Assert(t, fs.Files[gpio203Path+"value"].Contents, "1") fs.Files[gpio199Path+"value"].Contents = "1" diff --git a/platforms/nats/nats_adaptor.go b/platforms/nats/nats_adaptor.go index 5099ef9a2..122cdad9e 100644 --- a/platforms/nats/nats_adaptor.go +++ b/platforms/nats/nats_adaptor.go @@ -1,6 +1,7 @@ package nats import ( + "log" "net/url" "strings" @@ -86,23 +87,23 @@ func (a *Adaptor) Name() string { return a.name } func (a *Adaptor) SetName(n string) { a.name = n } // Connect makes a connection to the Nats server. -func (a *Adaptor) Connect() (err error) { +func (a *Adaptor) Connect() error { + var err error a.client, err = a.connect() - return + return err } // Disconnect from the nats server. -func (a *Adaptor) Disconnect() (err error) { +func (a *Adaptor) Disconnect() error { if a.client != nil { a.client.Close() } - return + return nil } // Finalize is simply a helper method for the disconnect. -func (a *Adaptor) Finalize() (err error) { - a.Disconnect() - return +func (a *Adaptor) Finalize() error { + return a.Disconnect() } // Publish sends a message with the particular topic to the nats server. @@ -110,7 +111,12 @@ func (a *Adaptor) Publish(topic string, message []byte) bool { if a.client == nil { return false } - a.client.Publish(topic, message) + + if err := a.client.Publish(topic, message); err != nil { + log.Println(err) + return false + } + return true } @@ -120,9 +126,12 @@ func (a *Adaptor) On(event string, f func(msg Message)) bool { if a.client == nil { return false } - a.client.Subscribe(event, func(msg *nats.Msg) { + if _, err := a.client.Subscribe(event, func(msg *nats.Msg) { f(msg) - }) + }); err != nil { + log.Println(err) + return false + } return true } diff --git a/platforms/nats/nats_adaptor_test.go b/platforms/nats/nats_adaptor_test.go index f0ff1d49e..469ec6f2b 100644 --- a/platforms/nats/nats_adaptor_test.go +++ b/platforms/nats/nats_adaptor_test.go @@ -72,7 +72,7 @@ func TestNatsAdaptorWithAuth(t *testing.T) { func TestNatsAdapterSetsRootCAs(t *testing.T) { a := initTestNatsAdaptorTLS(nats.RootCAs("test_certs/catest.pem")) gobottest.Assert(t, a.Host, "tls://localhost:4242") - a.Connect() + _ = a.Connect() o := a.client.Opts casPool, err := o.RootCAsCB() gobottest.Assert(t, err, nil) @@ -83,7 +83,7 @@ func TestNatsAdapterSetsRootCAs(t *testing.T) { func TestNatsAdapterSetsClientCerts(t *testing.T) { a := initTestNatsAdaptorTLS(nats.ClientCert("test_certs/client-cert.pem", "test_certs/client-key.pem")) gobottest.Assert(t, a.Host, "tls://localhost:4242") - a.Connect() + _ = a.Connect() cert, err := a.client.Opts.TLSCertCB() gobottest.Assert(t, err, nil) gobottest.Refute(t, cert, nil) @@ -94,7 +94,7 @@ func TestNatsAdapterSetsClientCerts(t *testing.T) { func TestNatsAdapterSetsClientCertsWithUserInfo(t *testing.T) { a := initTestNatsAdaptorTLS(nats.ClientCert("test_certs/client-cert.pem", "test_certs/client-key.pem"), nats.UserInfo("test", "testwd")) gobottest.Assert(t, a.Host, "tls://localhost:4242") - a.Connect() + _ = a.Connect() cert, err := a.client.Opts.TLSCertCB() gobottest.Assert(t, err, nil) gobottest.Refute(t, cert, nil) @@ -108,7 +108,7 @@ func TestNatsAdapterSetsClientCertsWithUserInfo(t *testing.T) { func TestNatsAdaptorPublishWhenConnected(t *testing.T) { t.Skip("TODO: implement this test without requiring actual server connection") a := initTestNatsAdaptor() - a.Connect() + _ = a.Connect() data := []byte("o") gobottest.Assert(t, a.Publish("test", data), true) } @@ -117,7 +117,7 @@ func TestNatsAdaptorPublishWhenConnected(t *testing.T) { func TestNatsAdaptorOnWhenConnected(t *testing.T) { t.Skip("TODO: implement this test without requiring actual server connection") a := initTestNatsAdaptor() - a.Connect() + _ = a.Connect() gobottest.Assert(t, a.On("hola", func(msg Message) { fmt.Println("hola") }), true) @@ -127,7 +127,7 @@ func TestNatsAdaptorOnWhenConnected(t *testing.T) { func TestNatsAdaptorPublishWhenConnectedWithAuth(t *testing.T) { t.Skip("TODO: implement this test without requiring actual server connection") a := NewAdaptorWithAuth("localhost:4222", 49999, "test", "testwd") - a.Connect() + _ = a.Connect() data := []byte("o") gobottest.Assert(t, a.Publish("test", data), true) } @@ -137,7 +137,7 @@ func TestNatsAdaptorOnWhenConnectedWithAuth(t *testing.T) { t.Skip("TODO: implement this test without requiring actual server connection") log.Println("###not skipped###") a := NewAdaptorWithAuth("localhost:4222", 59999, "test", "testwd") - a.Connect() + _ = a.Connect() gobottest.Assert(t, a.On("hola", func(msg Message) { fmt.Println("hola") }), true) diff --git a/platforms/neurosky/neurosky_adaptor_test.go b/platforms/neurosky/neurosky_adaptor_test.go index fe1d8aa17..74237ec7a 100644 --- a/platforms/neurosky/neurosky_adaptor_test.go +++ b/platforms/neurosky/neurosky_adaptor_test.go @@ -19,12 +19,6 @@ type NullReadWriteCloser struct { closeError error } -// func NewNullReadWriteCloser() *NullReadWriteCloser { -// return NullReadWriteCloser{ -// -// } -// } - func (n *NullReadWriteCloser) ReadError(e error) { n.mtx.Lock() defer n.mtx.Unlock() @@ -89,10 +83,10 @@ func TestNeuroskyAdaptorFinalize(t *testing.T) { a.connect = func(n *Adaptor) (io.ReadWriteCloser, error) { return rwc, nil } - a.Connect() + _ = a.Connect() gobottest.Assert(t, a.Finalize(), nil) rwc.CloseError(errors.New("close error")) - a.Connect() + _ = a.Connect() gobottest.Assert(t, a.Finalize(), errors.New("close error")) } diff --git a/platforms/neurosky/neurosky_driver.go b/platforms/neurosky/neurosky_driver.go index f08403ec8..a09328ea5 100644 --- a/platforms/neurosky/neurosky_driver.go +++ b/platforms/neurosky/neurosky_driver.go @@ -120,7 +120,7 @@ func (n *Driver) adaptor() *Adaptor { // Start creates a go routine to listen from serial port // and parse buffer readings -func (n *Driver) Start() (err error) { +func (n *Driver) Start() error { go func() { for { buff := make([]byte, 1024) @@ -128,34 +128,42 @@ func (n *Driver) Start() (err error) { if err != nil { n.Publish(n.Event("error"), err) } else { - n.parse(bytes.NewBuffer(buff)) + if err := n.parse(bytes.NewBuffer(buff)); err != nil { + panic(err) + } } } }() - return + return nil } // Halt stops neurosky driver (void) -func (n *Driver) Halt() (err error) { return } +func (n *Driver) Halt() error { return nil } // parse converts bytes buffer into packets until no more data is present -func (n *Driver) parse(buf *bytes.Buffer) { +func (n *Driver) parse(buf *bytes.Buffer) error { for buf.Len() > 2 { b1, _ := buf.ReadByte() b2, _ := buf.ReadByte() if b1 == BTSync && b2 == BTSync { length, _ := buf.ReadByte() payload := make([]byte, length) - buf.Read(payload) + if _, err := buf.Read(payload); err != nil { + return err + } //checksum, _ := buf.ReadByte() buf.Next(1) - n.parsePacket(bytes.NewBuffer(payload)) + if err := n.parsePacket(bytes.NewBuffer(payload)); err != nil { + panic(err) + } } } + + return nil } // parsePacket publishes event according to data parsed -func (n *Driver) parsePacket(buf *bytes.Buffer) { +func (n *Driver) parsePacket(buf *bytes.Buffer) error { for buf.Len() > 0 { b, _ := buf.ReadByte() switch b { @@ -176,7 +184,9 @@ func (n *Driver) parsePacket(buf *bytes.Buffer) { case CodeWave: buf.Next(1) var ret = make([]byte, 2) - buf.Read(ret) + if _, err := buf.Read(ret); err != nil { + return err + } n.Publish(n.Event("wave"), int16(ret[0])<<8|int16(ret[1])) case CodeAsicEEG: ret := make([]byte, 25) @@ -186,6 +196,8 @@ func (n *Driver) parsePacket(buf *bytes.Buffer) { } } } + + return nil } // parseEEG returns data converted into EEG map diff --git a/platforms/neurosky/neurosky_driver_test.go b/platforms/neurosky/neurosky_driver_test.go index ab73215b1..9f83f5387 100644 --- a/platforms/neurosky/neurosky_driver_test.go +++ b/platforms/neurosky/neurosky_driver_test.go @@ -19,7 +19,7 @@ func initTestNeuroskyDriver() *Driver { a.connect = func(n *Adaptor) (io.ReadWriteCloser, error) { return &NullReadWriteCloser{}, nil } - a.Connect() + _ = a.Connect() return NewDriver(a) } @@ -43,11 +43,11 @@ func TestNeuroskyDriverStart(t *testing.T) { a.connect = func(n *Adaptor) (io.ReadWriteCloser, error) { return rwc, nil } - a.Connect() + _ = a.Connect() d := NewDriver(a) e := errors.New("read error") - d.Once(d.Event(Error), func(data interface{}) { + _ = d.Once(d.Event(Error), func(data interface{}) { gobottest.Assert(t, data.(error), e) sem <- true }) @@ -79,10 +79,10 @@ func TestNeuroskyDriverParse(t *testing.T) { // CodeEx go func() { time.Sleep(5 * time.Millisecond) - d.parse(bytes.NewBuffer([]byte{0xAA, 0xAA, 1, 0x55, 0x00})) + _ = d.parse(bytes.NewBuffer([]byte{0xAA, 0xAA, 1, 0x55, 0x00})) }() - d.On(d.Event(Extended), func(data interface{}) { + _ = d.On(d.Event(Extended), func(data interface{}) { sem <- true }) @@ -95,10 +95,10 @@ func TestNeuroskyDriverParse(t *testing.T) { // CodeSignalQuality go func() { time.Sleep(5 * time.Millisecond) - d.parse(bytes.NewBuffer([]byte{0xAA, 0xAA, 2, 0x02, 100, 0x00})) + _ = d.parse(bytes.NewBuffer([]byte{0xAA, 0xAA, 2, 0x02, 100, 0x00})) }() - d.On(d.Event(Signal), func(data interface{}) { + _ = d.On(d.Event(Signal), func(data interface{}) { gobottest.Assert(t, data.(byte), byte(100)) sem <- true }) @@ -108,10 +108,10 @@ func TestNeuroskyDriverParse(t *testing.T) { // CodeAttention go func() { time.Sleep(5 * time.Millisecond) - d.parse(bytes.NewBuffer([]byte{0xAA, 0xAA, 2, 0x04, 40, 0x00})) + _ = d.parse(bytes.NewBuffer([]byte{0xAA, 0xAA, 2, 0x04, 40, 0x00})) }() - d.On(d.Event(Attention), func(data interface{}) { + _ = d.On(d.Event(Attention), func(data interface{}) { gobottest.Assert(t, data.(byte), byte(40)) sem <- true }) @@ -121,10 +121,10 @@ func TestNeuroskyDriverParse(t *testing.T) { // CodeMeditation go func() { time.Sleep(5 * time.Millisecond) - d.parse(bytes.NewBuffer([]byte{0xAA, 0xAA, 2, 0x05, 60, 0x00})) + _ = d.parse(bytes.NewBuffer([]byte{0xAA, 0xAA, 2, 0x05, 60, 0x00})) }() - d.On(d.Event(Meditation), func(data interface{}) { + _ = d.On(d.Event(Meditation), func(data interface{}) { gobottest.Assert(t, data.(byte), byte(60)) sem <- true }) @@ -134,10 +134,10 @@ func TestNeuroskyDriverParse(t *testing.T) { // CodeBlink go func() { time.Sleep(5 * time.Millisecond) - d.parse(bytes.NewBuffer([]byte{0xAA, 0xAA, 2, 0x16, 150, 0x00})) + _ = d.parse(bytes.NewBuffer([]byte{0xAA, 0xAA, 2, 0x16, 150, 0x00})) }() - d.On(d.Event(Blink), func(data interface{}) { + _ = d.On(d.Event(Blink), func(data interface{}) { gobottest.Assert(t, data.(byte), byte(150)) sem <- true }) @@ -147,10 +147,10 @@ func TestNeuroskyDriverParse(t *testing.T) { // CodeWave go func() { time.Sleep(5 * time.Millisecond) - d.parse(bytes.NewBuffer([]byte{0xAA, 0xAA, 4, 0x80, 0x00, 0x40, 0x11, 0x00})) + _ = d.parse(bytes.NewBuffer([]byte{0xAA, 0xAA, 4, 0x80, 0x00, 0x40, 0x11, 0x00})) }() - d.On(d.Event(Wave), func(data interface{}) { + _ = d.On(d.Event(Wave), func(data interface{}) { gobottest.Assert(t, data.(int16), int16(16401)) sem <- true }) @@ -160,12 +160,12 @@ func TestNeuroskyDriverParse(t *testing.T) { // CodeAsicEEG go func() { time.Sleep(5 * time.Millisecond) - d.parse(bytes.NewBuffer([]byte{0xAA, 0xAA, 30, 0x83, 24, 1, 121, 89, 0, + _ = d.parse(bytes.NewBuffer([]byte{0xAA, 0xAA, 30, 0x83, 24, 1, 121, 89, 0, 97, 26, 0, 30, 189, 0, 57, 1, 0, 62, 160, 0, 31, 127, 0, 18, 207, 0, 13, 108, 0x00})) }() - d.On(d.Event(EEG), func(data interface{}) { + _ = d.On(d.Event(EEG), func(data interface{}) { gobottest.Assert(t, data.(EEGData), EEGData{ diff --git a/platforms/parrot/ardrone/ardrone_driver_test.go b/platforms/parrot/ardrone/ardrone_driver_test.go index ec1bf9c91..dfdf6e26c 100644 --- a/platforms/parrot/ardrone/ardrone_driver_test.go +++ b/platforms/parrot/ardrone/ardrone_driver_test.go @@ -16,7 +16,7 @@ func initTestArdroneDriver() *Driver { } d := NewDriver(a) d.SetName("mydrone") - a.Connect() + _ = a.Connect() return d } diff --git a/platforms/parrot/bebop/bebop_adaptor.go b/platforms/parrot/bebop/bebop_adaptor.go index 23716e1cd..b094b8803 100644 --- a/platforms/parrot/bebop/bebop_adaptor.go +++ b/platforms/parrot/bebop/bebop_adaptor.go @@ -53,10 +53,9 @@ func (a *Adaptor) Name() string { return a.name } func (a *Adaptor) SetName(n string) { a.name = n } // Connect establishes a connection to the ardrone -func (a *Adaptor) Connect() (err error) { - err = a.connect(a) - return +func (a *Adaptor) Connect() error { + return a.connect(a) } // Finalize terminates the connection to the ardrone -func (a *Adaptor) Finalize() (err error) { return } +func (a *Adaptor) Finalize() error { return nil } diff --git a/platforms/parrot/bebop/bebop_adaptor_test.go b/platforms/parrot/bebop/bebop_adaptor_test.go index 65d818bbf..7faf839ca 100644 --- a/platforms/parrot/bebop/bebop_adaptor_test.go +++ b/platforms/parrot/bebop/bebop_adaptor_test.go @@ -39,6 +39,6 @@ func TestBebopAdaptorConnect(t *testing.T) { func TestBebopAdaptorFinalize(t *testing.T) { a := initTestBebopAdaptor() - a.Connect() + _ = a.Connect() gobottest.Assert(t, a.Finalize(), nil) } diff --git a/platforms/parrot/bebop/bebop_driver.go b/platforms/parrot/bebop/bebop_driver.go index 43d685123..b0d1c0f4f 100644 --- a/platforms/parrot/bebop/bebop_driver.go +++ b/platforms/parrot/bebop/bebop_driver.go @@ -57,63 +57,63 @@ func (a *Driver) TakeOff() { } // Land causes the drone to land -func (a *Driver) Land() { - a.adaptor().drone.Land() +func (a *Driver) Land() error { + return a.adaptor().drone.Land() } // Up makes the drone gain altitude. // speed can be a value from `0` to `100`. -func (a *Driver) Up(speed int) { - a.adaptor().drone.Up(speed) +func (a *Driver) Up(speed int) error { + return a.adaptor().drone.Up(speed) } // Down makes the drone reduce altitude. // speed can be a value from `0` to `100`. -func (a *Driver) Down(speed int) { - a.adaptor().drone.Down(speed) +func (a *Driver) Down(speed int) error { + return a.adaptor().drone.Down(speed) } // Left causes the drone to bank to the left, controls the roll, which is // a horizontal movement using the camera as a reference point. // speed can be a value from `0` to `100`. -func (a *Driver) Left(speed int) { - a.adaptor().drone.Left(speed) +func (a *Driver) Left(speed int) error { + return a.adaptor().drone.Left(speed) } // Right causes the drone to bank to the right, controls the roll, which is // a horizontal movement using the camera as a reference point. // speed can be a value from `0` to `100`. -func (a *Driver) Right(speed int) { - a.adaptor().drone.Right(speed) +func (a *Driver) Right(speed int) error { + return a.adaptor().drone.Right(speed) } // Forward causes the drone go forward, controls the pitch. // speed can be a value from `0` to `100`. -func (a *Driver) Forward(speed int) { - a.adaptor().drone.Forward(speed) +func (a *Driver) Forward(speed int) error { + return a.adaptor().drone.Forward(speed) } // Backward causes the drone go forward, controls the pitch. // speed can be a value from `0` to `100`. -func (a *Driver) Backward(speed int) { - a.adaptor().drone.Backward(speed) +func (a *Driver) Backward(speed int) error { + return a.adaptor().drone.Backward(speed) } // Clockwise causes the drone to spin in clockwise direction // speed can be a value from `0` to `100`. -func (a *Driver) Clockwise(speed int) { - a.adaptor().drone.Clockwise(speed) +func (a *Driver) Clockwise(speed int) error { + return a.adaptor().drone.Clockwise(speed) } // CounterClockwise the drone to spin in counter clockwise direction // speed can be a value from `0` to `100`. -func (a *Driver) CounterClockwise(speed int) { - a.adaptor().drone.CounterClockwise(speed) +func (a *Driver) CounterClockwise(speed int) error { + return a.adaptor().drone.CounterClockwise(speed) } // Stop makes the drone to hover in place. -func (a *Driver) Stop() { - a.adaptor().drone.Stop() +func (a *Driver) Stop() error { + return a.adaptor().drone.Stop() } // Video returns a channel which raw video frames will be broadcast on diff --git a/platforms/parrot/bebop/client/client.go b/platforms/parrot/bebop/client/client.go index 91acfa44d..50c76bcbf 100644 --- a/platforms/parrot/bebop/client/client.go +++ b/platforms/parrot/bebop/client/client.go @@ -69,7 +69,9 @@ func NewARStreamFrame(buf []byte) ARStreamFrame { } var number uint16 - binary.Read(bytes.NewReader(buf[0:2]), binary.LittleEndian, &number) + if err := binary.Read(bytes.NewReader(buf[0:2]), binary.LittleEndian, &number); err != nil { + panic(err) + } frame.FrameNumber = int(number) @@ -95,7 +97,9 @@ func NewNetworkFrame(buf []byte) NetworkFrame { } var size uint32 - binary.Read(bytes.NewReader(buf[3:7]), binary.LittleEndian, &size) + if err := binary.Read(bytes.NewReader(buf[3:7]), binary.LittleEndian, &size); err != nil { + panic(err) + } frame.Size = int(size) frame.Data = buf[7:frame.Size] @@ -136,7 +140,9 @@ func networkFrameGenerator() func(*bytes.Buffer, byte, byte) *bytes.Buffer { ret.WriteByte(seq[id]) size := &bytes.Buffer{} - binary.Write(size, binary.LittleEndian, uint32(cmd.Len()+hlen)) + if err := binary.Write(size, binary.LittleEndian, uint32(cmd.Len()+hlen)); err != nil { + panic(err) + } ret.Write(size.Bytes()) ret.Write(cmd.Bytes()) @@ -203,18 +209,16 @@ func (b *Bebop) write(buf []byte) (int, error) { func (b *Bebop) Discover() error { addr, err := net.ResolveTCPAddr("tcp", fmt.Sprintf("%s:%d", b.IP, b.DiscoveryPort)) - if err != nil { return err } b.discoveryClient, err = net.DialTCP("tcp", nil, addr) - if err != nil { return err } - b.discoveryClient.Write( + if _, err := b.discoveryClient.Write( []byte( fmt.Sprintf(`{ "controller_type": "computer", @@ -227,7 +231,9 @@ func (b *Bebop) Discover() error { b.RTPStreamPort, b.RTPControlPort), ), - ) + ); err != nil { + return err + } data := make([]byte, 10240) @@ -325,7 +331,9 @@ func (b *Bebop) FlatTrim() error { cmd.WriteByte(ARCOMMANDS_ID_ARDRONE3_CLASS_PILOTING) tmp := &bytes.Buffer{} - binary.Write(tmp, binary.LittleEndian, uint16(ARCOMMANDS_ID_ARDRONE3_PILOTING_CMD_FLATTRIM)) + if err := binary.Write(tmp, binary.LittleEndian, uint16(ARCOMMANDS_ID_ARDRONE3_PILOTING_CMD_FLATTRIM)); err != nil { + return err + } cmd.Write(tmp.Bytes()) @@ -344,7 +352,9 @@ func (b *Bebop) GenerateAllStates() error { cmd.WriteByte(ARCOMMANDS_ID_COMMON_CLASS_COMMON) tmp := &bytes.Buffer{} - binary.Write(tmp, binary.LittleEndian, uint16(ARCOMMANDS_ID_COMMON_COMMON_CMD_ALLSTATES)) + if err := binary.Write(tmp, binary.LittleEndian, uint16(ARCOMMANDS_ID_COMMON_COMMON_CMD_ALLSTATES)); err != nil { + return err + } cmd.Write(tmp.Bytes()) @@ -363,7 +373,9 @@ func (b *Bebop) TakeOff() error { cmd.WriteByte(ARCOMMANDS_ID_ARDRONE3_CLASS_PILOTING) tmp := &bytes.Buffer{} - binary.Write(tmp, binary.LittleEndian, uint16(ARCOMMANDS_ID_ARDRONE3_PILOTING_CMD_TAKEOFF)) + if err := binary.Write(tmp, binary.LittleEndian, uint16(ARCOMMANDS_ID_ARDRONE3_PILOTING_CMD_TAKEOFF)); err != nil { + return err + } cmd.Write(tmp.Bytes()) @@ -382,7 +394,9 @@ func (b *Bebop) Land() error { cmd.WriteByte(ARCOMMANDS_ID_ARDRONE3_CLASS_PILOTING) tmp := &bytes.Buffer{} - binary.Write(tmp, binary.LittleEndian, uint16(ARCOMMANDS_ID_ARDRONE3_PILOTING_CMD_LANDING)) + if err := binary.Write(tmp, binary.LittleEndian, uint16(ARCOMMANDS_ID_ARDRONE3_PILOTING_CMD_LANDING)); err != nil { + return err + } cmd.Write(tmp.Bytes()) @@ -465,37 +479,50 @@ func (b *Bebop) generatePcmd() *bytes.Buffer { // cmd := &bytes.Buffer{} - tmp := &bytes.Buffer{} cmd.WriteByte(ARCOMMANDS_ID_PROJECT_ARDRONE3) cmd.WriteByte(ARCOMMANDS_ID_ARDRONE3_CLASS_PILOTING) - tmp = &bytes.Buffer{} - binary.Write(tmp, binary.LittleEndian, uint16(ARCOMMANDS_ID_ARDRONE3_PILOTING_CMD_PCMD)) + tmp := &bytes.Buffer{} + if err := binary.Write(tmp, binary.LittleEndian, uint16(ARCOMMANDS_ID_ARDRONE3_PILOTING_CMD_PCMD)); err != nil { + panic(err) + } cmd.Write(tmp.Bytes()) tmp = &bytes.Buffer{} - binary.Write(tmp, binary.LittleEndian, uint8(b.Pcmd.Flag)) + if err := binary.Write(tmp, binary.LittleEndian, uint8(b.Pcmd.Flag)); err != nil { + panic(err) + } cmd.Write(tmp.Bytes()) tmp = &bytes.Buffer{} - binary.Write(tmp, binary.LittleEndian, int8(b.Pcmd.Roll)) + if err := binary.Write(tmp, binary.LittleEndian, int8(b.Pcmd.Roll)); err != nil { + panic(err) + } cmd.Write(tmp.Bytes()) tmp = &bytes.Buffer{} - binary.Write(tmp, binary.LittleEndian, int8(b.Pcmd.Pitch)) + if err := binary.Write(tmp, binary.LittleEndian, int8(b.Pcmd.Pitch)); err != nil { + panic(err) + } cmd.Write(tmp.Bytes()) tmp = &bytes.Buffer{} - binary.Write(tmp, binary.LittleEndian, int8(b.Pcmd.Yaw)) + if err := binary.Write(tmp, binary.LittleEndian, int8(b.Pcmd.Yaw)); err != nil { + panic(err) + } cmd.Write(tmp.Bytes()) tmp = &bytes.Buffer{} - binary.Write(tmp, binary.LittleEndian, int8(b.Pcmd.Gaz)) + if err := binary.Write(tmp, binary.LittleEndian, int8(b.Pcmd.Gaz)); err != nil { + panic(err) + } cmd.Write(tmp.Bytes()) tmp = &bytes.Buffer{} - binary.Write(tmp, binary.LittleEndian, uint32(b.Pcmd.Psi)) + if err := binary.Write(tmp, binary.LittleEndian, uint32(b.Pcmd.Psi)); err != nil { + panic(err) + } cmd.Write(tmp.Bytes()) return b.networkFrameGenerator(cmd, ARNETWORKAL_FRAME_TYPE_DATA, BD_NET_CD_NONACK_ID) @@ -565,15 +592,15 @@ func (b *Bebop) packetReceiver(buf []byte) { func (b *Bebop) StartRecording() error { buf := b.videoRecord(ARCOMMANDS_ARDRONE3_MEDIARECORD_VIDEO_RECORD_START) - b.write(b.networkFrameGenerator(buf, ARNETWORKAL_FRAME_TYPE_DATA, BD_NET_CD_NONACK_ID).Bytes()) - return nil + _, err := b.write(b.networkFrameGenerator(buf, ARNETWORKAL_FRAME_TYPE_DATA, BD_NET_CD_NONACK_ID).Bytes()) + return err } func (b *Bebop) StopRecording() error { buf := b.videoRecord(ARCOMMANDS_ARDRONE3_MEDIARECORD_VIDEO_RECORD_STOP) - b.write(b.networkFrameGenerator(buf, ARNETWORKAL_FRAME_TYPE_DATA, BD_NET_CD_NONACK_ID).Bytes()) - return nil + _, err := b.write(b.networkFrameGenerator(buf, ARNETWORKAL_FRAME_TYPE_DATA, BD_NET_CD_NONACK_ID).Bytes()) + return err } func (b *Bebop) videoRecord(state byte) *bytes.Buffer { @@ -587,15 +614,19 @@ func (b *Bebop) videoRecord(state byte) *bytes.Buffer { cmd.WriteByte(ARCOMMANDS_ID_ARDRONE3_CLASS_MEDIARECORD) tmp := &bytes.Buffer{} - binary.Write(tmp, + if err := binary.Write(tmp, binary.LittleEndian, uint16(ARCOMMANDS_ID_ARDRONE3_MEDIARECORD_CMD_VIDEO), - ) + ); err != nil { + panic(err) + } cmd.Write(tmp.Bytes()) tmp = &bytes.Buffer{} - binary.Write(tmp, binary.LittleEndian, uint32(state)) + if err := binary.Write(tmp, binary.LittleEndian, uint32(state)); err != nil { + panic(err) + } cmd.Write(tmp.Bytes()) @@ -619,15 +650,19 @@ func (b *Bebop) HullProtection(protect bool) error { cmd.WriteByte(ARCOMMANDS_ID_ARDRONE3_CLASS_SPEEDSETTINGS) tmp := &bytes.Buffer{} - binary.Write(tmp, + if err := binary.Write(tmp, binary.LittleEndian, uint16(ARCOMMANDS_ID_ARDRONE3_SPEEDSETTINGS_CMD_HULLPROTECTION), - ) + ); err != nil { + return err + } cmd.Write(tmp.Bytes()) tmp = &bytes.Buffer{} - binary.Write(tmp, binary.LittleEndian, bool2int8(protect)) + if err := binary.Write(tmp, binary.LittleEndian, bool2int8(protect)); err != nil { + return err + } cmd.Write(tmp.Bytes()) _, err := b.write(b.networkFrameGenerator(cmd, ARNETWORKAL_FRAME_TYPE_DATA, BD_NET_CD_NONACK_ID).Bytes()) @@ -645,15 +680,19 @@ func (b *Bebop) Outdoor(outdoor bool) error { cmd.WriteByte(ARCOMMANDS_ID_ARDRONE3_CLASS_SPEEDSETTINGS) tmp := &bytes.Buffer{} - binary.Write(tmp, + if err := binary.Write(tmp, binary.LittleEndian, uint16(ARCOMMANDS_ID_ARDRONE3_SPEEDSETTINGS_CMD_OUTDOOR), - ) + ); err != nil { + return err + } cmd.Write(tmp.Bytes()) tmp = &bytes.Buffer{} - binary.Write(tmp, binary.LittleEndian, bool2int8(outdoor)) + if err := binary.Write(tmp, binary.LittleEndian, bool2int8(outdoor)); err != nil { + return err + } cmd.Write(tmp.Bytes()) _, err := b.write(b.networkFrameGenerator(cmd, ARNETWORKAL_FRAME_TYPE_DATA, BD_NET_CD_NONACK_ID).Bytes()) @@ -667,15 +706,19 @@ func (b *Bebop) VideoEnable(enable bool) error { cmd.WriteByte(ARCOMMANDS_ID_ARDRONE3_CLASS_MEDIASTREAMING) tmp := &bytes.Buffer{} - binary.Write(tmp, + if err := binary.Write(tmp, binary.LittleEndian, uint16(ARCOMMANDS_ID_ARDRONE3_MEDIASTREAMING_CMD_VIDEOENABLE), - ) + ); err != nil { + return err + } cmd.Write(tmp.Bytes()) tmp = &bytes.Buffer{} - binary.Write(tmp, binary.LittleEndian, bool2int8(enable)) + if err := binary.Write(tmp, binary.LittleEndian, bool2int8(enable)); err != nil { + return err + } cmd.Write(tmp.Bytes()) _, err := b.write(b.networkFrameGenerator(cmd, ARNETWORKAL_FRAME_TYPE_DATA, BD_NET_CD_NONACK_ID).Bytes()) @@ -689,15 +732,19 @@ func (b *Bebop) VideoStreamMode(mode int8) error { cmd.WriteByte(ARCOMMANDS_ID_ARDRONE3_CLASS_MEDIASTREAMING) tmp := &bytes.Buffer{} - binary.Write(tmp, + if err := binary.Write(tmp, binary.LittleEndian, uint16(ARCOMMANDS_ID_ARDRONE3_MEDIASTREAMING_CMD_VIDEOSTREAMMODE), - ) + ); err != nil { + return err + } cmd.Write(tmp.Bytes()) tmp = &bytes.Buffer{} - binary.Write(tmp, binary.LittleEndian, mode) + if err := binary.Write(tmp, binary.LittleEndian, mode); err != nil { + return err + } cmd.Write(tmp.Bytes()) _, err := b.write(b.networkFrameGenerator(cmd, ARNETWORKAL_FRAME_TYPE_DATA, BD_NET_CD_NONACK_ID).Bytes()) @@ -781,15 +828,21 @@ func (b *Bebop) createARStreamACK(frame ARStreamFrame) *bytes.Buffer { ackPacket := &bytes.Buffer{} tmp := &bytes.Buffer{} - binary.Write(tmp, binary.LittleEndian, uint16(b.tmpFrame.arstreamACK.FrameNumber)) + if err := binary.Write(tmp, binary.LittleEndian, uint16(b.tmpFrame.arstreamACK.FrameNumber)); err != nil { + panic(err) + } ackPacket.Write(tmp.Bytes()) tmp = &bytes.Buffer{} - binary.Write(tmp, binary.LittleEndian, uint64(b.tmpFrame.arstreamACK.HighPacketsAck)) + if err := binary.Write(tmp, binary.LittleEndian, uint64(b.tmpFrame.arstreamACK.HighPacketsAck)); err != nil { + panic(err) + } ackPacket.Write(tmp.Bytes()) tmp = &bytes.Buffer{} - binary.Write(tmp, binary.LittleEndian, uint64(b.tmpFrame.arstreamACK.LowPacketsAck)) + if err := binary.Write(tmp, binary.LittleEndian, uint64(b.tmpFrame.arstreamACK.LowPacketsAck)); err != nil { + panic(err) + } ackPacket.Write(tmp.Bytes()) return b.networkFrameGenerator(ackPacket, ARNETWORKAL_FRAME_TYPE_DATA, BD_NET_CD_VIDEO_ACK_ID) diff --git a/platforms/parrot/minidrone/minidrone_driver.go b/platforms/parrot/minidrone/minidrone_driver.go index 812be61b1..e1d3a1183 100644 --- a/platforms/parrot/minidrone/minidrone_driver.go +++ b/platforms/parrot/minidrone/minidrone_driver.go @@ -25,8 +25,8 @@ type Driver struct { const ( // BLE services - droneCommandService = "9a66fa000800919111e4012d1540cb8e" - droneNotificationService = "9a66fb000800919111e4012d1540cb8e" + //droneCommandService = "9a66fa000800919111e4012d1540cb8e" + //droneNotificationService = "9a66fb000800919111e4012d1540cb8e" // send characteristics pcmdCharacteristic = "9a66fa0a0800919111e4012d1540cb8e" @@ -151,93 +151,86 @@ func (b *Driver) adaptor() ble.BLEConnector { } // Start tells driver to get ready to do work -func (b *Driver) Start() (err error) { +func (b *Driver) Start() error { b.adaptor().WithoutResponses(true) - b.Init() - b.FlatTrim() + if err := b.Init(); err != nil { + return err + } + if err := b.FlatTrim(); err != nil { + return err + } + b.StartPcmd() - b.FlatTrim() - return + return b.FlatTrim() } // Halt stops minidrone driver (void) -func (b *Driver) Halt() (err error) { - b.Land() - +func (b *Driver) Halt() error { + err := b.Land() time.Sleep(500 * time.Millisecond) - return + return err } // Init initializes the BLE insterfaces used by the Minidrone -func (b *Driver) Init() (err error) { - b.GenerateAllStates() +func (b *Driver) Init() error { + if err := b.GenerateAllStates(); err != nil { + return err + } // subscribe to battery notifications - b.adaptor().Subscribe(batteryCharacteristic, func(data []byte, e error) { + if err := b.adaptor().Subscribe(batteryCharacteristic, func(data []byte, e error) { b.Publish(b.Event(Battery), data[len(data)-1]) - }) + }); err != nil { + return err + } // subscribe to flying status notifications - b.adaptor().Subscribe(flightStatusCharacteristic, func(data []byte, e error) { + return b.adaptor().Subscribe(flightStatusCharacteristic, func(data []byte, e error) { b.processFlightStatus(data) }) - - return } // GenerateAllStates sets up all the default states aka settings on the drone -func (b *Driver) GenerateAllStates() (err error) { +func (b *Driver) GenerateAllStates() error { b.stepsfa0b++ buf := []byte{0x04, byte(b.stepsfa0b), 0x00, 0x04, 0x01, 0x00, 0x32, 0x30, 0x31, 0x34, 0x2D, 0x31, 0x30, 0x2D, 0x32, 0x38, 0x00} - err = b.adaptor().WriteCharacteristic(commandCharacteristic, buf) - - return + return b.adaptor().WriteCharacteristic(commandCharacteristic, buf) } // TakeOff tells the Minidrone to takeoff -func (b *Driver) TakeOff() (err error) { +func (b *Driver) TakeOff() error { b.stepsfa0b++ buf := []byte{0x02, byte(b.stepsfa0b) & 0xff, 0x02, 0x00, 0x01, 0x00} - err = b.adaptor().WriteCharacteristic(commandCharacteristic, buf) - - return + return b.adaptor().WriteCharacteristic(commandCharacteristic, buf) } // Land tells the Minidrone to land -func (b *Driver) Land() (err error) { +func (b *Driver) Land() error { b.stepsfa0b++ buf := []byte{0x02, byte(b.stepsfa0b) & 0xff, 0x02, 0x00, 0x03, 0x00} - err = b.adaptor().WriteCharacteristic(commandCharacteristic, buf) - - return err + return b.adaptor().WriteCharacteristic(commandCharacteristic, buf) } // FlatTrim calibrates the Minidrone to use its current position as being level -func (b *Driver) FlatTrim() (err error) { +func (b *Driver) FlatTrim() error { b.stepsfa0b++ buf := []byte{0x02, byte(b.stepsfa0b) & 0xff, 0x02, 0x00, 0x00, 0x00} - err = b.adaptor().WriteCharacteristic(commandCharacteristic, buf) - - return err + return b.adaptor().WriteCharacteristic(commandCharacteristic, buf) } // Emergency sets the Minidrone into emergency mode -func (b *Driver) Emergency() (err error) { +func (b *Driver) Emergency() error { b.stepsfa0b++ buf := []byte{0x02, byte(b.stepsfa0b) & 0xff, 0x02, 0x00, 0x04, 0x00} - err = b.adaptor().WriteCharacteristic(priorityCharacteristic, buf) - - return err + return b.adaptor().WriteCharacteristic(priorityCharacteristic, buf) } // TakePicture tells the Minidrone to take a picture -func (b *Driver) TakePicture() (err error) { +func (b *Driver) TakePicture() error { b.stepsfa0b++ buf := []byte{0x02, byte(b.stepsfa0b) & 0xff, 0x02, 0x06, 0x01, 0x00} - err = b.adaptor().WriteCharacteristic(commandCharacteristic, buf) - - return err + return b.adaptor().WriteCharacteristic(commandCharacteristic, buf) } // StartPcmd starts the continuous Pcmd communication with the Minidrone @@ -374,22 +367,22 @@ func (b *Driver) Outdoor(outdoor bool) error { } // FrontFlip tells the drone to perform a front flip -func (b *Driver) FrontFlip() (err error) { +func (b *Driver) FrontFlip() error { return b.adaptor().WriteCharacteristic(commandCharacteristic, b.generateAnimation(0).Bytes()) } // BackFlip tells the drone to perform a backflip -func (b *Driver) BackFlip() (err error) { +func (b *Driver) BackFlip() error { return b.adaptor().WriteCharacteristic(commandCharacteristic, b.generateAnimation(1).Bytes()) } // RightFlip tells the drone to perform a flip to the right -func (b *Driver) RightFlip() (err error) { +func (b *Driver) RightFlip() error { return b.adaptor().WriteCharacteristic(commandCharacteristic, b.generateAnimation(2).Bytes()) } // LeftFlip tells the drone to perform a flip to the left -func (b *Driver) LeftFlip() (err error) { +func (b *Driver) LeftFlip() error { return b.adaptor().WriteCharacteristic(commandCharacteristic, b.generateAnimation(3).Bytes()) } @@ -401,11 +394,10 @@ func (b *Driver) LeftFlip() (err error) { // mode - either LightFixed, LightBlinked, or LightOscillated // intensity - Light intensity from 0 (OFF) to 100 (Max intensity). // Only used in LightFixed mode. -func (b *Driver) LightControl(id uint8, mode uint8, intensity uint8) (err error) { +func (b *Driver) LightControl(id uint8, mode uint8, intensity uint8) error { b.stepsfa0b++ buf := []byte{0x02, byte(b.stepsfa0b) & 0xff, 0x02, 0x10, 0x00, id, mode, intensity, 0x00} - err = b.adaptor().WriteCharacteristic(commandCharacteristic, buf) - return + return b.adaptor().WriteCharacteristic(commandCharacteristic, buf) } // ClawControl controls the claw on the Parrot Mambo @@ -413,22 +405,21 @@ func (b *Driver) LightControl(id uint8, mode uint8, intensity uint8) (err error) // // id - always 0 // mode - either ClawOpen or ClawClosed -func (b *Driver) ClawControl(id uint8, mode uint8) (err error) { +func (b *Driver) ClawControl(id uint8, mode uint8) error { b.stepsfa0b++ buf := []byte{0x02, byte(b.stepsfa0b) & 0xff, 0x02, 0x10, 0x01, id, mode, 0x00} - err = b.adaptor().WriteCharacteristic(commandCharacteristic, buf) - return + return b.adaptor().WriteCharacteristic(commandCharacteristic, buf) } // GunControl fires the gun on the Parrot Mambo // Params: // // id - always 0 -func (b *Driver) GunControl(id uint8) (err error) { +func (b *Driver) GunControl(id uint8) error { b.stepsfa0b++ buf := []byte{0x02, byte(b.stepsfa0b) & 0xff, 0x02, 0x10, 0x02, id, 0x00} - err = b.adaptor().WriteCharacteristic(commandCharacteristic, buf) - return + return b.adaptor().WriteCharacteristic(commandCharacteristic, buf) + } func (b *Driver) generateAnimation(direction int8) *bytes.Buffer { @@ -444,20 +435,48 @@ func (b *Driver) generatePcmd() *bytes.Buffer { pcmd := b.Pcmd cmd := &bytes.Buffer{} - binary.Write(cmd, binary.LittleEndian, int8(2)) - binary.Write(cmd, binary.LittleEndian, int8(b.stepsfa0a)) - binary.Write(cmd, binary.LittleEndian, int8(2)) - binary.Write(cmd, binary.LittleEndian, int8(0)) - binary.Write(cmd, binary.LittleEndian, int8(2)) - binary.Write(cmd, binary.LittleEndian, int8(0)) - binary.Write(cmd, binary.LittleEndian, int8(pcmd.Flag)) - binary.Write(cmd, binary.LittleEndian, int8(pcmd.Roll)) - binary.Write(cmd, binary.LittleEndian, int8(pcmd.Pitch)) - binary.Write(cmd, binary.LittleEndian, int8(pcmd.Yaw)) - binary.Write(cmd, binary.LittleEndian, int8(pcmd.Gaz)) - binary.Write(cmd, binary.LittleEndian, float32(pcmd.Psi)) - binary.Write(cmd, binary.LittleEndian, int16(0)) - binary.Write(cmd, binary.LittleEndian, int16(0)) + if err := binary.Write(cmd, binary.LittleEndian, int8(2)); err != nil { + panic(err) + } + if err := binary.Write(cmd, binary.LittleEndian, int8(b.stepsfa0a)); err != nil { + panic(err) + } + if err := binary.Write(cmd, binary.LittleEndian, int8(2)); err != nil { + panic(err) + } + if err := binary.Write(cmd, binary.LittleEndian, int8(0)); err != nil { + panic(err) + } + if err := binary.Write(cmd, binary.LittleEndian, int8(2)); err != nil { + panic(err) + } + if err := binary.Write(cmd, binary.LittleEndian, int8(0)); err != nil { + panic(err) + } + if err := binary.Write(cmd, binary.LittleEndian, int8(pcmd.Flag)); err != nil { + panic(err) + } + if err := binary.Write(cmd, binary.LittleEndian, int8(pcmd.Roll)); err != nil { + panic(err) + } + if err := binary.Write(cmd, binary.LittleEndian, int8(pcmd.Pitch)); err != nil { + panic(err) + } + if err := binary.Write(cmd, binary.LittleEndian, int8(pcmd.Yaw)); err != nil { + panic(err) + } + if err := binary.Write(cmd, binary.LittleEndian, int8(pcmd.Gaz)); err != nil { + panic(err) + } + if err := binary.Write(cmd, binary.LittleEndian, float32(pcmd.Psi)); err != nil { + panic(err) + } + if err := binary.Write(cmd, binary.LittleEndian, int16(0)); err != nil { + panic(err) + } + if err := binary.Write(cmd, binary.LittleEndian, int16(0)); err != nil { + panic(err) + } return cmd } diff --git a/platforms/particle/adaptor.go b/platforms/particle/adaptor.go index aed5da0d7..dbaaf0ca9 100644 --- a/platforms/particle/adaptor.go +++ b/platforms/particle/adaptor.go @@ -58,17 +58,13 @@ func (s *Adaptor) Name() string { return s.name } func (s *Adaptor) SetName(n string) { s.name = n } // Connect returns true if connection to Particle Photon or Electron is successful -func (s *Adaptor) Connect() (err error) { - return -} +func (s *Adaptor) Connect() error { return nil } // Finalize returns true if connection to Particle Photon or Electron is finalized successfully -func (s *Adaptor) Finalize() (err error) { - return -} +func (s *Adaptor) Finalize() error { return nil } // AnalogRead reads analog ping value using Particle cloud api -func (s *Adaptor) AnalogRead(pin string) (val int, err error) { +func (s *Adaptor) AnalogRead(pin string) (int, error) { params := url.Values{ "params": {pin}, "access_token": {s.AccessToken}, @@ -78,63 +74,61 @@ func (s *Adaptor) AnalogRead(pin string) (val int, err error) { resp, err := s.request("POST", url, params) if err == nil { - val = int(resp["return_value"].(float64)) - return + return int(resp["return_value"].(float64)), nil } return 0, err } // PwmWrite writes in pin using analog write api -func (s *Adaptor) PwmWrite(pin string, level byte) (err error) { +func (s *Adaptor) PwmWrite(pin string, level byte) error { return s.AnalogWrite(pin, level) } // AnalogWrite writes analog pin with specified level using Particle cloud api -func (s *Adaptor) AnalogWrite(pin string, level byte) (err error) { +func (s *Adaptor) AnalogWrite(pin string, level byte) error { params := url.Values{ "params": {fmt.Sprintf("%v,%v", pin, level)}, "access_token": {s.AccessToken}, } url := fmt.Sprintf("%v/analogwrite", s.deviceURL()) - _, err = s.request("POST", url, params) - return + _, err := s.request("POST", url, params) + return err } // DigitalWrite writes to a digital pin using Particle cloud api -func (s *Adaptor) DigitalWrite(pin string, level byte) (err error) { +func (s *Adaptor) DigitalWrite(pin string, level byte) error { params := url.Values{ "params": {fmt.Sprintf("%v,%v", pin, s.pinLevel(level))}, "access_token": {s.AccessToken}, } url := fmt.Sprintf("%v/digitalwrite", s.deviceURL()) - _, err = s.request("POST", url, params) + _, err := s.request("POST", url, params) return err } // DigitalRead reads from digital pin using Particle cloud api -func (s *Adaptor) DigitalRead(pin string) (val int, err error) { +func (s *Adaptor) DigitalRead(pin string) (int, error) { params := url.Values{ "params": {pin}, "access_token": {s.AccessToken}, } url := fmt.Sprintf("%v/digitalread", s.deviceURL()) resp, err := s.request("POST", url, params) - if err == nil { - val = int(resp["return_value"].(float64)) - return + if err != nil { + return -1, err } - return -1, err + + return int(resp["return_value"].(float64)), nil } // ServoWrite writes the 0-180 degree angle to the specified pin. // To use it requires installing the "tinker-servo" sketch on your // Particle device. not just the default "tinker". -func (s *Adaptor) ServoWrite(pin string, angle byte) (err error) { +func (s *Adaptor) ServoWrite(pin string, angle byte) error { if _, present := s.servoPins[pin]; !present { - err = s.servoPinOpen(pin) - if err != nil { - return + if err := s.servoPinOpen(pin); err != nil { + return err } } @@ -143,7 +137,7 @@ func (s *Adaptor) ServoWrite(pin string, angle byte) (err error) { "access_token": {s.AccessToken}, } url := fmt.Sprintf("%v/servoSet", s.deviceURL()) - _, err = s.request("POST", url, params) + _, err := s.request("POST", url, params) return err } @@ -209,7 +203,7 @@ func (s *Adaptor) Variable(name string) (result string, err error) { // returns value from request. // Takes a String as the only argument and returns an Int. // If function is not defined in core, it will time out -func (s *Adaptor) Function(name string, args string) (val int, err error) { +func (s *Adaptor) Function(name string, args string) (int, error) { params := url.Values{ "args": {args}, "access_token": {s.AccessToken}, @@ -217,13 +211,11 @@ func (s *Adaptor) Function(name string, args string) (val int, err error) { url := fmt.Sprintf("%s/%s", s.deviceURL(), name) resp, err := s.request("POST", url, params) - if err != nil { return -1, err } - val = int(resp["return_value"].(float64)) - return + return int(resp["return_value"].(float64)), nil } // setAPIServer sets Particle cloud api server, this can be used to change from default api.spark.io @@ -268,7 +260,9 @@ func (s *Adaptor) request(method string, url string, params url.Values) (m map[s return } - json.Unmarshal(buf, &m) + if err := json.Unmarshal(buf, &m); err != nil { + return m, err + } if resp.Status != "200 OK" { err = fmt.Errorf("%v: error communicating to the Particle cloud", resp.Status) diff --git a/platforms/particle/adaptor_test.go b/platforms/particle/adaptor_test.go index b467606b6..0c55db12e 100644 --- a/platforms/particle/adaptor_test.go +++ b/platforms/particle/adaptor_test.go @@ -19,20 +19,20 @@ func createTestServer(handler func(w http.ResponseWriter, r *http.Request)) *htt return httptest.NewServer(http.HandlerFunc(handler)) } -func getDummyResponseForPath(path string, dummy_response string, t *testing.T) *httptest.Server { - dummy_data := []byte(dummy_response) +func getDummyResponseForPath(path string, dummyResponse string, t *testing.T) *httptest.Server { + dummyData := []byte(dummyResponse) return createTestServer(func(w http.ResponseWriter, r *http.Request) { actualPath := "/v1/devices" + path if r.URL.Path != actualPath { t.Errorf("Path doesn't match, expected %#v, got %#v", actualPath, r.URL.Path) } - w.Write(dummy_data) + _, _ = w.Write(dummyData) }) } -func getDummyResponseForPathWithParams(path string, params []string, dummy_response string, t *testing.T) *httptest.Server { - dummy_data := []byte(dummy_response) +func getDummyResponseForPathWithParams(path string, params []string, dummyResponse string, t *testing.T) *httptest.Server { + dummyData := []byte(dummyResponse) return createTestServer(func(w http.ResponseWriter, r *http.Request) { actualPath := "/v1/devices" + path @@ -40,14 +40,14 @@ func getDummyResponseForPathWithParams(path string, params []string, dummy_respo t.Errorf("Path doesn't match, expected %#v, got %#v", actualPath, r.URL.Path) } - r.ParseForm() + _ = r.ParseForm() for key, value := range params { if r.Form["params"][key] != value { t.Error("Expected param to be " + r.Form["params"][key] + " but was " + value) } } - w.Write(dummy_data) + _, _ = w.Write(dummyData) }) } @@ -93,7 +93,7 @@ func TestAdaptorConnect(t *testing.T) { func TestAdaptorFinalize(t *testing.T) { a := initTestAdaptor() - a.Connect() + _ = a.Connect() gobottest.Assert(t, a.Finalize(), nil) } @@ -134,7 +134,7 @@ func TestAdaptorPwmWrite(t *testing.T) { defer testServer.Close() a.setAPIServer(testServer.URL) - a.PwmWrite("A1", 1) + _ = a.PwmWrite("A1", 1) } func TestAdaptorAnalogWrite(t *testing.T) { @@ -146,7 +146,7 @@ func TestAdaptorAnalogWrite(t *testing.T) { defer testServer.Close() a.setAPIServer(testServer.URL) - a.AnalogWrite("A1", 1) + _ = a.AnalogWrite("A1", 1) } func TestAdaptorDigitalWrite(t *testing.T) { @@ -158,7 +158,7 @@ func TestAdaptorDigitalWrite(t *testing.T) { testServer := getDummyResponseForPathWithParams("/"+a.DeviceID+"/digitalwrite", params, response, t) a.setAPIServer(testServer.URL) - a.DigitalWrite("D7", 1) + _ = a.DigitalWrite("D7", 1) testServer.Close() // When LOW @@ -168,7 +168,7 @@ func TestAdaptorDigitalWrite(t *testing.T) { defer testServer.Close() a.setAPIServer(testServer.URL) - a.DigitalWrite("D7", 0) + _ = a.DigitalWrite("D7", 0) } func TestAdaptorServoOpen(t *testing.T) { @@ -180,7 +180,7 @@ func TestAdaptorServoOpen(t *testing.T) { defer testServer.Close() a.setAPIServer(testServer.URL) - a.servoPinOpen("1") + _ = a.servoPinOpen("1") } func TestAdaptorServoWrite(t *testing.T) { @@ -192,7 +192,7 @@ func TestAdaptorServoWrite(t *testing.T) { defer testServer.Close() a.setAPIServer(testServer.URL) - a.ServoWrite("1", 128) + _ = a.ServoWrite("1", 128) } func TestAdaptorDigitalRead(t *testing.T) { @@ -369,15 +369,6 @@ func TestAdaptorPostToparticle(t *testing.T) { } } -type testEventSource struct { - event string - data string -} - -func (testEventSource) Id() string { return "" } -func (t testEventSource) Event() string { return t.event } -func (t testEventSource) Data() string { return t.data } - func TestAdaptorEventStream(t *testing.T) { a := initTestAdaptor() var url string @@ -385,13 +376,13 @@ func TestAdaptorEventStream(t *testing.T) { url = u return nil, nil, nil } - a.EventStream("all", "ping") + _, _ = a.EventStream("all", "ping") gobottest.Assert(t, url, "https://api.particle.io/v1/events/ping?access_token=token") - a.EventStream("devices", "ping") + _, _ = a.EventStream("devices", "ping") gobottest.Assert(t, url, "https://api.particle.io/v1/devices/events/ping?access_token=token") - a.EventStream("device", "ping") + _, _ = a.EventStream("device", "ping") gobottest.Assert(t, url, "https://api.particle.io/v1/devices/myDevice/events/ping?access_token=token") _, err := a.EventStream("nothing", "ping") diff --git a/platforms/pebble/pebble_driver_test.go b/platforms/pebble/pebble_driver_test.go index 40023fd9c..cbf0cd695 100644 --- a/platforms/pebble/pebble_driver_test.go +++ b/platforms/pebble/pebble_driver_test.go @@ -39,7 +39,7 @@ func TestDriver(t *testing.T) { gobottest.Assert(t, d.PendingMessage(), "World") gobottest.Assert(t, d.PendingMessage(), "") - d.On(d.Event("button"), func(data interface{}) { + _ = d.On(d.Event("button"), func(data interface{}) { sem <- true }) @@ -51,7 +51,7 @@ func TestDriver(t *testing.T) { t.Errorf("Button Event was not published") } - d.On(d.Event("accel"), func(data interface{}) { + _ = d.On(d.Event("accel"), func(data interface{}) { sem <- true }) diff --git a/platforms/raspi/raspi_adaptor.go b/platforms/raspi/raspi_adaptor.go index 839f54091..19414926a 100644 --- a/platforms/raspi/raspi_adaptor.go +++ b/platforms/raspi/raspi_adaptor.go @@ -34,8 +34,7 @@ type Adaptor struct { *adaptors.DigitalPinsAdaptor *adaptors.I2cBusAdaptor *adaptors.SpiBusAdaptor - spiDefaultMaxSpeed int64 - PiBlasterPeriod uint32 + PiBlasterPeriod uint32 } // NewAdaptor creates a Raspi Adaptor @@ -236,7 +235,9 @@ func (c *Adaptor) pwmPin(id string) (gobot.PWMPinner, error) { return nil, err } pin = NewPWMPin(c.sys, "/dev/pi-blaster", strconv.Itoa(i)) - pin.SetPeriod(c.PiBlasterPeriod) + if err := pin.SetPeriod(c.PiBlasterPeriod); err != nil { + return nil, err + } c.pwmPins[id] = pin } diff --git a/platforms/raspi/raspi_adaptor_test.go b/platforms/raspi/raspi_adaptor_test.go index 28e71c9ba..560fed662 100644 --- a/platforms/raspi/raspi_adaptor_test.go +++ b/platforms/raspi/raspi_adaptor_test.go @@ -32,7 +32,7 @@ var _ spi.Connector = (*Adaptor)(nil) func initTestAdaptorWithMockedFilesystem(mockPaths []string) (*Adaptor, *system.MockFilesystem) { a := NewAdaptor() fs := a.sys.UseMockFilesystem(mockPaths) - a.Connect() + _ = a.Connect() return a, fs } @@ -99,10 +99,10 @@ func TestFinalize(t *testing.T) { } a, _ := initTestAdaptorWithMockedFilesystem(mockedPaths) - a.DigitalWrite("3", 1) - a.PwmWrite("7", 255) + _ = a.DigitalWrite("3", 1) + _ = a.PwmWrite("7", 255) - a.GetI2cConnection(0xff, 0) + _, _ = a.GetI2cConnection(0xff, 0) gobottest.Assert(t, a.Finalize(), nil) } @@ -179,7 +179,7 @@ func TestDigitalPinConcurrency(t *testing.T) { pinAsString := strconv.Itoa(i) go func(pin string) { defer wg.Done() - a.DigitalPin(pin) + _, _ = a.DigitalPin(pin) }(pinAsString) } diff --git a/platforms/rockpi/rockpi_adaptor.go b/platforms/rockpi/rockpi_adaptor.go index ae2800307..321b7a688 100644 --- a/platforms/rockpi/rockpi_adaptor.go +++ b/platforms/rockpi/rockpi_adaptor.go @@ -32,7 +32,6 @@ type Adaptor struct { *adaptors.DigitalPinsAdaptor *adaptors.I2cBusAdaptor *adaptors.SpiBusAdaptor - spiDefaultMaxSpeed int64 } // NewAdaptor creates a RockPi Adaptor diff --git a/platforms/rockpi/rockpi_adaptor_test.go b/platforms/rockpi/rockpi_adaptor_test.go index 7ce572ab6..1e3186298 100644 --- a/platforms/rockpi/rockpi_adaptor_test.go +++ b/platforms/rockpi/rockpi_adaptor_test.go @@ -11,7 +11,7 @@ import ( func initTestAdaptorWithMockedFilesystem(mockPaths []string) (*Adaptor, *system.MockFilesystem) { a := NewAdaptor() fs := a.sys.UseMockFilesystem(mockPaths) - a.Connect() + _ = a.Connect() return a, fs } diff --git a/platforms/sphero/ollie/ollie_driver.go b/platforms/sphero/ollie/ollie_driver.go index e8c406d92..eb4f29a18 100644 --- a/platforms/sphero/ollie/ollie_driver.go +++ b/platforms/sphero/ollie/ollie_driver.go @@ -29,8 +29,8 @@ type Driver struct { const ( // bluetooth service IDs - spheroBLEService = "22bb746f2bb075542d6f726568705327" - robotControlService = "22bb746f2ba075542d6f726568705327" + //spheroBLEService = "22bb746f2bb075542d6f726568705327" + //robotControlService = "22bb746f2ba075542d6f726568705327" // BLE characteristic IDs wakeCharacteristic = "22bb746f2bbf75542d6f726568705327" @@ -121,8 +121,10 @@ func (b *Driver) adaptor() ble.BLEConnector { } // Start tells driver to get ready to do work -func (b *Driver) Start() (err error) { - b.Init() +func (b *Driver) Start() error { + if err := b.Init(); err != nil { + return err + } // send commands go func() { @@ -137,74 +139,77 @@ func (b *Driver) Start() (err error) { go func() { for { - b.adaptor().ReadCharacteristic(responseCharacteristic) + if _, err := b.adaptor().ReadCharacteristic(responseCharacteristic); err != nil { + panic(err) + } time.Sleep(100 * time.Millisecond) } }() b.ConfigureCollisionDetection(DefaultCollisionConfig()) - return + return nil } // Halt stops Ollie driver (void) -func (b *Driver) Halt() (err error) { +func (b *Driver) Halt() error { b.Sleep() time.Sleep(750 * time.Microsecond) - return + return nil } // Init is used to initialize the Ollie -func (b *Driver) Init() (err error) { - b.AntiDOSOff() - b.SetTXPower(7) - b.Wake() +func (b *Driver) Init() error { + if err := b.AntiDOSOff(); err != nil { + return err + } + if err := b.SetTXPower(7); err != nil { + return err + } + if err := b.Wake(); err != nil { + return err + } // subscribe to Sphero response notifications - b.adaptor().Subscribe(responseCharacteristic, b.HandleResponses) - - return + return b.adaptor().Subscribe(responseCharacteristic, b.HandleResponses) } // AntiDOSOff turns off Anti-DOS code so we can control Ollie -func (b *Driver) AntiDOSOff() (err error) { +func (b *Driver) AntiDOSOff() error { str := "011i3" buf := &bytes.Buffer{} buf.WriteString(str) - err = b.adaptor().WriteCharacteristic(antiDosCharacteristic, buf.Bytes()) - if err != nil { + if err := b.adaptor().WriteCharacteristic(antiDosCharacteristic, buf.Bytes()); err != nil { fmt.Println("AntiDOSOff error:", err) return err } - return + return nil } // Wake wakes Ollie up so we can play -func (b *Driver) Wake() (err error) { +func (b *Driver) Wake() error { buf := []byte{0x01} - err = b.adaptor().WriteCharacteristic(wakeCharacteristic, buf) - if err != nil { + if err := b.adaptor().WriteCharacteristic(wakeCharacteristic, buf); err != nil { fmt.Println("Wake error:", err) return err } - return + return nil } // SetTXPower sets transmit level -func (b *Driver) SetTXPower(level int) (err error) { +func (b *Driver) SetTXPower(level int) error { buf := []byte{byte(level)} - err = b.adaptor().WriteCharacteristic(txPowerCharacteristic, buf) - if err != nil { + if err := b.adaptor().WriteCharacteristic(txPowerCharacteristic, buf); err != nil { fmt.Println("SetTXLevel error:", err) return err } - return + return nil } // HandleResponses handles responses returned from Ollie @@ -270,7 +275,9 @@ func (b *Driver) handleDataStreaming(data []byte) { //only difference in communication is that the "newer" spheros use BLE for communinations var dataPacket DataStreamingPacket buffer := bytes.NewBuffer(data[5:]) // skip header - binary.Read(buffer, binary.BigEndian, &dataPacket) + if err := binary.Read(buffer, binary.BigEndian, &dataPacket); err != nil { + panic(err) + } b.Publish(SensorData, dataPacket) } @@ -344,17 +351,19 @@ func (b *Driver) ConfigureCollisionDetection(cc sphero.CollisionConfig) { } // SetDataStreamingConfig passes the config to the sphero to stream sensor data -func (b *Driver) SetDataStreamingConfig(d sphero.DataStreamingConfig) { +func (b *Driver) SetDataStreamingConfig(d sphero.DataStreamingConfig) error { buf := new(bytes.Buffer) - binary.Write(buf, binary.BigEndian, d) + if err := binary.Write(buf, binary.BigEndian, d); err != nil { + return err + } b.PacketChannel() <- b.craftPacket(buf.Bytes(), 0x02, 0x11) + return nil } -func (b *Driver) write(packet *Packet) (err error) { +func (b *Driver) write(packet *Packet) error { buf := append(packet.Header, packet.Body...) buf = append(buf, packet.Checksum) - err = b.adaptor().WriteCharacteristic(commandsCharacteristic, buf) - if err != nil { + if err := b.adaptor().WriteCharacteristic(commandsCharacteristic, buf); err != nil { fmt.Println("send command error:", err) return err } @@ -362,7 +371,7 @@ func (b *Driver) write(packet *Packet) (err error) { b.mtx.Lock() defer b.mtx.Unlock() b.seq++ - return + return nil } func (b *Driver) craftPacket(body []uint8, did byte, cid byte) *Packet { @@ -381,7 +390,9 @@ func (b *Driver) handlePowerStateDetected(data []uint8) { var dataPacket PowerStatePacket buffer := bytes.NewBuffer(data[5:]) // skip header - binary.Read(buffer, binary.BigEndian, &dataPacket) + if err := binary.Read(buffer, binary.BigEndian, &dataPacket); err != nil { + panic(err) + } b.powerstateCallback(dataPacket) } @@ -454,7 +465,9 @@ func (b *Driver) handleCollisionDetected(data []uint8) { var collision sphero.CollisionPacket buffer := bytes.NewBuffer(b.collisionResponse[5:]) // skip header - binary.Read(buffer, binary.BigEndian, &collision) + if err := binary.Read(buffer, binary.BigEndian, &collision); err != nil { + panic(err) + } b.collisionResponse = nil // clear the current response b.Publish(Collision, collision) diff --git a/platforms/sphero/ollie/ollie_driver_test.go b/platforms/sphero/ollie/ollie_driver_test.go index de020a7a9..847c48dcf 100644 --- a/platforms/sphero/ollie/ollie_driver_test.go +++ b/platforms/sphero/ollie/ollie_driver_test.go @@ -2,7 +2,6 @@ package ollie import ( "fmt" - "math" "strconv" "testing" "time" @@ -63,10 +62,10 @@ func TestLocatorData(t *testing.T) { func TestDataStreaming(t *testing.T) { d := initTestOllieDriver() - d.SetDataStreamingConfig(sphero.DefaultDataStreamingConfig()) + _ = d.SetDataStreamingConfig(sphero.DefaultDataStreamingConfig()) response := false - d.On("sensordata", func(data interface{}) { + _ = d.On("sensordata", func(data interface{}) { cont := data.(DataStreamingPacket) fmt.Printf("got streaming packet: %+v \n", cont) gobottest.Assert(t, cont.RawAccX, int16(10)) @@ -100,14 +99,3 @@ func TestDataStreaming(t *testing.T) { t.Error("no response recieved") } } - -func parseBytes(s string) (f byte) { - i, err := strconv.ParseUint(s, 16, 32) - if err != nil { - return - } - - f = byte(math.Float32frombits(uint32(i))) - - return -} diff --git a/platforms/sphero/sphero_adaptor.go b/platforms/sphero/sphero_adaptor.go index 51dc380fa..762662a46 100644 --- a/platforms/sphero/sphero_adaptor.go +++ b/platforms/sphero/sphero_adaptor.go @@ -57,7 +57,9 @@ func (a *Adaptor) Connect() (err error) { // Returns true on Successful reconnection func (a *Adaptor) Reconnect() (err error) { if a.connected { - a.Disconnect() + if err := a.Disconnect(); err != nil { + return err + } } return a.Connect() } diff --git a/platforms/sphero/sphero_adaptor_test.go b/platforms/sphero/sphero_adaptor_test.go index 56a1b01ce..cd9403359 100644 --- a/platforms/sphero/sphero_adaptor_test.go +++ b/platforms/sphero/sphero_adaptor_test.go @@ -69,19 +69,19 @@ func TestSpheroAdaptor(t *testing.T) { func TestSpheroAdaptorReconnect(t *testing.T) { a, _ := initTestSpheroAdaptor() - a.Connect() + _ = a.Connect() gobottest.Assert(t, a.connected, true) - a.Reconnect() + _ = a.Reconnect() gobottest.Assert(t, a.connected, true) - a.Disconnect() + _ = a.Disconnect() gobottest.Assert(t, a.connected, false) - a.Reconnect() + _ = a.Reconnect() gobottest.Assert(t, a.connected, true) } func TestSpheroAdaptorFinalize(t *testing.T) { a, rwc := initTestSpheroAdaptor() - a.Connect() + _ = a.Connect() gobottest.Assert(t, a.Finalize(), nil) rwc.testAdaptorClose = func() error { diff --git a/platforms/sphero/sphero_driver.go b/platforms/sphero/sphero_driver.go index fb2bc2702..04b74f426 100644 --- a/platforms/sphero/sphero_driver.go +++ b/platforms/sphero/sphero_driver.go @@ -295,7 +295,9 @@ func (s *SpheroDriver) Roll(speed uint8, heading uint16) { // ConfigureLocator configures and enables the Locator func (s *SpheroDriver) ConfigureLocator(d LocatorConfig) { buf := new(bytes.Buffer) - binary.Write(buf, binary.BigEndian, d) + if err := binary.Write(buf, binary.BigEndian, d); err != nil { + panic(err) + } s.packetChannel <- s.craftPacket(buf.Bytes(), 0x02, 0x13) } @@ -303,7 +305,9 @@ func (s *SpheroDriver) ConfigureLocator(d LocatorConfig) { // SetDataStreaming enables sensor data streaming func (s *SpheroDriver) SetDataStreaming(d DataStreamingConfig) { buf := new(bytes.Buffer) - binary.Write(buf, binary.BigEndian, d) + if err := binary.Write(buf, binary.BigEndian, d); err != nil { + panic(err) + } s.packetChannel <- s.craftPacket(buf.Bytes(), 0x02, 0x11) } @@ -329,7 +333,9 @@ func (s *SpheroDriver) handleCollisionDetected(data []uint8) { } var collision CollisionPacket buffer := bytes.NewBuffer(data[5:]) // skip header - binary.Read(buffer, binary.BigEndian, &collision) + if err := binary.Read(buffer, binary.BigEndian, &collision); err != nil { + panic(err) + } s.Publish(Collision, collision) } @@ -340,7 +346,9 @@ func (s *SpheroDriver) handleDataStreaming(data []uint8) { } var dataPacket DataStreamingPacket buffer := bytes.NewBuffer(data[5:]) // skip header - binary.Read(buffer, binary.BigEndian, &dataPacket) + if err := binary.Read(buffer, binary.BigEndian, &dataPacket); err != nil { + panic(err) + } s.Publish(SensorData, dataPacket) } diff --git a/platforms/sphero/sphero_driver_test.go b/platforms/sphero/sphero_driver_test.go index f115afa42..28a3d79f7 100644 --- a/platforms/sphero/sphero_driver_test.go +++ b/platforms/sphero/sphero_driver_test.go @@ -14,7 +14,7 @@ var _ gobot.Driver = (*SpheroDriver)(nil) func initTestSpheroDriver() *SpheroDriver { a, _ := initTestSpheroAdaptor() - a.Connect() + _ = a.Connect() return NewSpheroDriver(a) } @@ -100,7 +100,7 @@ func TestSpheroDriverSetDataStreaming(t *testing.T) { data := <-d.packetChannel buf := new(bytes.Buffer) - binary.Write(buf, binary.BigEndian, DefaultDataStreamingConfig()) + _ = binary.Write(buf, binary.BigEndian, DefaultDataStreamingConfig()) gobottest.Assert(t, data.body, buf.Bytes()) @@ -118,7 +118,7 @@ func TestSpheroDriverSetDataStreaming(t *testing.T) { dconfig := DataStreamingConfig{N: 100, M: 200, Mask: 300, Pcnt: 255, Mask2: 400} buf = new(bytes.Buffer) - binary.Write(buf, binary.BigEndian, dconfig) + _ = binary.Write(buf, binary.BigEndian, dconfig) gobottest.Assert(t, data.body, buf.Bytes()) } @@ -129,7 +129,7 @@ func TestConfigureLocator(t *testing.T) { data := <-d.packetChannel buf := new(bytes.Buffer) - binary.Write(buf, binary.BigEndian, DefaultLocatorConfig()) + _ = binary.Write(buf, binary.BigEndian, DefaultLocatorConfig()) gobottest.Assert(t, data.body, buf.Bytes()) @@ -146,7 +146,7 @@ func TestConfigureLocator(t *testing.T) { lconfig := LocatorConfig{Flags: 1, X: 100, Y: 100, YawTare: 0} buf = new(bytes.Buffer) - binary.Write(buf, binary.BigEndian, lconfig) + _ = binary.Write(buf, binary.BigEndian, lconfig) gobottest.Assert(t, data.body, buf.Bytes()) } diff --git a/platforms/tinkerboard/adaptor.go b/platforms/tinkerboard/adaptor.go index 1a5e182fd..8b1208a65 100644 --- a/platforms/tinkerboard/adaptor.go +++ b/platforms/tinkerboard/adaptor.go @@ -11,8 +11,6 @@ import ( ) const ( - debug = false - pwmInvertedIdentifier = "inversed" defaultI2cBusNumber = 1 diff --git a/platforms/tinkerboard/adaptor_test.go b/platforms/tinkerboard/adaptor_test.go index 2bbb4ab0a..c25ae6145 100644 --- a/platforms/tinkerboard/adaptor_test.go +++ b/platforms/tinkerboard/adaptor_test.go @@ -83,7 +83,7 @@ func TestDigitalIO(t *testing.T) { // only basic tests needed, further tests are done in "digitalpinsadaptor.go" a, fs := initTestAdaptorWithMockedFilesystem(gpioMockPaths) - a.DigitalWrite("7", 1) + _ = a.DigitalWrite("7", 1) gobottest.Assert(t, fs.Files[gpio17Path+"value"].Contents, "1") fs.Files[gpio160Path+"value"].Contents = "1" diff --git a/platforms/upboard/up2/adaptor_test.go b/platforms/upboard/up2/adaptor_test.go index ce93c8af0..83ac48334 100644 --- a/platforms/upboard/up2/adaptor_test.go +++ b/platforms/upboard/up2/adaptor_test.go @@ -63,14 +63,14 @@ func TestName(t *testing.T) { func TestDigitalIO(t *testing.T) { a, fs := initTestAdaptorWithMockedFilesystem(gpioMockPaths) - a.DigitalWrite("7", 1) + _ = a.DigitalWrite("7", 1) gobottest.Assert(t, fs.Files["/sys/class/gpio/gpio462/value"].Contents, "1") fs.Files["/sys/class/gpio/gpio432/value"].Contents = "1" i, _ := a.DigitalRead("13") gobottest.Assert(t, i, 1) - a.DigitalWrite("green", 1) + _ = a.DigitalWrite("green", 1) gobottest.Assert(t, fs.Files["/sys/class/leds/upboard:green:/brightness"].Contents, "1", diff --git a/robot.go b/robot.go index 765d06ae6..6aa1283bf 100644 --- a/robot.go +++ b/robot.go @@ -68,30 +68,30 @@ func (r *Robots) Len() int { return len(*r) } -// Start calls the Start method of each Robot in the collection -func (r *Robots) Start(args ...interface{}) (err error) { +// Start calls the Start method of each Robot in the collection. We return on first error. +func (r *Robots) Start(args ...interface{}) error { autoRun := true if args[0] != nil { autoRun = args[0].(bool) } for _, robot := range *r { - if rerr := robot.Start(autoRun); rerr != nil { - err = multierror.Append(err, rerr) - return + if err := robot.Start(autoRun); err != nil { + return err } } - return + return nil } -// Stop calls the Stop method of each Robot in the collection -func (r *Robots) Stop() (err error) { +// Stop calls the Stop method of each Robot in the collection. We try to stop all robots and +// collect the errors. +func (r *Robots) Stop() error { + var err error for _, robot := range *r { - if rerr := robot.Stop(); rerr != nil { - err = multierror.Append(err, rerr) - return + if e := robot.Stop(); e != nil { + err = multierror.Append(err, e) } } - return + return err } // Each enumerates through the Robots and calls specified callback function. @@ -104,10 +104,9 @@ func (r *Robots) Each(f func(*Robot)) { // NewRobot returns a new Robot. It supports the following optional params: // // name: string with the name of the Robot. A name will be automatically generated if no name is supplied. -// []Connection: Connections which are automatically started and stopped with the robot +// []Connection: Connections which are automatically started and stopped with the robot // []Device: Devices which are automatically started and stopped with the robot // func(): The work routine the robot will execute once all devices and connections have been initialized and started -// func NewRobot(v ...interface{}) *Robot { r := &Robot{ Name: fmt.Sprintf("%X", Rand(int(^uint(0)>>1))), @@ -156,22 +155,23 @@ func NewRobot(v ...interface{}) *Robot { return r } -// Start a Robot's Connections, Devices, and work. -func (r *Robot) Start(args ...interface{}) (err error) { +// Start a Robot's Connections, Devices, and work. We stop initialization of +// connections and devices on first error. +func (r *Robot) Start(args ...interface{}) error { if len(args) > 0 && args[0] != nil { r.AutoRun = args[0].(bool) } log.Println("Starting Robot", r.Name, "...") - if cerr := r.Connections().Start(); cerr != nil { - err = multierror.Append(err, cerr) + if err := r.Connections().Start(); err != nil { log.Println(err) - return + return err } - if derr := r.Devices().Start(); derr != nil { - err = multierror.Append(err, derr) + + if err := r.Devices().Start(); err != nil { log.Println(err) - return + return err } + if r.Work == nil { r.Work = func() {} } @@ -183,36 +183,36 @@ func (r *Robot) Start(args ...interface{}) (err error) { }() r.running.Store(true) - if r.AutoRun { - c := make(chan os.Signal, 1) - r.trap(c) - // waiting for interrupt coming on the channel - <-c - - // Stop calls the Stop method on itself, if we are "auto-running". - r.Stop() + if !r.AutoRun { + return nil } - return + c := make(chan os.Signal, 1) + r.trap(c) + + // waiting for interrupt coming on the channel + <-c + + // Stop calls the Stop method on itself, if we are "auto-running". + return r.Stop() } -// Stop stops a Robot's connections and Devices +// Stop stops a Robot's connections and devices. We try to stop all items and +// collect all errors. func (r *Robot) Stop() error { - var result error + var err error log.Println("Stopping Robot", r.Name, "...") - err := r.Devices().Halt() - if err != nil { - result = multierror.Append(result, err) + if e := r.Devices().Halt(); e != nil { + err = multierror.Append(err, e) } - err = r.Connections().Finalize() - if err != nil { - result = multierror.Append(result, err) + if e := r.Connections().Finalize(); e != nil { + err = multierror.Append(err, e) } r.done <- true r.running.Store(false) - return result + return err } // Running returns if the Robot is currently started or not diff --git a/system/digitalpin_bench_test.go b/system/digitalpin_bench_test.go index afc58df34..eb60722c6 100644 --- a/system/digitalpin_bench_test.go +++ b/system/digitalpin_bench_test.go @@ -15,10 +15,10 @@ func BenchmarkDigitalRead(b *testing.B) { a.UseMockFilesystem(mockPaths) pin := a.NewDigitalPin("", 10) - pin.Write(1) + _ = pin.Write(1) for i := 0; i < b.N; i++ { - pin.Read() + _, _ = pin.Read() } } diff --git a/system/digitalpin_sysfs.go b/system/digitalpin_sysfs.go index c4170d5b4..7516a49d6 100644 --- a/system/digitalpin_sysfs.go +++ b/system/digitalpin_sysfs.go @@ -64,8 +64,7 @@ func (d *digitalPinSysfs) DirectionBehavior() string { // Export sets the pin as exported with the configured direction func (d *digitalPinSysfs) Export() error { - err := d.reconfigure() - return err + return d.reconfigure() } // Unexport release the pin @@ -194,7 +193,7 @@ func (d *digitalPinSysfs) reconfigure() error { } if err != nil { - d.Unexport() + return d.Unexport() } return err diff --git a/system/fs_mock_test.go b/system/fs_mock_test.go index afc39c516..78b974ad6 100644 --- a/system/fs_mock_test.go +++ b/system/fs_mock_test.go @@ -77,7 +77,7 @@ func TestMockFilesystemWrite(t *testing.T) { // Never been read or written. gobottest.Assert(t, f1.Seq <= 0, true) - f2.WriteString("testing") + _, _ = f2.WriteString("testing") // Was written. gobottest.Assert(t, f1.Seq > 0, true) gobottest.Assert(t, f1.Contents, "testing") diff --git a/system/spi_gpio.go b/system/spi_gpio.go index ab0af7894..68c7c0016 100644 --- a/system/spi_gpio.go +++ b/system/spi_gpio.go @@ -4,6 +4,7 @@ import ( "fmt" "time" + "github.com/hashicorp/go-multierror" "gobot.io/x/gobot/v2" ) @@ -77,19 +78,28 @@ func (s *spiGpio) TxRx(tx []byte, rx []byte) error { // Close the SPI connection. Implements gobot.SpiSystemDevicer. func (s *spiGpio) Close() error { + var err error if s.sclkPin != nil { - s.sclkPin.Unexport() + if e := s.sclkPin.Unexport(); e != nil { + err = multierror.Append(err, e) + } } if s.mosiPin != nil { - s.mosiPin.Unexport() + if e := s.mosiPin.Unexport(); e != nil { + err = multierror.Append(err, e) + } } if s.misoPin != nil { - s.misoPin.Unexport() + if e := s.misoPin.Unexport(); e != nil { + err = multierror.Append(err, e) + } } if s.nssPin != nil { - s.nssPin.Unexport() + if e := s.nssPin.Unexport(); e != nil { + err = multierror.Append(err, e) + } } - return nil + return err } func (cfg *spiGpioConfig) String() string { From e807156ccb8c38123fd224e077e39edbfc0cc0a8 Mon Sep 17 00:00:00 2001 From: Thomas Kohler Date: Wed, 14 Jun 2023 17:57:44 +0200 Subject: [PATCH 12/20] tello: fix wifiMessage and lightMessage (#957) --- platforms/dji/tello/driver.go | 15 +-- platforms/dji/tello/driver_test.go | 182 ++++++++++++++--------------- 2 files changed, 96 insertions(+), 101 deletions(-) diff --git a/platforms/dji/tello/driver.go b/platforms/dji/tello/driver.go index b4cb4c647..f48d28e99 100644 --- a/platforms/dji/tello/driver.go +++ b/platforms/dji/tello/driver.go @@ -994,18 +994,13 @@ func (d *Driver) handleResponse(r io.Reader) error { msgType = (uint16(buf[6]) << 8) | uint16(buf[5]) switch msgType { case wifiMessage: - buf := bytes.NewReader(buf[9:10]) - wd := &WifiData{} - // TODO: do not drop err, see #948 - _ = binary.Read(buf, binary.LittleEndian, &wd.Strength) - _ = binary.Read(buf, binary.LittleEndian, &wd.Disturb) + wd := &WifiData{ + Strength: int8(buf[9:10][0]), + Disturb: int8(buf[10:11][0]), + } d.Publish(d.Event(WifiDataEvent), wd) case lightMessage: - buf := bytes.NewReader(buf[9:9]) - var ld int8 - // TODO: do not drop err, see #948 - _ = binary.Read(buf, binary.LittleEndian, &ld) - d.Publish(d.Event(LightStrengthEvent), ld) + d.Publish(d.Event(LightStrengthEvent), int8(buf[9:10][0])) case logMessage: d.Publish(d.Event(LogEvent), buf[9:]) case timeCommand: diff --git a/platforms/dji/tello/driver_test.go b/platforms/dji/tello/driver_test.go index 12f270ba8..ecd9e22a4 100644 --- a/platforms/dji/tello/driver_test.go +++ b/platforms/dji/tello/driver_test.go @@ -24,122 +24,114 @@ func (w *WriteCloserDoNothing) Close() error { return nil } -func TestTelloDriver(t *testing.T) { +func TestNewDriver(t *testing.T) { d := NewDriver("8888") gobottest.Assert(t, d.respPort, "8888") } -func statusMessage(msgType uint16, msgAfter7 ...byte) []byte { - msg := make([]byte, 7, len(msgAfter7)+7) - msg[0] = messageStart - binary.LittleEndian.PutUint16(msg[5:7], msgType) - msg = append(msg, msgAfter7...) - return msg -} - -func TestHandleResponse(t *testing.T) { - cc := []struct { - name string - msg io.Reader - events []gobot.Event - err error +func Test_handleResponse(t *testing.T) { + tests := map[string]struct { + msg []byte + wantEvent string + wantData (interface{}) + err error }{ - { - name: "[empty messsage]", - msg: bytes.NewReader(nil), - err: io.EOF, + "[empty message]": { + msg: nil, + err: io.EOF, }, - { - name: "wifiMessage", - msg: bytes.NewReader(statusMessage(wifiMessage)), - events: []gobot.Event{{Name: WifiDataEvent}}, + "wifiMessage": { + msg: statusMessage(wifiMessage, 0x07, 0x08, 0xA3, 0x0A), + wantEvent: WifiDataEvent, + wantData: &WifiData{Strength: -93, Disturb: 10}, }, - { - name: "lightMessage", - msg: bytes.NewReader(statusMessage(lightMessage)), - events: []gobot.Event{{Name: LightStrengthEvent}}, + "lightMessage": { + msg: statusMessage(lightMessage, 0x17, 0x18, 0xFF), + wantEvent: LightStrengthEvent, + wantData: int8(-1), }, - { - name: "logMessage", - msg: bytes.NewReader(statusMessage(logMessage)), - events: []gobot.Event{{Name: LogEvent}}, + "logMessage": { + msg: statusMessage(logMessage), + wantEvent: LogEvent, + wantData: make([]byte, 2048-9), }, - { - name: "timeCommand", - msg: bytes.NewReader(statusMessage(timeCommand)), - events: []gobot.Event{{Name: TimeEvent}}, + "timeCommand": { + msg: statusMessage(timeCommand, 0x27), + wantEvent: TimeEvent, + wantData: []uint8{0x27}, }, - { - name: "bounceCommand", - msg: bytes.NewReader(statusMessage(bounceCommand)), - events: []gobot.Event{{Name: BounceEvent}}, + "bounceCommand": { + msg: statusMessage(bounceCommand, 0x37), + wantEvent: BounceEvent, + wantData: []uint8{0x37}, }, - { - name: "takeoffCommand", - msg: bytes.NewReader(statusMessage(takeoffCommand)), - events: []gobot.Event{{Name: TakeoffEvent}}, + "takeoffCommand": { + msg: statusMessage(takeoffCommand, 0x47), + wantEvent: TakeoffEvent, + wantData: []uint8{0x47}, }, - { - name: "landCommand", - msg: bytes.NewReader(statusMessage(landCommand)), - events: []gobot.Event{{Name: LandingEvent}}, + "landCommand": { + msg: statusMessage(landCommand, 0x57), + wantEvent: LandingEvent, + wantData: []uint8{0x57}, }, - { - name: "palmLandCommand", - msg: bytes.NewReader(statusMessage(palmLandCommand)), - events: []gobot.Event{{Name: PalmLandingEvent}}, + "palmLandCommand": { + msg: statusMessage(palmLandCommand, 0x67), + wantEvent: PalmLandingEvent, + wantData: []uint8{0x67}, }, - { - name: "flipCommand", - msg: bytes.NewReader(statusMessage(flipCommand)), - events: []gobot.Event{{Name: FlipEvent}}, + "flipCommand": { + msg: statusMessage(flipCommand, 0x77), + wantEvent: FlipEvent, + wantData: []uint8{0x77}, }, - { - name: "flightMessage", - msg: bytes.NewReader(statusMessage(flightMessage)), - events: []gobot.Event{{Name: FlightDataEvent}}, + "flightMessage": { + msg: statusMessage(flightMessage, 0x87, 0x88, 0x60, 0xA4), + wantEvent: FlightDataEvent, + wantData: &FlightData{Height: -23456}, }, - { - name: "exposureCommand", - msg: bytes.NewReader(statusMessage(exposureCommand)), - events: []gobot.Event{{Name: SetExposureEvent}}, + "exposureCommand": { + msg: statusMessage(exposureCommand, 0x97), + wantEvent: SetExposureEvent, + wantData: []uint8{0x97}, }, - { - name: "videoEncoderRateCommand", - msg: bytes.NewReader(statusMessage(videoEncoderRateCommand)), - events: []gobot.Event{{Name: SetVideoEncoderRateEvent}}, + "videoEncoderRateCommand": { + msg: statusMessage(videoEncoderRateCommand, 0xa7), + wantEvent: SetVideoEncoderRateEvent, + wantData: []uint8{0xA7}, }, - { - name: "ConnectedEvent", - msg: bytes.NewReader([]byte{0x63, 0x6f, 0x6e}), - events: []gobot.Event{{Name: ConnectedEvent}}, + "ConnectedEvent": { + msg: []byte{0x63, 0x6f, 0x6e}, + wantEvent: ConnectedEvent, + wantData: nil, }, } - - for _, c := range cc { - t.Run(c.name, func(t *testing.T) { + for name, tc := range tests { + t.Run(name, func(t *testing.T) { d := NewDriver("8888") events := d.Subscribe() - err := d.handleResponse(c.msg) - if c.err != err { - t.Errorf("expected '%v' error, got: %v", c.err, err) + err := d.handleResponse(bytes.NewReader(tc.msg)) + if tc.err != err { + t.Errorf("expected '%v' error, got: %v", tc.err, err) } - for i, cev := range c.events { - t.Run(fmt.Sprintf("event %d", i), func(t *testing.T) { - t.Logf("expect: %#v", cev) - select { - case ev, ok := <-events: - if !ok { - t.Error("subscription channel is closed") - } - if ev.Name != cev.Name { - t.Errorf("got: %s", ev.Name) - } - case <-time.After(time.Millisecond): - t.Error("subscription channel seems empty") + if tc.wantEvent != "" { + select { + case ev, ok := <-events: + if !ok { + t.Error("subscription channel is closed") + } + if ev.Name != tc.wantEvent { + t.Errorf("\ngot: %s\nwant: %s\n", ev.Name, tc.wantEvent) } - }) + got := fmt.Sprintf("%T %+[1]v", ev.Data) + want := fmt.Sprintf("%T %+[1]v", tc.wantData) + if got != want { + t.Errorf("\ngot: %s\nwant: %s\n", got, want) + } + case <-time.After(time.Millisecond): + t.Error("subscription channel seems empty") + } } }) } @@ -190,3 +182,11 @@ func TestHaltNotWaitForeverWhenCalledMultipleTimes(t *testing.T) { _ = d.Halt() _ = d.Halt() } + +func statusMessage(msgType uint16, msgAfter7 ...byte) []byte { + msg := make([]byte, 7, len(msgAfter7)+7) + msg[0] = messageStart + binary.LittleEndian.PutUint16(msg[5:7], msgType) + msg = append(msg, msgAfter7...) + return msg +} From 70b8f314835913196b336ccee97123a706ba50f4 Mon Sep 17 00:00:00 2001 From: Thomas Kohler Date: Wed, 14 Jun 2023 18:27:22 +0200 Subject: [PATCH 13/20] ble: simplify and substitute errors.Wrap() (#958) --- drivers/i2c/adxl345_driver.go | 14 +++++++------- go.mod | 4 ---- go.sum | 12 ------------ platforms/ble/ble_client_adaptor.go | 7 +++---- platforms/mqtt/mqtt_adaptor.go | 4 ++-- 5 files changed, 12 insertions(+), 29 deletions(-) diff --git a/drivers/i2c/adxl345_driver.go b/drivers/i2c/adxl345_driver.go index dae15904f..61df38e0b 100644 --- a/drivers/i2c/adxl345_driver.go +++ b/drivers/i2c/adxl345_driver.go @@ -2,9 +2,8 @@ package i2c import ( "encoding/binary" + "fmt" "log" - - "github.com/pkg/errors" ) const adxl345Debug = false @@ -117,12 +116,13 @@ type adxl345BwRate struct { // NewADXL345Driver creates a new driver with specified i2c interface // Params: -// c Connector - the Adaptor to use with this Driver +// +// c Connector - the Adaptor to use with this Driver // // Optional params: -// i2c.WithBus(int): bus to use with this driver -// i2c.WithAddress(int): address to use with this driver // +// i2c.WithBus(int): bus to use with this driver +// i2c.WithAddress(int): address to use with this driver func NewADXL345Driver(c Connector, options ...func(Config)) *ADXL345Driver { d := &ADXL345Driver{ Driver: NewDriver(c, "ADXL345", adxl345DefaultAddress), @@ -232,7 +232,7 @@ func (d *ADXL345Driver) XYZ() (float64, float64, float64, error) { return d.dataFormat.convertToG(xr), d.dataFormat.convertToG(yr), d.dataFormat.convertToG(zr), nil } -// XYZ returns the raw x,y and z axis +// RawXYZ returns the raw x,y and z axis func (d *ADXL345Driver) RawXYZ() (int16, int16, int16, error) { d.mutex.Lock() defer d.mutex.Unlock() @@ -269,7 +269,7 @@ func (d *ADXL345Driver) initialize() error { func (d *ADXL345Driver) shutdown() error { d.powerCtl.measure = 0 if d.connection == nil { - return errors.New("connection not available") + return fmt.Errorf("connection not available") } return d.connection.WriteByteData(adxl345Reg_POWER_CTL, d.powerCtl.toByte()) } diff --git a/go.mod b/go.mod index f888b4caa..39c355f9e 100644 --- a/go.mod +++ b/go.mod @@ -11,10 +11,8 @@ require ( github.com/hybridgroup/go-ardrone v0.0.0-20140402002621-b9750d8d7b78 github.com/hybridgroup/mjpeg v0.0.0-20140228234708-4680f319790e github.com/nats-io/nats.go v1.26.0 - github.com/pkg/errors v0.9.1 github.com/sigurn/crc8 v0.0.0-20220107193325-2243fe600f9f github.com/stretchr/testify v1.8.4 - github.com/urfave/cli v1.22.13 github.com/veandco/go-sdl2 v0.4.35 github.com/warthog618/gpiod v0.8.1 go.bug.st/serial v1.5.0 @@ -26,7 +24,6 @@ require ( ) require ( - github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect github.com/creack/goselect v0.1.2 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/fatih/structs v1.1.0 // indirect @@ -41,7 +38,6 @@ require ( github.com/nats-io/nkeys v0.4.4 // indirect github.com/nats-io/nuid v1.0.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/saltosystems/winrt-go v0.0.0-20230510070731-e096b9afa761 // indirect github.com/sirupsen/logrus v1.9.3 // indirect github.com/tinygo-org/cbgo v0.0.4 // indirect diff --git a/go.sum b/go.sum index 61f7dc96e..3ba709f68 100644 --- a/go.sum +++ b/go.sum @@ -1,10 +1,7 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/BurntSushi/toml v1.2.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/bgould/http v0.0.0-20190627042742-d268792bdee7/go.mod h1:BTqvVegvwifopl4KTEDth6Zezs9eR+lCWhvGKvkxJHE= github.com/bmizerany/pat v0.0.0-20210406213842-e4b6760bdd6f h1:gOO/tNZMjjvTKZWpY7YnXC72ULNLErRtp94LountVE8= github.com/bmizerany/pat v0.0.0-20210406213842-e4b6760bdd6f/go.mod h1:8rLXio+WjiTceGBHIoTvn60HIbs7Hm7bcHjyrSqYB9c= -github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= -github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/goselect v0.1.2 h1:2DNy14+JPjRBgPzAd1thbQp4BSIihxcBf0IXhQXDRa0= github.com/creack/goselect v0.1.2/go.mod h1:a/NhLweNvqIYMuxcMOuWY516Cimucms3DglDzQP3hKY= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -74,12 +71,9 @@ github.com/paypal/gatt v0.0.0-20151011220935-4ae819d591cf/go.mod h1:+AwQL2mK3Pd3 github.com/pelletier/go-toml v1.6.0/go.mod h1:5N711Q9dKgbdkxHL+MEfF31hpT7l0S0s/t2kKREewys= github.com/peterbourgon/ff/v3 v3.1.2/go.mod h1:XNJLY8EIl6MjMVjBS4F0+G0LYoAqs0DTa4rmHHukKDE= github.com/pilebones/go-udev v0.9.0 h1:N1uEO/SxUwtIctc0WLU0t69JeBxIYEYnj8lT/Nabl9Q= -github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= -github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/sago35/go-bdf v0.0.0-20200313142241-6c17821c91c4/go.mod h1:rOebXGuMLsXhZAC6mF/TjxONsm45498ZyzVhel++6KM= github.com/saltosystems/winrt-go v0.0.0-20220826130236-ddc8202da421/go.mod h1:UvKm1lyhg+8ehk99i8g5Q7AX1LXUJgks0lRyAkG/ahQ= github.com/saltosystems/winrt-go v0.0.0-20230510070731-e096b9afa761 h1:xEscoMxTrGSpdho1mP9VnGsK0DGhXKwm0qP7kYcjgrI= @@ -93,22 +87,17 @@ github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.5/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/suapapa/go_eddystone v1.3.1/go.mod h1:bXC11TfJOS+3g3q/Uzd7FKd5g62STQEfeEIhcKe4Qy8= github.com/tdakkota/win32metadata v0.1.0/go.mod h1:77e6YvX0LIVW+O81fhWLnXAxxcyu/wdZdG7iwed7Fyk= github.com/tinygo-org/cbgo v0.0.4 h1:3D76CRYbH03Rudi8sEgs/YO0x3JIMdyq8jlQtk/44fU= github.com/tinygo-org/cbgo v0.0.4/go.mod h1:7+HgWIHd4nbAz0ESjGlJ1/v9LDU1Ox8MGzP9mah/fLk= -github.com/urfave/cli v1.22.13 h1:wsLILXG8qCJNse/qAgLNf23737Cx05GflHg/PJGe1Ok= -github.com/urfave/cli v1.22.13/go.mod h1:VufqObjsMTF2BBwKawpx9R8eAneNEWhoO0yx8Vd+FkE= github.com/valyala/fastjson v1.6.3/go.mod h1:CLCAqky6SMuOcxStkYQvblddUtoRxhYMGLrsQns1aXY= github.com/veandco/go-sdl2 v0.4.35 h1:NohzsfageDWGtCd9nf7Pc3sokMK/MOK+UA2QMJARWzQ= github.com/veandco/go-sdl2 v0.4.35/go.mod h1:OROqMhHD43nT4/i9crJukyVecjPNYYuCofep6SNiAjY= @@ -179,7 +168,6 @@ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/platforms/ble/ble_client_adaptor.go b/platforms/ble/ble_client_adaptor.go index 7d815acde..ce65c3807 100644 --- a/platforms/ble/ble_client_adaptor.go +++ b/platforms/ble/ble_client_adaptor.go @@ -6,7 +6,6 @@ import ( "sync" "time" - "github.com/pkg/errors" "gobot.io/x/gobot/v2" "tinygo.org/x/bluetooth" @@ -79,7 +78,7 @@ func (b *ClientAdaptor) Connect() error { // enable adaptor b.adpt, err = getBLEAdapter(b.AdapterName) if err != nil { - return errors.Wrap(err, "can't enable adapter "+b.AdapterName) + return fmt.Errorf("can't get adapter %s: %w", b.AdapterName, err) } // handle address @@ -212,7 +211,7 @@ func (b *ClientAdaptor) Subscribe(cUUID string, f func([]byte, error)) error { return fmt.Errorf("Unknown characteristic: %s", cUUID) } -// getBLEDevice is singleton for bluetooth adapter connection +// getBLEAdapter is singleton for bluetooth adapter connection func getBLEAdapter(impl string) (*bluetooth.Adapter, error) { if currentAdapter != nil { return currentAdapter, nil @@ -221,7 +220,7 @@ func getBLEAdapter(impl string) (*bluetooth.Adapter, error) { currentAdapter = bluetooth.DefaultAdapter err := currentAdapter.Enable() if err != nil { - return nil, errors.Wrap(err, "can't get device") + return nil, err } return currentAdapter, nil diff --git a/platforms/mqtt/mqtt_adaptor.go b/platforms/mqtt/mqtt_adaptor.go index d70badb05..d0889e6c2 100644 --- a/platforms/mqtt/mqtt_adaptor.go +++ b/platforms/mqtt/mqtt_adaptor.go @@ -3,17 +3,17 @@ package mqtt import ( "crypto/tls" "crypto/x509" + "fmt" "os" "gobot.io/x/gobot/v2" paho "github.com/eclipse/paho.mqtt.golang" - "github.com/pkg/errors" ) var ( // ErrNilClient is returned when a client action can't be taken because the struct has no client - ErrNilClient = errors.New("no MQTT client available") + ErrNilClient = fmt.Errorf("no MQTT client available") ) // Message is a message received from the broker. From 33e906be61595f24e617bc5f3bb6edcbfaf00d02 Mon Sep 17 00:00:00 2001 From: Thomas Kohler Date: Wed, 14 Jun 2023 20:08:02 +0200 Subject: [PATCH 14/20] mavlink: fix linter issues of errcheck (#959) --- platforms/mavlink/README.md | 4 +- platforms/mavlink/common/common.go | 6193 ++++++++++++++++++++------- platforms/mavlink/common/mavlink.go | 44 +- 3 files changed, 4674 insertions(+), 1567 deletions(-) diff --git a/platforms/mavlink/README.md b/platforms/mavlink/README.md index 9e44368d8..b8b7412bd 100644 --- a/platforms/mavlink/README.md +++ b/platforms/mavlink/README.md @@ -1,6 +1,6 @@ # Mavlink -For information on the MAVlink communication protocol click [here](http://qgroundcontrol.org/mavlink/start). +For information on the MAVlink communication protocol click [here](https://mavlink.io/). This package supports Mavlink over serial (such as a [SiK modem](http://ardupilot.org/copter/docs/common-sik-telemetry-radio.html)) @@ -14,6 +14,8 @@ As at 2018-04, this package supports Mavlink 1.0 only. If the robot doesn't receiving data then check that the other devices are configured to send version 1.0 frames. +For Mavlink 2.0 please refer to [gomavlib](https://github.com/bluenviron/gomavlib). + ## How to Install Please refer to the main [README.md](https://github.com/hybridgroup/gobot/blob/release/README.md) diff --git a/platforms/mavlink/common/common.go b/platforms/mavlink/common/common.go index 9b624b29c..1b26feee0 100644 --- a/platforms/mavlink/common/common.go +++ b/platforms/mavlink/common/common.go @@ -1,4 +1,3 @@ -//nolint:errcheck // to much code to fix it immediately package mavlink // @@ -681,24 +680,48 @@ func (*Heartbeat) Crc() uint8 { // Pack returns a packed byte array which represents a Heartbeat payload func (m *Heartbeat) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.CUSTOM_MODE) - binary.Write(data, binary.LittleEndian, m.TYPE) - binary.Write(data, binary.LittleEndian, m.AUTOPILOT) - binary.Write(data, binary.LittleEndian, m.BASE_MODE) - binary.Write(data, binary.LittleEndian, m.SYSTEM_STATUS) - binary.Write(data, binary.LittleEndian, m.MAVLINK_VERSION) + if err := binary.Write(data, binary.LittleEndian, m.CUSTOM_MODE); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.TYPE); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.AUTOPILOT); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.BASE_MODE); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.SYSTEM_STATUS); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.MAVLINK_VERSION); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the Heartbeat func (m *Heartbeat) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.CUSTOM_MODE) - binary.Read(data, binary.LittleEndian, &m.TYPE) - binary.Read(data, binary.LittleEndian, &m.AUTOPILOT) - binary.Read(data, binary.LittleEndian, &m.BASE_MODE) - binary.Read(data, binary.LittleEndian, &m.SYSTEM_STATUS) - binary.Read(data, binary.LittleEndian, &m.MAVLINK_VERSION) + if err := binary.Read(data, binary.LittleEndian, &m.CUSTOM_MODE); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.TYPE); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.AUTOPILOT); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.BASE_MODE); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.SYSTEM_STATUS); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.MAVLINK_VERSION); err != nil { + panic(err) + } } // MESSAGE SYS_STATUS @@ -761,38 +784,90 @@ func (*SysStatus) Crc() uint8 { // Pack returns a packed byte array which represents a SysStatus payload func (m *SysStatus) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.ONBOARD_CONTROL_SENSORS_PRESENT) - binary.Write(data, binary.LittleEndian, m.ONBOARD_CONTROL_SENSORS_ENABLED) - binary.Write(data, binary.LittleEndian, m.ONBOARD_CONTROL_SENSORS_HEALTH) - binary.Write(data, binary.LittleEndian, m.LOAD) - binary.Write(data, binary.LittleEndian, m.VOLTAGE_BATTERY) - binary.Write(data, binary.LittleEndian, m.CURRENT_BATTERY) - binary.Write(data, binary.LittleEndian, m.DROP_RATE_COMM) - binary.Write(data, binary.LittleEndian, m.ERRORS_COMM) - binary.Write(data, binary.LittleEndian, m.ERRORS_COUNT1) - binary.Write(data, binary.LittleEndian, m.ERRORS_COUNT2) - binary.Write(data, binary.LittleEndian, m.ERRORS_COUNT3) - binary.Write(data, binary.LittleEndian, m.ERRORS_COUNT4) - binary.Write(data, binary.LittleEndian, m.BATTERY_REMAINING) + if err := binary.Write(data, binary.LittleEndian, m.ONBOARD_CONTROL_SENSORS_PRESENT); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.ONBOARD_CONTROL_SENSORS_ENABLED); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.ONBOARD_CONTROL_SENSORS_HEALTH); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.LOAD); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.VOLTAGE_BATTERY); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.CURRENT_BATTERY); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.DROP_RATE_COMM); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.ERRORS_COMM); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.ERRORS_COUNT1); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.ERRORS_COUNT2); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.ERRORS_COUNT3); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.ERRORS_COUNT4); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.BATTERY_REMAINING); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the SysStatus func (m *SysStatus) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.ONBOARD_CONTROL_SENSORS_PRESENT) - binary.Read(data, binary.LittleEndian, &m.ONBOARD_CONTROL_SENSORS_ENABLED) - binary.Read(data, binary.LittleEndian, &m.ONBOARD_CONTROL_SENSORS_HEALTH) - binary.Read(data, binary.LittleEndian, &m.LOAD) - binary.Read(data, binary.LittleEndian, &m.VOLTAGE_BATTERY) - binary.Read(data, binary.LittleEndian, &m.CURRENT_BATTERY) - binary.Read(data, binary.LittleEndian, &m.DROP_RATE_COMM) - binary.Read(data, binary.LittleEndian, &m.ERRORS_COMM) - binary.Read(data, binary.LittleEndian, &m.ERRORS_COUNT1) - binary.Read(data, binary.LittleEndian, &m.ERRORS_COUNT2) - binary.Read(data, binary.LittleEndian, &m.ERRORS_COUNT3) - binary.Read(data, binary.LittleEndian, &m.ERRORS_COUNT4) - binary.Read(data, binary.LittleEndian, &m.BATTERY_REMAINING) + if err := binary.Read(data, binary.LittleEndian, &m.ONBOARD_CONTROL_SENSORS_PRESENT); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.ONBOARD_CONTROL_SENSORS_ENABLED); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.ONBOARD_CONTROL_SENSORS_HEALTH); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.LOAD); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.VOLTAGE_BATTERY); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.CURRENT_BATTERY); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.DROP_RATE_COMM); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.ERRORS_COMM); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.ERRORS_COUNT1); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.ERRORS_COUNT2); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.ERRORS_COUNT3); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.ERRORS_COUNT4); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.BATTERY_REMAINING); err != nil { + panic(err) + } } // MESSAGE SYSTEM_TIME @@ -833,16 +908,24 @@ func (*SystemTime) Crc() uint8 { // Pack returns a packed byte array which represents a SystemTime payload func (m *SystemTime) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.TIME_UNIX_USEC) - binary.Write(data, binary.LittleEndian, m.TIME_BOOT_MS) + if err := binary.Write(data, binary.LittleEndian, m.TIME_UNIX_USEC); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.TIME_BOOT_MS); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the SystemTime func (m *SystemTime) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.TIME_UNIX_USEC) - binary.Read(data, binary.LittleEndian, &m.TIME_BOOT_MS) + if err := binary.Read(data, binary.LittleEndian, &m.TIME_UNIX_USEC); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.TIME_BOOT_MS); err != nil { + panic(err) + } } // MESSAGE PING @@ -887,20 +970,36 @@ func (*Ping) Crc() uint8 { // Pack returns a packed byte array which represents a Ping payload func (m *Ping) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.TIME_USEC) - binary.Write(data, binary.LittleEndian, m.SEQ) - binary.Write(data, binary.LittleEndian, m.TARGET_SYSTEM) - binary.Write(data, binary.LittleEndian, m.TARGET_COMPONENT) + if err := binary.Write(data, binary.LittleEndian, m.TIME_USEC); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.SEQ); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.TARGET_SYSTEM); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.TARGET_COMPONENT); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the Ping func (m *Ping) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.TIME_USEC) - binary.Read(data, binary.LittleEndian, &m.SEQ) - binary.Read(data, binary.LittleEndian, &m.TARGET_SYSTEM) - binary.Read(data, binary.LittleEndian, &m.TARGET_COMPONENT) + if err := binary.Read(data, binary.LittleEndian, &m.TIME_USEC); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.SEQ); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.TARGET_SYSTEM); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.TARGET_COMPONENT); err != nil { + panic(err) + } } // MESSAGE CHANGE_OPERATOR_CONTROL @@ -945,20 +1044,36 @@ func (*ChangeOperatorControl) Crc() uint8 { // Pack returns a packed byte array which represents a ChangeOperatorControl payload func (m *ChangeOperatorControl) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.TARGET_SYSTEM) - binary.Write(data, binary.LittleEndian, m.CONTROL_REQUEST) - binary.Write(data, binary.LittleEndian, m.VERSION) - binary.Write(data, binary.LittleEndian, m.PASSKEY) + if err := binary.Write(data, binary.LittleEndian, m.TARGET_SYSTEM); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.CONTROL_REQUEST); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.VERSION); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.PASSKEY); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the ChangeOperatorControl func (m *ChangeOperatorControl) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.TARGET_SYSTEM) - binary.Read(data, binary.LittleEndian, &m.CONTROL_REQUEST) - binary.Read(data, binary.LittleEndian, &m.VERSION) - binary.Read(data, binary.LittleEndian, &m.PASSKEY) + if err := binary.Read(data, binary.LittleEndian, &m.TARGET_SYSTEM); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.CONTROL_REQUEST); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.VERSION); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.PASSKEY); err != nil { + panic(err) + } } const ( @@ -1005,18 +1120,30 @@ func (*ChangeOperatorControlAck) Crc() uint8 { // Pack returns a packed byte array which represents a ChangeOperatorControlAck payload func (m *ChangeOperatorControlAck) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.GCS_SYSTEM_ID) - binary.Write(data, binary.LittleEndian, m.CONTROL_REQUEST) - binary.Write(data, binary.LittleEndian, m.ACK) + if err := binary.Write(data, binary.LittleEndian, m.GCS_SYSTEM_ID); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.CONTROL_REQUEST); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.ACK); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the ChangeOperatorControlAck func (m *ChangeOperatorControlAck) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.GCS_SYSTEM_ID) - binary.Read(data, binary.LittleEndian, &m.CONTROL_REQUEST) - binary.Read(data, binary.LittleEndian, &m.ACK) + if err := binary.Read(data, binary.LittleEndian, &m.GCS_SYSTEM_ID); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.CONTROL_REQUEST); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.ACK); err != nil { + panic(err) + } } // MESSAGE AUTH_KEY @@ -1055,14 +1182,18 @@ func (*AuthKey) Crc() uint8 { // Pack returns a packed byte array which represents a AuthKey payload func (m *AuthKey) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.KEY) + if err := binary.Write(data, binary.LittleEndian, m.KEY); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the AuthKey func (m *AuthKey) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.KEY) + if err := binary.Read(data, binary.LittleEndian, &m.KEY); err != nil { + panic(err) + } } const ( @@ -1109,18 +1240,30 @@ func (*SetMode) Crc() uint8 { // Pack returns a packed byte array which represents a SetMode payload func (m *SetMode) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.CUSTOM_MODE) - binary.Write(data, binary.LittleEndian, m.TARGET_SYSTEM) - binary.Write(data, binary.LittleEndian, m.BASE_MODE) + if err := binary.Write(data, binary.LittleEndian, m.CUSTOM_MODE); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.TARGET_SYSTEM); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.BASE_MODE); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the SetMode func (m *SetMode) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.CUSTOM_MODE) - binary.Read(data, binary.LittleEndian, &m.TARGET_SYSTEM) - binary.Read(data, binary.LittleEndian, &m.BASE_MODE) + if err := binary.Read(data, binary.LittleEndian, &m.CUSTOM_MODE); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.TARGET_SYSTEM); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.BASE_MODE); err != nil { + panic(err) + } } // MESSAGE PARAM_REQUEST_READ @@ -1165,20 +1308,36 @@ func (*ParamRequestRead) Crc() uint8 { // Pack returns a packed byte array which represents a ParamRequestRead payload func (m *ParamRequestRead) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.PARAM_INDEX) - binary.Write(data, binary.LittleEndian, m.TARGET_SYSTEM) - binary.Write(data, binary.LittleEndian, m.TARGET_COMPONENT) - binary.Write(data, binary.LittleEndian, m.PARAM_ID) + if err := binary.Write(data, binary.LittleEndian, m.PARAM_INDEX); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.TARGET_SYSTEM); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.TARGET_COMPONENT); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.PARAM_ID); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the ParamRequestRead func (m *ParamRequestRead) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.PARAM_INDEX) - binary.Read(data, binary.LittleEndian, &m.TARGET_SYSTEM) - binary.Read(data, binary.LittleEndian, &m.TARGET_COMPONENT) - binary.Read(data, binary.LittleEndian, &m.PARAM_ID) + if err := binary.Read(data, binary.LittleEndian, &m.PARAM_INDEX); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.TARGET_SYSTEM); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.TARGET_COMPONENT); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.PARAM_ID); err != nil { + panic(err) + } } const ( @@ -1223,16 +1382,24 @@ func (*ParamRequestList) Crc() uint8 { // Pack returns a packed byte array which represents a ParamRequestList payload func (m *ParamRequestList) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.TARGET_SYSTEM) - binary.Write(data, binary.LittleEndian, m.TARGET_COMPONENT) + if err := binary.Write(data, binary.LittleEndian, m.TARGET_SYSTEM); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.TARGET_COMPONENT); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the ParamRequestList func (m *ParamRequestList) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.TARGET_SYSTEM) - binary.Read(data, binary.LittleEndian, &m.TARGET_COMPONENT) + if err := binary.Read(data, binary.LittleEndian, &m.TARGET_SYSTEM); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.TARGET_COMPONENT); err != nil { + panic(err) + } } // MESSAGE PARAM_VALUE @@ -1279,22 +1446,42 @@ func (*ParamValue) Crc() uint8 { // Pack returns a packed byte array which represents a ParamValue payload func (m *ParamValue) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.PARAM_VALUE) - binary.Write(data, binary.LittleEndian, m.PARAM_COUNT) - binary.Write(data, binary.LittleEndian, m.PARAM_INDEX) - binary.Write(data, binary.LittleEndian, m.PARAM_ID) - binary.Write(data, binary.LittleEndian, m.PARAM_TYPE) + if err := binary.Write(data, binary.LittleEndian, m.PARAM_VALUE); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.PARAM_COUNT); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.PARAM_INDEX); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.PARAM_ID); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.PARAM_TYPE); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the ParamValue func (m *ParamValue) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.PARAM_VALUE) - binary.Read(data, binary.LittleEndian, &m.PARAM_COUNT) - binary.Read(data, binary.LittleEndian, &m.PARAM_INDEX) - binary.Read(data, binary.LittleEndian, &m.PARAM_ID) - binary.Read(data, binary.LittleEndian, &m.PARAM_TYPE) + if err := binary.Read(data, binary.LittleEndian, &m.PARAM_VALUE); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.PARAM_COUNT); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.PARAM_INDEX); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.PARAM_ID); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.PARAM_TYPE); err != nil { + panic(err) + } } const ( @@ -1345,22 +1532,42 @@ func (*ParamSet) Crc() uint8 { // Pack returns a packed byte array which represents a ParamSet payload func (m *ParamSet) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.PARAM_VALUE) - binary.Write(data, binary.LittleEndian, m.TARGET_SYSTEM) - binary.Write(data, binary.LittleEndian, m.TARGET_COMPONENT) - binary.Write(data, binary.LittleEndian, m.PARAM_ID) - binary.Write(data, binary.LittleEndian, m.PARAM_TYPE) + if err := binary.Write(data, binary.LittleEndian, m.PARAM_VALUE); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.TARGET_SYSTEM); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.TARGET_COMPONENT); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.PARAM_ID); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.PARAM_TYPE); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the ParamSet func (m *ParamSet) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.PARAM_VALUE) - binary.Read(data, binary.LittleEndian, &m.TARGET_SYSTEM) - binary.Read(data, binary.LittleEndian, &m.TARGET_COMPONENT) - binary.Read(data, binary.LittleEndian, &m.PARAM_ID) - binary.Read(data, binary.LittleEndian, &m.PARAM_TYPE) + if err := binary.Read(data, binary.LittleEndian, &m.PARAM_VALUE); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.TARGET_SYSTEM); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.TARGET_COMPONENT); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.PARAM_ID); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.PARAM_TYPE); err != nil { + panic(err) + } } const ( @@ -1421,32 +1628,72 @@ func (*GpsRawInt) Crc() uint8 { // Pack returns a packed byte array which represents a GpsRawInt payload func (m *GpsRawInt) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.TIME_USEC) - binary.Write(data, binary.LittleEndian, m.LAT) - binary.Write(data, binary.LittleEndian, m.LON) - binary.Write(data, binary.LittleEndian, m.ALT) - binary.Write(data, binary.LittleEndian, m.EPH) - binary.Write(data, binary.LittleEndian, m.EPV) - binary.Write(data, binary.LittleEndian, m.VEL) - binary.Write(data, binary.LittleEndian, m.COG) - binary.Write(data, binary.LittleEndian, m.FIX_TYPE) - binary.Write(data, binary.LittleEndian, m.SATELLITES_VISIBLE) + if err := binary.Write(data, binary.LittleEndian, m.TIME_USEC); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.LAT); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.LON); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.ALT); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.EPH); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.EPV); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.VEL); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.COG); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.FIX_TYPE); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.SATELLITES_VISIBLE); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the GpsRawInt func (m *GpsRawInt) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.TIME_USEC) - binary.Read(data, binary.LittleEndian, &m.LAT) - binary.Read(data, binary.LittleEndian, &m.LON) - binary.Read(data, binary.LittleEndian, &m.ALT) - binary.Read(data, binary.LittleEndian, &m.EPH) - binary.Read(data, binary.LittleEndian, &m.EPV) - binary.Read(data, binary.LittleEndian, &m.VEL) - binary.Read(data, binary.LittleEndian, &m.COG) - binary.Read(data, binary.LittleEndian, &m.FIX_TYPE) - binary.Read(data, binary.LittleEndian, &m.SATELLITES_VISIBLE) + if err := binary.Read(data, binary.LittleEndian, &m.TIME_USEC); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.LAT); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.LON); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.ALT); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.EPH); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.EPV); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.VEL); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.COG); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.FIX_TYPE); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.SATELLITES_VISIBLE); err != nil { + panic(err) + } } // MESSAGE GPS_STATUS @@ -1495,24 +1742,48 @@ func (*GpsStatus) Crc() uint8 { // Pack returns a packed byte array which represents a GpsStatus payload func (m *GpsStatus) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.SATELLITES_VISIBLE) - binary.Write(data, binary.LittleEndian, m.SATELLITE_PRN) - binary.Write(data, binary.LittleEndian, m.SATELLITE_USED) - binary.Write(data, binary.LittleEndian, m.SATELLITE_ELEVATION) - binary.Write(data, binary.LittleEndian, m.SATELLITE_AZIMUTH) - binary.Write(data, binary.LittleEndian, m.SATELLITE_SNR) + if err := binary.Write(data, binary.LittleEndian, m.SATELLITES_VISIBLE); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.SATELLITE_PRN); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.SATELLITE_USED); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.SATELLITE_ELEVATION); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.SATELLITE_AZIMUTH); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.SATELLITE_SNR); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the GpsStatus func (m *GpsStatus) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.SATELLITES_VISIBLE) - binary.Read(data, binary.LittleEndian, &m.SATELLITE_PRN) - binary.Read(data, binary.LittleEndian, &m.SATELLITE_USED) - binary.Read(data, binary.LittleEndian, &m.SATELLITE_ELEVATION) - binary.Read(data, binary.LittleEndian, &m.SATELLITE_AZIMUTH) - binary.Read(data, binary.LittleEndian, &m.SATELLITE_SNR) + if err := binary.Read(data, binary.LittleEndian, &m.SATELLITES_VISIBLE); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.SATELLITE_PRN); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.SATELLITE_USED); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.SATELLITE_ELEVATION); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.SATELLITE_AZIMUTH); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.SATELLITE_SNR); err != nil { + panic(err) + } } const ( @@ -1577,32 +1848,72 @@ func (*ScaledImu) Crc() uint8 { // Pack returns a packed byte array which represents a ScaledImu payload func (m *ScaledImu) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.TIME_BOOT_MS) - binary.Write(data, binary.LittleEndian, m.XACC) - binary.Write(data, binary.LittleEndian, m.YACC) - binary.Write(data, binary.LittleEndian, m.ZACC) - binary.Write(data, binary.LittleEndian, m.XGYRO) - binary.Write(data, binary.LittleEndian, m.YGYRO) - binary.Write(data, binary.LittleEndian, m.ZGYRO) - binary.Write(data, binary.LittleEndian, m.XMAG) - binary.Write(data, binary.LittleEndian, m.YMAG) - binary.Write(data, binary.LittleEndian, m.ZMAG) + if err := binary.Write(data, binary.LittleEndian, m.TIME_BOOT_MS); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.XACC); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.YACC); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.ZACC); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.XGYRO); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.YGYRO); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.ZGYRO); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.XMAG); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.YMAG); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.ZMAG); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the ScaledImu func (m *ScaledImu) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.TIME_BOOT_MS) - binary.Read(data, binary.LittleEndian, &m.XACC) - binary.Read(data, binary.LittleEndian, &m.YACC) - binary.Read(data, binary.LittleEndian, &m.ZACC) - binary.Read(data, binary.LittleEndian, &m.XGYRO) - binary.Read(data, binary.LittleEndian, &m.YGYRO) - binary.Read(data, binary.LittleEndian, &m.ZGYRO) - binary.Read(data, binary.LittleEndian, &m.XMAG) - binary.Read(data, binary.LittleEndian, &m.YMAG) - binary.Read(data, binary.LittleEndian, &m.ZMAG) + if err := binary.Read(data, binary.LittleEndian, &m.TIME_BOOT_MS); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.XACC); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.YACC); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.ZACC); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.XGYRO); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.YGYRO); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.ZGYRO); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.XMAG); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.YMAG); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.ZMAG); err != nil { + panic(err) + } } // MESSAGE RAW_IMU @@ -1659,32 +1970,72 @@ func (*RawImu) Crc() uint8 { // Pack returns a packed byte array which represents a RawImu payload func (m *RawImu) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.TIME_USEC) - binary.Write(data, binary.LittleEndian, m.XACC) - binary.Write(data, binary.LittleEndian, m.YACC) - binary.Write(data, binary.LittleEndian, m.ZACC) - binary.Write(data, binary.LittleEndian, m.XGYRO) - binary.Write(data, binary.LittleEndian, m.YGYRO) - binary.Write(data, binary.LittleEndian, m.ZGYRO) - binary.Write(data, binary.LittleEndian, m.XMAG) - binary.Write(data, binary.LittleEndian, m.YMAG) - binary.Write(data, binary.LittleEndian, m.ZMAG) + if err := binary.Write(data, binary.LittleEndian, m.TIME_USEC); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.XACC); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.YACC); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.ZACC); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.XGYRO); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.YGYRO); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.ZGYRO); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.XMAG); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.YMAG); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.ZMAG); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the RawImu func (m *RawImu) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.TIME_USEC) - binary.Read(data, binary.LittleEndian, &m.XACC) - binary.Read(data, binary.LittleEndian, &m.YACC) - binary.Read(data, binary.LittleEndian, &m.ZACC) - binary.Read(data, binary.LittleEndian, &m.XGYRO) - binary.Read(data, binary.LittleEndian, &m.YGYRO) - binary.Read(data, binary.LittleEndian, &m.ZGYRO) - binary.Read(data, binary.LittleEndian, &m.XMAG) - binary.Read(data, binary.LittleEndian, &m.YMAG) - binary.Read(data, binary.LittleEndian, &m.ZMAG) + if err := binary.Read(data, binary.LittleEndian, &m.TIME_USEC); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.XACC); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.YACC); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.ZACC); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.XGYRO); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.YGYRO); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.ZGYRO); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.XMAG); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.YMAG); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.ZMAG); err != nil { + panic(err) + } } // MESSAGE RAW_PRESSURE @@ -1731,22 +2082,42 @@ func (*RawPressure) Crc() uint8 { // Pack returns a packed byte array which represents a RawPressure payload func (m *RawPressure) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.TIME_USEC) - binary.Write(data, binary.LittleEndian, m.PRESS_ABS) - binary.Write(data, binary.LittleEndian, m.PRESS_DIFF1) - binary.Write(data, binary.LittleEndian, m.PRESS_DIFF2) - binary.Write(data, binary.LittleEndian, m.TEMPERATURE) + if err := binary.Write(data, binary.LittleEndian, m.TIME_USEC); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.PRESS_ABS); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.PRESS_DIFF1); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.PRESS_DIFF2); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.TEMPERATURE); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the RawPressure func (m *RawPressure) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.TIME_USEC) - binary.Read(data, binary.LittleEndian, &m.PRESS_ABS) - binary.Read(data, binary.LittleEndian, &m.PRESS_DIFF1) - binary.Read(data, binary.LittleEndian, &m.PRESS_DIFF2) - binary.Read(data, binary.LittleEndian, &m.TEMPERATURE) + if err := binary.Read(data, binary.LittleEndian, &m.TIME_USEC); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.PRESS_ABS); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.PRESS_DIFF1); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.PRESS_DIFF2); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.TEMPERATURE); err != nil { + panic(err) + } } // MESSAGE SCALED_PRESSURE @@ -1791,20 +2162,36 @@ func (*ScaledPressure) Crc() uint8 { // Pack returns a packed byte array which represents a ScaledPressure payload func (m *ScaledPressure) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.TIME_BOOT_MS) - binary.Write(data, binary.LittleEndian, m.PRESS_ABS) - binary.Write(data, binary.LittleEndian, m.PRESS_DIFF) - binary.Write(data, binary.LittleEndian, m.TEMPERATURE) + if err := binary.Write(data, binary.LittleEndian, m.TIME_BOOT_MS); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.PRESS_ABS); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.PRESS_DIFF); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.TEMPERATURE); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the ScaledPressure func (m *ScaledPressure) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.TIME_BOOT_MS) - binary.Read(data, binary.LittleEndian, &m.PRESS_ABS) - binary.Read(data, binary.LittleEndian, &m.PRESS_DIFF) - binary.Read(data, binary.LittleEndian, &m.TEMPERATURE) + if err := binary.Read(data, binary.LittleEndian, &m.TIME_BOOT_MS); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.PRESS_ABS); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.PRESS_DIFF); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.TEMPERATURE); err != nil { + panic(err) + } } // MESSAGE ATTITUDE @@ -1855,26 +2242,54 @@ func (*Attitude) Crc() uint8 { // Pack returns a packed byte array which represents a Attitude payload func (m *Attitude) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.TIME_BOOT_MS) - binary.Write(data, binary.LittleEndian, m.ROLL) - binary.Write(data, binary.LittleEndian, m.PITCH) - binary.Write(data, binary.LittleEndian, m.YAW) - binary.Write(data, binary.LittleEndian, m.ROLLSPEED) - binary.Write(data, binary.LittleEndian, m.PITCHSPEED) - binary.Write(data, binary.LittleEndian, m.YAWSPEED) + if err := binary.Write(data, binary.LittleEndian, m.TIME_BOOT_MS); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.ROLL); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.PITCH); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.YAW); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.ROLLSPEED); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.PITCHSPEED); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.YAWSPEED); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the Attitude func (m *Attitude) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.TIME_BOOT_MS) - binary.Read(data, binary.LittleEndian, &m.ROLL) - binary.Read(data, binary.LittleEndian, &m.PITCH) - binary.Read(data, binary.LittleEndian, &m.YAW) - binary.Read(data, binary.LittleEndian, &m.ROLLSPEED) - binary.Read(data, binary.LittleEndian, &m.PITCHSPEED) - binary.Read(data, binary.LittleEndian, &m.YAWSPEED) + if err := binary.Read(data, binary.LittleEndian, &m.TIME_BOOT_MS); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.ROLL); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.PITCH); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.YAW); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.ROLLSPEED); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.PITCHSPEED); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.YAWSPEED); err != nil { + panic(err) + } } // MESSAGE ATTITUDE_QUATERNION @@ -1927,28 +2342,60 @@ func (*AttitudeQuaternion) Crc() uint8 { // Pack returns a packed byte array which represents a AttitudeQuaternion payload func (m *AttitudeQuaternion) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.TIME_BOOT_MS) - binary.Write(data, binary.LittleEndian, m.Q1) - binary.Write(data, binary.LittleEndian, m.Q2) - binary.Write(data, binary.LittleEndian, m.Q3) - binary.Write(data, binary.LittleEndian, m.Q4) - binary.Write(data, binary.LittleEndian, m.ROLLSPEED) - binary.Write(data, binary.LittleEndian, m.PITCHSPEED) - binary.Write(data, binary.LittleEndian, m.YAWSPEED) + if err := binary.Write(data, binary.LittleEndian, m.TIME_BOOT_MS); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.Q1); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.Q2); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.Q3); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.Q4); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.ROLLSPEED); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.PITCHSPEED); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.YAWSPEED); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the AttitudeQuaternion func (m *AttitudeQuaternion) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.TIME_BOOT_MS) - binary.Read(data, binary.LittleEndian, &m.Q1) - binary.Read(data, binary.LittleEndian, &m.Q2) - binary.Read(data, binary.LittleEndian, &m.Q3) - binary.Read(data, binary.LittleEndian, &m.Q4) - binary.Read(data, binary.LittleEndian, &m.ROLLSPEED) - binary.Read(data, binary.LittleEndian, &m.PITCHSPEED) - binary.Read(data, binary.LittleEndian, &m.YAWSPEED) + if err := binary.Read(data, binary.LittleEndian, &m.TIME_BOOT_MS); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.Q1); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.Q2); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.Q3); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.Q4); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.ROLLSPEED); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.PITCHSPEED); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.YAWSPEED); err != nil { + panic(err) + } } // MESSAGE LOCAL_POSITION_NED @@ -1999,26 +2446,54 @@ func (*LocalPositionNed) Crc() uint8 { // Pack returns a packed byte array which represents a LocalPositionNed payload func (m *LocalPositionNed) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.TIME_BOOT_MS) - binary.Write(data, binary.LittleEndian, m.X) - binary.Write(data, binary.LittleEndian, m.Y) - binary.Write(data, binary.LittleEndian, m.Z) - binary.Write(data, binary.LittleEndian, m.VX) - binary.Write(data, binary.LittleEndian, m.VY) - binary.Write(data, binary.LittleEndian, m.VZ) + if err := binary.Write(data, binary.LittleEndian, m.TIME_BOOT_MS); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.X); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.Y); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.Z); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.VX); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.VY); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.VZ); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the LocalPositionNed func (m *LocalPositionNed) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.TIME_BOOT_MS) - binary.Read(data, binary.LittleEndian, &m.X) - binary.Read(data, binary.LittleEndian, &m.Y) - binary.Read(data, binary.LittleEndian, &m.Z) - binary.Read(data, binary.LittleEndian, &m.VX) - binary.Read(data, binary.LittleEndian, &m.VY) - binary.Read(data, binary.LittleEndian, &m.VZ) + if err := binary.Read(data, binary.LittleEndian, &m.TIME_BOOT_MS); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.X); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.Y); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.Z); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.VX); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.VY); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.VZ); err != nil { + panic(err) + } } // MESSAGE GLOBAL_POSITION_INT @@ -2073,30 +2548,66 @@ func (*GlobalPositionInt) Crc() uint8 { // Pack returns a packed byte array which represents a GlobalPositionInt payload func (m *GlobalPositionInt) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.TIME_BOOT_MS) - binary.Write(data, binary.LittleEndian, m.LAT) - binary.Write(data, binary.LittleEndian, m.LON) - binary.Write(data, binary.LittleEndian, m.ALT) - binary.Write(data, binary.LittleEndian, m.RELATIVE_ALT) - binary.Write(data, binary.LittleEndian, m.VX) - binary.Write(data, binary.LittleEndian, m.VY) - binary.Write(data, binary.LittleEndian, m.VZ) - binary.Write(data, binary.LittleEndian, m.HDG) + if err := binary.Write(data, binary.LittleEndian, m.TIME_BOOT_MS); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.LAT); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.LON); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.ALT); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.RELATIVE_ALT); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.VX); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.VY); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.VZ); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.HDG); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the GlobalPositionInt func (m *GlobalPositionInt) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.TIME_BOOT_MS) - binary.Read(data, binary.LittleEndian, &m.LAT) - binary.Read(data, binary.LittleEndian, &m.LON) - binary.Read(data, binary.LittleEndian, &m.ALT) - binary.Read(data, binary.LittleEndian, &m.RELATIVE_ALT) - binary.Read(data, binary.LittleEndian, &m.VX) - binary.Read(data, binary.LittleEndian, &m.VY) - binary.Read(data, binary.LittleEndian, &m.VZ) - binary.Read(data, binary.LittleEndian, &m.HDG) + if err := binary.Read(data, binary.LittleEndian, &m.TIME_BOOT_MS); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.LAT); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.LON); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.ALT); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.RELATIVE_ALT); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.VX); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.VY); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.VZ); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.HDG); err != nil { + panic(err) + } } // MESSAGE RC_CHANNELS_SCALED @@ -2155,34 +2666,78 @@ func (*RcChannelsScaled) Crc() uint8 { // Pack returns a packed byte array which represents a RcChannelsScaled payload func (m *RcChannelsScaled) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.TIME_BOOT_MS) - binary.Write(data, binary.LittleEndian, m.CHAN1_SCALED) - binary.Write(data, binary.LittleEndian, m.CHAN2_SCALED) - binary.Write(data, binary.LittleEndian, m.CHAN3_SCALED) - binary.Write(data, binary.LittleEndian, m.CHAN4_SCALED) - binary.Write(data, binary.LittleEndian, m.CHAN5_SCALED) - binary.Write(data, binary.LittleEndian, m.CHAN6_SCALED) - binary.Write(data, binary.LittleEndian, m.CHAN7_SCALED) - binary.Write(data, binary.LittleEndian, m.CHAN8_SCALED) - binary.Write(data, binary.LittleEndian, m.PORT) - binary.Write(data, binary.LittleEndian, m.RSSI) + if err := binary.Write(data, binary.LittleEndian, m.TIME_BOOT_MS); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.CHAN1_SCALED); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.CHAN2_SCALED); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.CHAN3_SCALED); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.CHAN4_SCALED); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.CHAN5_SCALED); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.CHAN6_SCALED); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.CHAN7_SCALED); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.CHAN8_SCALED); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.PORT); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.RSSI); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the RcChannelsScaled func (m *RcChannelsScaled) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.TIME_BOOT_MS) - binary.Read(data, binary.LittleEndian, &m.CHAN1_SCALED) - binary.Read(data, binary.LittleEndian, &m.CHAN2_SCALED) - binary.Read(data, binary.LittleEndian, &m.CHAN3_SCALED) - binary.Read(data, binary.LittleEndian, &m.CHAN4_SCALED) - binary.Read(data, binary.LittleEndian, &m.CHAN5_SCALED) - binary.Read(data, binary.LittleEndian, &m.CHAN6_SCALED) - binary.Read(data, binary.LittleEndian, &m.CHAN7_SCALED) - binary.Read(data, binary.LittleEndian, &m.CHAN8_SCALED) - binary.Read(data, binary.LittleEndian, &m.PORT) - binary.Read(data, binary.LittleEndian, &m.RSSI) + if err := binary.Read(data, binary.LittleEndian, &m.TIME_BOOT_MS); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.CHAN1_SCALED); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.CHAN2_SCALED); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.CHAN3_SCALED); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.CHAN4_SCALED); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.CHAN5_SCALED); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.CHAN6_SCALED); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.CHAN7_SCALED); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.CHAN8_SCALED); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.PORT); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.RSSI); err != nil { + panic(err) + } } // MESSAGE RC_CHANNELS_RAW @@ -2241,34 +2796,78 @@ func (*RcChannelsRaw) Crc() uint8 { // Pack returns a packed byte array which represents a RcChannelsRaw payload func (m *RcChannelsRaw) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.TIME_BOOT_MS) - binary.Write(data, binary.LittleEndian, m.CHAN1_RAW) - binary.Write(data, binary.LittleEndian, m.CHAN2_RAW) - binary.Write(data, binary.LittleEndian, m.CHAN3_RAW) - binary.Write(data, binary.LittleEndian, m.CHAN4_RAW) - binary.Write(data, binary.LittleEndian, m.CHAN5_RAW) - binary.Write(data, binary.LittleEndian, m.CHAN6_RAW) - binary.Write(data, binary.LittleEndian, m.CHAN7_RAW) - binary.Write(data, binary.LittleEndian, m.CHAN8_RAW) - binary.Write(data, binary.LittleEndian, m.PORT) - binary.Write(data, binary.LittleEndian, m.RSSI) + if err := binary.Write(data, binary.LittleEndian, m.TIME_BOOT_MS); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.CHAN1_RAW); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.CHAN2_RAW); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.CHAN3_RAW); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.CHAN4_RAW); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.CHAN5_RAW); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.CHAN6_RAW); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.CHAN7_RAW); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.CHAN8_RAW); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.PORT); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.RSSI); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the RcChannelsRaw func (m *RcChannelsRaw) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.TIME_BOOT_MS) - binary.Read(data, binary.LittleEndian, &m.CHAN1_RAW) - binary.Read(data, binary.LittleEndian, &m.CHAN2_RAW) - binary.Read(data, binary.LittleEndian, &m.CHAN3_RAW) - binary.Read(data, binary.LittleEndian, &m.CHAN4_RAW) - binary.Read(data, binary.LittleEndian, &m.CHAN5_RAW) - binary.Read(data, binary.LittleEndian, &m.CHAN6_RAW) - binary.Read(data, binary.LittleEndian, &m.CHAN7_RAW) - binary.Read(data, binary.LittleEndian, &m.CHAN8_RAW) - binary.Read(data, binary.LittleEndian, &m.PORT) - binary.Read(data, binary.LittleEndian, &m.RSSI) + if err := binary.Read(data, binary.LittleEndian, &m.TIME_BOOT_MS); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.CHAN1_RAW); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.CHAN2_RAW); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.CHAN3_RAW); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.CHAN4_RAW); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.CHAN5_RAW); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.CHAN6_RAW); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.CHAN7_RAW); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.CHAN8_RAW); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.PORT); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.RSSI); err != nil { + panic(err) + } } // MESSAGE SERVO_OUTPUT_RAW @@ -2325,32 +2924,72 @@ func (*ServoOutputRaw) Crc() uint8 { // Pack returns a packed byte array which represents a ServoOutputRaw payload func (m *ServoOutputRaw) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.TIME_USEC) - binary.Write(data, binary.LittleEndian, m.SERVO1_RAW) - binary.Write(data, binary.LittleEndian, m.SERVO2_RAW) - binary.Write(data, binary.LittleEndian, m.SERVO3_RAW) - binary.Write(data, binary.LittleEndian, m.SERVO4_RAW) - binary.Write(data, binary.LittleEndian, m.SERVO5_RAW) - binary.Write(data, binary.LittleEndian, m.SERVO6_RAW) - binary.Write(data, binary.LittleEndian, m.SERVO7_RAW) - binary.Write(data, binary.LittleEndian, m.SERVO8_RAW) - binary.Write(data, binary.LittleEndian, m.PORT) + if err := binary.Write(data, binary.LittleEndian, m.TIME_USEC); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.SERVO1_RAW); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.SERVO2_RAW); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.SERVO3_RAW); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.SERVO4_RAW); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.SERVO5_RAW); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.SERVO6_RAW); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.SERVO7_RAW); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.SERVO8_RAW); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.PORT); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the ServoOutputRaw func (m *ServoOutputRaw) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.TIME_USEC) - binary.Read(data, binary.LittleEndian, &m.SERVO1_RAW) - binary.Read(data, binary.LittleEndian, &m.SERVO2_RAW) - binary.Read(data, binary.LittleEndian, &m.SERVO3_RAW) - binary.Read(data, binary.LittleEndian, &m.SERVO4_RAW) - binary.Read(data, binary.LittleEndian, &m.SERVO5_RAW) - binary.Read(data, binary.LittleEndian, &m.SERVO6_RAW) - binary.Read(data, binary.LittleEndian, &m.SERVO7_RAW) - binary.Read(data, binary.LittleEndian, &m.SERVO8_RAW) - binary.Read(data, binary.LittleEndian, &m.PORT) + if err := binary.Read(data, binary.LittleEndian, &m.TIME_USEC); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.SERVO1_RAW); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.SERVO2_RAW); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.SERVO3_RAW); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.SERVO4_RAW); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.SERVO5_RAW); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.SERVO6_RAW); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.SERVO7_RAW); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.SERVO8_RAW); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.PORT); err != nil { + panic(err) + } } // MESSAGE MISSION_REQUEST_PARTIAL_LIST @@ -2395,20 +3034,36 @@ func (*MissionRequestPartialList) Crc() uint8 { // Pack returns a packed byte array which represents a MissionRequestPartialList payload func (m *MissionRequestPartialList) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.START_INDEX) - binary.Write(data, binary.LittleEndian, m.END_INDEX) - binary.Write(data, binary.LittleEndian, m.TARGET_SYSTEM) - binary.Write(data, binary.LittleEndian, m.TARGET_COMPONENT) + if err := binary.Write(data, binary.LittleEndian, m.START_INDEX); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.END_INDEX); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.TARGET_SYSTEM); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.TARGET_COMPONENT); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the MissionRequestPartialList func (m *MissionRequestPartialList) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.START_INDEX) - binary.Read(data, binary.LittleEndian, &m.END_INDEX) - binary.Read(data, binary.LittleEndian, &m.TARGET_SYSTEM) - binary.Read(data, binary.LittleEndian, &m.TARGET_COMPONENT) + if err := binary.Read(data, binary.LittleEndian, &m.START_INDEX); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.END_INDEX); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.TARGET_SYSTEM); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.TARGET_COMPONENT); err != nil { + panic(err) + } } // MESSAGE MISSION_WRITE_PARTIAL_LIST @@ -2453,20 +3108,36 @@ func (*MissionWritePartialList) Crc() uint8 { // Pack returns a packed byte array which represents a MissionWritePartialList payload func (m *MissionWritePartialList) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.START_INDEX) - binary.Write(data, binary.LittleEndian, m.END_INDEX) - binary.Write(data, binary.LittleEndian, m.TARGET_SYSTEM) - binary.Write(data, binary.LittleEndian, m.TARGET_COMPONENT) + if err := binary.Write(data, binary.LittleEndian, m.START_INDEX); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.END_INDEX); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.TARGET_SYSTEM); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.TARGET_COMPONENT); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the MissionWritePartialList func (m *MissionWritePartialList) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.START_INDEX) - binary.Read(data, binary.LittleEndian, &m.END_INDEX) - binary.Read(data, binary.LittleEndian, &m.TARGET_SYSTEM) - binary.Read(data, binary.LittleEndian, &m.TARGET_COMPONENT) + if err := binary.Read(data, binary.LittleEndian, &m.START_INDEX); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.END_INDEX); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.TARGET_SYSTEM); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.TARGET_COMPONENT); err != nil { + panic(err) + } } // MESSAGE MISSION_ITEM @@ -2531,40 +3202,96 @@ func (*MissionItem) Crc() uint8 { // Pack returns a packed byte array which represents a MissionItem payload func (m *MissionItem) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.PARAM1) - binary.Write(data, binary.LittleEndian, m.PARAM2) - binary.Write(data, binary.LittleEndian, m.PARAM3) - binary.Write(data, binary.LittleEndian, m.PARAM4) - binary.Write(data, binary.LittleEndian, m.X) - binary.Write(data, binary.LittleEndian, m.Y) - binary.Write(data, binary.LittleEndian, m.Z) - binary.Write(data, binary.LittleEndian, m.SEQ) - binary.Write(data, binary.LittleEndian, m.COMMAND) - binary.Write(data, binary.LittleEndian, m.TARGET_SYSTEM) - binary.Write(data, binary.LittleEndian, m.TARGET_COMPONENT) - binary.Write(data, binary.LittleEndian, m.FRAME) - binary.Write(data, binary.LittleEndian, m.CURRENT) - binary.Write(data, binary.LittleEndian, m.AUTOCONTINUE) + if err := binary.Write(data, binary.LittleEndian, m.PARAM1); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.PARAM2); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.PARAM3); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.PARAM4); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.X); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.Y); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.Z); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.SEQ); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.COMMAND); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.TARGET_SYSTEM); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.TARGET_COMPONENT); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.FRAME); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.CURRENT); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.AUTOCONTINUE); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the MissionItem func (m *MissionItem) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.PARAM1) - binary.Read(data, binary.LittleEndian, &m.PARAM2) - binary.Read(data, binary.LittleEndian, &m.PARAM3) - binary.Read(data, binary.LittleEndian, &m.PARAM4) - binary.Read(data, binary.LittleEndian, &m.X) - binary.Read(data, binary.LittleEndian, &m.Y) - binary.Read(data, binary.LittleEndian, &m.Z) - binary.Read(data, binary.LittleEndian, &m.SEQ) - binary.Read(data, binary.LittleEndian, &m.COMMAND) - binary.Read(data, binary.LittleEndian, &m.TARGET_SYSTEM) - binary.Read(data, binary.LittleEndian, &m.TARGET_COMPONENT) - binary.Read(data, binary.LittleEndian, &m.FRAME) - binary.Read(data, binary.LittleEndian, &m.CURRENT) - binary.Read(data, binary.LittleEndian, &m.AUTOCONTINUE) + if err := binary.Read(data, binary.LittleEndian, &m.PARAM1); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.PARAM2); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.PARAM3); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.PARAM4); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.X); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.Y); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.Z); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.SEQ); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.COMMAND); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.TARGET_SYSTEM); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.TARGET_COMPONENT); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.FRAME); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.CURRENT); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.AUTOCONTINUE); err != nil { + panic(err) + } } // MESSAGE MISSION_REQUEST @@ -2607,18 +3334,30 @@ func (*MissionRequest) Crc() uint8 { // Pack returns a packed byte array which represents a MissionRequest payload func (m *MissionRequest) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.SEQ) - binary.Write(data, binary.LittleEndian, m.TARGET_SYSTEM) - binary.Write(data, binary.LittleEndian, m.TARGET_COMPONENT) + if err := binary.Write(data, binary.LittleEndian, m.SEQ); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.TARGET_SYSTEM); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.TARGET_COMPONENT); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the MissionRequest func (m *MissionRequest) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.SEQ) - binary.Read(data, binary.LittleEndian, &m.TARGET_SYSTEM) - binary.Read(data, binary.LittleEndian, &m.TARGET_COMPONENT) + if err := binary.Read(data, binary.LittleEndian, &m.SEQ); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.TARGET_SYSTEM); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.TARGET_COMPONENT); err != nil { + panic(err) + } } // MESSAGE MISSION_SET_CURRENT @@ -2661,18 +3400,30 @@ func (*MissionSetCurrent) Crc() uint8 { // Pack returns a packed byte array which represents a MissionSetCurrent payload func (m *MissionSetCurrent) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.SEQ) - binary.Write(data, binary.LittleEndian, m.TARGET_SYSTEM) - binary.Write(data, binary.LittleEndian, m.TARGET_COMPONENT) + if err := binary.Write(data, binary.LittleEndian, m.SEQ); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.TARGET_SYSTEM); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.TARGET_COMPONENT); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the MissionSetCurrent func (m *MissionSetCurrent) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.SEQ) - binary.Read(data, binary.LittleEndian, &m.TARGET_SYSTEM) - binary.Read(data, binary.LittleEndian, &m.TARGET_COMPONENT) + if err := binary.Read(data, binary.LittleEndian, &m.SEQ); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.TARGET_SYSTEM); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.TARGET_COMPONENT); err != nil { + panic(err) + } } // MESSAGE MISSION_CURRENT @@ -2711,14 +3462,18 @@ func (*MissionCurrent) Crc() uint8 { // Pack returns a packed byte array which represents a MissionCurrent payload func (m *MissionCurrent) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.SEQ) + if err := binary.Write(data, binary.LittleEndian, m.SEQ); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the MissionCurrent func (m *MissionCurrent) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.SEQ) + if err := binary.Read(data, binary.LittleEndian, &m.SEQ); err != nil { + panic(err) + } } // MESSAGE MISSION_REQUEST_LIST @@ -2759,16 +3514,24 @@ func (*MissionRequestList) Crc() uint8 { // Pack returns a packed byte array which represents a MissionRequestList payload func (m *MissionRequestList) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.TARGET_SYSTEM) - binary.Write(data, binary.LittleEndian, m.TARGET_COMPONENT) + if err := binary.Write(data, binary.LittleEndian, m.TARGET_SYSTEM); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.TARGET_COMPONENT); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the MissionRequestList func (m *MissionRequestList) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.TARGET_SYSTEM) - binary.Read(data, binary.LittleEndian, &m.TARGET_COMPONENT) + if err := binary.Read(data, binary.LittleEndian, &m.TARGET_SYSTEM); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.TARGET_COMPONENT); err != nil { + panic(err) + } } // MESSAGE MISSION_COUNT @@ -2811,18 +3574,30 @@ func (*MissionCount) Crc() uint8 { // Pack returns a packed byte array which represents a MissionCount payload func (m *MissionCount) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.COUNT) - binary.Write(data, binary.LittleEndian, m.TARGET_SYSTEM) - binary.Write(data, binary.LittleEndian, m.TARGET_COMPONENT) + if err := binary.Write(data, binary.LittleEndian, m.COUNT); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.TARGET_SYSTEM); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.TARGET_COMPONENT); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the MissionCount func (m *MissionCount) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.COUNT) - binary.Read(data, binary.LittleEndian, &m.TARGET_SYSTEM) - binary.Read(data, binary.LittleEndian, &m.TARGET_COMPONENT) + if err := binary.Read(data, binary.LittleEndian, &m.COUNT); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.TARGET_SYSTEM); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.TARGET_COMPONENT); err != nil { + panic(err) + } } // MESSAGE MISSION_CLEAR_ALL @@ -2863,16 +3638,24 @@ func (*MissionClearAll) Crc() uint8 { // Pack returns a packed byte array which represents a MissionClearAll payload func (m *MissionClearAll) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.TARGET_SYSTEM) - binary.Write(data, binary.LittleEndian, m.TARGET_COMPONENT) + if err := binary.Write(data, binary.LittleEndian, m.TARGET_SYSTEM); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.TARGET_COMPONENT); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the MissionClearAll func (m *MissionClearAll) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.TARGET_SYSTEM) - binary.Read(data, binary.LittleEndian, &m.TARGET_COMPONENT) + if err := binary.Read(data, binary.LittleEndian, &m.TARGET_SYSTEM); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.TARGET_COMPONENT); err != nil { + panic(err) + } } // MESSAGE MISSION_ITEM_REACHED @@ -2911,14 +3694,18 @@ func (*MissionItemReached) Crc() uint8 { // Pack returns a packed byte array which represents a MissionItemReached payload func (m *MissionItemReached) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.SEQ) + if err := binary.Write(data, binary.LittleEndian, m.SEQ); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the MissionItemReached func (m *MissionItemReached) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.SEQ) + if err := binary.Read(data, binary.LittleEndian, &m.SEQ); err != nil { + panic(err) + } } // MESSAGE MISSION_ACK @@ -2961,18 +3748,30 @@ func (*MissionAck) Crc() uint8 { // Pack returns a packed byte array which represents a MissionAck payload func (m *MissionAck) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.TARGET_SYSTEM) - binary.Write(data, binary.LittleEndian, m.TARGET_COMPONENT) - binary.Write(data, binary.LittleEndian, m.TYPE) + if err := binary.Write(data, binary.LittleEndian, m.TARGET_SYSTEM); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.TARGET_COMPONENT); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.TYPE); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the MissionAck func (m *MissionAck) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.TARGET_SYSTEM) - binary.Read(data, binary.LittleEndian, &m.TARGET_COMPONENT) - binary.Read(data, binary.LittleEndian, &m.TYPE) + if err := binary.Read(data, binary.LittleEndian, &m.TARGET_SYSTEM); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.TARGET_COMPONENT); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.TYPE); err != nil { + panic(err) + } } // MESSAGE SET_GPS_GLOBAL_ORIGIN @@ -3017,20 +3816,36 @@ func (*SetGpsGlobalOrigin) Crc() uint8 { // Pack returns a packed byte array which represents a SetGpsGlobalOrigin payload func (m *SetGpsGlobalOrigin) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.LATITUDE) - binary.Write(data, binary.LittleEndian, m.LONGITUDE) - binary.Write(data, binary.LittleEndian, m.ALTITUDE) - binary.Write(data, binary.LittleEndian, m.TARGET_SYSTEM) + if err := binary.Write(data, binary.LittleEndian, m.LATITUDE); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.LONGITUDE); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.ALTITUDE); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.TARGET_SYSTEM); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the SetGpsGlobalOrigin func (m *SetGpsGlobalOrigin) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.LATITUDE) - binary.Read(data, binary.LittleEndian, &m.LONGITUDE) - binary.Read(data, binary.LittleEndian, &m.ALTITUDE) - binary.Read(data, binary.LittleEndian, &m.TARGET_SYSTEM) + if err := binary.Read(data, binary.LittleEndian, &m.LATITUDE); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.LONGITUDE); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.ALTITUDE); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.TARGET_SYSTEM); err != nil { + panic(err) + } } // MESSAGE GPS_GLOBAL_ORIGIN @@ -3073,18 +3888,30 @@ func (*GpsGlobalOrigin) Crc() uint8 { // Pack returns a packed byte array which represents a GpsGlobalOrigin payload func (m *GpsGlobalOrigin) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.LATITUDE) - binary.Write(data, binary.LittleEndian, m.LONGITUDE) - binary.Write(data, binary.LittleEndian, m.ALTITUDE) + if err := binary.Write(data, binary.LittleEndian, m.LATITUDE); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.LONGITUDE); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.ALTITUDE); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the GpsGlobalOrigin func (m *GpsGlobalOrigin) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.LATITUDE) - binary.Read(data, binary.LittleEndian, &m.LONGITUDE) - binary.Read(data, binary.LittleEndian, &m.ALTITUDE) + if err := binary.Read(data, binary.LittleEndian, &m.LATITUDE); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.LONGITUDE); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.ALTITUDE); err != nil { + panic(err) + } } // MESSAGE SET_LOCAL_POSITION_SETPOINT @@ -3135,26 +3962,54 @@ func (*SetLocalPositionSetpoint) Crc() uint8 { // Pack returns a packed byte array which represents a SetLocalPositionSetpoint payload func (m *SetLocalPositionSetpoint) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.X) - binary.Write(data, binary.LittleEndian, m.Y) - binary.Write(data, binary.LittleEndian, m.Z) - binary.Write(data, binary.LittleEndian, m.YAW) - binary.Write(data, binary.LittleEndian, m.TARGET_SYSTEM) - binary.Write(data, binary.LittleEndian, m.TARGET_COMPONENT) - binary.Write(data, binary.LittleEndian, m.COORDINATE_FRAME) + if err := binary.Write(data, binary.LittleEndian, m.X); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.Y); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.Z); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.YAW); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.TARGET_SYSTEM); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.TARGET_COMPONENT); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.COORDINATE_FRAME); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the SetLocalPositionSetpoint func (m *SetLocalPositionSetpoint) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.X) - binary.Read(data, binary.LittleEndian, &m.Y) - binary.Read(data, binary.LittleEndian, &m.Z) - binary.Read(data, binary.LittleEndian, &m.YAW) - binary.Read(data, binary.LittleEndian, &m.TARGET_SYSTEM) - binary.Read(data, binary.LittleEndian, &m.TARGET_COMPONENT) - binary.Read(data, binary.LittleEndian, &m.COORDINATE_FRAME) + if err := binary.Read(data, binary.LittleEndian, &m.X); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.Y); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.Z); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.YAW); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.TARGET_SYSTEM); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.TARGET_COMPONENT); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.COORDINATE_FRAME); err != nil { + panic(err) + } } // MESSAGE LOCAL_POSITION_SETPOINT @@ -3201,22 +4056,42 @@ func (*LocalPositionSetpoint) Crc() uint8 { // Pack returns a packed byte array which represents a LocalPositionSetpoint payload func (m *LocalPositionSetpoint) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.X) - binary.Write(data, binary.LittleEndian, m.Y) - binary.Write(data, binary.LittleEndian, m.Z) - binary.Write(data, binary.LittleEndian, m.YAW) - binary.Write(data, binary.LittleEndian, m.COORDINATE_FRAME) + if err := binary.Write(data, binary.LittleEndian, m.X); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.Y); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.Z); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.YAW); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.COORDINATE_FRAME); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the LocalPositionSetpoint func (m *LocalPositionSetpoint) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.X) - binary.Read(data, binary.LittleEndian, &m.Y) - binary.Read(data, binary.LittleEndian, &m.Z) - binary.Read(data, binary.LittleEndian, &m.YAW) - binary.Read(data, binary.LittleEndian, &m.COORDINATE_FRAME) + if err := binary.Read(data, binary.LittleEndian, &m.X); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.Y); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.Z); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.YAW); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.COORDINATE_FRAME); err != nil { + panic(err) + } } // MESSAGE GLOBAL_POSITION_SETPOINT_INT @@ -3263,22 +4138,42 @@ func (*GlobalPositionSetpointInt) Crc() uint8 { // Pack returns a packed byte array which represents a GlobalPositionSetpointInt payload func (m *GlobalPositionSetpointInt) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.LATITUDE) - binary.Write(data, binary.LittleEndian, m.LONGITUDE) - binary.Write(data, binary.LittleEndian, m.ALTITUDE) - binary.Write(data, binary.LittleEndian, m.YAW) - binary.Write(data, binary.LittleEndian, m.COORDINATE_FRAME) + if err := binary.Write(data, binary.LittleEndian, m.LATITUDE); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.LONGITUDE); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.ALTITUDE); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.YAW); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.COORDINATE_FRAME); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the GlobalPositionSetpointInt func (m *GlobalPositionSetpointInt) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.LATITUDE) - binary.Read(data, binary.LittleEndian, &m.LONGITUDE) - binary.Read(data, binary.LittleEndian, &m.ALTITUDE) - binary.Read(data, binary.LittleEndian, &m.YAW) - binary.Read(data, binary.LittleEndian, &m.COORDINATE_FRAME) + if err := binary.Read(data, binary.LittleEndian, &m.LATITUDE); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.LONGITUDE); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.ALTITUDE); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.YAW); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.COORDINATE_FRAME); err != nil { + panic(err) + } } // MESSAGE SET_GLOBAL_POSITION_SETPOINT_INT @@ -3325,22 +4220,42 @@ func (*SetGlobalPositionSetpointInt) Crc() uint8 { // Pack returns a packed byte array which represents a SetGlobalPositionSetpointInt payload func (m *SetGlobalPositionSetpointInt) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.LATITUDE) - binary.Write(data, binary.LittleEndian, m.LONGITUDE) - binary.Write(data, binary.LittleEndian, m.ALTITUDE) - binary.Write(data, binary.LittleEndian, m.YAW) - binary.Write(data, binary.LittleEndian, m.COORDINATE_FRAME) + if err := binary.Write(data, binary.LittleEndian, m.LATITUDE); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.LONGITUDE); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.ALTITUDE); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.YAW); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.COORDINATE_FRAME); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the SetGlobalPositionSetpointInt func (m *SetGlobalPositionSetpointInt) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.LATITUDE) - binary.Read(data, binary.LittleEndian, &m.LONGITUDE) - binary.Read(data, binary.LittleEndian, &m.ALTITUDE) - binary.Read(data, binary.LittleEndian, &m.YAW) - binary.Read(data, binary.LittleEndian, &m.COORDINATE_FRAME) + if err := binary.Read(data, binary.LittleEndian, &m.LATITUDE); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.LONGITUDE); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.ALTITUDE); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.YAW); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.COORDINATE_FRAME); err != nil { + panic(err) + } } // MESSAGE SAFETY_SET_ALLOWED_AREA @@ -3395,30 +4310,66 @@ func (*SafetySetAllowedArea) Crc() uint8 { // Pack returns a packed byte array which represents a SafetySetAllowedArea payload func (m *SafetySetAllowedArea) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.P1X) - binary.Write(data, binary.LittleEndian, m.P1Y) - binary.Write(data, binary.LittleEndian, m.P1Z) - binary.Write(data, binary.LittleEndian, m.P2X) - binary.Write(data, binary.LittleEndian, m.P2Y) - binary.Write(data, binary.LittleEndian, m.P2Z) - binary.Write(data, binary.LittleEndian, m.TARGET_SYSTEM) - binary.Write(data, binary.LittleEndian, m.TARGET_COMPONENT) - binary.Write(data, binary.LittleEndian, m.FRAME) + if err := binary.Write(data, binary.LittleEndian, m.P1X); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.P1Y); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.P1Z); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.P2X); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.P2Y); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.P2Z); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.TARGET_SYSTEM); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.TARGET_COMPONENT); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.FRAME); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the SafetySetAllowedArea func (m *SafetySetAllowedArea) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.P1X) - binary.Read(data, binary.LittleEndian, &m.P1Y) - binary.Read(data, binary.LittleEndian, &m.P1Z) - binary.Read(data, binary.LittleEndian, &m.P2X) - binary.Read(data, binary.LittleEndian, &m.P2Y) - binary.Read(data, binary.LittleEndian, &m.P2Z) - binary.Read(data, binary.LittleEndian, &m.TARGET_SYSTEM) - binary.Read(data, binary.LittleEndian, &m.TARGET_COMPONENT) - binary.Read(data, binary.LittleEndian, &m.FRAME) + if err := binary.Read(data, binary.LittleEndian, &m.P1X); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.P1Y); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.P1Z); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.P2X); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.P2Y); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.P2Z); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.TARGET_SYSTEM); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.TARGET_COMPONENT); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.FRAME); err != nil { + panic(err) + } } // MESSAGE SAFETY_ALLOWED_AREA @@ -3469,26 +4420,54 @@ func (*SafetyAllowedArea) Crc() uint8 { // Pack returns a packed byte array which represents a SafetyAllowedArea payload func (m *SafetyAllowedArea) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.P1X) - binary.Write(data, binary.LittleEndian, m.P1Y) - binary.Write(data, binary.LittleEndian, m.P1Z) - binary.Write(data, binary.LittleEndian, m.P2X) - binary.Write(data, binary.LittleEndian, m.P2Y) - binary.Write(data, binary.LittleEndian, m.P2Z) - binary.Write(data, binary.LittleEndian, m.FRAME) + if err := binary.Write(data, binary.LittleEndian, m.P1X); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.P1Y); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.P1Z); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.P2X); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.P2Y); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.P2Z); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.FRAME); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the SafetyAllowedArea func (m *SafetyAllowedArea) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.P1X) - binary.Read(data, binary.LittleEndian, &m.P1Y) - binary.Read(data, binary.LittleEndian, &m.P1Z) - binary.Read(data, binary.LittleEndian, &m.P2X) - binary.Read(data, binary.LittleEndian, &m.P2Y) - binary.Read(data, binary.LittleEndian, &m.P2Z) - binary.Read(data, binary.LittleEndian, &m.FRAME) + if err := binary.Read(data, binary.LittleEndian, &m.P1X); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.P1Y); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.P1Z); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.P2X); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.P2Y); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.P2Z); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.FRAME); err != nil { + panic(err) + } } // MESSAGE SET_ROLL_PITCH_YAW_THRUST @@ -3537,24 +4516,48 @@ func (*SetRollPitchYawThrust) Crc() uint8 { // Pack returns a packed byte array which represents a SetRollPitchYawThrust payload func (m *SetRollPitchYawThrust) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.ROLL) - binary.Write(data, binary.LittleEndian, m.PITCH) - binary.Write(data, binary.LittleEndian, m.YAW) - binary.Write(data, binary.LittleEndian, m.THRUST) - binary.Write(data, binary.LittleEndian, m.TARGET_SYSTEM) - binary.Write(data, binary.LittleEndian, m.TARGET_COMPONENT) + if err := binary.Write(data, binary.LittleEndian, m.ROLL); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.PITCH); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.YAW); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.THRUST); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.TARGET_SYSTEM); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.TARGET_COMPONENT); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the SetRollPitchYawThrust func (m *SetRollPitchYawThrust) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.ROLL) - binary.Read(data, binary.LittleEndian, &m.PITCH) - binary.Read(data, binary.LittleEndian, &m.YAW) - binary.Read(data, binary.LittleEndian, &m.THRUST) - binary.Read(data, binary.LittleEndian, &m.TARGET_SYSTEM) - binary.Read(data, binary.LittleEndian, &m.TARGET_COMPONENT) + if err := binary.Read(data, binary.LittleEndian, &m.ROLL); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.PITCH); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.YAW); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.THRUST); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.TARGET_SYSTEM); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.TARGET_COMPONENT); err != nil { + panic(err) + } } // MESSAGE SET_ROLL_PITCH_YAW_SPEED_THRUST @@ -3603,28 +4606,52 @@ func (*SetRollPitchYawSpeedThrust) Crc() uint8 { // Pack returns a packed byte array which represents a SetRollPitchYawSpeedThrust payload func (m *SetRollPitchYawSpeedThrust) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.ROLL_SPEED) - binary.Write(data, binary.LittleEndian, m.PITCH_SPEED) - binary.Write(data, binary.LittleEndian, m.YAW_SPEED) - binary.Write(data, binary.LittleEndian, m.THRUST) - binary.Write(data, binary.LittleEndian, m.TARGET_SYSTEM) - binary.Write(data, binary.LittleEndian, m.TARGET_COMPONENT) + if err := binary.Write(data, binary.LittleEndian, m.ROLL_SPEED); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.PITCH_SPEED); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.YAW_SPEED); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.THRUST); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.TARGET_SYSTEM); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.TARGET_COMPONENT); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the SetRollPitchYawSpeedThrust func (m *SetRollPitchYawSpeedThrust) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.ROLL_SPEED) - binary.Read(data, binary.LittleEndian, &m.PITCH_SPEED) - binary.Read(data, binary.LittleEndian, &m.YAW_SPEED) - binary.Read(data, binary.LittleEndian, &m.THRUST) - binary.Read(data, binary.LittleEndian, &m.TARGET_SYSTEM) - binary.Read(data, binary.LittleEndian, &m.TARGET_COMPONENT) -} - -// MESSAGE ROLL_PITCH_YAW_THRUST_SETPOINT -// + if err := binary.Read(data, binary.LittleEndian, &m.ROLL_SPEED); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.PITCH_SPEED); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.YAW_SPEED); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.THRUST); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.TARGET_SYSTEM); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.TARGET_COMPONENT); err != nil { + panic(err) + } +} + +// MESSAGE ROLL_PITCH_YAW_THRUST_SETPOINT +// // MAVLINK_MSG_ID_ROLL_PITCH_YAW_THRUST_SETPOINT 58 // // MAVLINK_MSG_ID_ROLL_PITCH_YAW_THRUST_SETPOINT_LEN 20 @@ -3667,22 +4694,42 @@ func (*RollPitchYawThrustSetpoint) Crc() uint8 { // Pack returns a packed byte array which represents a RollPitchYawThrustSetpoint payload func (m *RollPitchYawThrustSetpoint) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.TIME_BOOT_MS) - binary.Write(data, binary.LittleEndian, m.ROLL) - binary.Write(data, binary.LittleEndian, m.PITCH) - binary.Write(data, binary.LittleEndian, m.YAW) - binary.Write(data, binary.LittleEndian, m.THRUST) + if err := binary.Write(data, binary.LittleEndian, m.TIME_BOOT_MS); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.ROLL); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.PITCH); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.YAW); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.THRUST); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the RollPitchYawThrustSetpoint func (m *RollPitchYawThrustSetpoint) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.TIME_BOOT_MS) - binary.Read(data, binary.LittleEndian, &m.ROLL) - binary.Read(data, binary.LittleEndian, &m.PITCH) - binary.Read(data, binary.LittleEndian, &m.YAW) - binary.Read(data, binary.LittleEndian, &m.THRUST) + if err := binary.Read(data, binary.LittleEndian, &m.TIME_BOOT_MS); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.ROLL); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.PITCH); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.YAW); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.THRUST); err != nil { + panic(err) + } } // MESSAGE ROLL_PITCH_YAW_SPEED_THRUST_SETPOINT @@ -3729,22 +4776,42 @@ func (*RollPitchYawSpeedThrustSetpoint) Crc() uint8 { // Pack returns a packed byte array which represents a RollPitchYawSpeedThrustSetpoint payload func (m *RollPitchYawSpeedThrustSetpoint) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.TIME_BOOT_MS) - binary.Write(data, binary.LittleEndian, m.ROLL_SPEED) - binary.Write(data, binary.LittleEndian, m.PITCH_SPEED) - binary.Write(data, binary.LittleEndian, m.YAW_SPEED) - binary.Write(data, binary.LittleEndian, m.THRUST) + if err := binary.Write(data, binary.LittleEndian, m.TIME_BOOT_MS); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.ROLL_SPEED); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.PITCH_SPEED); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.YAW_SPEED); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.THRUST); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the RollPitchYawSpeedThrustSetpoint func (m *RollPitchYawSpeedThrustSetpoint) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.TIME_BOOT_MS) - binary.Read(data, binary.LittleEndian, &m.ROLL_SPEED) - binary.Read(data, binary.LittleEndian, &m.PITCH_SPEED) - binary.Read(data, binary.LittleEndian, &m.YAW_SPEED) - binary.Read(data, binary.LittleEndian, &m.THRUST) + if err := binary.Read(data, binary.LittleEndian, &m.TIME_BOOT_MS); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.ROLL_SPEED); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.PITCH_SPEED); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.YAW_SPEED); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.THRUST); err != nil { + panic(err) + } } // MESSAGE SET_QUAD_MOTORS_SETPOINT @@ -3791,22 +4858,42 @@ func (*SetQuadMotorsSetpoint) Crc() uint8 { // Pack returns a packed byte array which represents a SetQuadMotorsSetpoint payload func (m *SetQuadMotorsSetpoint) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.MOTOR_FRONT_NW) - binary.Write(data, binary.LittleEndian, m.MOTOR_RIGHT_NE) - binary.Write(data, binary.LittleEndian, m.MOTOR_BACK_SE) - binary.Write(data, binary.LittleEndian, m.MOTOR_LEFT_SW) - binary.Write(data, binary.LittleEndian, m.TARGET_SYSTEM) + if err := binary.Write(data, binary.LittleEndian, m.MOTOR_FRONT_NW); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.MOTOR_RIGHT_NE); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.MOTOR_BACK_SE); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.MOTOR_LEFT_SW); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.TARGET_SYSTEM); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the SetQuadMotorsSetpoint func (m *SetQuadMotorsSetpoint) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.MOTOR_FRONT_NW) - binary.Read(data, binary.LittleEndian, &m.MOTOR_RIGHT_NE) - binary.Read(data, binary.LittleEndian, &m.MOTOR_BACK_SE) - binary.Read(data, binary.LittleEndian, &m.MOTOR_LEFT_SW) - binary.Read(data, binary.LittleEndian, &m.TARGET_SYSTEM) + if err := binary.Read(data, binary.LittleEndian, &m.MOTOR_FRONT_NW); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.MOTOR_RIGHT_NE); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.MOTOR_BACK_SE); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.MOTOR_LEFT_SW); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.TARGET_SYSTEM); err != nil { + panic(err) + } } // MESSAGE SET_QUAD_SWARM_ROLL_PITCH_YAW_THRUST @@ -3855,24 +4942,48 @@ func (*SetQuadSwarmRollPitchYawThrust) Crc() uint8 { // Pack returns a packed byte array which represents a SetQuadSwarmRollPitchYawThrust payload func (m *SetQuadSwarmRollPitchYawThrust) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.ROLL) - binary.Write(data, binary.LittleEndian, m.PITCH) - binary.Write(data, binary.LittleEndian, m.YAW) - binary.Write(data, binary.LittleEndian, m.THRUST) - binary.Write(data, binary.LittleEndian, m.GROUP) - binary.Write(data, binary.LittleEndian, m.MODE) + if err := binary.Write(data, binary.LittleEndian, m.ROLL); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.PITCH); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.YAW); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.THRUST); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.GROUP); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.MODE); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the SetQuadSwarmRollPitchYawThrust func (m *SetQuadSwarmRollPitchYawThrust) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.ROLL) - binary.Read(data, binary.LittleEndian, &m.PITCH) - binary.Read(data, binary.LittleEndian, &m.YAW) - binary.Read(data, binary.LittleEndian, &m.THRUST) - binary.Read(data, binary.LittleEndian, &m.GROUP) - binary.Read(data, binary.LittleEndian, &m.MODE) + if err := binary.Read(data, binary.LittleEndian, &m.ROLL); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.PITCH); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.YAW); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.THRUST); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.GROUP); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.MODE); err != nil { + panic(err) + } } const ( @@ -3932,28 +5043,60 @@ func (*NavControllerOutput) Crc() uint8 { // Pack returns a packed byte array which represents a NavControllerOutput payload func (m *NavControllerOutput) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.NAV_ROLL) - binary.Write(data, binary.LittleEndian, m.NAV_PITCH) - binary.Write(data, binary.LittleEndian, m.ALT_ERROR) - binary.Write(data, binary.LittleEndian, m.ASPD_ERROR) - binary.Write(data, binary.LittleEndian, m.XTRACK_ERROR) - binary.Write(data, binary.LittleEndian, m.NAV_BEARING) - binary.Write(data, binary.LittleEndian, m.TARGET_BEARING) - binary.Write(data, binary.LittleEndian, m.WP_DIST) + if err := binary.Write(data, binary.LittleEndian, m.NAV_ROLL); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.NAV_PITCH); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.ALT_ERROR); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.ASPD_ERROR); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.XTRACK_ERROR); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.NAV_BEARING); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.TARGET_BEARING); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.WP_DIST); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the NavControllerOutput func (m *NavControllerOutput) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.NAV_ROLL) - binary.Read(data, binary.LittleEndian, &m.NAV_PITCH) - binary.Read(data, binary.LittleEndian, &m.ALT_ERROR) - binary.Read(data, binary.LittleEndian, &m.ASPD_ERROR) - binary.Read(data, binary.LittleEndian, &m.XTRACK_ERROR) - binary.Read(data, binary.LittleEndian, &m.NAV_BEARING) - binary.Read(data, binary.LittleEndian, &m.TARGET_BEARING) - binary.Read(data, binary.LittleEndian, &m.WP_DIST) + if err := binary.Read(data, binary.LittleEndian, &m.NAV_ROLL); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.NAV_PITCH); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.ALT_ERROR); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.ASPD_ERROR); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.XTRACK_ERROR); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.NAV_BEARING); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.TARGET_BEARING); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.WP_DIST); err != nil { + panic(err) + } } // MESSAGE SET_QUAD_SWARM_LED_ROLL_PITCH_YAW_THRUST @@ -4008,30 +5151,66 @@ func (*SetQuadSwarmLedRollPitchYawThrust) Crc() uint8 { // Pack returns a packed byte array which represents a SetQuadSwarmLedRollPitchYawThrust payload func (m *SetQuadSwarmLedRollPitchYawThrust) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.ROLL) - binary.Write(data, binary.LittleEndian, m.PITCH) - binary.Write(data, binary.LittleEndian, m.YAW) - binary.Write(data, binary.LittleEndian, m.THRUST) - binary.Write(data, binary.LittleEndian, m.GROUP) - binary.Write(data, binary.LittleEndian, m.MODE) - binary.Write(data, binary.LittleEndian, m.LED_RED) - binary.Write(data, binary.LittleEndian, m.LED_BLUE) - binary.Write(data, binary.LittleEndian, m.LED_GREEN) + if err := binary.Write(data, binary.LittleEndian, m.ROLL); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.PITCH); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.YAW); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.THRUST); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.GROUP); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.MODE); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.LED_RED); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.LED_BLUE); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.LED_GREEN); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the SetQuadSwarmLedRollPitchYawThrust func (m *SetQuadSwarmLedRollPitchYawThrust) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.ROLL) - binary.Read(data, binary.LittleEndian, &m.PITCH) - binary.Read(data, binary.LittleEndian, &m.YAW) - binary.Read(data, binary.LittleEndian, &m.THRUST) - binary.Read(data, binary.LittleEndian, &m.GROUP) - binary.Read(data, binary.LittleEndian, &m.MODE) - binary.Read(data, binary.LittleEndian, &m.LED_RED) - binary.Read(data, binary.LittleEndian, &m.LED_BLUE) - binary.Read(data, binary.LittleEndian, &m.LED_GREEN) + if err := binary.Read(data, binary.LittleEndian, &m.ROLL); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.PITCH); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.YAW); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.THRUST); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.GROUP); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.MODE); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.LED_RED); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.LED_BLUE); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.LED_GREEN); err != nil { + panic(err) + } } const ( @@ -4096,30 +5275,66 @@ func (*StateCorrection) Crc() uint8 { // Pack returns a packed byte array which represents a StateCorrection payload func (m *StateCorrection) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.XERR) - binary.Write(data, binary.LittleEndian, m.YERR) - binary.Write(data, binary.LittleEndian, m.ZERR) - binary.Write(data, binary.LittleEndian, m.ROLLERR) - binary.Write(data, binary.LittleEndian, m.PITCHERR) - binary.Write(data, binary.LittleEndian, m.YAWERR) - binary.Write(data, binary.LittleEndian, m.VXERR) - binary.Write(data, binary.LittleEndian, m.VYERR) - binary.Write(data, binary.LittleEndian, m.VZERR) + if err := binary.Write(data, binary.LittleEndian, m.XERR); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.YERR); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.ZERR); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.ROLLERR); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.PITCHERR); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.YAWERR); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.VXERR); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.VYERR); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.VZERR); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the StateCorrection func (m *StateCorrection) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.XERR) - binary.Read(data, binary.LittleEndian, &m.YERR) - binary.Read(data, binary.LittleEndian, &m.ZERR) - binary.Read(data, binary.LittleEndian, &m.ROLLERR) - binary.Read(data, binary.LittleEndian, &m.PITCHERR) - binary.Read(data, binary.LittleEndian, &m.YAWERR) - binary.Read(data, binary.LittleEndian, &m.VXERR) - binary.Read(data, binary.LittleEndian, &m.VYERR) - binary.Read(data, binary.LittleEndian, &m.VZERR) + if err := binary.Read(data, binary.LittleEndian, &m.XERR); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.YERR); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.ZERR); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.ROLLERR); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.PITCHERR); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.YAWERR); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.VXERR); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.VYERR); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.VZERR); err != nil { + panic(err) + } } // MESSAGE RC_CHANNELS @@ -4198,54 +5413,138 @@ func (*RcChannels) Crc() uint8 { // Pack returns a packed byte array which represents a RcChannels payload func (m *RcChannels) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.TIME_BOOT_MS) - binary.Write(data, binary.LittleEndian, m.CHAN1_RAW) - binary.Write(data, binary.LittleEndian, m.CHAN2_RAW) - binary.Write(data, binary.LittleEndian, m.CHAN3_RAW) - binary.Write(data, binary.LittleEndian, m.CHAN4_RAW) - binary.Write(data, binary.LittleEndian, m.CHAN5_RAW) - binary.Write(data, binary.LittleEndian, m.CHAN6_RAW) - binary.Write(data, binary.LittleEndian, m.CHAN7_RAW) - binary.Write(data, binary.LittleEndian, m.CHAN8_RAW) - binary.Write(data, binary.LittleEndian, m.CHAN9_RAW) - binary.Write(data, binary.LittleEndian, m.CHAN10_RAW) - binary.Write(data, binary.LittleEndian, m.CHAN11_RAW) - binary.Write(data, binary.LittleEndian, m.CHAN12_RAW) - binary.Write(data, binary.LittleEndian, m.CHAN13_RAW) - binary.Write(data, binary.LittleEndian, m.CHAN14_RAW) - binary.Write(data, binary.LittleEndian, m.CHAN15_RAW) - binary.Write(data, binary.LittleEndian, m.CHAN16_RAW) - binary.Write(data, binary.LittleEndian, m.CHAN17_RAW) - binary.Write(data, binary.LittleEndian, m.CHAN18_RAW) - binary.Write(data, binary.LittleEndian, m.CHANCOUNT) - binary.Write(data, binary.LittleEndian, m.RSSI) + if err := binary.Write(data, binary.LittleEndian, m.TIME_BOOT_MS); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.CHAN1_RAW); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.CHAN2_RAW); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.CHAN3_RAW); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.CHAN4_RAW); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.CHAN5_RAW); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.CHAN6_RAW); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.CHAN7_RAW); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.CHAN8_RAW); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.CHAN9_RAW); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.CHAN10_RAW); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.CHAN11_RAW); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.CHAN12_RAW); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.CHAN13_RAW); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.CHAN14_RAW); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.CHAN15_RAW); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.CHAN16_RAW); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.CHAN17_RAW); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.CHAN18_RAW); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.CHANCOUNT); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.RSSI); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the RcChannels func (m *RcChannels) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.TIME_BOOT_MS) - binary.Read(data, binary.LittleEndian, &m.CHAN1_RAW) - binary.Read(data, binary.LittleEndian, &m.CHAN2_RAW) - binary.Read(data, binary.LittleEndian, &m.CHAN3_RAW) - binary.Read(data, binary.LittleEndian, &m.CHAN4_RAW) - binary.Read(data, binary.LittleEndian, &m.CHAN5_RAW) - binary.Read(data, binary.LittleEndian, &m.CHAN6_RAW) - binary.Read(data, binary.LittleEndian, &m.CHAN7_RAW) - binary.Read(data, binary.LittleEndian, &m.CHAN8_RAW) - binary.Read(data, binary.LittleEndian, &m.CHAN9_RAW) - binary.Read(data, binary.LittleEndian, &m.CHAN10_RAW) - binary.Read(data, binary.LittleEndian, &m.CHAN11_RAW) - binary.Read(data, binary.LittleEndian, &m.CHAN12_RAW) - binary.Read(data, binary.LittleEndian, &m.CHAN13_RAW) - binary.Read(data, binary.LittleEndian, &m.CHAN14_RAW) - binary.Read(data, binary.LittleEndian, &m.CHAN15_RAW) - binary.Read(data, binary.LittleEndian, &m.CHAN16_RAW) - binary.Read(data, binary.LittleEndian, &m.CHAN17_RAW) - binary.Read(data, binary.LittleEndian, &m.CHAN18_RAW) - binary.Read(data, binary.LittleEndian, &m.CHANCOUNT) - binary.Read(data, binary.LittleEndian, &m.RSSI) + if err := binary.Read(data, binary.LittleEndian, &m.TIME_BOOT_MS); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.CHAN1_RAW); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.CHAN2_RAW); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.CHAN3_RAW); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.CHAN4_RAW); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.CHAN5_RAW); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.CHAN6_RAW); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.CHAN7_RAW); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.CHAN8_RAW); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.CHAN9_RAW); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.CHAN10_RAW); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.CHAN11_RAW); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.CHAN12_RAW); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.CHAN13_RAW); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.CHAN14_RAW); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.CHAN15_RAW); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.CHAN16_RAW); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.CHAN17_RAW); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.CHAN18_RAW); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.CHANCOUNT); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.RSSI); err != nil { + panic(err) + } } // MESSAGE REQUEST_DATA_STREAM @@ -4292,22 +5591,42 @@ func (*RequestDataStream) Crc() uint8 { // Pack returns a packed byte array which represents a RequestDataStream payload func (m *RequestDataStream) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.REQ_MESSAGE_RATE) - binary.Write(data, binary.LittleEndian, m.TARGET_SYSTEM) - binary.Write(data, binary.LittleEndian, m.TARGET_COMPONENT) - binary.Write(data, binary.LittleEndian, m.REQ_STREAM_ID) - binary.Write(data, binary.LittleEndian, m.START_STOP) + if err := binary.Write(data, binary.LittleEndian, m.REQ_MESSAGE_RATE); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.TARGET_SYSTEM); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.TARGET_COMPONENT); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.REQ_STREAM_ID); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.START_STOP); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the RequestDataStream func (m *RequestDataStream) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.REQ_MESSAGE_RATE) - binary.Read(data, binary.LittleEndian, &m.TARGET_SYSTEM) - binary.Read(data, binary.LittleEndian, &m.TARGET_COMPONENT) - binary.Read(data, binary.LittleEndian, &m.REQ_STREAM_ID) - binary.Read(data, binary.LittleEndian, &m.START_STOP) + if err := binary.Read(data, binary.LittleEndian, &m.REQ_MESSAGE_RATE); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.TARGET_SYSTEM); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.TARGET_COMPONENT); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.REQ_STREAM_ID); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.START_STOP); err != nil { + panic(err) + } } // MESSAGE DATA_STREAM @@ -4350,18 +5669,30 @@ func (*DataStream) Crc() uint8 { // Pack returns a packed byte array which represents a DataStream payload func (m *DataStream) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.MESSAGE_RATE) - binary.Write(data, binary.LittleEndian, m.STREAM_ID) - binary.Write(data, binary.LittleEndian, m.ON_OFF) + if err := binary.Write(data, binary.LittleEndian, m.MESSAGE_RATE); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.STREAM_ID); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.ON_OFF); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the DataStream func (m *DataStream) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.MESSAGE_RATE) - binary.Read(data, binary.LittleEndian, &m.STREAM_ID) - binary.Read(data, binary.LittleEndian, &m.ON_OFF) + if err := binary.Read(data, binary.LittleEndian, &m.MESSAGE_RATE); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.STREAM_ID); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.ON_OFF); err != nil { + panic(err) + } } // MESSAGE MANUAL_CONTROL @@ -4410,24 +5741,48 @@ func (*ManualControl) Crc() uint8 { // Pack returns a packed byte array which represents a ManualControl payload func (m *ManualControl) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.X) - binary.Write(data, binary.LittleEndian, m.Y) - binary.Write(data, binary.LittleEndian, m.Z) - binary.Write(data, binary.LittleEndian, m.R) - binary.Write(data, binary.LittleEndian, m.BUTTONS) - binary.Write(data, binary.LittleEndian, m.TARGET) + if err := binary.Write(data, binary.LittleEndian, m.X); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.Y); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.Z); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.R); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.BUTTONS); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.TARGET); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the ManualControl func (m *ManualControl) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.X) - binary.Read(data, binary.LittleEndian, &m.Y) - binary.Read(data, binary.LittleEndian, &m.Z) - binary.Read(data, binary.LittleEndian, &m.R) - binary.Read(data, binary.LittleEndian, &m.BUTTONS) - binary.Read(data, binary.LittleEndian, &m.TARGET) + if err := binary.Read(data, binary.LittleEndian, &m.X); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.Y); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.Z); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.R); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.BUTTONS); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.TARGET); err != nil { + panic(err) + } } // MESSAGE RC_CHANNELS_OVERRIDE @@ -4484,32 +5839,72 @@ func (*RcChannelsOverride) Crc() uint8 { // Pack returns a packed byte array which represents a RcChannelsOverride payload func (m *RcChannelsOverride) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.CHAN1_RAW) - binary.Write(data, binary.LittleEndian, m.CHAN2_RAW) - binary.Write(data, binary.LittleEndian, m.CHAN3_RAW) - binary.Write(data, binary.LittleEndian, m.CHAN4_RAW) - binary.Write(data, binary.LittleEndian, m.CHAN5_RAW) - binary.Write(data, binary.LittleEndian, m.CHAN6_RAW) - binary.Write(data, binary.LittleEndian, m.CHAN7_RAW) - binary.Write(data, binary.LittleEndian, m.CHAN8_RAW) - binary.Write(data, binary.LittleEndian, m.TARGET_SYSTEM) - binary.Write(data, binary.LittleEndian, m.TARGET_COMPONENT) + if err := binary.Write(data, binary.LittleEndian, m.CHAN1_RAW); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.CHAN2_RAW); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.CHAN3_RAW); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.CHAN4_RAW); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.CHAN5_RAW); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.CHAN6_RAW); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.CHAN7_RAW); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.CHAN8_RAW); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.TARGET_SYSTEM); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.TARGET_COMPONENT); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the RcChannelsOverride func (m *RcChannelsOverride) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.CHAN1_RAW) - binary.Read(data, binary.LittleEndian, &m.CHAN2_RAW) - binary.Read(data, binary.LittleEndian, &m.CHAN3_RAW) - binary.Read(data, binary.LittleEndian, &m.CHAN4_RAW) - binary.Read(data, binary.LittleEndian, &m.CHAN5_RAW) - binary.Read(data, binary.LittleEndian, &m.CHAN6_RAW) - binary.Read(data, binary.LittleEndian, &m.CHAN7_RAW) - binary.Read(data, binary.LittleEndian, &m.CHAN8_RAW) - binary.Read(data, binary.LittleEndian, &m.TARGET_SYSTEM) - binary.Read(data, binary.LittleEndian, &m.TARGET_COMPONENT) + if err := binary.Read(data, binary.LittleEndian, &m.CHAN1_RAW); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.CHAN2_RAW); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.CHAN3_RAW); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.CHAN4_RAW); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.CHAN5_RAW); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.CHAN6_RAW); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.CHAN7_RAW); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.CHAN8_RAW); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.TARGET_SYSTEM); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.TARGET_COMPONENT); err != nil { + panic(err) + } } // MESSAGE VFR_HUD @@ -4558,24 +5953,48 @@ func (*VfrHud) Crc() uint8 { // Pack returns a packed byte array which represents a VfrHud payload func (m *VfrHud) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.AIRSPEED) - binary.Write(data, binary.LittleEndian, m.GROUNDSPEED) - binary.Write(data, binary.LittleEndian, m.ALT) - binary.Write(data, binary.LittleEndian, m.CLIMB) - binary.Write(data, binary.LittleEndian, m.HEADING) - binary.Write(data, binary.LittleEndian, m.THROTTLE) + if err := binary.Write(data, binary.LittleEndian, m.AIRSPEED); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.GROUNDSPEED); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.ALT); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.CLIMB); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.HEADING); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.THROTTLE); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the VfrHud func (m *VfrHud) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.AIRSPEED) - binary.Read(data, binary.LittleEndian, &m.GROUNDSPEED) - binary.Read(data, binary.LittleEndian, &m.ALT) - binary.Read(data, binary.LittleEndian, &m.CLIMB) - binary.Read(data, binary.LittleEndian, &m.HEADING) - binary.Read(data, binary.LittleEndian, &m.THROTTLE) + if err := binary.Read(data, binary.LittleEndian, &m.AIRSPEED); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.GROUNDSPEED); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.ALT); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.CLIMB); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.HEADING); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.THROTTLE); err != nil { + panic(err) + } } // MESSAGE COMMAND_LONG @@ -4634,34 +6053,78 @@ func (*CommandLong) Crc() uint8 { // Pack returns a packed byte array which represents a CommandLong payload func (m *CommandLong) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.PARAM1) - binary.Write(data, binary.LittleEndian, m.PARAM2) - binary.Write(data, binary.LittleEndian, m.PARAM3) - binary.Write(data, binary.LittleEndian, m.PARAM4) - binary.Write(data, binary.LittleEndian, m.PARAM5) - binary.Write(data, binary.LittleEndian, m.PARAM6) - binary.Write(data, binary.LittleEndian, m.PARAM7) - binary.Write(data, binary.LittleEndian, m.COMMAND) - binary.Write(data, binary.LittleEndian, m.TARGET_SYSTEM) - binary.Write(data, binary.LittleEndian, m.TARGET_COMPONENT) - binary.Write(data, binary.LittleEndian, m.CONFIRMATION) + if err := binary.Write(data, binary.LittleEndian, m.PARAM1); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.PARAM2); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.PARAM3); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.PARAM4); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.PARAM5); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.PARAM6); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.PARAM7); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.COMMAND); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.TARGET_SYSTEM); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.TARGET_COMPONENT); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.CONFIRMATION); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the CommandLong func (m *CommandLong) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.PARAM1) - binary.Read(data, binary.LittleEndian, &m.PARAM2) - binary.Read(data, binary.LittleEndian, &m.PARAM3) - binary.Read(data, binary.LittleEndian, &m.PARAM4) - binary.Read(data, binary.LittleEndian, &m.PARAM5) - binary.Read(data, binary.LittleEndian, &m.PARAM6) - binary.Read(data, binary.LittleEndian, &m.PARAM7) - binary.Read(data, binary.LittleEndian, &m.COMMAND) - binary.Read(data, binary.LittleEndian, &m.TARGET_SYSTEM) - binary.Read(data, binary.LittleEndian, &m.TARGET_COMPONENT) - binary.Read(data, binary.LittleEndian, &m.CONFIRMATION) + if err := binary.Read(data, binary.LittleEndian, &m.PARAM1); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.PARAM2); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.PARAM3); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.PARAM4); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.PARAM5); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.PARAM6); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.PARAM7); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.COMMAND); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.TARGET_SYSTEM); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.TARGET_COMPONENT); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.CONFIRMATION); err != nil { + panic(err) + } } // MESSAGE COMMAND_ACK @@ -4702,16 +6165,24 @@ func (*CommandAck) Crc() uint8 { // Pack returns a packed byte array which represents a CommandAck payload func (m *CommandAck) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.COMMAND) - binary.Write(data, binary.LittleEndian, m.RESULT) + if err := binary.Write(data, binary.LittleEndian, m.COMMAND); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.RESULT); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the CommandAck func (m *CommandAck) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.COMMAND) - binary.Read(data, binary.LittleEndian, &m.RESULT) + if err := binary.Read(data, binary.LittleEndian, &m.COMMAND); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.RESULT); err != nil { + panic(err) + } } // MESSAGE ROLL_PITCH_YAW_RATES_THRUST_SETPOINT @@ -4758,22 +6229,42 @@ func (*RollPitchYawRatesThrustSetpoint) Crc() uint8 { // Pack returns a packed byte array which represents a RollPitchYawRatesThrustSetpoint payload func (m *RollPitchYawRatesThrustSetpoint) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.TIME_BOOT_MS) - binary.Write(data, binary.LittleEndian, m.ROLL_RATE) - binary.Write(data, binary.LittleEndian, m.PITCH_RATE) - binary.Write(data, binary.LittleEndian, m.YAW_RATE) - binary.Write(data, binary.LittleEndian, m.THRUST) + if err := binary.Write(data, binary.LittleEndian, m.TIME_BOOT_MS); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.ROLL_RATE); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.PITCH_RATE); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.YAW_RATE); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.THRUST); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the RollPitchYawRatesThrustSetpoint func (m *RollPitchYawRatesThrustSetpoint) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.TIME_BOOT_MS) - binary.Read(data, binary.LittleEndian, &m.ROLL_RATE) - binary.Read(data, binary.LittleEndian, &m.PITCH_RATE) - binary.Read(data, binary.LittleEndian, &m.YAW_RATE) - binary.Read(data, binary.LittleEndian, &m.THRUST) + if err := binary.Read(data, binary.LittleEndian, &m.TIME_BOOT_MS); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.ROLL_RATE); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.PITCH_RATE); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.YAW_RATE); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.THRUST); err != nil { + panic(err) + } } // MESSAGE MANUAL_SETPOINT @@ -4824,26 +6315,54 @@ func (*ManualSetpoint) Crc() uint8 { // Pack returns a packed byte array which represents a ManualSetpoint payload func (m *ManualSetpoint) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.TIME_BOOT_MS) - binary.Write(data, binary.LittleEndian, m.ROLL) - binary.Write(data, binary.LittleEndian, m.PITCH) - binary.Write(data, binary.LittleEndian, m.YAW) - binary.Write(data, binary.LittleEndian, m.THRUST) - binary.Write(data, binary.LittleEndian, m.MODE_SWITCH) - binary.Write(data, binary.LittleEndian, m.MANUAL_OVERRIDE_SWITCH) + if err := binary.Write(data, binary.LittleEndian, m.TIME_BOOT_MS); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.ROLL); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.PITCH); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.YAW); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.THRUST); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.MODE_SWITCH); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.MANUAL_OVERRIDE_SWITCH); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the ManualSetpoint func (m *ManualSetpoint) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.TIME_BOOT_MS) - binary.Read(data, binary.LittleEndian, &m.ROLL) - binary.Read(data, binary.LittleEndian, &m.PITCH) - binary.Read(data, binary.LittleEndian, &m.YAW) - binary.Read(data, binary.LittleEndian, &m.THRUST) - binary.Read(data, binary.LittleEndian, &m.MODE_SWITCH) - binary.Read(data, binary.LittleEndian, &m.MANUAL_OVERRIDE_SWITCH) + if err := binary.Read(data, binary.LittleEndian, &m.TIME_BOOT_MS); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.ROLL); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.PITCH); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.YAW); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.THRUST); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.MODE_SWITCH); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.MANUAL_OVERRIDE_SWITCH); err != nil { + panic(err) + } } // MESSAGE ATTITUDE_SETPOINT_EXTERNAL @@ -4898,30 +6417,66 @@ func (*AttitudeSetpointExternal) Crc() uint8 { // Pack returns a packed byte array which represents a AttitudeSetpointExternal payload func (m *AttitudeSetpointExternal) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.TIME_BOOT_MS) - binary.Write(data, binary.LittleEndian, m.Q) - binary.Write(data, binary.LittleEndian, m.BODY_ROLL_RATE) - binary.Write(data, binary.LittleEndian, m.BODY_PITCH_RATE) - binary.Write(data, binary.LittleEndian, m.BODY_YAW_RATE) - binary.Write(data, binary.LittleEndian, m.THRUST) - binary.Write(data, binary.LittleEndian, m.TARGET_SYSTEM) - binary.Write(data, binary.LittleEndian, m.TARGET_COMPONENT) - binary.Write(data, binary.LittleEndian, m.TYPE_MASK) + if err := binary.Write(data, binary.LittleEndian, m.TIME_BOOT_MS); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.Q); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.BODY_ROLL_RATE); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.BODY_PITCH_RATE); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.BODY_YAW_RATE); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.THRUST); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.TARGET_SYSTEM); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.TARGET_COMPONENT); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.TYPE_MASK); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the AttitudeSetpointExternal func (m *AttitudeSetpointExternal) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.TIME_BOOT_MS) - binary.Read(data, binary.LittleEndian, &m.Q) - binary.Read(data, binary.LittleEndian, &m.BODY_ROLL_RATE) - binary.Read(data, binary.LittleEndian, &m.BODY_PITCH_RATE) - binary.Read(data, binary.LittleEndian, &m.BODY_YAW_RATE) - binary.Read(data, binary.LittleEndian, &m.THRUST) - binary.Read(data, binary.LittleEndian, &m.TARGET_SYSTEM) - binary.Read(data, binary.LittleEndian, &m.TARGET_COMPONENT) - binary.Read(data, binary.LittleEndian, &m.TYPE_MASK) + if err := binary.Read(data, binary.LittleEndian, &m.TIME_BOOT_MS); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.Q); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.BODY_ROLL_RATE); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.BODY_PITCH_RATE); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.BODY_YAW_RATE); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.THRUST); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.TARGET_SYSTEM); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.TARGET_COMPONENT); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.TYPE_MASK); err != nil { + panic(err) + } } const ( @@ -4990,40 +6545,96 @@ func (*LocalNedPositionSetpointExternal) Crc() uint8 { // Pack returns a packed byte array which represents a LocalNedPositionSetpointExternal payload func (m *LocalNedPositionSetpointExternal) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.TIME_BOOT_MS) - binary.Write(data, binary.LittleEndian, m.X) - binary.Write(data, binary.LittleEndian, m.Y) - binary.Write(data, binary.LittleEndian, m.Z) - binary.Write(data, binary.LittleEndian, m.VX) - binary.Write(data, binary.LittleEndian, m.VY) - binary.Write(data, binary.LittleEndian, m.VZ) - binary.Write(data, binary.LittleEndian, m.AFX) - binary.Write(data, binary.LittleEndian, m.AFY) - binary.Write(data, binary.LittleEndian, m.AFZ) - binary.Write(data, binary.LittleEndian, m.TYPE_MASK) - binary.Write(data, binary.LittleEndian, m.TARGET_SYSTEM) - binary.Write(data, binary.LittleEndian, m.TARGET_COMPONENT) - binary.Write(data, binary.LittleEndian, m.COORDINATE_FRAME) + if err := binary.Write(data, binary.LittleEndian, m.TIME_BOOT_MS); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.X); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.Y); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.Z); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.VX); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.VY); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.VZ); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.AFX); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.AFY); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.AFZ); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.TYPE_MASK); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.TARGET_SYSTEM); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.TARGET_COMPONENT); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.COORDINATE_FRAME); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the LocalNedPositionSetpointExternal func (m *LocalNedPositionSetpointExternal) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.TIME_BOOT_MS) - binary.Read(data, binary.LittleEndian, &m.X) - binary.Read(data, binary.LittleEndian, &m.Y) - binary.Read(data, binary.LittleEndian, &m.Z) - binary.Read(data, binary.LittleEndian, &m.VX) - binary.Read(data, binary.LittleEndian, &m.VY) - binary.Read(data, binary.LittleEndian, &m.VZ) - binary.Read(data, binary.LittleEndian, &m.AFX) - binary.Read(data, binary.LittleEndian, &m.AFY) - binary.Read(data, binary.LittleEndian, &m.AFZ) - binary.Read(data, binary.LittleEndian, &m.TYPE_MASK) - binary.Read(data, binary.LittleEndian, &m.TARGET_SYSTEM) - binary.Read(data, binary.LittleEndian, &m.TARGET_COMPONENT) - binary.Read(data, binary.LittleEndian, &m.COORDINATE_FRAME) + if err := binary.Read(data, binary.LittleEndian, &m.TIME_BOOT_MS); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.X); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.Y); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.Z); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.VX); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.VY); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.VZ); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.AFX); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.AFY); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.AFZ); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.TYPE_MASK); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.TARGET_SYSTEM); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.TARGET_COMPONENT); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.COORDINATE_FRAME); err != nil { + panic(err) + } } // MESSAGE GLOBAL_POSITION_SETPOINT_EXTERNAL_INT @@ -5086,38 +6697,90 @@ func (*GlobalPositionSetpointExternalInt) Crc() uint8 { // Pack returns a packed byte array which represents a GlobalPositionSetpointExternalInt payload func (m *GlobalPositionSetpointExternalInt) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.TIME_BOOT_MS) - binary.Write(data, binary.LittleEndian, m.LAT_INT) - binary.Write(data, binary.LittleEndian, m.LON_INT) - binary.Write(data, binary.LittleEndian, m.ALT) - binary.Write(data, binary.LittleEndian, m.VX) - binary.Write(data, binary.LittleEndian, m.VY) - binary.Write(data, binary.LittleEndian, m.VZ) - binary.Write(data, binary.LittleEndian, m.AFX) - binary.Write(data, binary.LittleEndian, m.AFY) - binary.Write(data, binary.LittleEndian, m.AFZ) - binary.Write(data, binary.LittleEndian, m.TYPE_MASK) - binary.Write(data, binary.LittleEndian, m.TARGET_SYSTEM) - binary.Write(data, binary.LittleEndian, m.TARGET_COMPONENT) + if err := binary.Write(data, binary.LittleEndian, m.TIME_BOOT_MS); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.LAT_INT); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.LON_INT); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.ALT); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.VX); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.VY); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.VZ); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.AFX); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.AFY); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.AFZ); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.TYPE_MASK); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.TARGET_SYSTEM); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.TARGET_COMPONENT); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the GlobalPositionSetpointExternalInt func (m *GlobalPositionSetpointExternalInt) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.TIME_BOOT_MS) - binary.Read(data, binary.LittleEndian, &m.LAT_INT) - binary.Read(data, binary.LittleEndian, &m.LON_INT) - binary.Read(data, binary.LittleEndian, &m.ALT) - binary.Read(data, binary.LittleEndian, &m.VX) - binary.Read(data, binary.LittleEndian, &m.VY) - binary.Read(data, binary.LittleEndian, &m.VZ) - binary.Read(data, binary.LittleEndian, &m.AFX) - binary.Read(data, binary.LittleEndian, &m.AFY) - binary.Read(data, binary.LittleEndian, &m.AFZ) - binary.Read(data, binary.LittleEndian, &m.TYPE_MASK) - binary.Read(data, binary.LittleEndian, &m.TARGET_SYSTEM) - binary.Read(data, binary.LittleEndian, &m.TARGET_COMPONENT) + if err := binary.Read(data, binary.LittleEndian, &m.TIME_BOOT_MS); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.LAT_INT); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.LON_INT); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.ALT); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.VX); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.VY); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.VZ); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.AFX); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.AFY); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.AFZ); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.TYPE_MASK); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.TARGET_SYSTEM); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.TARGET_COMPONENT); err != nil { + panic(err) + } } // MESSAGE LOCAL_POSITION_NED_SYSTEM_GLOBAL_OFFSET @@ -5168,26 +6831,54 @@ func (*LocalPositionNedSystemGlobalOffset) Crc() uint8 { // Pack returns a packed byte array which represents a LocalPositionNedSystemGlobalOffset payload func (m *LocalPositionNedSystemGlobalOffset) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.TIME_BOOT_MS) - binary.Write(data, binary.LittleEndian, m.X) - binary.Write(data, binary.LittleEndian, m.Y) - binary.Write(data, binary.LittleEndian, m.Z) - binary.Write(data, binary.LittleEndian, m.ROLL) - binary.Write(data, binary.LittleEndian, m.PITCH) - binary.Write(data, binary.LittleEndian, m.YAW) + if err := binary.Write(data, binary.LittleEndian, m.TIME_BOOT_MS); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.X); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.Y); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.Z); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.ROLL); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.PITCH); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.YAW); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the LocalPositionNedSystemGlobalOffset func (m *LocalPositionNedSystemGlobalOffset) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.TIME_BOOT_MS) - binary.Read(data, binary.LittleEndian, &m.X) - binary.Read(data, binary.LittleEndian, &m.Y) - binary.Read(data, binary.LittleEndian, &m.Z) - binary.Read(data, binary.LittleEndian, &m.ROLL) - binary.Read(data, binary.LittleEndian, &m.PITCH) - binary.Read(data, binary.LittleEndian, &m.YAW) + if err := binary.Read(data, binary.LittleEndian, &m.TIME_BOOT_MS); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.X); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.Y); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.Z); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.ROLL); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.PITCH); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.YAW); err != nil { + panic(err) + } } // MESSAGE HIL_STATE @@ -5256,44 +6947,108 @@ func (*HilState) Crc() uint8 { // Pack returns a packed byte array which represents a HilState payload func (m *HilState) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.TIME_USEC) - binary.Write(data, binary.LittleEndian, m.ROLL) - binary.Write(data, binary.LittleEndian, m.PITCH) - binary.Write(data, binary.LittleEndian, m.YAW) - binary.Write(data, binary.LittleEndian, m.ROLLSPEED) - binary.Write(data, binary.LittleEndian, m.PITCHSPEED) - binary.Write(data, binary.LittleEndian, m.YAWSPEED) - binary.Write(data, binary.LittleEndian, m.LAT) - binary.Write(data, binary.LittleEndian, m.LON) - binary.Write(data, binary.LittleEndian, m.ALT) - binary.Write(data, binary.LittleEndian, m.VX) - binary.Write(data, binary.LittleEndian, m.VY) - binary.Write(data, binary.LittleEndian, m.VZ) - binary.Write(data, binary.LittleEndian, m.XACC) - binary.Write(data, binary.LittleEndian, m.YACC) - binary.Write(data, binary.LittleEndian, m.ZACC) + if err := binary.Write(data, binary.LittleEndian, m.TIME_USEC); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.ROLL); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.PITCH); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.YAW); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.ROLLSPEED); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.PITCHSPEED); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.YAWSPEED); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.LAT); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.LON); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.ALT); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.VX); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.VY); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.VZ); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.XACC); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.YACC); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.ZACC); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the HilState func (m *HilState) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.TIME_USEC) - binary.Read(data, binary.LittleEndian, &m.ROLL) - binary.Read(data, binary.LittleEndian, &m.PITCH) - binary.Read(data, binary.LittleEndian, &m.YAW) - binary.Read(data, binary.LittleEndian, &m.ROLLSPEED) - binary.Read(data, binary.LittleEndian, &m.PITCHSPEED) - binary.Read(data, binary.LittleEndian, &m.YAWSPEED) - binary.Read(data, binary.LittleEndian, &m.LAT) - binary.Read(data, binary.LittleEndian, &m.LON) - binary.Read(data, binary.LittleEndian, &m.ALT) - binary.Read(data, binary.LittleEndian, &m.VX) - binary.Read(data, binary.LittleEndian, &m.VY) - binary.Read(data, binary.LittleEndian, &m.VZ) - binary.Read(data, binary.LittleEndian, &m.XACC) - binary.Read(data, binary.LittleEndian, &m.YACC) - binary.Read(data, binary.LittleEndian, &m.ZACC) + if err := binary.Read(data, binary.LittleEndian, &m.TIME_USEC); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.ROLL); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.PITCH); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.YAW); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.ROLLSPEED); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.PITCHSPEED); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.YAWSPEED); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.LAT); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.LON); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.ALT); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.VX); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.VY); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.VZ); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.XACC); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.YACC); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.ZACC); err != nil { + panic(err) + } } // MESSAGE HIL_CONTROLS @@ -5352,34 +7107,78 @@ func (*HilControls) Crc() uint8 { // Pack returns a packed byte array which represents a HilControls payload func (m *HilControls) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.TIME_USEC) - binary.Write(data, binary.LittleEndian, m.ROLL_AILERONS) - binary.Write(data, binary.LittleEndian, m.PITCH_ELEVATOR) - binary.Write(data, binary.LittleEndian, m.YAW_RUDDER) - binary.Write(data, binary.LittleEndian, m.THROTTLE) - binary.Write(data, binary.LittleEndian, m.AUX1) - binary.Write(data, binary.LittleEndian, m.AUX2) - binary.Write(data, binary.LittleEndian, m.AUX3) - binary.Write(data, binary.LittleEndian, m.AUX4) - binary.Write(data, binary.LittleEndian, m.MODE) - binary.Write(data, binary.LittleEndian, m.NAV_MODE) + if err := binary.Write(data, binary.LittleEndian, m.TIME_USEC); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.ROLL_AILERONS); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.PITCH_ELEVATOR); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.YAW_RUDDER); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.THROTTLE); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.AUX1); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.AUX2); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.AUX3); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.AUX4); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.MODE); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.NAV_MODE); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the HilControls func (m *HilControls) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.TIME_USEC) - binary.Read(data, binary.LittleEndian, &m.ROLL_AILERONS) - binary.Read(data, binary.LittleEndian, &m.PITCH_ELEVATOR) - binary.Read(data, binary.LittleEndian, &m.YAW_RUDDER) - binary.Read(data, binary.LittleEndian, &m.THROTTLE) - binary.Read(data, binary.LittleEndian, &m.AUX1) - binary.Read(data, binary.LittleEndian, &m.AUX2) - binary.Read(data, binary.LittleEndian, &m.AUX3) - binary.Read(data, binary.LittleEndian, &m.AUX4) - binary.Read(data, binary.LittleEndian, &m.MODE) - binary.Read(data, binary.LittleEndian, &m.NAV_MODE) + if err := binary.Read(data, binary.LittleEndian, &m.TIME_USEC); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.ROLL_AILERONS); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.PITCH_ELEVATOR); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.YAW_RUDDER); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.THROTTLE); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.AUX1); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.AUX2); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.AUX3); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.AUX4); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.MODE); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.NAV_MODE); err != nil { + panic(err) + } } // MESSAGE HIL_RC_INPUTS_RAW @@ -5444,40 +7243,96 @@ func (*HilRcInputsRaw) Crc() uint8 { // Pack returns a packed byte array which represents a HilRcInputsRaw payload func (m *HilRcInputsRaw) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.TIME_USEC) - binary.Write(data, binary.LittleEndian, m.CHAN1_RAW) - binary.Write(data, binary.LittleEndian, m.CHAN2_RAW) - binary.Write(data, binary.LittleEndian, m.CHAN3_RAW) - binary.Write(data, binary.LittleEndian, m.CHAN4_RAW) - binary.Write(data, binary.LittleEndian, m.CHAN5_RAW) - binary.Write(data, binary.LittleEndian, m.CHAN6_RAW) - binary.Write(data, binary.LittleEndian, m.CHAN7_RAW) - binary.Write(data, binary.LittleEndian, m.CHAN8_RAW) - binary.Write(data, binary.LittleEndian, m.CHAN9_RAW) - binary.Write(data, binary.LittleEndian, m.CHAN10_RAW) - binary.Write(data, binary.LittleEndian, m.CHAN11_RAW) - binary.Write(data, binary.LittleEndian, m.CHAN12_RAW) - binary.Write(data, binary.LittleEndian, m.RSSI) + if err := binary.Write(data, binary.LittleEndian, m.TIME_USEC); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.CHAN1_RAW); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.CHAN2_RAW); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.CHAN3_RAW); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.CHAN4_RAW); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.CHAN5_RAW); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.CHAN6_RAW); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.CHAN7_RAW); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.CHAN8_RAW); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.CHAN9_RAW); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.CHAN10_RAW); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.CHAN11_RAW); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.CHAN12_RAW); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.RSSI); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the HilRcInputsRaw func (m *HilRcInputsRaw) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.TIME_USEC) - binary.Read(data, binary.LittleEndian, &m.CHAN1_RAW) - binary.Read(data, binary.LittleEndian, &m.CHAN2_RAW) - binary.Read(data, binary.LittleEndian, &m.CHAN3_RAW) - binary.Read(data, binary.LittleEndian, &m.CHAN4_RAW) - binary.Read(data, binary.LittleEndian, &m.CHAN5_RAW) - binary.Read(data, binary.LittleEndian, &m.CHAN6_RAW) - binary.Read(data, binary.LittleEndian, &m.CHAN7_RAW) - binary.Read(data, binary.LittleEndian, &m.CHAN8_RAW) - binary.Read(data, binary.LittleEndian, &m.CHAN9_RAW) - binary.Read(data, binary.LittleEndian, &m.CHAN10_RAW) - binary.Read(data, binary.LittleEndian, &m.CHAN11_RAW) - binary.Read(data, binary.LittleEndian, &m.CHAN12_RAW) - binary.Read(data, binary.LittleEndian, &m.RSSI) + if err := binary.Read(data, binary.LittleEndian, &m.TIME_USEC); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.CHAN1_RAW); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.CHAN2_RAW); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.CHAN3_RAW); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.CHAN4_RAW); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.CHAN5_RAW); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.CHAN6_RAW); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.CHAN7_RAW); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.CHAN8_RAW); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.CHAN9_RAW); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.CHAN10_RAW); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.CHAN11_RAW); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.CHAN12_RAW); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.RSSI); err != nil { + panic(err) + } } // MESSAGE OPTICAL_FLOW @@ -5530,28 +7385,60 @@ func (*OpticalFlow) Crc() uint8 { // Pack returns a packed byte array which represents a OpticalFlow payload func (m *OpticalFlow) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.TIME_USEC) - binary.Write(data, binary.LittleEndian, m.FLOW_COMP_M_X) - binary.Write(data, binary.LittleEndian, m.FLOW_COMP_M_Y) - binary.Write(data, binary.LittleEndian, m.GROUND_DISTANCE) - binary.Write(data, binary.LittleEndian, m.FLOW_X) - binary.Write(data, binary.LittleEndian, m.FLOW_Y) - binary.Write(data, binary.LittleEndian, m.SENSOR_ID) - binary.Write(data, binary.LittleEndian, m.QUALITY) + if err := binary.Write(data, binary.LittleEndian, m.TIME_USEC); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.FLOW_COMP_M_X); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.FLOW_COMP_M_Y); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.GROUND_DISTANCE); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.FLOW_X); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.FLOW_Y); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.SENSOR_ID); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.QUALITY); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the OpticalFlow func (m *OpticalFlow) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.TIME_USEC) - binary.Read(data, binary.LittleEndian, &m.FLOW_COMP_M_X) - binary.Read(data, binary.LittleEndian, &m.FLOW_COMP_M_Y) - binary.Read(data, binary.LittleEndian, &m.GROUND_DISTANCE) - binary.Read(data, binary.LittleEndian, &m.FLOW_X) - binary.Read(data, binary.LittleEndian, &m.FLOW_Y) - binary.Read(data, binary.LittleEndian, &m.SENSOR_ID) - binary.Read(data, binary.LittleEndian, &m.QUALITY) + if err := binary.Read(data, binary.LittleEndian, &m.TIME_USEC); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.FLOW_COMP_M_X); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.FLOW_COMP_M_Y); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.GROUND_DISTANCE); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.FLOW_X); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.FLOW_Y); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.SENSOR_ID); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.QUALITY); err != nil { + panic(err) + } } // MESSAGE GLOBAL_VISION_POSITION_ESTIMATE @@ -5602,26 +7489,54 @@ func (*GlobalVisionPositionEstimate) Crc() uint8 { // Pack returns a packed byte array which represents a GlobalVisionPositionEstimate payload func (m *GlobalVisionPositionEstimate) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.USEC) - binary.Write(data, binary.LittleEndian, m.X) - binary.Write(data, binary.LittleEndian, m.Y) - binary.Write(data, binary.LittleEndian, m.Z) - binary.Write(data, binary.LittleEndian, m.ROLL) - binary.Write(data, binary.LittleEndian, m.PITCH) - binary.Write(data, binary.LittleEndian, m.YAW) + if err := binary.Write(data, binary.LittleEndian, m.USEC); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.X); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.Y); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.Z); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.ROLL); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.PITCH); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.YAW); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the GlobalVisionPositionEstimate func (m *GlobalVisionPositionEstimate) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.USEC) - binary.Read(data, binary.LittleEndian, &m.X) - binary.Read(data, binary.LittleEndian, &m.Y) - binary.Read(data, binary.LittleEndian, &m.Z) - binary.Read(data, binary.LittleEndian, &m.ROLL) - binary.Read(data, binary.LittleEndian, &m.PITCH) - binary.Read(data, binary.LittleEndian, &m.YAW) + if err := binary.Read(data, binary.LittleEndian, &m.USEC); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.X); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.Y); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.Z); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.ROLL); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.PITCH); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.YAW); err != nil { + panic(err) + } } // MESSAGE VISION_POSITION_ESTIMATE @@ -5672,26 +7587,54 @@ func (*VisionPositionEstimate) Crc() uint8 { // Pack returns a packed byte array which represents a VisionPositionEstimate payload func (m *VisionPositionEstimate) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.USEC) - binary.Write(data, binary.LittleEndian, m.X) - binary.Write(data, binary.LittleEndian, m.Y) - binary.Write(data, binary.LittleEndian, m.Z) - binary.Write(data, binary.LittleEndian, m.ROLL) - binary.Write(data, binary.LittleEndian, m.PITCH) - binary.Write(data, binary.LittleEndian, m.YAW) + if err := binary.Write(data, binary.LittleEndian, m.USEC); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.X); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.Y); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.Z); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.ROLL); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.PITCH); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.YAW); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the VisionPositionEstimate func (m *VisionPositionEstimate) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.USEC) - binary.Read(data, binary.LittleEndian, &m.X) - binary.Read(data, binary.LittleEndian, &m.Y) - binary.Read(data, binary.LittleEndian, &m.Z) - binary.Read(data, binary.LittleEndian, &m.ROLL) - binary.Read(data, binary.LittleEndian, &m.PITCH) - binary.Read(data, binary.LittleEndian, &m.YAW) + if err := binary.Read(data, binary.LittleEndian, &m.USEC); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.X); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.Y); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.Z); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.ROLL); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.PITCH); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.YAW); err != nil { + panic(err) + } } // MESSAGE VISION_SPEED_ESTIMATE @@ -5736,20 +7679,36 @@ func (*VisionSpeedEstimate) Crc() uint8 { // Pack returns a packed byte array which represents a VisionSpeedEstimate payload func (m *VisionSpeedEstimate) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.USEC) - binary.Write(data, binary.LittleEndian, m.X) - binary.Write(data, binary.LittleEndian, m.Y) - binary.Write(data, binary.LittleEndian, m.Z) + if err := binary.Write(data, binary.LittleEndian, m.USEC); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.X); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.Y); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.Z); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the VisionSpeedEstimate func (m *VisionSpeedEstimate) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.USEC) - binary.Read(data, binary.LittleEndian, &m.X) - binary.Read(data, binary.LittleEndian, &m.Y) - binary.Read(data, binary.LittleEndian, &m.Z) + if err := binary.Read(data, binary.LittleEndian, &m.USEC); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.X); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.Y); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.Z); err != nil { + panic(err) + } } // MESSAGE VICON_POSITION_ESTIMATE @@ -5800,26 +7759,54 @@ func (*ViconPositionEstimate) Crc() uint8 { // Pack returns a packed byte array which represents a ViconPositionEstimate payload func (m *ViconPositionEstimate) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.USEC) - binary.Write(data, binary.LittleEndian, m.X) - binary.Write(data, binary.LittleEndian, m.Y) - binary.Write(data, binary.LittleEndian, m.Z) - binary.Write(data, binary.LittleEndian, m.ROLL) - binary.Write(data, binary.LittleEndian, m.PITCH) - binary.Write(data, binary.LittleEndian, m.YAW) + if err := binary.Write(data, binary.LittleEndian, m.USEC); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.X); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.Y); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.Z); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.ROLL); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.PITCH); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.YAW); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the ViconPositionEstimate func (m *ViconPositionEstimate) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.USEC) - binary.Read(data, binary.LittleEndian, &m.X) - binary.Read(data, binary.LittleEndian, &m.Y) - binary.Read(data, binary.LittleEndian, &m.Z) - binary.Read(data, binary.LittleEndian, &m.ROLL) - binary.Read(data, binary.LittleEndian, &m.PITCH) - binary.Read(data, binary.LittleEndian, &m.YAW) + if err := binary.Read(data, binary.LittleEndian, &m.USEC); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.X); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.Y); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.Z); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.ROLL); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.PITCH); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.YAW); err != nil { + panic(err) + } } // MESSAGE HIGHRES_IMU @@ -5886,42 +7873,102 @@ func (*HighresImu) Crc() uint8 { // Pack returns a packed byte array which represents a HighresImu payload func (m *HighresImu) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.TIME_USEC) - binary.Write(data, binary.LittleEndian, m.XACC) - binary.Write(data, binary.LittleEndian, m.YACC) - binary.Write(data, binary.LittleEndian, m.ZACC) - binary.Write(data, binary.LittleEndian, m.XGYRO) - binary.Write(data, binary.LittleEndian, m.YGYRO) - binary.Write(data, binary.LittleEndian, m.ZGYRO) - binary.Write(data, binary.LittleEndian, m.XMAG) - binary.Write(data, binary.LittleEndian, m.YMAG) - binary.Write(data, binary.LittleEndian, m.ZMAG) - binary.Write(data, binary.LittleEndian, m.ABS_PRESSURE) - binary.Write(data, binary.LittleEndian, m.DIFF_PRESSURE) - binary.Write(data, binary.LittleEndian, m.PRESSURE_ALT) - binary.Write(data, binary.LittleEndian, m.TEMPERATURE) - binary.Write(data, binary.LittleEndian, m.FIELDS_UPDATED) + if err := binary.Write(data, binary.LittleEndian, m.TIME_USEC); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.XACC); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.YACC); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.ZACC); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.XGYRO); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.YGYRO); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.ZGYRO); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.XMAG); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.YMAG); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.ZMAG); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.ABS_PRESSURE); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.DIFF_PRESSURE); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.PRESSURE_ALT); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.TEMPERATURE); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.FIELDS_UPDATED); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the HighresImu func (m *HighresImu) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.TIME_USEC) - binary.Read(data, binary.LittleEndian, &m.XACC) - binary.Read(data, binary.LittleEndian, &m.YACC) - binary.Read(data, binary.LittleEndian, &m.ZACC) - binary.Read(data, binary.LittleEndian, &m.XGYRO) - binary.Read(data, binary.LittleEndian, &m.YGYRO) - binary.Read(data, binary.LittleEndian, &m.ZGYRO) - binary.Read(data, binary.LittleEndian, &m.XMAG) - binary.Read(data, binary.LittleEndian, &m.YMAG) - binary.Read(data, binary.LittleEndian, &m.ZMAG) - binary.Read(data, binary.LittleEndian, &m.ABS_PRESSURE) - binary.Read(data, binary.LittleEndian, &m.DIFF_PRESSURE) - binary.Read(data, binary.LittleEndian, &m.PRESSURE_ALT) - binary.Read(data, binary.LittleEndian, &m.TEMPERATURE) - binary.Read(data, binary.LittleEndian, &m.FIELDS_UPDATED) + if err := binary.Read(data, binary.LittleEndian, &m.TIME_USEC); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.XACC); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.YACC); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.ZACC); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.XGYRO); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.YGYRO); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.ZGYRO); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.XMAG); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.YMAG); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.ZMAG); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.ABS_PRESSURE); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.DIFF_PRESSURE); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.PRESSURE_ALT); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.TEMPERATURE); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.FIELDS_UPDATED); err != nil { + panic(err) + } } // MESSAGE OMNIDIRECTIONAL_FLOW @@ -5970,24 +8017,48 @@ func (*OmnidirectionalFlow) Crc() uint8 { // Pack returns a packed byte array which represents a OmnidirectionalFlow payload func (m *OmnidirectionalFlow) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.TIME_USEC) - binary.Write(data, binary.LittleEndian, m.FRONT_DISTANCE_M) - binary.Write(data, binary.LittleEndian, m.LEFT) - binary.Write(data, binary.LittleEndian, m.RIGHT) - binary.Write(data, binary.LittleEndian, m.SENSOR_ID) - binary.Write(data, binary.LittleEndian, m.QUALITY) + if err := binary.Write(data, binary.LittleEndian, m.TIME_USEC); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.FRONT_DISTANCE_M); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.LEFT); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.RIGHT); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.SENSOR_ID); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.QUALITY); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the OmnidirectionalFlow func (m *OmnidirectionalFlow) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.TIME_USEC) - binary.Read(data, binary.LittleEndian, &m.FRONT_DISTANCE_M) - binary.Read(data, binary.LittleEndian, &m.LEFT) - binary.Read(data, binary.LittleEndian, &m.RIGHT) - binary.Read(data, binary.LittleEndian, &m.SENSOR_ID) - binary.Read(data, binary.LittleEndian, &m.QUALITY) + if err := binary.Read(data, binary.LittleEndian, &m.TIME_USEC); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.FRONT_DISTANCE_M); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.LEFT); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.RIGHT); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.SENSOR_ID); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.QUALITY); err != nil { + panic(err) + } } const ( @@ -6059,42 +8130,102 @@ func (*HilSensor) Crc() uint8 { // Pack returns a packed byte array which represents a HilSensor payload func (m *HilSensor) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.TIME_USEC) - binary.Write(data, binary.LittleEndian, m.XACC) - binary.Write(data, binary.LittleEndian, m.YACC) - binary.Write(data, binary.LittleEndian, m.ZACC) - binary.Write(data, binary.LittleEndian, m.XGYRO) - binary.Write(data, binary.LittleEndian, m.YGYRO) - binary.Write(data, binary.LittleEndian, m.ZGYRO) - binary.Write(data, binary.LittleEndian, m.XMAG) - binary.Write(data, binary.LittleEndian, m.YMAG) - binary.Write(data, binary.LittleEndian, m.ZMAG) - binary.Write(data, binary.LittleEndian, m.ABS_PRESSURE) - binary.Write(data, binary.LittleEndian, m.DIFF_PRESSURE) - binary.Write(data, binary.LittleEndian, m.PRESSURE_ALT) - binary.Write(data, binary.LittleEndian, m.TEMPERATURE) - binary.Write(data, binary.LittleEndian, m.FIELDS_UPDATED) + if err := binary.Write(data, binary.LittleEndian, m.TIME_USEC); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.XACC); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.YACC); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.ZACC); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.XGYRO); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.YGYRO); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.ZGYRO); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.XMAG); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.YMAG); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.ZMAG); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.ABS_PRESSURE); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.DIFF_PRESSURE); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.PRESSURE_ALT); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.TEMPERATURE); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.FIELDS_UPDATED); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the HilSensor func (m *HilSensor) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.TIME_USEC) - binary.Read(data, binary.LittleEndian, &m.XACC) - binary.Read(data, binary.LittleEndian, &m.YACC) - binary.Read(data, binary.LittleEndian, &m.ZACC) - binary.Read(data, binary.LittleEndian, &m.XGYRO) - binary.Read(data, binary.LittleEndian, &m.YGYRO) - binary.Read(data, binary.LittleEndian, &m.ZGYRO) - binary.Read(data, binary.LittleEndian, &m.XMAG) - binary.Read(data, binary.LittleEndian, &m.YMAG) - binary.Read(data, binary.LittleEndian, &m.ZMAG) - binary.Read(data, binary.LittleEndian, &m.ABS_PRESSURE) - binary.Read(data, binary.LittleEndian, &m.DIFF_PRESSURE) - binary.Read(data, binary.LittleEndian, &m.PRESSURE_ALT) - binary.Read(data, binary.LittleEndian, &m.TEMPERATURE) - binary.Read(data, binary.LittleEndian, &m.FIELDS_UPDATED) + if err := binary.Read(data, binary.LittleEndian, &m.TIME_USEC); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.XACC); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.YACC); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.ZACC); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.XGYRO); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.YGYRO); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.ZGYRO); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.XMAG); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.YMAG); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.ZMAG); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.ABS_PRESSURE); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.DIFF_PRESSURE); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.PRESSURE_ALT); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.TEMPERATURE); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.FIELDS_UPDATED); err != nil { + panic(err) + } } // MESSAGE SIM_STATE @@ -6173,54 +8304,138 @@ func (*SimState) Crc() uint8 { // Pack returns a packed byte array which represents a SimState payload func (m *SimState) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.Q1) - binary.Write(data, binary.LittleEndian, m.Q2) - binary.Write(data, binary.LittleEndian, m.Q3) - binary.Write(data, binary.LittleEndian, m.Q4) - binary.Write(data, binary.LittleEndian, m.ROLL) - binary.Write(data, binary.LittleEndian, m.PITCH) - binary.Write(data, binary.LittleEndian, m.YAW) - binary.Write(data, binary.LittleEndian, m.XACC) - binary.Write(data, binary.LittleEndian, m.YACC) - binary.Write(data, binary.LittleEndian, m.ZACC) - binary.Write(data, binary.LittleEndian, m.XGYRO) - binary.Write(data, binary.LittleEndian, m.YGYRO) - binary.Write(data, binary.LittleEndian, m.ZGYRO) - binary.Write(data, binary.LittleEndian, m.LAT) - binary.Write(data, binary.LittleEndian, m.LON) - binary.Write(data, binary.LittleEndian, m.ALT) - binary.Write(data, binary.LittleEndian, m.STD_DEV_HORZ) - binary.Write(data, binary.LittleEndian, m.STD_DEV_VERT) - binary.Write(data, binary.LittleEndian, m.VN) - binary.Write(data, binary.LittleEndian, m.VE) - binary.Write(data, binary.LittleEndian, m.VD) + if err := binary.Write(data, binary.LittleEndian, m.Q1); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.Q2); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.Q3); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.Q4); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.ROLL); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.PITCH); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.YAW); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.XACC); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.YACC); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.ZACC); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.XGYRO); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.YGYRO); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.ZGYRO); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.LAT); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.LON); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.ALT); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.STD_DEV_HORZ); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.STD_DEV_VERT); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.VN); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.VE); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.VD); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the SimState func (m *SimState) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.Q1) - binary.Read(data, binary.LittleEndian, &m.Q2) - binary.Read(data, binary.LittleEndian, &m.Q3) - binary.Read(data, binary.LittleEndian, &m.Q4) - binary.Read(data, binary.LittleEndian, &m.ROLL) - binary.Read(data, binary.LittleEndian, &m.PITCH) - binary.Read(data, binary.LittleEndian, &m.YAW) - binary.Read(data, binary.LittleEndian, &m.XACC) - binary.Read(data, binary.LittleEndian, &m.YACC) - binary.Read(data, binary.LittleEndian, &m.ZACC) - binary.Read(data, binary.LittleEndian, &m.XGYRO) - binary.Read(data, binary.LittleEndian, &m.YGYRO) - binary.Read(data, binary.LittleEndian, &m.ZGYRO) - binary.Read(data, binary.LittleEndian, &m.LAT) - binary.Read(data, binary.LittleEndian, &m.LON) - binary.Read(data, binary.LittleEndian, &m.ALT) - binary.Read(data, binary.LittleEndian, &m.STD_DEV_HORZ) - binary.Read(data, binary.LittleEndian, &m.STD_DEV_VERT) - binary.Read(data, binary.LittleEndian, &m.VN) - binary.Read(data, binary.LittleEndian, &m.VE) - binary.Read(data, binary.LittleEndian, &m.VD) + if err := binary.Read(data, binary.LittleEndian, &m.Q1); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.Q2); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.Q3); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.Q4); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.ROLL); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.PITCH); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.YAW); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.XACC); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.YACC); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.ZACC); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.XGYRO); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.YGYRO); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.ZGYRO); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.LAT); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.LON); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.ALT); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.STD_DEV_HORZ); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.STD_DEV_VERT); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.VN); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.VE); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.VD); err != nil { + panic(err) + } } // MESSAGE RADIO_STATUS @@ -6271,26 +8486,54 @@ func (*RadioStatus) Crc() uint8 { // Pack returns a packed byte array which represents a RadioStatus payload func (m *RadioStatus) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.RXERRORS) - binary.Write(data, binary.LittleEndian, m.FIXED) - binary.Write(data, binary.LittleEndian, m.RSSI) - binary.Write(data, binary.LittleEndian, m.REMRSSI) - binary.Write(data, binary.LittleEndian, m.TXBUF) - binary.Write(data, binary.LittleEndian, m.NOISE) - binary.Write(data, binary.LittleEndian, m.REMNOISE) + if err := binary.Write(data, binary.LittleEndian, m.RXERRORS); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.FIXED); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.RSSI); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.REMRSSI); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.TXBUF); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.NOISE); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.REMNOISE); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the RadioStatus func (m *RadioStatus) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.RXERRORS) - binary.Read(data, binary.LittleEndian, &m.FIXED) - binary.Read(data, binary.LittleEndian, &m.RSSI) - binary.Read(data, binary.LittleEndian, &m.REMRSSI) - binary.Read(data, binary.LittleEndian, &m.TXBUF) - binary.Read(data, binary.LittleEndian, &m.NOISE) - binary.Read(data, binary.LittleEndian, &m.REMNOISE) + if err := binary.Read(data, binary.LittleEndian, &m.RXERRORS); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.FIXED); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.RSSI); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.REMRSSI); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.TXBUF); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.NOISE); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.REMNOISE); err != nil { + panic(err) + } } // MESSAGE FILE_TRANSFER_START @@ -6337,22 +8580,42 @@ func (*FileTransferStart) Crc() uint8 { // Pack returns a packed byte array which represents a FileTransferStart payload func (m *FileTransferStart) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.TRANSFER_UID) - binary.Write(data, binary.LittleEndian, m.FILE_SIZE) - binary.Write(data, binary.LittleEndian, m.DEST_PATH) - binary.Write(data, binary.LittleEndian, m.DIRECTION) - binary.Write(data, binary.LittleEndian, m.FLAGS) + if err := binary.Write(data, binary.LittleEndian, m.TRANSFER_UID); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.FILE_SIZE); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.DEST_PATH); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.DIRECTION); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.FLAGS); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the FileTransferStart func (m *FileTransferStart) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.TRANSFER_UID) - binary.Read(data, binary.LittleEndian, &m.FILE_SIZE) - binary.Read(data, binary.LittleEndian, &m.DEST_PATH) - binary.Read(data, binary.LittleEndian, &m.DIRECTION) - binary.Read(data, binary.LittleEndian, &m.FLAGS) + if err := binary.Read(data, binary.LittleEndian, &m.TRANSFER_UID); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.FILE_SIZE); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.DEST_PATH); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.DIRECTION); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.FLAGS); err != nil { + panic(err) + } } const ( @@ -6399,18 +8662,30 @@ func (*FileTransferDirList) Crc() uint8 { // Pack returns a packed byte array which represents a FileTransferDirList payload func (m *FileTransferDirList) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.TRANSFER_UID) - binary.Write(data, binary.LittleEndian, m.DIR_PATH) - binary.Write(data, binary.LittleEndian, m.FLAGS) + if err := binary.Write(data, binary.LittleEndian, m.TRANSFER_UID); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.DIR_PATH); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.FLAGS); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the FileTransferDirList func (m *FileTransferDirList) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.TRANSFER_UID) - binary.Read(data, binary.LittleEndian, &m.DIR_PATH) - binary.Read(data, binary.LittleEndian, &m.FLAGS) + if err := binary.Read(data, binary.LittleEndian, &m.TRANSFER_UID); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.DIR_PATH); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.FLAGS); err != nil { + panic(err) + } } const ( @@ -6455,16 +8730,24 @@ func (*FileTransferRes) Crc() uint8 { // Pack returns a packed byte array which represents a FileTransferRes payload func (m *FileTransferRes) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.TRANSFER_UID) - binary.Write(data, binary.LittleEndian, m.RESULT) + if err := binary.Write(data, binary.LittleEndian, m.TRANSFER_UID); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.RESULT); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the FileTransferRes func (m *FileTransferRes) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.TRANSFER_UID) - binary.Read(data, binary.LittleEndian, &m.RESULT) + if err := binary.Read(data, binary.LittleEndian, &m.TRANSFER_UID); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.RESULT); err != nil { + panic(err) + } } // MESSAGE HIL_GPS @@ -6527,38 +8810,90 @@ func (*HilGps) Crc() uint8 { // Pack returns a packed byte array which represents a HilGps payload func (m *HilGps) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.TIME_USEC) - binary.Write(data, binary.LittleEndian, m.LAT) - binary.Write(data, binary.LittleEndian, m.LON) - binary.Write(data, binary.LittleEndian, m.ALT) - binary.Write(data, binary.LittleEndian, m.EPH) - binary.Write(data, binary.LittleEndian, m.EPV) - binary.Write(data, binary.LittleEndian, m.VEL) - binary.Write(data, binary.LittleEndian, m.VN) - binary.Write(data, binary.LittleEndian, m.VE) - binary.Write(data, binary.LittleEndian, m.VD) - binary.Write(data, binary.LittleEndian, m.COG) - binary.Write(data, binary.LittleEndian, m.FIX_TYPE) - binary.Write(data, binary.LittleEndian, m.SATELLITES_VISIBLE) + if err := binary.Write(data, binary.LittleEndian, m.TIME_USEC); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.LAT); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.LON); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.ALT); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.EPH); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.EPV); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.VEL); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.VN); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.VE); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.VD); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.COG); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.FIX_TYPE); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.SATELLITES_VISIBLE); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the HilGps func (m *HilGps) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.TIME_USEC) - binary.Read(data, binary.LittleEndian, &m.LAT) - binary.Read(data, binary.LittleEndian, &m.LON) - binary.Read(data, binary.LittleEndian, &m.ALT) - binary.Read(data, binary.LittleEndian, &m.EPH) - binary.Read(data, binary.LittleEndian, &m.EPV) - binary.Read(data, binary.LittleEndian, &m.VEL) - binary.Read(data, binary.LittleEndian, &m.VN) - binary.Read(data, binary.LittleEndian, &m.VE) - binary.Read(data, binary.LittleEndian, &m.VD) - binary.Read(data, binary.LittleEndian, &m.COG) - binary.Read(data, binary.LittleEndian, &m.FIX_TYPE) - binary.Read(data, binary.LittleEndian, &m.SATELLITES_VISIBLE) + if err := binary.Read(data, binary.LittleEndian, &m.TIME_USEC); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.LAT); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.LON); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.ALT); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.EPH); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.EPV); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.VEL); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.VN); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.VE); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.VD); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.COG); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.FIX_TYPE); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.SATELLITES_VISIBLE); err != nil { + panic(err) + } } // MESSAGE HIL_OPTICAL_FLOW @@ -6611,28 +8946,60 @@ func (*HilOpticalFlow) Crc() uint8 { // Pack returns a packed byte array which represents a HilOpticalFlow payload func (m *HilOpticalFlow) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.TIME_USEC) - binary.Write(data, binary.LittleEndian, m.FLOW_COMP_M_X) - binary.Write(data, binary.LittleEndian, m.FLOW_COMP_M_Y) - binary.Write(data, binary.LittleEndian, m.GROUND_DISTANCE) - binary.Write(data, binary.LittleEndian, m.FLOW_X) - binary.Write(data, binary.LittleEndian, m.FLOW_Y) - binary.Write(data, binary.LittleEndian, m.SENSOR_ID) - binary.Write(data, binary.LittleEndian, m.QUALITY) + if err := binary.Write(data, binary.LittleEndian, m.TIME_USEC); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.FLOW_COMP_M_X); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.FLOW_COMP_M_Y); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.GROUND_DISTANCE); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.FLOW_X); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.FLOW_Y); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.SENSOR_ID); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.QUALITY); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the HilOpticalFlow func (m *HilOpticalFlow) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.TIME_USEC) - binary.Read(data, binary.LittleEndian, &m.FLOW_COMP_M_X) - binary.Read(data, binary.LittleEndian, &m.FLOW_COMP_M_Y) - binary.Read(data, binary.LittleEndian, &m.GROUND_DISTANCE) - binary.Read(data, binary.LittleEndian, &m.FLOW_X) - binary.Read(data, binary.LittleEndian, &m.FLOW_Y) - binary.Read(data, binary.LittleEndian, &m.SENSOR_ID) - binary.Read(data, binary.LittleEndian, &m.QUALITY) + if err := binary.Read(data, binary.LittleEndian, &m.TIME_USEC); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.FLOW_COMP_M_X); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.FLOW_COMP_M_Y); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.GROUND_DISTANCE); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.FLOW_X); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.FLOW_Y); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.SENSOR_ID); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.QUALITY); err != nil { + panic(err) + } } // MESSAGE HIL_STATE_QUATERNION @@ -6701,44 +9068,108 @@ func (*HilStateQuaternion) Crc() uint8 { // Pack returns a packed byte array which represents a HilStateQuaternion payload func (m *HilStateQuaternion) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.TIME_USEC) - binary.Write(data, binary.LittleEndian, m.ATTITUDE_QUATERNION) - binary.Write(data, binary.LittleEndian, m.ROLLSPEED) - binary.Write(data, binary.LittleEndian, m.PITCHSPEED) - binary.Write(data, binary.LittleEndian, m.YAWSPEED) - binary.Write(data, binary.LittleEndian, m.LAT) - binary.Write(data, binary.LittleEndian, m.LON) - binary.Write(data, binary.LittleEndian, m.ALT) - binary.Write(data, binary.LittleEndian, m.VX) - binary.Write(data, binary.LittleEndian, m.VY) - binary.Write(data, binary.LittleEndian, m.VZ) - binary.Write(data, binary.LittleEndian, m.IND_AIRSPEED) - binary.Write(data, binary.LittleEndian, m.TRUE_AIRSPEED) - binary.Write(data, binary.LittleEndian, m.XACC) - binary.Write(data, binary.LittleEndian, m.YACC) - binary.Write(data, binary.LittleEndian, m.ZACC) + if err := binary.Write(data, binary.LittleEndian, m.TIME_USEC); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.ATTITUDE_QUATERNION); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.ROLLSPEED); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.PITCHSPEED); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.YAWSPEED); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.LAT); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.LON); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.ALT); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.VX); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.VY); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.VZ); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.IND_AIRSPEED); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.TRUE_AIRSPEED); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.XACC); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.YACC); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.ZACC); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the HilStateQuaternion func (m *HilStateQuaternion) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.TIME_USEC) - binary.Read(data, binary.LittleEndian, &m.ATTITUDE_QUATERNION) - binary.Read(data, binary.LittleEndian, &m.ROLLSPEED) - binary.Read(data, binary.LittleEndian, &m.PITCHSPEED) - binary.Read(data, binary.LittleEndian, &m.YAWSPEED) - binary.Read(data, binary.LittleEndian, &m.LAT) - binary.Read(data, binary.LittleEndian, &m.LON) - binary.Read(data, binary.LittleEndian, &m.ALT) - binary.Read(data, binary.LittleEndian, &m.VX) - binary.Read(data, binary.LittleEndian, &m.VY) - binary.Read(data, binary.LittleEndian, &m.VZ) - binary.Read(data, binary.LittleEndian, &m.IND_AIRSPEED) - binary.Read(data, binary.LittleEndian, &m.TRUE_AIRSPEED) - binary.Read(data, binary.LittleEndian, &m.XACC) - binary.Read(data, binary.LittleEndian, &m.YACC) - binary.Read(data, binary.LittleEndian, &m.ZACC) + if err := binary.Read(data, binary.LittleEndian, &m.TIME_USEC); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.ATTITUDE_QUATERNION); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.ROLLSPEED); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.PITCHSPEED); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.YAWSPEED); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.LAT); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.LON); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.ALT); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.VX); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.VY); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.VZ); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.IND_AIRSPEED); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.TRUE_AIRSPEED); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.XACC); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.YACC); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.ZACC); err != nil { + panic(err) + } } const ( @@ -6799,32 +9230,72 @@ func (*ScaledImu2) Crc() uint8 { // Pack returns a packed byte array which represents a ScaledImu2 payload func (m *ScaledImu2) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.TIME_BOOT_MS) - binary.Write(data, binary.LittleEndian, m.XACC) - binary.Write(data, binary.LittleEndian, m.YACC) - binary.Write(data, binary.LittleEndian, m.ZACC) - binary.Write(data, binary.LittleEndian, m.XGYRO) - binary.Write(data, binary.LittleEndian, m.YGYRO) - binary.Write(data, binary.LittleEndian, m.ZGYRO) - binary.Write(data, binary.LittleEndian, m.XMAG) - binary.Write(data, binary.LittleEndian, m.YMAG) - binary.Write(data, binary.LittleEndian, m.ZMAG) + if err := binary.Write(data, binary.LittleEndian, m.TIME_BOOT_MS); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.XACC); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.YACC); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.ZACC); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.XGYRO); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.YGYRO); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.ZGYRO); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.XMAG); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.YMAG); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.ZMAG); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the ScaledImu2 func (m *ScaledImu2) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.TIME_BOOT_MS) - binary.Read(data, binary.LittleEndian, &m.XACC) - binary.Read(data, binary.LittleEndian, &m.YACC) - binary.Read(data, binary.LittleEndian, &m.ZACC) - binary.Read(data, binary.LittleEndian, &m.XGYRO) - binary.Read(data, binary.LittleEndian, &m.YGYRO) - binary.Read(data, binary.LittleEndian, &m.ZGYRO) - binary.Read(data, binary.LittleEndian, &m.XMAG) - binary.Read(data, binary.LittleEndian, &m.YMAG) - binary.Read(data, binary.LittleEndian, &m.ZMAG) + if err := binary.Read(data, binary.LittleEndian, &m.TIME_BOOT_MS); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.XACC); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.YACC); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.ZACC); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.XGYRO); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.YGYRO); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.ZGYRO); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.XMAG); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.YMAG); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.ZMAG); err != nil { + panic(err) + } } // MESSAGE LOG_REQUEST_LIST @@ -6869,20 +9340,36 @@ func (*LogRequestList) Crc() uint8 { // Pack returns a packed byte array which represents a LogRequestList payload func (m *LogRequestList) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.START) - binary.Write(data, binary.LittleEndian, m.END) - binary.Write(data, binary.LittleEndian, m.TARGET_SYSTEM) - binary.Write(data, binary.LittleEndian, m.TARGET_COMPONENT) + if err := binary.Write(data, binary.LittleEndian, m.START); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.END); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.TARGET_SYSTEM); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.TARGET_COMPONENT); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the LogRequestList func (m *LogRequestList) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.START) - binary.Read(data, binary.LittleEndian, &m.END) - binary.Read(data, binary.LittleEndian, &m.TARGET_SYSTEM) - binary.Read(data, binary.LittleEndian, &m.TARGET_COMPONENT) + if err := binary.Read(data, binary.LittleEndian, &m.START); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.END); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.TARGET_SYSTEM); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.TARGET_COMPONENT); err != nil { + panic(err) + } } // MESSAGE LOG_ENTRY @@ -6929,22 +9416,42 @@ func (*LogEntry) Crc() uint8 { // Pack returns a packed byte array which represents a LogEntry payload func (m *LogEntry) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.TIME_UTC) - binary.Write(data, binary.LittleEndian, m.SIZE) - binary.Write(data, binary.LittleEndian, m.ID) - binary.Write(data, binary.LittleEndian, m.NUM_LOGS) - binary.Write(data, binary.LittleEndian, m.LAST_LOG_NUM) + if err := binary.Write(data, binary.LittleEndian, m.TIME_UTC); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.SIZE); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.ID); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.NUM_LOGS); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.LAST_LOG_NUM); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the LogEntry func (m *LogEntry) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.TIME_UTC) - binary.Read(data, binary.LittleEndian, &m.SIZE) - binary.Read(data, binary.LittleEndian, &m.ID) - binary.Read(data, binary.LittleEndian, &m.NUM_LOGS) - binary.Read(data, binary.LittleEndian, &m.LAST_LOG_NUM) + if err := binary.Read(data, binary.LittleEndian, &m.TIME_UTC); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.SIZE); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.ID); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.NUM_LOGS); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.LAST_LOG_NUM); err != nil { + panic(err) + } } // MESSAGE LOG_REQUEST_DATA @@ -6991,22 +9498,42 @@ func (*LogRequestData) Crc() uint8 { // Pack returns a packed byte array which represents a LogRequestData payload func (m *LogRequestData) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.OFS) - binary.Write(data, binary.LittleEndian, m.COUNT) - binary.Write(data, binary.LittleEndian, m.ID) - binary.Write(data, binary.LittleEndian, m.TARGET_SYSTEM) - binary.Write(data, binary.LittleEndian, m.TARGET_COMPONENT) + if err := binary.Write(data, binary.LittleEndian, m.OFS); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.COUNT); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.ID); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.TARGET_SYSTEM); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.TARGET_COMPONENT); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the LogRequestData func (m *LogRequestData) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.OFS) - binary.Read(data, binary.LittleEndian, &m.COUNT) - binary.Read(data, binary.LittleEndian, &m.ID) - binary.Read(data, binary.LittleEndian, &m.TARGET_SYSTEM) - binary.Read(data, binary.LittleEndian, &m.TARGET_COMPONENT) + if err := binary.Read(data, binary.LittleEndian, &m.OFS); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.COUNT); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.ID); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.TARGET_SYSTEM); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.TARGET_COMPONENT); err != nil { + panic(err) + } } // MESSAGE LOG_DATA @@ -7051,20 +9578,36 @@ func (*LogData) Crc() uint8 { // Pack returns a packed byte array which represents a LogData payload func (m *LogData) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.OFS) - binary.Write(data, binary.LittleEndian, m.ID) - binary.Write(data, binary.LittleEndian, m.COUNT) - binary.Write(data, binary.LittleEndian, m.DATA) + if err := binary.Write(data, binary.LittleEndian, m.OFS); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.ID); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.COUNT); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.DATA); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the LogData func (m *LogData) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.OFS) - binary.Read(data, binary.LittleEndian, &m.ID) - binary.Read(data, binary.LittleEndian, &m.COUNT) - binary.Read(data, binary.LittleEndian, &m.DATA) + if err := binary.Read(data, binary.LittleEndian, &m.OFS); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.ID); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.COUNT); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.DATA); err != nil { + panic(err) + } } const ( @@ -7109,16 +9652,24 @@ func (*LogErase) Crc() uint8 { // Pack returns a packed byte array which represents a LogErase payload func (m *LogErase) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.TARGET_SYSTEM) - binary.Write(data, binary.LittleEndian, m.TARGET_COMPONENT) + if err := binary.Write(data, binary.LittleEndian, m.TARGET_SYSTEM); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.TARGET_COMPONENT); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the LogErase func (m *LogErase) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.TARGET_SYSTEM) - binary.Read(data, binary.LittleEndian, &m.TARGET_COMPONENT) + if err := binary.Read(data, binary.LittleEndian, &m.TARGET_SYSTEM); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.TARGET_COMPONENT); err != nil { + panic(err) + } } // MESSAGE LOG_REQUEST_END @@ -7159,16 +9710,24 @@ func (*LogRequestEnd) Crc() uint8 { // Pack returns a packed byte array which represents a LogRequestEnd payload func (m *LogRequestEnd) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.TARGET_SYSTEM) - binary.Write(data, binary.LittleEndian, m.TARGET_COMPONENT) + if err := binary.Write(data, binary.LittleEndian, m.TARGET_SYSTEM); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.TARGET_COMPONENT); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the LogRequestEnd func (m *LogRequestEnd) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.TARGET_SYSTEM) - binary.Read(data, binary.LittleEndian, &m.TARGET_COMPONENT) + if err := binary.Read(data, binary.LittleEndian, &m.TARGET_SYSTEM); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.TARGET_COMPONENT); err != nil { + panic(err) + } } // MESSAGE GPS_INJECT_DATA @@ -7213,20 +9772,36 @@ func (*GpsInjectData) Crc() uint8 { // Pack returns a packed byte array which represents a GpsInjectData payload func (m *GpsInjectData) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.TARGET_SYSTEM) - binary.Write(data, binary.LittleEndian, m.TARGET_COMPONENT) - binary.Write(data, binary.LittleEndian, m.LEN) - binary.Write(data, binary.LittleEndian, m.DATA) + if err := binary.Write(data, binary.LittleEndian, m.TARGET_SYSTEM); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.TARGET_COMPONENT); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.LEN); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.DATA); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the GpsInjectData func (m *GpsInjectData) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.TARGET_SYSTEM) - binary.Read(data, binary.LittleEndian, &m.TARGET_COMPONENT) - binary.Read(data, binary.LittleEndian, &m.LEN) - binary.Read(data, binary.LittleEndian, &m.DATA) + if err := binary.Read(data, binary.LittleEndian, &m.TARGET_SYSTEM); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.TARGET_COMPONENT); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.LEN); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.DATA); err != nil { + panic(err) + } } const ( @@ -7291,36 +9866,84 @@ func (*Gps2Raw) Crc() uint8 { // Pack returns a packed byte array which represents a Gps2Raw payload func (m *Gps2Raw) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.TIME_USEC) - binary.Write(data, binary.LittleEndian, m.LAT) - binary.Write(data, binary.LittleEndian, m.LON) - binary.Write(data, binary.LittleEndian, m.ALT) - binary.Write(data, binary.LittleEndian, m.DGPS_AGE) - binary.Write(data, binary.LittleEndian, m.EPH) - binary.Write(data, binary.LittleEndian, m.EPV) - binary.Write(data, binary.LittleEndian, m.VEL) - binary.Write(data, binary.LittleEndian, m.COG) - binary.Write(data, binary.LittleEndian, m.FIX_TYPE) - binary.Write(data, binary.LittleEndian, m.SATELLITES_VISIBLE) - binary.Write(data, binary.LittleEndian, m.DGPS_NUMCH) + if err := binary.Write(data, binary.LittleEndian, m.TIME_USEC); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.LAT); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.LON); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.ALT); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.DGPS_AGE); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.EPH); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.EPV); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.VEL); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.COG); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.FIX_TYPE); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.SATELLITES_VISIBLE); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.DGPS_NUMCH); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the Gps2Raw func (m *Gps2Raw) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.TIME_USEC) - binary.Read(data, binary.LittleEndian, &m.LAT) - binary.Read(data, binary.LittleEndian, &m.LON) - binary.Read(data, binary.LittleEndian, &m.ALT) - binary.Read(data, binary.LittleEndian, &m.DGPS_AGE) - binary.Read(data, binary.LittleEndian, &m.EPH) - binary.Read(data, binary.LittleEndian, &m.EPV) - binary.Read(data, binary.LittleEndian, &m.VEL) - binary.Read(data, binary.LittleEndian, &m.COG) - binary.Read(data, binary.LittleEndian, &m.FIX_TYPE) - binary.Read(data, binary.LittleEndian, &m.SATELLITES_VISIBLE) - binary.Read(data, binary.LittleEndian, &m.DGPS_NUMCH) + if err := binary.Read(data, binary.LittleEndian, &m.TIME_USEC); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.LAT); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.LON); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.ALT); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.DGPS_AGE); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.EPH); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.EPV); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.VEL); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.COG); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.FIX_TYPE); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.SATELLITES_VISIBLE); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.DGPS_NUMCH); err != nil { + panic(err) + } } // MESSAGE POWER_STATUS @@ -7363,18 +9986,30 @@ func (*PowerStatus) Crc() uint8 { // Pack returns a packed byte array which represents a PowerStatus payload func (m *PowerStatus) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.VCC) - binary.Write(data, binary.LittleEndian, m.VSERVO) - binary.Write(data, binary.LittleEndian, m.FLAGS) + if err := binary.Write(data, binary.LittleEndian, m.VCC); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.VSERVO); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.FLAGS); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the PowerStatus func (m *PowerStatus) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.VCC) - binary.Read(data, binary.LittleEndian, &m.VSERVO) - binary.Read(data, binary.LittleEndian, &m.FLAGS) + if err := binary.Read(data, binary.LittleEndian, &m.VCC); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.VSERVO); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.FLAGS); err != nil { + panic(err) + } } // MESSAGE SERIAL_CONTROL @@ -7423,24 +10058,48 @@ func (*SerialControl) Crc() uint8 { // Pack returns a packed byte array which represents a SerialControl payload func (m *SerialControl) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.BAUDRATE) - binary.Write(data, binary.LittleEndian, m.TIMEOUT) - binary.Write(data, binary.LittleEndian, m.DEVICE) - binary.Write(data, binary.LittleEndian, m.FLAGS) - binary.Write(data, binary.LittleEndian, m.COUNT) - binary.Write(data, binary.LittleEndian, m.DATA) + if err := binary.Write(data, binary.LittleEndian, m.BAUDRATE); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.TIMEOUT); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.DEVICE); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.FLAGS); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.COUNT); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.DATA); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the SerialControl func (m *SerialControl) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.BAUDRATE) - binary.Read(data, binary.LittleEndian, &m.TIMEOUT) - binary.Read(data, binary.LittleEndian, &m.DEVICE) - binary.Read(data, binary.LittleEndian, &m.FLAGS) - binary.Read(data, binary.LittleEndian, &m.COUNT) - binary.Read(data, binary.LittleEndian, &m.DATA) + if err := binary.Read(data, binary.LittleEndian, &m.BAUDRATE); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.TIMEOUT); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.DEVICE); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.FLAGS); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.COUNT); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.DATA); err != nil { + panic(err) + } } const ( @@ -7507,38 +10166,90 @@ func (*GpsRtk) Crc() uint8 { // Pack returns a packed byte array which represents a GpsRtk payload func (m *GpsRtk) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.TIME_LAST_BASELINE_MS) - binary.Write(data, binary.LittleEndian, m.TOW) - binary.Write(data, binary.LittleEndian, m.BASELINE_A_MM) - binary.Write(data, binary.LittleEndian, m.BASELINE_B_MM) - binary.Write(data, binary.LittleEndian, m.BASELINE_C_MM) - binary.Write(data, binary.LittleEndian, m.ACCURACY) - binary.Write(data, binary.LittleEndian, m.IAR_NUM_HYPOTHESES) - binary.Write(data, binary.LittleEndian, m.WN) - binary.Write(data, binary.LittleEndian, m.RTK_RECEIVER_ID) - binary.Write(data, binary.LittleEndian, m.RTK_HEALTH) - binary.Write(data, binary.LittleEndian, m.RTK_RATE) - binary.Write(data, binary.LittleEndian, m.NSATS) - binary.Write(data, binary.LittleEndian, m.BASELINE_COORDS_TYPE) + if err := binary.Write(data, binary.LittleEndian, m.TIME_LAST_BASELINE_MS); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.TOW); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.BASELINE_A_MM); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.BASELINE_B_MM); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.BASELINE_C_MM); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.ACCURACY); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.IAR_NUM_HYPOTHESES); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.WN); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.RTK_RECEIVER_ID); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.RTK_HEALTH); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.RTK_RATE); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.NSATS); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.BASELINE_COORDS_TYPE); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the GpsRtk func (m *GpsRtk) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.TIME_LAST_BASELINE_MS) - binary.Read(data, binary.LittleEndian, &m.TOW) - binary.Read(data, binary.LittleEndian, &m.BASELINE_A_MM) - binary.Read(data, binary.LittleEndian, &m.BASELINE_B_MM) - binary.Read(data, binary.LittleEndian, &m.BASELINE_C_MM) - binary.Read(data, binary.LittleEndian, &m.ACCURACY) - binary.Read(data, binary.LittleEndian, &m.IAR_NUM_HYPOTHESES) - binary.Read(data, binary.LittleEndian, &m.WN) - binary.Read(data, binary.LittleEndian, &m.RTK_RECEIVER_ID) - binary.Read(data, binary.LittleEndian, &m.RTK_HEALTH) - binary.Read(data, binary.LittleEndian, &m.RTK_RATE) - binary.Read(data, binary.LittleEndian, &m.NSATS) - binary.Read(data, binary.LittleEndian, &m.BASELINE_COORDS_TYPE) + if err := binary.Read(data, binary.LittleEndian, &m.TIME_LAST_BASELINE_MS); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.TOW); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.BASELINE_A_MM); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.BASELINE_B_MM); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.BASELINE_C_MM); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.ACCURACY); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.IAR_NUM_HYPOTHESES); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.WN); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.RTK_RECEIVER_ID); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.RTK_HEALTH); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.RTK_RATE); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.NSATS); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.BASELINE_COORDS_TYPE); err != nil { + panic(err) + } } // MESSAGE GPS2_RTK @@ -7601,38 +10312,90 @@ func (*Gps2Rtk) Crc() uint8 { // Pack returns a packed byte array which represents a Gps2Rtk payload func (m *Gps2Rtk) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.TIME_LAST_BASELINE_MS) - binary.Write(data, binary.LittleEndian, m.TOW) - binary.Write(data, binary.LittleEndian, m.BASELINE_A_MM) - binary.Write(data, binary.LittleEndian, m.BASELINE_B_MM) - binary.Write(data, binary.LittleEndian, m.BASELINE_C_MM) - binary.Write(data, binary.LittleEndian, m.ACCURACY) - binary.Write(data, binary.LittleEndian, m.IAR_NUM_HYPOTHESES) - binary.Write(data, binary.LittleEndian, m.WN) - binary.Write(data, binary.LittleEndian, m.RTK_RECEIVER_ID) - binary.Write(data, binary.LittleEndian, m.RTK_HEALTH) - binary.Write(data, binary.LittleEndian, m.RTK_RATE) - binary.Write(data, binary.LittleEndian, m.NSATS) - binary.Write(data, binary.LittleEndian, m.BASELINE_COORDS_TYPE) + if err := binary.Write(data, binary.LittleEndian, m.TIME_LAST_BASELINE_MS); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.TOW); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.BASELINE_A_MM); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.BASELINE_B_MM); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.BASELINE_C_MM); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.ACCURACY); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.IAR_NUM_HYPOTHESES); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.WN); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.RTK_RECEIVER_ID); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.RTK_HEALTH); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.RTK_RATE); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.NSATS); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.BASELINE_COORDS_TYPE); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the Gps2Rtk func (m *Gps2Rtk) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.TIME_LAST_BASELINE_MS) - binary.Read(data, binary.LittleEndian, &m.TOW) - binary.Read(data, binary.LittleEndian, &m.BASELINE_A_MM) - binary.Read(data, binary.LittleEndian, &m.BASELINE_B_MM) - binary.Read(data, binary.LittleEndian, &m.BASELINE_C_MM) - binary.Read(data, binary.LittleEndian, &m.ACCURACY) - binary.Read(data, binary.LittleEndian, &m.IAR_NUM_HYPOTHESES) - binary.Read(data, binary.LittleEndian, &m.WN) - binary.Read(data, binary.LittleEndian, &m.RTK_RECEIVER_ID) - binary.Read(data, binary.LittleEndian, &m.RTK_HEALTH) - binary.Read(data, binary.LittleEndian, &m.RTK_RATE) - binary.Read(data, binary.LittleEndian, &m.NSATS) - binary.Read(data, binary.LittleEndian, &m.BASELINE_COORDS_TYPE) + if err := binary.Read(data, binary.LittleEndian, &m.TIME_LAST_BASELINE_MS); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.TOW); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.BASELINE_A_MM); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.BASELINE_B_MM); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.BASELINE_C_MM); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.ACCURACY); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.IAR_NUM_HYPOTHESES); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.WN); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.RTK_RECEIVER_ID); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.RTK_HEALTH); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.RTK_RATE); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.NSATS); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.BASELINE_COORDS_TYPE); err != nil { + panic(err) + } } // MESSAGE DATA_TRANSMISSION_HANDSHAKE @@ -7683,26 +10446,54 @@ func (*DataTransmissionHandshake) Crc() uint8 { // Pack returns a packed byte array which represents a DataTransmissionHandshake payload func (m *DataTransmissionHandshake) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.SIZE) - binary.Write(data, binary.LittleEndian, m.WIDTH) - binary.Write(data, binary.LittleEndian, m.HEIGHT) - binary.Write(data, binary.LittleEndian, m.PACKETS) - binary.Write(data, binary.LittleEndian, m.TYPE) - binary.Write(data, binary.LittleEndian, m.PAYLOAD) - binary.Write(data, binary.LittleEndian, m.JPG_QUALITY) + if err := binary.Write(data, binary.LittleEndian, m.SIZE); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.WIDTH); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.HEIGHT); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.PACKETS); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.TYPE); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.PAYLOAD); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.JPG_QUALITY); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the DataTransmissionHandshake func (m *DataTransmissionHandshake) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.SIZE) - binary.Read(data, binary.LittleEndian, &m.WIDTH) - binary.Read(data, binary.LittleEndian, &m.HEIGHT) - binary.Read(data, binary.LittleEndian, &m.PACKETS) - binary.Read(data, binary.LittleEndian, &m.TYPE) - binary.Read(data, binary.LittleEndian, &m.PAYLOAD) - binary.Read(data, binary.LittleEndian, &m.JPG_QUALITY) + if err := binary.Read(data, binary.LittleEndian, &m.SIZE); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.WIDTH); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.HEIGHT); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.PACKETS); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.TYPE); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.PAYLOAD); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.JPG_QUALITY); err != nil { + panic(err) + } } // MESSAGE ENCAPSULATED_DATA @@ -7743,16 +10534,24 @@ func (*EncapsulatedData) Crc() uint8 { // Pack returns a packed byte array which represents a EncapsulatedData payload func (m *EncapsulatedData) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.SEQNR) - binary.Write(data, binary.LittleEndian, m.DATA) + if err := binary.Write(data, binary.LittleEndian, m.SEQNR); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.DATA); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the EncapsulatedData func (m *EncapsulatedData) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.SEQNR) - binary.Read(data, binary.LittleEndian, &m.DATA) + if err := binary.Read(data, binary.LittleEndian, &m.SEQNR); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.DATA); err != nil { + panic(err) + } } const ( @@ -7809,28 +10608,60 @@ func (*DistanceSensor) Crc() uint8 { // Pack returns a packed byte array which represents a DistanceSensor payload func (m *DistanceSensor) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.TIME_BOOT_MS) - binary.Write(data, binary.LittleEndian, m.MIN_DISTANCE) - binary.Write(data, binary.LittleEndian, m.MAX_DISTANCE) - binary.Write(data, binary.LittleEndian, m.CURRENT_DISTANCE) - binary.Write(data, binary.LittleEndian, m.TYPE) - binary.Write(data, binary.LittleEndian, m.ID) - binary.Write(data, binary.LittleEndian, m.ORIENTATION) - binary.Write(data, binary.LittleEndian, m.COVARIANCE) + if err := binary.Write(data, binary.LittleEndian, m.TIME_BOOT_MS); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.MIN_DISTANCE); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.MAX_DISTANCE); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.CURRENT_DISTANCE); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.TYPE); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.ID); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.ORIENTATION); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.COVARIANCE); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the DistanceSensor func (m *DistanceSensor) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.TIME_BOOT_MS) - binary.Read(data, binary.LittleEndian, &m.MIN_DISTANCE) - binary.Read(data, binary.LittleEndian, &m.MAX_DISTANCE) - binary.Read(data, binary.LittleEndian, &m.CURRENT_DISTANCE) - binary.Read(data, binary.LittleEndian, &m.TYPE) - binary.Read(data, binary.LittleEndian, &m.ID) - binary.Read(data, binary.LittleEndian, &m.ORIENTATION) - binary.Read(data, binary.LittleEndian, &m.COVARIANCE) + if err := binary.Read(data, binary.LittleEndian, &m.TIME_BOOT_MS); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.MIN_DISTANCE); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.MAX_DISTANCE); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.CURRENT_DISTANCE); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.TYPE); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.ID); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.ORIENTATION); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.COVARIANCE); err != nil { + panic(err) + } } // MESSAGE TERRAIN_REQUEST @@ -7875,20 +10706,36 @@ func (*TerrainRequest) Crc() uint8 { // Pack returns a packed byte array which represents a TerrainRequest payload func (m *TerrainRequest) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.MASK) - binary.Write(data, binary.LittleEndian, m.LAT) - binary.Write(data, binary.LittleEndian, m.LON) - binary.Write(data, binary.LittleEndian, m.GRID_SPACING) + if err := binary.Write(data, binary.LittleEndian, m.MASK); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.LAT); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.LON); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.GRID_SPACING); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the TerrainRequest func (m *TerrainRequest) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.MASK) - binary.Read(data, binary.LittleEndian, &m.LAT) - binary.Read(data, binary.LittleEndian, &m.LON) - binary.Read(data, binary.LittleEndian, &m.GRID_SPACING) + if err := binary.Read(data, binary.LittleEndian, &m.MASK); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.LAT); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.LON); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.GRID_SPACING); err != nil { + panic(err) + } } // MESSAGE TERRAIN_DATA @@ -7935,22 +10782,42 @@ func (*TerrainData) Crc() uint8 { // Pack returns a packed byte array which represents a TerrainData payload func (m *TerrainData) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.LAT) - binary.Write(data, binary.LittleEndian, m.LON) - binary.Write(data, binary.LittleEndian, m.GRID_SPACING) - binary.Write(data, binary.LittleEndian, m.DATA) - binary.Write(data, binary.LittleEndian, m.GRIDBIT) + if err := binary.Write(data, binary.LittleEndian, m.LAT); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.LON); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.GRID_SPACING); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.DATA); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.GRIDBIT); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the TerrainData func (m *TerrainData) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.LAT) - binary.Read(data, binary.LittleEndian, &m.LON) - binary.Read(data, binary.LittleEndian, &m.GRID_SPACING) - binary.Read(data, binary.LittleEndian, &m.DATA) - binary.Read(data, binary.LittleEndian, &m.GRIDBIT) + if err := binary.Read(data, binary.LittleEndian, &m.LAT); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.LON); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.GRID_SPACING); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.DATA); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.GRIDBIT); err != nil { + panic(err) + } } const ( @@ -7995,16 +10862,24 @@ func (*TerrainCheck) Crc() uint8 { // Pack returns a packed byte array which represents a TerrainCheck payload func (m *TerrainCheck) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.LAT) - binary.Write(data, binary.LittleEndian, m.LON) + if err := binary.Write(data, binary.LittleEndian, m.LAT); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.LON); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the TerrainCheck func (m *TerrainCheck) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.LAT) - binary.Read(data, binary.LittleEndian, &m.LON) + if err := binary.Read(data, binary.LittleEndian, &m.LAT); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.LON); err != nil { + panic(err) + } } // MESSAGE TERRAIN_REPORT @@ -8055,26 +10930,54 @@ func (*TerrainReport) Crc() uint8 { // Pack returns a packed byte array which represents a TerrainReport payload func (m *TerrainReport) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.LAT) - binary.Write(data, binary.LittleEndian, m.LON) - binary.Write(data, binary.LittleEndian, m.TERRAIN_HEIGHT) - binary.Write(data, binary.LittleEndian, m.CURRENT_HEIGHT) - binary.Write(data, binary.LittleEndian, m.SPACING) - binary.Write(data, binary.LittleEndian, m.PENDING) - binary.Write(data, binary.LittleEndian, m.LOADED) + if err := binary.Write(data, binary.LittleEndian, m.LAT); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.LON); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.TERRAIN_HEIGHT); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.CURRENT_HEIGHT); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.SPACING); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.PENDING); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.LOADED); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the TerrainReport func (m *TerrainReport) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.LAT) - binary.Read(data, binary.LittleEndian, &m.LON) - binary.Read(data, binary.LittleEndian, &m.TERRAIN_HEIGHT) - binary.Read(data, binary.LittleEndian, &m.CURRENT_HEIGHT) - binary.Read(data, binary.LittleEndian, &m.SPACING) - binary.Read(data, binary.LittleEndian, &m.PENDING) - binary.Read(data, binary.LittleEndian, &m.LOADED) + if err := binary.Read(data, binary.LittleEndian, &m.LAT); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.LON); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.TERRAIN_HEIGHT); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.CURRENT_HEIGHT); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.SPACING); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.PENDING); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.LOADED); err != nil { + panic(err) + } } // MESSAGE BATTERY_STATUS @@ -8133,34 +11036,78 @@ func (*BatteryStatus) Crc() uint8 { // Pack returns a packed byte array which represents a BatteryStatus payload func (m *BatteryStatus) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.CURRENT_CONSUMED) - binary.Write(data, binary.LittleEndian, m.ENERGY_CONSUMED) - binary.Write(data, binary.LittleEndian, m.VOLTAGE_CELL_1) - binary.Write(data, binary.LittleEndian, m.VOLTAGE_CELL_2) - binary.Write(data, binary.LittleEndian, m.VOLTAGE_CELL_3) - binary.Write(data, binary.LittleEndian, m.VOLTAGE_CELL_4) - binary.Write(data, binary.LittleEndian, m.VOLTAGE_CELL_5) - binary.Write(data, binary.LittleEndian, m.VOLTAGE_CELL_6) - binary.Write(data, binary.LittleEndian, m.CURRENT_BATTERY) - binary.Write(data, binary.LittleEndian, m.ACCU_ID) - binary.Write(data, binary.LittleEndian, m.BATTERY_REMAINING) + if err := binary.Write(data, binary.LittleEndian, m.CURRENT_CONSUMED); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.ENERGY_CONSUMED); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.VOLTAGE_CELL_1); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.VOLTAGE_CELL_2); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.VOLTAGE_CELL_3); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.VOLTAGE_CELL_4); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.VOLTAGE_CELL_5); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.VOLTAGE_CELL_6); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.CURRENT_BATTERY); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.ACCU_ID); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.BATTERY_REMAINING); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the BatteryStatus func (m *BatteryStatus) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.CURRENT_CONSUMED) - binary.Read(data, binary.LittleEndian, &m.ENERGY_CONSUMED) - binary.Read(data, binary.LittleEndian, &m.VOLTAGE_CELL_1) - binary.Read(data, binary.LittleEndian, &m.VOLTAGE_CELL_2) - binary.Read(data, binary.LittleEndian, &m.VOLTAGE_CELL_3) - binary.Read(data, binary.LittleEndian, &m.VOLTAGE_CELL_4) - binary.Read(data, binary.LittleEndian, &m.VOLTAGE_CELL_5) - binary.Read(data, binary.LittleEndian, &m.VOLTAGE_CELL_6) - binary.Read(data, binary.LittleEndian, &m.CURRENT_BATTERY) - binary.Read(data, binary.LittleEndian, &m.ACCU_ID) - binary.Read(data, binary.LittleEndian, &m.BATTERY_REMAINING) + if err := binary.Read(data, binary.LittleEndian, &m.CURRENT_CONSUMED); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.ENERGY_CONSUMED); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.VOLTAGE_CELL_1); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.VOLTAGE_CELL_2); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.VOLTAGE_CELL_3); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.VOLTAGE_CELL_4); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.VOLTAGE_CELL_5); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.VOLTAGE_CELL_6); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.CURRENT_BATTERY); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.ACCU_ID); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.BATTERY_REMAINING); err != nil { + panic(err) + } } // MESSAGE SETPOINT_8DOF @@ -8215,30 +11162,66 @@ func (*Setpoint8Dof) Crc() uint8 { // Pack returns a packed byte array which represents a Setpoint8Dof payload func (m *Setpoint8Dof) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.VAL1) - binary.Write(data, binary.LittleEndian, m.VAL2) - binary.Write(data, binary.LittleEndian, m.VAL3) - binary.Write(data, binary.LittleEndian, m.VAL4) - binary.Write(data, binary.LittleEndian, m.VAL5) - binary.Write(data, binary.LittleEndian, m.VAL6) - binary.Write(data, binary.LittleEndian, m.VAL7) - binary.Write(data, binary.LittleEndian, m.VAL8) - binary.Write(data, binary.LittleEndian, m.TARGET_SYSTEM) + if err := binary.Write(data, binary.LittleEndian, m.VAL1); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.VAL2); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.VAL3); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.VAL4); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.VAL5); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.VAL6); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.VAL7); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.VAL8); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.TARGET_SYSTEM); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the Setpoint8Dof func (m *Setpoint8Dof) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.VAL1) - binary.Read(data, binary.LittleEndian, &m.VAL2) - binary.Read(data, binary.LittleEndian, &m.VAL3) - binary.Read(data, binary.LittleEndian, &m.VAL4) - binary.Read(data, binary.LittleEndian, &m.VAL5) - binary.Read(data, binary.LittleEndian, &m.VAL6) - binary.Read(data, binary.LittleEndian, &m.VAL7) - binary.Read(data, binary.LittleEndian, &m.VAL8) - binary.Read(data, binary.LittleEndian, &m.TARGET_SYSTEM) + if err := binary.Read(data, binary.LittleEndian, &m.VAL1); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.VAL2); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.VAL3); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.VAL4); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.VAL5); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.VAL6); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.VAL7); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.VAL8); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.TARGET_SYSTEM); err != nil { + panic(err) + } } // MESSAGE SETPOINT_6DOF @@ -8289,26 +11272,54 @@ func (*Setpoint6Dof) Crc() uint8 { // Pack returns a packed byte array which represents a Setpoint6Dof payload func (m *Setpoint6Dof) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.TRANS_X) - binary.Write(data, binary.LittleEndian, m.TRANS_Y) - binary.Write(data, binary.LittleEndian, m.TRANS_Z) - binary.Write(data, binary.LittleEndian, m.ROT_X) - binary.Write(data, binary.LittleEndian, m.ROT_Y) - binary.Write(data, binary.LittleEndian, m.ROT_Z) - binary.Write(data, binary.LittleEndian, m.TARGET_SYSTEM) + if err := binary.Write(data, binary.LittleEndian, m.TRANS_X); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.TRANS_Y); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.TRANS_Z); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.ROT_X); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.ROT_Y); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.ROT_Z); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.TARGET_SYSTEM); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the Setpoint6Dof func (m *Setpoint6Dof) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.TRANS_X) - binary.Read(data, binary.LittleEndian, &m.TRANS_Y) - binary.Read(data, binary.LittleEndian, &m.TRANS_Z) - binary.Read(data, binary.LittleEndian, &m.ROT_X) - binary.Read(data, binary.LittleEndian, &m.ROT_Y) - binary.Read(data, binary.LittleEndian, &m.ROT_Z) - binary.Read(data, binary.LittleEndian, &m.TARGET_SYSTEM) + if err := binary.Read(data, binary.LittleEndian, &m.TRANS_X); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.TRANS_Y); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.TRANS_Z); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.ROT_X); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.ROT_Y); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.ROT_Z); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.TARGET_SYSTEM); err != nil { + panic(err) + } } // MESSAGE MEMORY_VECT @@ -8353,20 +11364,36 @@ func (*MemoryVect) Crc() uint8 { // Pack returns a packed byte array which represents a MemoryVect payload func (m *MemoryVect) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.ADDRESS) - binary.Write(data, binary.LittleEndian, m.VER) - binary.Write(data, binary.LittleEndian, m.TYPE) - binary.Write(data, binary.LittleEndian, m.VALUE) + if err := binary.Write(data, binary.LittleEndian, m.ADDRESS); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.VER); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.TYPE); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.VALUE); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the MemoryVect func (m *MemoryVect) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.ADDRESS) - binary.Read(data, binary.LittleEndian, &m.VER) - binary.Read(data, binary.LittleEndian, &m.TYPE) - binary.Read(data, binary.LittleEndian, &m.VALUE) + if err := binary.Read(data, binary.LittleEndian, &m.ADDRESS); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.VER); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.TYPE); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.VALUE); err != nil { + panic(err) + } } const ( @@ -8417,22 +11444,42 @@ func (*DebugVect) Crc() uint8 { // Pack returns a packed byte array which represents a DebugVect payload func (m *DebugVect) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.TIME_USEC) - binary.Write(data, binary.LittleEndian, m.X) - binary.Write(data, binary.LittleEndian, m.Y) - binary.Write(data, binary.LittleEndian, m.Z) - binary.Write(data, binary.LittleEndian, m.NAME) + if err := binary.Write(data, binary.LittleEndian, m.TIME_USEC); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.X); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.Y); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.Z); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.NAME); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the DebugVect func (m *DebugVect) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.TIME_USEC) - binary.Read(data, binary.LittleEndian, &m.X) - binary.Read(data, binary.LittleEndian, &m.Y) - binary.Read(data, binary.LittleEndian, &m.Z) - binary.Read(data, binary.LittleEndian, &m.NAME) + if err := binary.Read(data, binary.LittleEndian, &m.TIME_USEC); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.X); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.Y); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.Z); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.NAME); err != nil { + panic(err) + } } const ( @@ -8479,18 +11526,30 @@ func (*NamedValueFloat) Crc() uint8 { // Pack returns a packed byte array which represents a NamedValueFloat payload func (m *NamedValueFloat) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.TIME_BOOT_MS) - binary.Write(data, binary.LittleEndian, m.VALUE) - binary.Write(data, binary.LittleEndian, m.NAME) + if err := binary.Write(data, binary.LittleEndian, m.TIME_BOOT_MS); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.VALUE); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.NAME); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the NamedValueFloat func (m *NamedValueFloat) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.TIME_BOOT_MS) - binary.Read(data, binary.LittleEndian, &m.VALUE) - binary.Read(data, binary.LittleEndian, &m.NAME) + if err := binary.Read(data, binary.LittleEndian, &m.TIME_BOOT_MS); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.VALUE); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.NAME); err != nil { + panic(err) + } } const ( @@ -8537,18 +11596,30 @@ func (*NamedValueInt) Crc() uint8 { // Pack returns a packed byte array which represents a NamedValueInt payload func (m *NamedValueInt) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.TIME_BOOT_MS) - binary.Write(data, binary.LittleEndian, m.VALUE) - binary.Write(data, binary.LittleEndian, m.NAME) + if err := binary.Write(data, binary.LittleEndian, m.TIME_BOOT_MS); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.VALUE); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.NAME); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the NamedValueInt func (m *NamedValueInt) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.TIME_BOOT_MS) - binary.Read(data, binary.LittleEndian, &m.VALUE) - binary.Read(data, binary.LittleEndian, &m.NAME) + if err := binary.Read(data, binary.LittleEndian, &m.TIME_BOOT_MS); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.VALUE); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.NAME); err != nil { + panic(err) + } } const ( @@ -8593,16 +11664,24 @@ func (*Statustext) Crc() uint8 { // Pack returns a packed byte array which represents a Statustext payload func (m *Statustext) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.SEVERITY) - binary.Write(data, binary.LittleEndian, m.TEXT) + if err := binary.Write(data, binary.LittleEndian, m.SEVERITY); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.TEXT); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the Statustext func (m *Statustext) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.SEVERITY) - binary.Read(data, binary.LittleEndian, &m.TEXT) + if err := binary.Read(data, binary.LittleEndian, &m.SEVERITY); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.TEXT); err != nil { + panic(err) + } } const ( @@ -8649,16 +11728,28 @@ func (*Debug) Crc() uint8 { // Pack returns a packed byte array which represents a Debug payload func (m *Debug) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.TIME_BOOT_MS) - binary.Write(data, binary.LittleEndian, m.VALUE) - binary.Write(data, binary.LittleEndian, m.IND) + if err := binary.Write(data, binary.LittleEndian, m.TIME_BOOT_MS); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.VALUE); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.IND); err != nil { + panic(err) + } return data.Bytes() } // Decode accepts a packed byte array and populates the fields of the Debug func (m *Debug) Decode(buf []byte) { data := bytes.NewBuffer(buf) - binary.Read(data, binary.LittleEndian, &m.TIME_BOOT_MS) - binary.Read(data, binary.LittleEndian, &m.VALUE) - binary.Read(data, binary.LittleEndian, &m.IND) + if err := binary.Read(data, binary.LittleEndian, &m.TIME_BOOT_MS); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.VALUE); err != nil { + panic(err) + } + if err := binary.Read(data, binary.LittleEndian, &m.IND); err != nil { + panic(err) + } } diff --git a/platforms/mavlink/common/mavlink.go b/platforms/mavlink/common/mavlink.go index b48748713..8051e5538 100644 --- a/platforms/mavlink/common/mavlink.go +++ b/platforms/mavlink/common/mavlink.go @@ -1,4 +1,3 @@ -//nolint:errcheck // to much code to fix it immediately package mavlink // @@ -117,14 +116,28 @@ func (m *MAVLinkPacket) MAVLinkMessage() (MAVLinkMessage, error) { // Pack returns a packed byte array which represents the MAVLinkPacket func (m *MAVLinkPacket) Pack() []byte { data := new(bytes.Buffer) - binary.Write(data, binary.LittleEndian, m.Protocol) - binary.Write(data, binary.LittleEndian, m.Length) - binary.Write(data, binary.LittleEndian, m.Sequence) - binary.Write(data, binary.LittleEndian, m.SystemID) - binary.Write(data, binary.LittleEndian, m.ComponentID) - binary.Write(data, binary.LittleEndian, m.MessageID) + if err := binary.Write(data, binary.LittleEndian, m.Protocol); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.Length); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.Sequence); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.SystemID); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.ComponentID); err != nil { + panic(err) + } + if err := binary.Write(data, binary.LittleEndian, m.MessageID); err != nil { + panic(err) + } data.Write(m.Data) - binary.Write(data, binary.LittleEndian, m.Checksum) + if err := binary.Write(data, binary.LittleEndian, m.Checksum); err != nil { + panic(err) + } return data.Bytes() } @@ -148,15 +161,16 @@ func read(r io.Reader, length int) ([]byte, error) { i, err := r.Read(tmp[:]) if err != nil { return nil, err + } + + length -= i + buf = append(buf, tmp...) + if length != i { + time.Sleep(1 * time.Millisecond) } else { - length -= i - buf = append(buf, tmp...) - if length != i { - time.Sleep(1 * time.Millisecond) - } else { - break - } + break } + } return buf, nil } From a2e06b8e9ab08dff210915de62964ed5a0d1699c Mon Sep 17 00:00:00 2001 From: Thomas Kohler Date: Sun, 18 Jun 2023 17:00:59 +0200 Subject: [PATCH 15/20] core: upgrade modules (#961) go: upgraded github.com/nats-io/nats.go v1.26.0 => v1.27.0 go: upgraded gocv.io/x/gocv v0.32.1 => v0.33.0 go: upgraded golang.org/x/net v0.10.0 => v0.11.0 go: upgraded tinygo.org/x/bluetooth v0.6.0 => v0.7.0 --- go.mod | 18 +++++++++--------- go.sum | 43 +++++++++++++++++++++++-------------------- 2 files changed, 32 insertions(+), 29 deletions(-) diff --git a/go.mod b/go.mod index 39c355f9e..2281cc52f 100644 --- a/go.mod +++ b/go.mod @@ -10,17 +10,17 @@ require ( github.com/hashicorp/go-multierror v1.1.1 github.com/hybridgroup/go-ardrone v0.0.0-20140402002621-b9750d8d7b78 github.com/hybridgroup/mjpeg v0.0.0-20140228234708-4680f319790e - github.com/nats-io/nats.go v1.26.0 + github.com/nats-io/nats.go v1.27.0 github.com/sigurn/crc8 v0.0.0-20220107193325-2243fe600f9f github.com/stretchr/testify v1.8.4 github.com/veandco/go-sdl2 v0.4.35 github.com/warthog618/gpiod v0.8.1 go.bug.st/serial v1.5.0 - gocv.io/x/gocv v0.32.1 - golang.org/x/net v0.10.0 + gocv.io/x/gocv v0.33.0 + golang.org/x/net v0.11.0 periph.io/x/conn/v3 v3.7.0 periph.io/x/host/v3 v3.8.2 - tinygo.org/x/bluetooth v0.6.0 + tinygo.org/x/bluetooth v0.7.0 ) require ( @@ -32,18 +32,18 @@ require ( github.com/golang/protobuf v1.5.0 // indirect github.com/gorilla/websocket v1.5.0 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect - github.com/klauspost/compress v1.16.5 // indirect + github.com/klauspost/compress v1.16.6 // indirect github.com/muka/go-bluetooth v0.0.0-20221213043340-85dc80edc4e1 // indirect github.com/nats-io/nats-server/v2 v2.7.4 // indirect github.com/nats-io/nkeys v0.4.4 // indirect github.com/nats-io/nuid v1.0.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/saltosystems/winrt-go v0.0.0-20230510070731-e096b9afa761 // indirect + github.com/saltosystems/winrt-go v0.0.0-20230613063811-c792451fa808 // indirect github.com/sirupsen/logrus v1.9.3 // indirect github.com/tinygo-org/cbgo v0.0.4 // indirect - golang.org/x/crypto v0.9.0 // indirect - golang.org/x/sync v0.2.0 // indirect - golang.org/x/sys v0.8.0 // indirect + golang.org/x/crypto v0.10.0 // indirect + golang.org/x/sync v0.3.0 // indirect + golang.org/x/sys v0.9.0 // indirect google.golang.org/protobuf v1.28.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 3ba709f68..48bfa4d04 100644 --- a/go.sum +++ b/go.sum @@ -29,6 +29,7 @@ github.com/golang/protobuf v1.5.0 h1:LUVKkCeviFUMKqHa4tXIIij/lbhnMbP7Fn5wKdKkRh4 github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= @@ -43,8 +44,8 @@ github.com/hybridgroup/go-ardrone v0.0.0-20140402002621-b9750d8d7b78 h1:7of6LJZ4 github.com/hybridgroup/go-ardrone v0.0.0-20140402002621-b9750d8d7b78/go.mod h1:YllNbhGM1UEcySxCv1BWK5lre7QLmJJ+O0ADUOo2nbc= github.com/hybridgroup/mjpeg v0.0.0-20140228234708-4680f319790e h1:xCcwD5FOXul+j1dn8xD16nbrhJkkum/Cn+jTd/u1LhY= github.com/hybridgroup/mjpeg v0.0.0-20140228234708-4680f319790e/go.mod h1:eagM805MRKrioHYuU7iKLUyFPVKqVV6um5DAvCkUtXs= -github.com/klauspost/compress v1.16.5 h1:IFV2oUNUzZaz+XyusxpLzpzS8Pt5rh0Z16For/djlyI= -github.com/klauspost/compress v1.16.5/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= +github.com/klauspost/compress v1.16.6 h1:91SKEy4K37vkp255cJ8QesJhjyRO0hn9i9G0GoUwLsk= +github.com/klauspost/compress v1.16.6/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= @@ -58,8 +59,8 @@ github.com/muka/go-bluetooth v0.0.0-20221213043340-85dc80edc4e1/go.mod h1:dMCjic github.com/nats-io/jwt/v2 v2.2.1-0.20220113022732-58e87895b296 h1:vU9tpM3apjYlLLeY23zRWJ9Zktr5jp+mloR942LEOpY= github.com/nats-io/nats-server/v2 v2.7.4 h1:c+BZJ3rGzUKCBIM4IXO8uNT2u1vajGbD1kPA6wqCEaM= github.com/nats-io/nats-server/v2 v2.7.4/go.mod h1:1vZ2Nijh8tcyNe8BDVyTviCd9NYzRbubQYiEHsvOQWc= -github.com/nats-io/nats.go v1.26.0 h1:fWJTYPnZ8DzxIaqIHOAMfColuznchnd5Ab5dbJpgPIE= -github.com/nats-io/nats.go v1.26.0/go.mod h1:XpbWUlOElGwTYbMR7imivs7jJj9GtK7ypv321Wp6pjc= +github.com/nats-io/nats.go v1.27.0 h1:3o9fsPhmoKm+yK7rekH2GtWoE+D9jFbw8N3/ayI1C00= +github.com/nats-io/nats.go v1.27.0/go.mod h1:XpbWUlOElGwTYbMR7imivs7jJj9GtK7ypv321Wp6pjc= github.com/nats-io/nkeys v0.4.4 h1:xvBJ8d69TznjcQl9t6//Q5xXuVhyYiSos6RPtvQNTwA= github.com/nats-io/nkeys v0.4.4/go.mod h1:XUkxdLPTufzlihbamfzQ7mw/VGx6ObUs+0bN5sNvt64= github.com/nats-io/nuid v1.0.1 h1:5iA8DT8V7q8WK2EScv2padNa/rTESc1KdnPw4TC2paw= @@ -75,9 +76,9 @@ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/sago35/go-bdf v0.0.0-20200313142241-6c17821c91c4/go.mod h1:rOebXGuMLsXhZAC6mF/TjxONsm45498ZyzVhel++6KM= -github.com/saltosystems/winrt-go v0.0.0-20220826130236-ddc8202da421/go.mod h1:UvKm1lyhg+8ehk99i8g5Q7AX1LXUJgks0lRyAkG/ahQ= -github.com/saltosystems/winrt-go v0.0.0-20230510070731-e096b9afa761 h1:xEscoMxTrGSpdho1mP9VnGsK0DGhXKwm0qP7kYcjgrI= github.com/saltosystems/winrt-go v0.0.0-20230510070731-e096b9afa761/go.mod h1:UvKm1lyhg+8ehk99i8g5Q7AX1LXUJgks0lRyAkG/ahQ= +github.com/saltosystems/winrt-go v0.0.0-20230613063811-c792451fa808 h1:OmW/lr7pviC5Fcsiz3qqc8dh0uo1r3EqqI/mDTSpGmc= +github.com/saltosystems/winrt-go v0.0.0-20230613063811-c792451fa808/go.mod h1:UvKm1lyhg+8ehk99i8g5Q7AX1LXUJgks0lRyAkG/ahQ= github.com/sigurn/crc8 v0.0.0-20220107193325-2243fe600f9f h1:1R9KdKjCNSd7F8iGTxIpoID9prlYH8nuNYKt0XvweHA= github.com/sigurn/crc8 v0.0.0-20220107193325-2243fe600f9f/go.mod h1:vQhwQ4meQEDfahT5kd61wLAF5AAeh5ZPLVI4JJ/tYo8= github.com/sirupsen/logrus v1.5.0/go.mod h1:+F7Ogzej0PZc/94MaYx/nvG9jOFMD2osvC3s+Squfpo= @@ -107,15 +108,16 @@ github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9dec github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= go.bug.st/serial v1.5.0 h1:ThuUkHpOEmCVXxGEfpoExjQCS2WBVV4ZcUKVYInM9T4= go.bug.st/serial v1.5.0/go.mod h1:UABfsluHAiaNI+La2iESysd9Vetq7VRdpxvjx7CmmOE= -gocv.io/x/gocv v0.32.1 h1:BC9hHs5+47nVgySUFVKntc6RsF3SULFzqk6OV9xz+C0= -gocv.io/x/gocv v0.32.1/go.mod h1:oc6FvfYqfBp99p+yOEzs9tbYF9gOrAQSeL/dyIPefJU= +gocv.io/x/gocv v0.33.0 h1:WDtaBrq92AKrhepYzEktydDzNSm3t5k7ciawZK4rns8= +gocv.io/x/gocv v0.33.0/go.mod h1:oc6FvfYqfBp99p+yOEzs9tbYF9gOrAQSeL/dyIPefJU= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.9.0 h1:LF6fAI+IutBocDJ2OT0Q1g8plpYljMZ4+lty+dsqw3g= -golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0= +golang.org/x/crypto v0.10.0 h1:LKqV2xt9+kDzSTfOhx4FrkEBcMrAgHSYgzywV9zcGmM= +golang.org/x/crypto v0.10.0/go.mod h1:o4eNf7Ede1fv+hwOwZsTHl9EsPFO6q6ZvYR8vYfY45I= golang.org/x/image v0.0.0-20210628002857-a66eb6448b8d/go.mod h1:023OzeP/+EPmXeapQh35lcL3II3LrY8Ic+EFFKVhULM= +golang.org/x/image v0.0.0-20220617043117-41969df76e82/go.mod h1:doUCurBvlfPMKfmIpRIywoHmhN3VyhnoFDbvIEWF4hY= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= @@ -125,13 +127,13 @@ golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81R golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= -golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= +golang.org/x/net v0.11.0 h1:Gi2tvZIJyBtO9SDr1q9h5hEQCp/4L2RQ+ar0qjx2oNU= +golang.org/x/net v0.11.0/go.mod h1:2L/ixqYpgIVXmeoSA/4Lu7BzTG4KIyPIryS4IsOd1oQ= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.2.0 h1:PUR+T4wwASmuSTYdKjYHI5TD22Wy5ogLU5qZCOLxBrI= -golang.org/x/sync v0.2.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= +golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -145,9 +147,10 @@ golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220624220833-87e55d714810/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220829200755-d48e67d00261/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= -golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s= +golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= @@ -175,15 +178,15 @@ periph.io/x/conn/v3 v3.7.0 h1:f1EXLn4pkf7AEWwkol2gilCNZ0ElY+bxS4WE2PQXfrA= periph.io/x/conn/v3 v3.7.0/go.mod h1:ypY7UVxgDbP9PJGwFSVelRRagxyXYfttVh7hJZUHEhg= periph.io/x/host/v3 v3.8.2 h1:ayKUDzgUCN0g8+/xM9GTkWaOBhSLVcVHGTfjAOi8OsQ= periph.io/x/host/v3 v3.8.2/go.mod h1:yFL76AesNHR68PboofSWYaQTKmvPXsQH2Apvp/ls/K4= -tinygo.org/x/bluetooth v0.6.0 h1:5RTUh28WBtWfRtwFcsDcdiCvlSWr9F7fHxRikQZW/Io= -tinygo.org/x/bluetooth v0.6.0/go.mod h1:tiW1IiKOupcsvM2CX0PwLsf6aZRL+ciSIqP2YlgYOtQ= +tinygo.org/x/bluetooth v0.7.0 h1:7lU0VrauwccbLvb6AKHf4ZedFlxZIFwwqHWQD2fLWvA= +tinygo.org/x/bluetooth v0.7.0/go.mod h1:2hZPpfPDMR7Vvi6yMvyi83o8gYXeMKKsLfUnvmtBcjM= tinygo.org/x/drivers v0.14.0/go.mod h1:uT2svMq3EpBZpKkGO+NQHjxjGf1f42ra4OnMMwQL2aI= tinygo.org/x/drivers v0.15.1/go.mod h1:uT2svMq3EpBZpKkGO+NQHjxjGf1f42ra4OnMMwQL2aI= tinygo.org/x/drivers v0.16.0/go.mod h1:uT2svMq3EpBZpKkGO+NQHjxjGf1f42ra4OnMMwQL2aI= tinygo.org/x/drivers v0.19.0/go.mod h1:uJD/l1qWzxzLx+vcxaW0eY464N5RAgFi1zTVzASFdqI= -tinygo.org/x/drivers v0.23.0/go.mod h1:J4+51Li1kcfL5F93kmnDWEEzQF3bLGz0Am3Q7E2a8/E= +tinygo.org/x/drivers v0.25.0/go.mod h1:v+mXaA4cgpz/YZJ3ZPm/86bYQJAXTaYtMkHlVwbodbw= tinygo.org/x/tinyfont v0.2.1/go.mod h1:eLqnYSrFRjt5STxWaMeOWJTzrKhXqpWw7nU3bPfKOAM= tinygo.org/x/tinyfont v0.3.0/go.mod h1:+TV5q0KpwSGRWnN+ITijsIhrWYJkoUCp9MYELjKpAXk= +tinygo.org/x/tinyfont v0.4.0/go.mod h1:7nVj3j3geqBoPDzpFukAhF1C8AP9YocMsZy0HSAcGCA= tinygo.org/x/tinyfs v0.1.0/go.mod h1:ysc8Y92iHfhTXeyEM9+c7zviUQ4fN9UCFgSOFfMWv20= -tinygo.org/x/tinyfs v0.2.0/go.mod h1:6ZHYdvB3sFYeMB3ypmXZCNEnFwceKc61ADYTYHpep1E= tinygo.org/x/tinyterm v0.1.0/go.mod h1:/DDhNnGwNF2/tNgHywvyZuCGnbH3ov49Z/6e8LPLRR4= From 0648f66ef8add35988a684e4a9719019c792333e Mon Sep 17 00:00:00 2001 From: Thomas Kohler Date: Sun, 18 Jun 2023 18:10:46 +0200 Subject: [PATCH 16/20] build(linters): list of linter todo's (#962) --- .github/workflows/golangci-lint.yml | 2 +- .golangci.yml | 111 +++++++++++++++++- Makefile | 4 +- platforms/joystick/bin/scanner.go | 2 + platforms/joystick/joystick_dualshock3.go | 36 +++--- platforms/joystick/joystick_dualshock4.go | 44 +++---- .../joystick/joystick_nintendo_joycon.go | 52 ++++---- platforms/joystick/joystick_shield.go | 44 +++---- .../joystick/joystick_tflight_hotas_x.go | 44 +++---- platforms/joystick/joystick_xbox360.go | 52 ++++---- .../joystick_xbox360_rock_band_drums.go | 24 ++-- platforms/joystick/joystick_xboxone.go | 44 +++---- platforms/leap/doc.go | 2 +- platforms/nanopi/nanopineo_pin_map.go | 30 ++--- platforms/tinkerboard/pin_map.go | 60 +++++----- 15 files changed, 329 insertions(+), 222 deletions(-) diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index c3d6a976b..6ead6dc19 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -24,7 +24,7 @@ jobs: uses: golangci/golangci-lint-action@v3 with: # Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version - version: v1.52.2 + version: v1.53.3 # Optional: working directory, useful for monorepos # working-directory: v2 diff --git a/.golangci.yml b/.golangci.yml index 215dd56a9..421b80750 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -29,13 +29,118 @@ run: - platforms/opencv linters: - # Enable specific linter + # currently active linters: + # + #INFO [lintersdb] Active 35 linters: [asasalint asciicheck bidichk contextcheck decorder depguard durationcheck errcheck exportloopref + # gocheckcompilerdirectives gomoddirectives gomodguard goprintffuncname gosimple govet grouper importas ineffassign mirror musttag + # nilerr nilnil nolintlint nosprintfhostport prealloc reassign revive staticcheck tagalign tenv testableexamples tparallel typecheck unused wastedassign] + + enable-all: true + # https://golangci-lint.run/usage/linters/#enabled-by-default # note: typecheck can not be disabled, it is used to check code compilation - enable: - - nolintlint + disable: + # deprecated + - deadcode # deprecated + - exhaustivestruct # deprecated + - golint # deprecated + - ifshort # deprecated + - interfacer # deprecated + - maligned # deprecated + - nosnakecase # deprecated + - scopelint # deprecated + - structcheck # deprecated + - varcheck # deprecated + # not used for any reason + - execinquery # not needed (no sql) + - exhaustive # not used (we allow incomplete usage of enum switch, e.g. with default case) + - forbidigo # not used (we allow print statements) + - ginkgolinter # not needed (enforces standards of using ginkgo and gomega) + - gochecknoglobals # not used (we allow definition of unexposed variables at top level) + - godot # not used (seems to be counting peas) + - godox # not used (we have many TODOs, so not useful) + - goerr113 # not used (we allow error creation at return statement) + - gofumpt # not used (we use "go fmt" or "gofmt" not gofumpt" + - gosmopolitan # not needed (report i18n/l10n anti-patterns) + - ireturn # not used (we allow return interfaces) + - loggercheck # not needed (relates to kitlog, klog, logr, zap) + - paralleltest # not used + - promlinter # not needed (prometheus metrics naming) + - rowserrcheck # not needed (sql related) + - sqlclosecheck # not needed (sql related) + - testpackage # not needed, we use the same name for test package to have access to unexposed items + - wrapcheck # not needed (we allow errors from interface methods) + - zerologlint # not needed (related to zerolog package) + # important to have + - gofmt # important to prevent "format tsunami" ("gofmt -s -w" missed), disabled due to "https://github.com/golangci/golangci-lint-action/issues/535" + - makezero # very important (find/reduce bugs, e.g. in robot_work_test.go) + - nakedret # very useful together with "nonamedreturns" (reduce bugs) + - nonamedreturns # very useful (reduce bugs) + - unconvert # very useful (reduce bugs, simplify code) + - unparam # very useful (reduce bugs, simplify code) + # useful for the future + - bodyclose # maybe useful (reduce bugs), exclusions for tests needed + - containedctx # useful (structs are not for context wrapping) + - cyclop # useful with some tweeks (better understandable code), see also gocyclo + - dogsled # useful with some tweeks (e.g. exclude tests) + - dupl # useful with some tweeks (reduce bugs and lines of code) + - dupword # useful with some tweeks, but not important + - errchkjson # useful (reduce bugs) + - errname # useful for common style + - errorlint # useful (reduce bugs), but suppress the "Use `%w` to format errors" check + - exhaustruct # useful with some exclusions for existing code (e.g. mavlink/common/common.go) + - forcetypeassert # useful (reduce bugs) + - funlen # useful with some tweeks (reduce bugs, simplify code, better understandable code) + - gci # useful (improve readability) + - gochecknoinits # useful (reduce bugs, simplify bug catching) + - gocognit # useful with some tweeks (better understandable code) + - goconst # useful (reduce bugs) + - gocritic # useful with some exclusions for existing code (e.g. mavlink/common/common.go) + - gocyclo # useful with some tweeks (better understandable code) + - goheader # useful, if we introduce a common header (e.g. for copyright) + - goimports # useful (common style), but not important + - gomnd # useful with some exclusions for existing code (e.g. mavlink.go) + - gosec # useful (security) + - interfacebloat # useful with some exclusions at usage of external packages + - lll # useful with some exclusions for existing code (e.g. mavlink/common/common.go) + - maintidx # useful with some tweeks (better understandable code), maybe use instead "gocyclo", "gocognit" , "cyclop" + - misspell # useful (better understandable code), but not important + - nestif # useful (reduce bugs, simplify code, better understandable code) + - nlreturn # more common style, but could become annoying + - noctx # maybe good (show used context explicit) + - predeclared # useful (reduce bugs) + - stylecheck # useful with some tweaking (e.g. underscores in names should be allowed - we use it for constants retrieved from C/C++) + - tagliatelle # maybe useful with some tweaking or excluding + - thelper # useful + - usestdlibvars # useful + - varnamelen # maybe useful with some tweaking, but many findings + - whitespace # more common style, but could become annoying + - wsl # more common style, but could become annoying linters-settings: + depguard: + # Rules to apply. + # + # Variables: + # - File Variables + # you can still use and exclamation mark ! in front of a variable to say not to use it. + # Example !$test will match any file that is not a go test file. + # + # `$all` - matches all go files + # `$test` - matches all go test files + # + # - Package Variables + # + # `$gostd` - matches all of go's standard library (Pulled from `GOROOT`) + # + # Default: Only allow $gostd in all files. + rules: + main: + # Packages that are not allowed where the value is a suggestion. + deny: + - pkg: "github.com/pkg/errors" + desc: Should be replaced by standard lib errors package + nolintlint: # Enable to require an explanation of nonzero length after each nolint directive. # Default: false diff --git a/Makefile b/Makefile index 5ba96901e..75757935c 100644 --- a/Makefile +++ b/Makefile @@ -56,12 +56,12 @@ version_check: # Check for bad code style and other issues fmt_check: - gofmt -l ./ + gofmt -l -s . golangci-lint run -v # Fix bad code style (will only be executed, on version match) fmt_fix: version_check - go fmt ./... + gofmt -l -s -w . examples: $(EXAMPLES) diff --git a/platforms/joystick/bin/scanner.go b/platforms/joystick/bin/scanner.go index 049c6747a..66eff923d 100644 --- a/platforms/joystick/bin/scanner.go +++ b/platforms/joystick/bin/scanner.go @@ -1,4 +1,6 @@ +//go:build utils // +build utils + // // Do not build by default. // diff --git a/platforms/joystick/joystick_dualshock3.go b/platforms/joystick/joystick_dualshock3.go index 489765bc4..d7a8d3060 100644 --- a/platforms/joystick/joystick_dualshock3.go +++ b/platforms/joystick/joystick_dualshock3.go @@ -4,57 +4,57 @@ var dualshock3Config = joystickConfig{ Name: "Dualshock3 Controller", GUID: "1111", Axis: []pair{ - pair{ + { Name: "left_x", ID: 0, }, - pair{ + { Name: "left_y", ID: 1, }, - pair{ + { Name: "right_x", ID: 3, }, - pair{ + { Name: "right_y", ID: 4, }, }, Buttons: []pair{ - pair{ + { Name: "square", ID: 3, }, - pair{ + { Name: "triangle", ID: 2, }, - pair{ + { Name: "circle", ID: 1, }, - pair{ + { Name: "x", ID: 0, }, - pair{ + { Name: "up", ID: 13, }, - pair{ + { Name: "down", ID: 14, }, - pair{ + { Name: "left", ID: 15, }, - pair{ + { Name: "right", ID: 16, }, - pair{ + { Name: "l1", ID: 4, }, @@ -62,23 +62,23 @@ var dualshock3Config = joystickConfig{ Name: "l2", ID: 6, }, - pair{ + { Name: "r1", ID: 5, }, - pair{ + { Name: "r2", ID: 7, }, - pair{ + { Name: "start", ID: 9, }, - pair{ + { Name: "select", ID: 8, }, - pair{ + { Name: "home", ID: 10, }, diff --git a/platforms/joystick/joystick_dualshock4.go b/platforms/joystick/joystick_dualshock4.go index d36717ac5..cb1bdb5d6 100644 --- a/platforms/joystick/joystick_dualshock4.go +++ b/platforms/joystick/joystick_dualshock4.go @@ -4,99 +4,99 @@ var dualshock4Config = joystickConfig{ Name: "Dualshock4 Controller", GUID: "2222", Axis: []pair{ - pair{ + { Name: "left_x", ID: 0, }, - pair{ + { Name: "left_y", ID: 1, }, - pair{ + { Name: "right_x", ID: 3, }, - pair{ + { Name: "right_y", ID: 4, }, - pair{ + { Name: "l2", ID: 2, }, - pair{ + { Name: "r2", ID: 5, }, }, Buttons: []pair{ - pair{ + { Name: "square", ID: 3, }, - pair{ + { Name: "triangle", ID: 2, }, - pair{ + { Name: "circle", ID: 1, }, - pair{ + { Name: "x", ID: 0, }, - pair{ + { Name: "l1", ID: 4, }, - pair{ + { Name: "l2", ID: 6, }, - pair{ + { Name: "r1", ID: 5, }, - pair{ + { Name: "r2", ID: 7, }, - pair{ + { Name: "share", ID: 8, }, - pair{ + { Name: "options", ID: 9, }, - pair{ + { Name: "home", ID: 10, }, }, Hats: []hat{ - hat{ + { Hat: 0, Name: "down", ID: 4, }, - hat{ + { Hat: 0, Name: "up", ID: 1, }, - hat{ + { Hat: 0, Name: "left", ID: 8, }, - hat{ + { Hat: 0, Name: "right", ID: 2, }, - hat{ + { Hat: 0, Name: "released", ID: 0, diff --git a/platforms/joystick/joystick_nintendo_joycon.go b/platforms/joystick/joystick_nintendo_joycon.go index c9fa67bee..4226ab1df 100644 --- a/platforms/joystick/joystick_nintendo_joycon.go +++ b/platforms/joystick/joystick_nintendo_joycon.go @@ -4,109 +4,109 @@ var joyconPairConfig = joystickConfig{ Name: "Nintendo Switch Joycon Controller Pair", GUID: "5555", Axis: []pair{ - pair{ + { Name: "left_x", ID: 0, }, - pair{ + { Name: "left_y", ID: 1, }, - pair{ + { Name: "right_x", ID: 2, }, - pair{ + { Name: "right_y", ID: 3, }, - pair{ + { Name: "lt", ID: 4, }, - pair{ + { Name: "rt", ID: 5, }, }, Buttons: []pair{ - pair{ + { Name: "a", ID: 0, }, - pair{ + { Name: "b", ID: 1, }, - pair{ + { Name: "x", ID: 2, }, - pair{ + { Name: "y", ID: 3, }, - pair{ + { Name: "up", ID: 11, }, - pair{ + { Name: "down", ID: 12, }, - pair{ + { Name: "left", ID: 13, }, - pair{ + { Name: "right", ID: 14, }, - pair{ + { Name: "lb", ID: 9, }, - pair{ + { Name: "rb", ID: 10, }, - pair{ + { Name: "right_stick", ID: 8, }, - pair{ + { Name: "left_stick", ID: 7, }, - pair{ + { Name: "options", ID: 15, }, - pair{ + { Name: "home", ID: 5, }, - pair{ + { Name: "sr_left", ID: 17, }, - pair{ + { Name: "sl_left", ID: 19, }, - pair{ + { Name: "sr_right", ID: 16, }, - pair{ + { Name: "sl_right", ID: 18, }, - pair{ + { Name: "minus", ID: 4, }, - pair{ + { Name: "plus", ID: 6, }, diff --git a/platforms/joystick/joystick_shield.go b/platforms/joystick/joystick_shield.go index f2ed7e093..dd6a70e00 100644 --- a/platforms/joystick/joystick_shield.go +++ b/platforms/joystick/joystick_shield.go @@ -4,99 +4,99 @@ var shieldConfig = joystickConfig{ Name: "Nvidia SHIELD Controller", GUID: "3333", Axis: []pair{ - pair{ + { Name: "left_x", ID: 0, }, - pair{ + { Name: "left_y", ID: 1, }, - pair{ + { Name: "right_x", ID: 2, }, - pair{ + { Name: "right_y", ID: 3, }, - pair{ + { Name: "rt", ID: 4, }, - pair{ + { Name: "lt", ID: 5, }, }, Buttons: []pair{ - pair{ + { Name: "x", ID: 2, }, - pair{ + { Name: "a", ID: 0, }, - pair{ + { Name: "b", ID: 1, }, - pair{ + { Name: "y", ID: 3, }, - pair{ + { Name: "lb", ID: 4, }, - pair{ + { Name: "rb", ID: 5, }, - pair{ + { Name: "back", ID: 14, }, - pair{ + { Name: "start", ID: 7, }, - pair{ + { Name: "home", ID: 15, }, - pair{ + { Name: "right_stick", ID: 8, }, - pair{ + { Name: "left_stick", ID: 9, }, }, Hats: []hat{ - hat{ + { Hat: 0, Name: "down", ID: 4, }, - hat{ + { Hat: 0, Name: "up", ID: 1, }, - hat{ + { Hat: 0, Name: "left", ID: 8, }, - hat{ + { Hat: 0, Name: "right", ID: 2, }, - hat{ + { Hat: 0, Name: "released", ID: 0, diff --git a/platforms/joystick/joystick_tflight_hotas_x.go b/platforms/joystick/joystick_tflight_hotas_x.go index 9767d9270..280346dd6 100644 --- a/platforms/joystick/joystick_tflight_hotas_x.go +++ b/platforms/joystick/joystick_tflight_hotas_x.go @@ -4,31 +4,31 @@ var tflightHotasXConfig = joystickConfig{ Name: "Thrustmaster T-Flight Hotas X Joystick", GUID: "4444", Axis: []pair{ - pair{Name: "right_x", ID: 0}, - pair{Name: "right_y", ID: 1}, - pair{Name: "left_y", ID: 2}, - pair{Name: "r1", ID: 3}, // RH Twist - pair{Name: "left_x", ID: 4}, + {Name: "right_x", ID: 0}, + {Name: "right_y", ID: 1}, + {Name: "left_y", ID: 2}, + {Name: "r1", ID: 3}, // RH Twist + {Name: "left_x", ID: 4}, }, Buttons: []pair{ - pair{Name: "r1", ID: 0}, - pair{Name: "l1", ID: 1}, - pair{Name: "r3", ID: 2}, - pair{Name: "l3", ID: 3}, - pair{Name: "square", ID: 4}, - pair{Name: "x", ID: 5}, - pair{Name: "circle", ID: 6}, - pair{Name: "triangle", ID: 7}, - pair{Name: "r2", ID: 8}, - pair{Name: "l2", ID: 9}, - pair{Name: "select", ID: 10}, - pair{Name: "start", ID: 11}, + {Name: "r1", ID: 0}, + {Name: "l1", ID: 1}, + {Name: "r3", ID: 2}, + {Name: "l3", ID: 3}, + {Name: "square", ID: 4}, + {Name: "x", ID: 5}, + {Name: "circle", ID: 6}, + {Name: "triangle", ID: 7}, + {Name: "r2", ID: 8}, + {Name: "l2", ID: 9}, + {Name: "select", ID: 10}, + {Name: "start", ID: 11}, }, Hats: []hat{ - hat{Hat: 0, Name: "down", ID: 4}, - hat{Hat: 0, Name: "up", ID: 1}, - hat{Hat: 0, Name: "left", ID: 8}, - hat{Hat: 0, Name: "right", ID: 2}, - hat{Hat: 0, Name: "released", ID: 0}, + {Hat: 0, Name: "down", ID: 4}, + {Hat: 0, Name: "up", ID: 1}, + {Hat: 0, Name: "left", ID: 8}, + {Hat: 0, Name: "right", ID: 2}, + {Hat: 0, Name: "released", ID: 0}, }, } diff --git a/platforms/joystick/joystick_xbox360.go b/platforms/joystick/joystick_xbox360.go index 9e581886a..6658b7097 100644 --- a/platforms/joystick/joystick_xbox360.go +++ b/platforms/joystick/joystick_xbox360.go @@ -4,119 +4,119 @@ var xbox360Config = joystickConfig{ Name: "XBox 360 Controller", GUID: "3333", Axis: []pair{ - pair{ + { Name: "left_x", ID: 0, }, - pair{ + { Name: "left_y", ID: 1, }, - pair{ + { Name: "right_x", ID: 3, }, - pair{ + { Name: "right_y", ID: 4, }, - pair{ + { Name: "rt", ID: 5, }, - pair{ + { Name: "lt", ID: 2, }, }, Buttons: []pair{ - pair{ + { Name: "x", ID: 2, }, - pair{ + { Name: "a", ID: 0, }, - pair{ + { Name: "b", ID: 1, }, - pair{ + { Name: "y", ID: 3, }, - pair{ + { Name: "lb", ID: 4, }, - pair{ + { Name: "rb", ID: 5, }, - pair{ + { Name: "back", ID: 6, }, - pair{ + { Name: "start", ID: 7, }, - pair{ + { Name: "home", ID: 8, }, - pair{ + { Name: "right_stick", ID: 10, }, - pair{ + { Name: "left_stick", ID: 9, }, }, Hats: []hat{ - hat{ + { Hat: 0, Name: "down", ID: 4, }, - hat{ + { Hat: 0, Name: "up", ID: 1, }, - hat{ + { Hat: 0, Name: "left", ID: 8, }, - hat{ + { Hat: 0, Name: "upLeft", ID: 9, }, - hat{ + { Hat: 0, Name: "downLeft", ID: 12, }, - hat{ + { Hat: 0, Name: "right", ID: 2, }, - hat{ + { Hat: 0, Name: "upRight", ID: 3, }, - hat{ + { Hat: 0, Name: "downRight", ID: 6, }, - hat{ + { Hat: 0, Name: "released", ID: 0, diff --git a/platforms/joystick/joystick_xbox360_rock_band_drums.go b/platforms/joystick/joystick_xbox360_rock_band_drums.go index 890337005..c6c02a738 100644 --- a/platforms/joystick/joystick_xbox360_rock_band_drums.go +++ b/platforms/joystick/joystick_xbox360_rock_band_drums.go @@ -5,51 +5,51 @@ var xbox360RockBandDrumsConfig = joystickConfig{ GUID: "4444", Axis: []pair{}, Buttons: []pair{ - pair{ + { Name: "green", ID: 0, }, - pair{ + { Name: "red", ID: 1, }, - pair{ + { Name: "blue", ID: 2, }, - pair{ + { Name: "yellow", ID: 3, }, - pair{ + { Name: "pedal", ID: 4, }, - pair{ + { Name: "back", ID: 6, }, - pair{ + { Name: "start", ID: 7, }, - pair{ + { Name: "home", ID: 8, }, - pair{ + { Name: "left", ID: 11, }, - pair{ + { Name: "right", ID: 12, }, - pair{ + { Name: "up", ID: 13, }, - pair{ + { Name: "down", ID: 14, }, diff --git a/platforms/joystick/joystick_xboxone.go b/platforms/joystick/joystick_xboxone.go index ea2a244af..76d085e36 100644 --- a/platforms/joystick/joystick_xboxone.go +++ b/platforms/joystick/joystick_xboxone.go @@ -4,99 +4,99 @@ var xboxOneConfig = joystickConfig{ Name: "Xbox One Controller", GUID: "30001983600083000100", Axis: []pair{ - pair{ + { Name: "left_x", ID: 0, }, - pair{ + { Name: "left_y", ID: 1, }, - pair{ + { Name: "right_x", ID: 3, }, - pair{ + { Name: "right_y", ID: 4, }, - pair{ + { Name: "rt", ID: 5, }, - pair{ + { Name: "lt", ID: 2, }, }, Buttons: []pair{ - pair{ + { Name: "x", ID: 2, }, - pair{ + { Name: "a", ID: 0, }, - pair{ + { Name: "b", ID: 1, }, - pair{ + { Name: "y", ID: 3, }, - pair{ + { Name: "lb", ID: 4, }, - pair{ + { Name: "rb", ID: 5, }, - pair{ + { Name: "back", ID: 6, }, - pair{ + { Name: "start", ID: 7, }, - pair{ + { Name: "home", ID: 9, }, - pair{ + { Name: "right_stick", ID: 10, }, - pair{ + { Name: "left_stick", ID: 8, }, }, Hats: []hat{ - hat{ + { Hat: 0, Name: "down", ID: 4, }, - hat{ + { Hat: 0, Name: "up", ID: 1, }, - hat{ + { Hat: 0, Name: "left", ID: 8, }, - hat{ + { Hat: 0, Name: "right", ID: 2, }, - hat{ + { Hat: 0, Name: "released", ID: 0, diff --git a/platforms/leap/doc.go b/platforms/leap/doc.go index 60611e88e..226445d60 100644 --- a/platforms/leap/doc.go +++ b/platforms/leap/doc.go @@ -4,7 +4,7 @@ Package leap provides the Gobot adaptor and driver for the Leap Motion. Installing: Please refer to the main [README.md](https://github.com/hybridgroup/gobot/blob/release/README.md) - + Install the [Leap Motion Software](https://www.leapmotion.com/setup). Example: diff --git a/platforms/nanopi/nanopineo_pin_map.go b/platforms/nanopi/nanopineo_pin_map.go index 40f69c459..366473d16 100644 --- a/platforms/nanopi/nanopineo_pin_map.go +++ b/platforms/nanopi/nanopineo_pin_map.go @@ -3,23 +3,23 @@ package nanopi // pin definition for NanoPi NEO // pins: A=0+Nr, C=64+Nr, G=192+Nr var neoGpioPins = map[string]gpioPinDefinition{ - "11": gpioPinDefinition{sysfs: 0, cdev: cdevPin{chip: 0, line: 0}}, // UART2_TX/GPIOA0 - "22": gpioPinDefinition{sysfs: 1, cdev: cdevPin{chip: 0, line: 1}}, // UART2_RX/GPIOA1 - "13": gpioPinDefinition{sysfs: 2, cdev: cdevPin{chip: 0, line: 2}}, // UART2_RTS/GPIOA2 - "15": gpioPinDefinition{sysfs: 3, cdev: cdevPin{chip: 0, line: 3}}, // UART2_CTS/GPIOA3 - "12": gpioPinDefinition{sysfs: 6, cdev: cdevPin{chip: 0, line: 6}}, // GPIOA6 - "19": gpioPinDefinition{sysfs: 64, cdev: cdevPin{chip: 0, line: 64}}, // SPI0_MOSI/GPIOC0 - "21": gpioPinDefinition{sysfs: 65, cdev: cdevPin{chip: 0, line: 65}}, // SPI0_MISO/GPIOC1 - "23": gpioPinDefinition{sysfs: 66, cdev: cdevPin{chip: 0, line: 66}}, // SPI0_CLK/GPIOC2 - "24": gpioPinDefinition{sysfs: 67, cdev: cdevPin{chip: 0, line: 67}}, // SPI0_CS/GPIOC3 - "8": gpioPinDefinition{sysfs: 198, cdev: cdevPin{chip: 0, line: 198}}, // UART1_TX/GPIOG6 - "10": gpioPinDefinition{sysfs: 199, cdev: cdevPin{chip: 0, line: 199}}, // UART1_RX/GPIOG7 - "16": gpioPinDefinition{sysfs: 200, cdev: cdevPin{chip: 0, line: 200}}, // UART1_RTS/GPIOG8 - "18": gpioPinDefinition{sysfs: 201, cdev: cdevPin{chip: 0, line: 201}}, // UART1_CTS/GPIOG9 - "7": gpioPinDefinition{sysfs: 203, cdev: cdevPin{chip: 0, line: 203}}, // GPIOG11 + "11": {sysfs: 0, cdev: cdevPin{chip: 0, line: 0}}, // UART2_TX/GPIOA0 + "22": {sysfs: 1, cdev: cdevPin{chip: 0, line: 1}}, // UART2_RX/GPIOA1 + "13": {sysfs: 2, cdev: cdevPin{chip: 0, line: 2}}, // UART2_RTS/GPIOA2 + "15": {sysfs: 3, cdev: cdevPin{chip: 0, line: 3}}, // UART2_CTS/GPIOA3 + "12": {sysfs: 6, cdev: cdevPin{chip: 0, line: 6}}, // GPIOA6 + "19": {sysfs: 64, cdev: cdevPin{chip: 0, line: 64}}, // SPI0_MOSI/GPIOC0 + "21": {sysfs: 65, cdev: cdevPin{chip: 0, line: 65}}, // SPI0_MISO/GPIOC1 + "23": {sysfs: 66, cdev: cdevPin{chip: 0, line: 66}}, // SPI0_CLK/GPIOC2 + "24": {sysfs: 67, cdev: cdevPin{chip: 0, line: 67}}, // SPI0_CS/GPIOC3 + "8": {sysfs: 198, cdev: cdevPin{chip: 0, line: 198}}, // UART1_TX/GPIOG6 + "10": {sysfs: 199, cdev: cdevPin{chip: 0, line: 199}}, // UART1_RX/GPIOG7 + "16": {sysfs: 200, cdev: cdevPin{chip: 0, line: 200}}, // UART1_RTS/GPIOG8 + "18": {sysfs: 201, cdev: cdevPin{chip: 0, line: 201}}, // UART1_CTS/GPIOG9 + "7": {sysfs: 203, cdev: cdevPin{chip: 0, line: 203}}, // GPIOG11 } var neoPwmPins = map[string]pwmPinDefinition{ // UART_RXD0, GPIOA5, PWM - "PWM": pwmPinDefinition{dir: "/sys/devices/platform/soc/1c21400.pwm/pwm/", dirRegexp: "pwmchip[0]$", channel: 0}, + "PWM": {dir: "/sys/devices/platform/soc/1c21400.pwm/pwm/", dirRegexp: "pwmchip[0]$", channel: 0}, } diff --git a/platforms/tinkerboard/pin_map.go b/platforms/tinkerboard/pin_map.go index 2039b182d..aa396d9cb 100644 --- a/platforms/tinkerboard/pin_map.go +++ b/platforms/tinkerboard/pin_map.go @@ -14,39 +14,39 @@ type gpioPinDefinition struct { // pins: A=0+Nr, B=8+Nr, C=16+Nr // tested: armbian Linux, OK: work as input and output, IN: work only as input var gpioPinDefinitions = map[string]gpioPinDefinition{ - "7": gpioPinDefinition{sysfs: 17, cdev: cdevPin{chip: 0, line: 17}}, // GPIO0_C1_CLKOUT - OK - "10": gpioPinDefinition{sysfs: 160, cdev: cdevPin{chip: 5, line: 8}}, // GPIO5_B0_UART1RX - IN, initial 1 - "8": gpioPinDefinition{sysfs: 161, cdev: cdevPin{chip: 5, line: 9}}, // GPIO5_B1_UART1TX - NO, initial 1 - "16": gpioPinDefinition{sysfs: 162, cdev: cdevPin{chip: 5, line: 10}}, // GPIO5_B2_UART1CTSN - NO, initial 0 - "18": gpioPinDefinition{sysfs: 163, cdev: cdevPin{chip: 5, line: 11}}, // GPIO5_B3_UART1RTSN - NO, initial 0 - "11": gpioPinDefinition{sysfs: 164, cdev: cdevPin{chip: 5, line: 12}}, // GPIO5_B4_SPI0CLK_UART4CTSN - NO, initial 0 - "29": gpioPinDefinition{sysfs: 165, cdev: cdevPin{chip: 5, line: 13}}, // GPIO5_B5_SPI0CSN_UART4RTSN - NO, initial 0 - "13": gpioPinDefinition{sysfs: 166, cdev: cdevPin{chip: 5, line: 14}}, // GPIO5_B6_SPI0_TXD_UART4TX - NO, initial 1 - "15": gpioPinDefinition{sysfs: 167, cdev: cdevPin{chip: 5, line: 15}}, // GPIO5_B7_SPI0_RXD_UART4RX - IN, initial 1 - "31": gpioPinDefinition{sysfs: 168, cdev: cdevPin{chip: 5, line: 16}}, // GPIO5_C0_SPI0CSN1 - OK if SPI0 off - "22": gpioPinDefinition{sysfs: 171, cdev: cdevPin{chip: 5, line: 19}}, // GPIO5_C3 - OK - "12": gpioPinDefinition{sysfs: 184, cdev: cdevPin{chip: 6, line: 0}}, // GPIO6_A0_PCM/I2S_CLK - NO, initial 1 - "35": gpioPinDefinition{sysfs: 185, cdev: cdevPin{chip: 6, line: 1}}, // GPIO6_A1_PCM/I2S_FS - NO, initial 0 - "38": gpioPinDefinition{sysfs: 187, cdev: cdevPin{chip: 6, line: 3}}, // GPIO6_A3_PCM/I2S_SDI - IN, initial 1 - "40": gpioPinDefinition{sysfs: 188, cdev: cdevPin{chip: 6, line: 4}}, // GPIO6_A4_PCM/I2S_SDO - NO, initial 0 - "36": gpioPinDefinition{sysfs: 223, cdev: cdevPin{chip: 7, line: 7}}, // GPIO7_A7_UART3RX - IN, initial 1 - "37": gpioPinDefinition{sysfs: 224, cdev: cdevPin{chip: 7, line: 8}}, // GPIO7_B0_UART3TX - NO, initial 1 - "27": gpioPinDefinition{sysfs: 233, cdev: cdevPin{chip: 7, line: 17}}, // GPIO7_C1_I2C4_SDA - OK if I2C4 off - "28": gpioPinDefinition{sysfs: 234, cdev: cdevPin{chip: 7, line: 18}}, // GPIO7_C2_I2C_SCL - OK if I2C4 off - "33": gpioPinDefinition{sysfs: 238, cdev: cdevPin{chip: 7, line: 22}}, // GPIO7_C6_UART2RX_PWM2 - IN, initial 1 - "32": gpioPinDefinition{sysfs: 239, cdev: cdevPin{chip: 7, line: 23}}, // GPIO7_C7_UART2TX_PWM3 - NO, initial 1 - "26": gpioPinDefinition{sysfs: 251, cdev: cdevPin{chip: 8, line: 3}}, // GPIO8_A3_SPI2CSN1 - OK if SPI2 off - "3": gpioPinDefinition{sysfs: 252, cdev: cdevPin{chip: 8, line: 4}}, // GPIO8_A4_I2C1_SDA - OK if I2C1 off - "5": gpioPinDefinition{sysfs: 253, cdev: cdevPin{chip: 8, line: 5}}, // GPIO8_A5_I2C1_SCL - OK if I2C1 off - "23": gpioPinDefinition{sysfs: 254, cdev: cdevPin{chip: 8, line: 6}}, // GPIO8_A6_SPI2CLK - OK if SPI2 off - "24": gpioPinDefinition{sysfs: 255, cdev: cdevPin{chip: 8, line: 7}}, // GPIO8_A7_SPI2CSN0 - OK if SPI2 off - "21": gpioPinDefinition{sysfs: 256, cdev: cdevPin{chip: 8, line: 8}}, // GPIO8_B0_SPI2RXD - OK if SPI2 off - "19": gpioPinDefinition{sysfs: 257, cdev: cdevPin{chip: 8, line: 9}}, // GPIO8_B1_SPI2TXD - OK if SPI2 off + "7": {sysfs: 17, cdev: cdevPin{chip: 0, line: 17}}, // GPIO0_C1_CLKOUT - OK + "10": {sysfs: 160, cdev: cdevPin{chip: 5, line: 8}}, // GPIO5_B0_UART1RX - IN, initial 1 + "8": {sysfs: 161, cdev: cdevPin{chip: 5, line: 9}}, // GPIO5_B1_UART1TX - NO, initial 1 + "16": {sysfs: 162, cdev: cdevPin{chip: 5, line: 10}}, // GPIO5_B2_UART1CTSN - NO, initial 0 + "18": {sysfs: 163, cdev: cdevPin{chip: 5, line: 11}}, // GPIO5_B3_UART1RTSN - NO, initial 0 + "11": {sysfs: 164, cdev: cdevPin{chip: 5, line: 12}}, // GPIO5_B4_SPI0CLK_UART4CTSN - NO, initial 0 + "29": {sysfs: 165, cdev: cdevPin{chip: 5, line: 13}}, // GPIO5_B5_SPI0CSN_UART4RTSN - NO, initial 0 + "13": {sysfs: 166, cdev: cdevPin{chip: 5, line: 14}}, // GPIO5_B6_SPI0_TXD_UART4TX - NO, initial 1 + "15": {sysfs: 167, cdev: cdevPin{chip: 5, line: 15}}, // GPIO5_B7_SPI0_RXD_UART4RX - IN, initial 1 + "31": {sysfs: 168, cdev: cdevPin{chip: 5, line: 16}}, // GPIO5_C0_SPI0CSN1 - OK if SPI0 off + "22": {sysfs: 171, cdev: cdevPin{chip: 5, line: 19}}, // GPIO5_C3 - OK + "12": {sysfs: 184, cdev: cdevPin{chip: 6, line: 0}}, // GPIO6_A0_PCM/I2S_CLK - NO, initial 1 + "35": {sysfs: 185, cdev: cdevPin{chip: 6, line: 1}}, // GPIO6_A1_PCM/I2S_FS - NO, initial 0 + "38": {sysfs: 187, cdev: cdevPin{chip: 6, line: 3}}, // GPIO6_A3_PCM/I2S_SDI - IN, initial 1 + "40": {sysfs: 188, cdev: cdevPin{chip: 6, line: 4}}, // GPIO6_A4_PCM/I2S_SDO - NO, initial 0 + "36": {sysfs: 223, cdev: cdevPin{chip: 7, line: 7}}, // GPIO7_A7_UART3RX - IN, initial 1 + "37": {sysfs: 224, cdev: cdevPin{chip: 7, line: 8}}, // GPIO7_B0_UART3TX - NO, initial 1 + "27": {sysfs: 233, cdev: cdevPin{chip: 7, line: 17}}, // GPIO7_C1_I2C4_SDA - OK if I2C4 off + "28": {sysfs: 234, cdev: cdevPin{chip: 7, line: 18}}, // GPIO7_C2_I2C_SCL - OK if I2C4 off + "33": {sysfs: 238, cdev: cdevPin{chip: 7, line: 22}}, // GPIO7_C6_UART2RX_PWM2 - IN, initial 1 + "32": {sysfs: 239, cdev: cdevPin{chip: 7, line: 23}}, // GPIO7_C7_UART2TX_PWM3 - NO, initial 1 + "26": {sysfs: 251, cdev: cdevPin{chip: 8, line: 3}}, // GPIO8_A3_SPI2CSN1 - OK if SPI2 off + "3": {sysfs: 252, cdev: cdevPin{chip: 8, line: 4}}, // GPIO8_A4_I2C1_SDA - OK if I2C1 off + "5": {sysfs: 253, cdev: cdevPin{chip: 8, line: 5}}, // GPIO8_A5_I2C1_SCL - OK if I2C1 off + "23": {sysfs: 254, cdev: cdevPin{chip: 8, line: 6}}, // GPIO8_A6_SPI2CLK - OK if SPI2 off + "24": {sysfs: 255, cdev: cdevPin{chip: 8, line: 7}}, // GPIO8_A7_SPI2CSN0 - OK if SPI2 off + "21": {sysfs: 256, cdev: cdevPin{chip: 8, line: 8}}, // GPIO8_B0_SPI2RXD - OK if SPI2 off + "19": {sysfs: 257, cdev: cdevPin{chip: 8, line: 9}}, // GPIO8_B1_SPI2TXD - OK if SPI2 off } var pwmPinDefinitions = map[string]pwmPinDefinition{ // GPIO7_C6_UART2RX_PWM2 - "33": pwmPinDefinition{dir: "/sys/devices/platform/ff680020.pwm/pwm/", dirRegexp: "pwmchip[0|1|2]$", channel: 0}, + "33": {dir: "/sys/devices/platform/ff680020.pwm/pwm/", dirRegexp: "pwmchip[0|1|2]$", channel: 0}, // GPIO7_C7_UART2TX_PWM3 - "32": pwmPinDefinition{dir: "/sys/devices/platform/ff680030.pwm/pwm/", dirRegexp: "pwmchip[0|1|2|3]$", channel: 0}, + "32": {dir: "/sys/devices/platform/ff680030.pwm/pwm/", dirRegexp: "pwmchip[0|1|2|3]$", channel: 0}, } From bc3d7d4194a6632350127e57fff445ea0305265d Mon Sep 17 00:00:00 2001 From: Thomas Kohler Date: Mon, 19 Jun 2023 16:06:44 +0200 Subject: [PATCH 17/20] system(syscall): switch to x/sys (#963) --- .golangci.yml | 3 ++- Makefile | 2 +- drivers/i2c/i2c_connection_test.go | 11 +++++------ system/digitalpin_sysfs.go | 5 ++--- system/digitalpin_sysfs_test.go | 9 ++++----- system/i2c_device.go | 3 +-- system/i2c_device_test.go | 29 ++++++++++++++--------------- system/pwmpin_sysfs.go | 3 +-- system/pwmpin_sysfs_test.go | 13 ++++++------- system/syscall.go | 26 ++++++++++++++++++++++---- system/syscall_mock.go | 5 ++--- system/system.go | 3 +-- 12 files changed, 61 insertions(+), 51 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 421b80750..68e4a90a6 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -32,7 +32,7 @@ linters: # currently active linters: # #INFO [lintersdb] Active 35 linters: [asasalint asciicheck bidichk contextcheck decorder depguard durationcheck errcheck exportloopref - # gocheckcompilerdirectives gomoddirectives gomodguard goprintffuncname gosimple govet grouper importas ineffassign mirror musttag + # gocheckcompilerdirectives gomoddirectives gomodguard goprintffuncname gosimple govet grouper ineffassign mirror musttag # nilerr nilnil nolintlint nosprintfhostport prealloc reassign revive staticcheck tagalign tenv testableexamples tparallel typecheck unused wastedassign] enable-all: true @@ -62,6 +62,7 @@ linters: - goerr113 # not used (we allow error creation at return statement) - gofumpt # not used (we use "go fmt" or "gofmt" not gofumpt" - gosmopolitan # not needed (report i18n/l10n anti-patterns) + - importas # not needed (there is no alias rule at the moment) - ireturn # not used (we allow return interfaces) - loggercheck # not needed (relates to kitlog, klog, logr, zap) - paralleltest # not used diff --git a/Makefile b/Makefile index 75757935c..4d7c4b56d 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ including_except := $(shell go list ./... | grep -v platforms/opencv) # Run tests on nearly all directories without test cache test: - go test -count=1 -v $(including_except) + go test -failfast -count=1 -v $(including_except) # Run tests with race detection test_race: diff --git a/drivers/i2c/i2c_connection_test.go b/drivers/i2c/i2c_connection_test.go index f8a1a17da..7e7600742 100644 --- a/drivers/i2c/i2c_connection_test.go +++ b/drivers/i2c/i2c_connection_test.go @@ -7,7 +7,6 @@ import ( "errors" "testing" - "syscall" "unsafe" "gobot.io/x/gobot/v2" @@ -17,13 +16,13 @@ import ( const dev = "/dev/i2c-1" -func getSyscallFuncImpl(errorMask byte) func(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) { +func getSyscallFuncImpl(errorMask byte) func(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err system.SyscallErrno) { // bit 0: error on function query // bit 1: error on set address // bit 2: error on command - return func(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) { + return func(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err system.SyscallErrno) { // function query - if (trap == syscall.SYS_IOCTL) && (a2 == system.I2C_FUNCS) { + if (trap == system.Syscall_SYS_IOCTL) && (a2 == system.I2C_FUNCS) { if errorMask&0x01 == 0x01 { return 0, 0, 1 } @@ -35,13 +34,13 @@ func getSyscallFuncImpl(errorMask byte) func(trap, a1, a2, a3 uintptr) (r1, r2 u system.I2C_FUNC_SMBUS_WRITE_WORD_DATA } // set address - if (trap == syscall.SYS_IOCTL) && (a2 == system.I2C_SLAVE) { + if (trap == system.Syscall_SYS_IOCTL) && (a2 == system.I2C_SLAVE) { if errorMask&0x02 == 0x02 { return 0, 0, 1 } } // command - if (trap == syscall.SYS_IOCTL) && (a2 == system.I2C_SMBUS) { + if (trap == system.Syscall_SYS_IOCTL) && (a2 == system.I2C_SMBUS) { if errorMask&0x04 == 0x04 { return 0, 0, 1 } diff --git a/system/digitalpin_sysfs.go b/system/digitalpin_sysfs.go index 7516a49d6..b716ff639 100644 --- a/system/digitalpin_sysfs.go +++ b/system/digitalpin_sysfs.go @@ -7,7 +7,6 @@ import ( "log" "os" "strconv" - "syscall" "time" "gobot.io/x/gobot/v2" @@ -92,7 +91,7 @@ func (d *digitalPinSysfs) Unexport() error { if err != nil { // If EINVAL then the pin is reserved in the system and can't be unexported e, ok := err.(*os.PathError) - if !ok || e.Err != syscall.EINVAL { + if !ok || e.Err != Syscall_EINVAL { return err } } @@ -126,7 +125,7 @@ func (d *digitalPinSysfs) reconfigure() error { if err != nil { // If EBUSY then the pin has already been exported e, ok := err.(*os.PathError) - if !ok || e.Err != syscall.EBUSY { + if !ok || e.Err != Syscall_EBUSY { return err } } diff --git a/system/digitalpin_sysfs_test.go b/system/digitalpin_sysfs_test.go index ba1699840..992a06be5 100644 --- a/system/digitalpin_sysfs_test.go +++ b/system/digitalpin_sysfs_test.go @@ -3,7 +3,6 @@ package system import ( "errors" "os" - "syscall" "testing" "gobot.io/x/gobot/v2" @@ -63,7 +62,7 @@ func TestDigitalPin(t *testing.T) { gobottest.Assert(t, data, 0) writeFile = func(File, []byte) (int, error) { - return 0, &os.PathError{Err: syscall.EINVAL} + return 0, &os.PathError{Err: Syscall_EINVAL} } err = pin.Unexport() @@ -81,7 +80,7 @@ func TestDigitalPin(t *testing.T) { writeFile = func(File, []byte) (int, error) { cnt++ if cnt == 1 { - return 0, &os.PathError{Err: syscall.EBUSY} + return 0, &os.PathError{Err: Syscall_EBUSY} } return 0, nil } @@ -104,7 +103,7 @@ func TestDigitalPinExportError(t *testing.T) { pin, _ := initTestDigitalPinSysFsWithMockedFilesystem(mockPaths) writeFile = func(File, []byte) (int, error) { - return 0, &os.PathError{Err: syscall.EBUSY} + return 0, &os.PathError{Err: Syscall_EBUSY} } err := pin.Export() @@ -118,7 +117,7 @@ func TestDigitalPinUnexportError(t *testing.T) { pin, _ := initTestDigitalPinSysFsWithMockedFilesystem(mockPaths) writeFile = func(File, []byte) (int, error) { - return 0, &os.PathError{Err: syscall.EBUSY} + return 0, &os.PathError{Err: Syscall_EBUSY} } err := pin.Unexport() diff --git a/system/i2c_device.go b/system/i2c_device.go index 754d2a536..9b7717527 100644 --- a/system/i2c_device.go +++ b/system/i2c_device.go @@ -5,7 +5,6 @@ import ( "log" "os" "sync" - "syscall" "unsafe" ) @@ -375,7 +374,7 @@ func (d *i2cDevice) syscallIoctl(signal uintptr, payload unsafe.Pointer, sender if err := d.openFileLazy(sender); err != nil { return err } - if _, _, errno := d.sys.syscall(syscall.SYS_IOCTL, d.file, signal, payload); errno != 0 { + if _, _, errno := d.sys.syscall(Syscall_SYS_IOCTL, d.file, signal, payload); errno != 0 { return fmt.Errorf("%s failed with syscall.Errno %v", sender, errno) } diff --git a/system/i2c_device_test.go b/system/i2c_device_test.go index deeacb343..f40124d03 100644 --- a/system/i2c_device_test.go +++ b/system/i2c_device_test.go @@ -3,7 +3,6 @@ package system import ( "errors" "os" - "syscall" "testing" "unsafe" @@ -13,13 +12,13 @@ import ( const dev = "/dev/i2c-1" -func getSyscallFuncImpl(errorMask byte) func(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) { +func getSyscallFuncImpl(errorMask byte) func(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err SyscallErrno) { // bit 0: error on function query // bit 1: error on set address // bit 2: error on command - return func(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) { + return func(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err SyscallErrno) { // function query - if (trap == syscall.SYS_IOCTL) && (a2 == I2C_FUNCS) { + if (trap == Syscall_SYS_IOCTL) && (a2 == I2C_FUNCS) { if errorMask&0x01 == 0x01 { return 0, 0, 1 } @@ -31,13 +30,13 @@ func getSyscallFuncImpl(errorMask byte) func(trap, a1, a2, a3 uintptr) (r1, r2 u I2C_FUNC_SMBUS_WRITE_WORD_DATA } // set address - if (trap == syscall.SYS_IOCTL) && (a2 == I2C_SLAVE) { + if (trap == Syscall_SYS_IOCTL) && (a2 == I2C_SLAVE) { if errorMask&0x02 == 0x02 { return 0, 0, 1 } } // command - if (trap == syscall.SYS_IOCTL) && (a2 == I2C_SMBUS) { + if (trap == Syscall_SYS_IOCTL) && (a2 == I2C_SMBUS) { if errorMask&0x04 == 0x04 { return 0, 0, 1 } @@ -117,7 +116,7 @@ func TestWriteRead(t *testing.T) { func TestReadByte(t *testing.T) { var tests = map[string]struct { funcs uint64 - syscallImpl func(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) + syscallImpl func(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err SyscallErrno) wantErr string }{ "read_byte_ok": { @@ -161,7 +160,7 @@ func TestReadByte(t *testing.T) { func TestReadByteData(t *testing.T) { var tests = map[string]struct { funcs uint64 - syscallImpl func(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) + syscallImpl func(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err SyscallErrno) wantErr string }{ "read_byte_data_ok": { @@ -208,7 +207,7 @@ func TestReadByteData(t *testing.T) { func TestReadWordData(t *testing.T) { var tests = map[string]struct { funcs uint64 - syscallImpl func(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) + syscallImpl func(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err SyscallErrno) wantErr string }{ "read_word_data_ok": { @@ -272,7 +271,7 @@ func TestReadBlockData(t *testing.T) { ) var tests = map[string]struct { funcs uint64 - syscallImpl func(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) + syscallImpl func(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err SyscallErrno) wantErr string }{ "read_block_data_ok": { @@ -317,7 +316,7 @@ func TestReadBlockData(t *testing.T) { func TestWriteByte(t *testing.T) { var tests = map[string]struct { funcs uint64 - syscallImpl func(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) + syscallImpl func(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err SyscallErrno) wantErr string }{ "write_byte_ok": { @@ -359,7 +358,7 @@ func TestWriteByte(t *testing.T) { func TestWriteByteData(t *testing.T) { var tests = map[string]struct { funcs uint64 - syscallImpl func(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) + syscallImpl func(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err SyscallErrno) wantErr string }{ "write_byte_data_ok": { @@ -406,7 +405,7 @@ func TestWriteByteData(t *testing.T) { func TestWriteWordData(t *testing.T) { var tests = map[string]struct { funcs uint64 - syscallImpl func(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) + syscallImpl func(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err SyscallErrno) wantErr string }{ "write_word_data_ok": { @@ -471,7 +470,7 @@ func TestWriteBlockData(t *testing.T) { ) var tests = map[string]struct { funcs uint64 - syscallImpl func(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) + syscallImpl func(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err SyscallErrno) wantErr string }{ "write_block_data_ok": { @@ -533,7 +532,7 @@ func Test_queryFunctionality(t *testing.T) { var tests = map[string]struct { requested uint64 dev string - syscallImpl func(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) + syscallImpl func(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err SyscallErrno) wantErr string wantFile bool wantFuncs uint64 diff --git a/system/pwmpin_sysfs.go b/system/pwmpin_sysfs.go index 1b1cf78e1..d695c6761 100644 --- a/system/pwmpin_sysfs.go +++ b/system/pwmpin_sysfs.go @@ -6,7 +6,6 @@ import ( "os" "path" "strconv" - "syscall" "time" ) @@ -50,7 +49,7 @@ func (p *pwmPinSysFs) Export() error { if err != nil { // If EBUSY then the pin has already been exported e, ok := err.(*os.PathError) - if !ok || e.Err != syscall.EBUSY { + if !ok || e.Err != Syscall_EBUSY { return fmt.Errorf(pwmPinErrorPattern, "Export", p.pin, err) } } diff --git a/system/pwmpin_sysfs_test.go b/system/pwmpin_sysfs_test.go index 986fc43a3..44c224973 100644 --- a/system/pwmpin_sysfs_test.go +++ b/system/pwmpin_sysfs_test.go @@ -2,7 +2,6 @@ package system import ( "os" - "syscall" "testing" "gobot.io/x/gobot/v2" @@ -85,7 +84,7 @@ func TestPwmPinAlreadyExported(t *testing.T) { pin, _ := initTestPWMPinSysFsWithMockedFilesystem(mockedPaths) pin.write = func(filesystem, string, []byte) (int, error) { - return 0, &os.PathError{Err: syscall.EBUSY} + return 0, &os.PathError{Err: Syscall_EBUSY} } // no error indicates that the pin was already exported @@ -103,7 +102,7 @@ func TestPwmPinExportError(t *testing.T) { pin, _ := initTestPWMPinSysFsWithMockedFilesystem(mockedPaths) pin.write = func(filesystem, string, []byte) (int, error) { - return 0, &os.PathError{Err: syscall.EFAULT} + return 0, &os.PathError{Err: Syscall_EFAULT} } // no error indicates that the pin was already exported @@ -122,7 +121,7 @@ func TestPwmPinUnxportError(t *testing.T) { pin, _ := initTestPWMPinSysFsWithMockedFilesystem(mockedPaths) pin.write = func(filesystem, string, []byte) (int, error) { - return 0, &os.PathError{Err: syscall.EBUSY} + return 0, &os.PathError{Err: Syscall_EBUSY} } err := pin.Unexport() @@ -140,7 +139,7 @@ func TestPwmPinPeriodError(t *testing.T) { pin, _ := initTestPWMPinSysFsWithMockedFilesystem(mockedPaths) pin.read = func(filesystem, string) ([]byte, error) { - return nil, &os.PathError{Err: syscall.EBUSY} + return nil, &os.PathError{Err: Syscall_EBUSY} } _, err := pin.Period() @@ -158,7 +157,7 @@ func TestPwmPinPolarityError(t *testing.T) { pin, _ := initTestPWMPinSysFsWithMockedFilesystem(mockedPaths) pin.read = func(filesystem, string) ([]byte, error) { - return nil, &os.PathError{Err: syscall.EBUSY} + return nil, &os.PathError{Err: Syscall_EBUSY} } _, err := pin.Polarity() @@ -176,7 +175,7 @@ func TestPwmPinDutyCycleError(t *testing.T) { pin, _ := initTestPWMPinSysFsWithMockedFilesystem(mockedPaths) pin.read = func(filesystem, string) ([]byte, error) { - return nil, &os.PathError{Err: syscall.EBUSY} + return nil, &os.PathError{Err: Syscall_EBUSY} } _, err := pin.DutyCycle() diff --git a/system/syscall.go b/system/syscall.go index ae630adec..633bd9ba9 100644 --- a/system/syscall.go +++ b/system/syscall.go @@ -1,14 +1,32 @@ package system import ( - "syscall" "unsafe" + + "golang.org/x/sys/unix" +) + +// SyscallErrno wraps the "unix.Errno" +type SyscallErrno unix.Errno + +// wrapping for used constants of unix package +const ( + Syscall_SYS_IOCTL = unix.SYS_IOCTL + Syscall_EINVAL = unix.EINVAL + Syscall_EBUSY = unix.EBUSY + Syscall_EFAULT = unix.EFAULT ) // nativeSyscall represents the native Syscall type nativeSyscall struct{} -// Syscall calls the native syscall.Syscall, implements the SystemCaller interface -func (sys *nativeSyscall) syscall(trap uintptr, f File, signal uintptr, payload unsafe.Pointer) (r1, r2 uintptr, err syscall.Errno) { - return syscall.Syscall(trap, f.Fd(), signal, uintptr(payload)) +// Syscall calls the native unix.Syscall, implements the SystemCaller interface +func (sys *nativeSyscall) syscall(trap uintptr, f File, signal uintptr, payload unsafe.Pointer) (r1, r2 uintptr, err SyscallErrno) { + r1, r2, errNo := unix.Syscall(trap, f.Fd(), signal, uintptr(payload)) + return r1, r2, SyscallErrno(errNo) +} + +// Error implements the error interface. It wraps the "unix.Errno.Error()". +func (e SyscallErrno) Error() string { + return unix.Errno(e).Error() } diff --git a/system/syscall_mock.go b/system/syscall_mock.go index ce8496128..8f00d0198 100644 --- a/system/syscall_mock.go +++ b/system/syscall_mock.go @@ -1,7 +1,6 @@ package system import ( - "syscall" "unsafe" ) @@ -14,11 +13,11 @@ type mockSyscall struct { smbus *i2cSmbusIoctlData sliceSize uint8 dataSlice []byte - Impl func(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) + Impl func(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err SyscallErrno) } // Syscall calls the user defined implementation, used for tests, implements the SystemCaller interface -func (sys *mockSyscall) syscall(trap uintptr, f File, signal uintptr, payload unsafe.Pointer) (r1, r2 uintptr, err syscall.Errno) { +func (sys *mockSyscall) syscall(trap uintptr, f File, signal uintptr, payload unsafe.Pointer) (r1, r2 uintptr, err SyscallErrno) { sys.lastTrap = trap // points to the used syscall (e.g. "SYS_IOCTL") sys.lastFile = f // a character device file (e.g. file to path "/dev/i2c-1") sys.lastSignal = signal // points to used function type (e.g. I2C_SMBUS, I2C_RDWR) diff --git a/system/system.go b/system/system.go index 06111acdd..824d43865 100644 --- a/system/system.go +++ b/system/system.go @@ -2,7 +2,6 @@ package system import ( "os" - "syscall" "unsafe" "gobot.io/x/gobot/v2" @@ -33,7 +32,7 @@ type filesystem interface { // systemCaller represents unexposed Syscall interface to allow the switch between native and mocked implementation // Prevent unsafe call, since go 1.15, see "Pattern 4" in: https://go101.org/article/unsafe.html type systemCaller interface { - syscall(trap uintptr, f File, signal uintptr, payload unsafe.Pointer) (r1, r2 uintptr, err syscall.Errno) + syscall(trap uintptr, f File, signal uintptr, payload unsafe.Pointer) (r1, r2 uintptr, err SyscallErrno) } // digitalPinAccesser represents unexposed interface to allow the switch between different implementations and From a6d657118ef188919ada64caea56b5823aaf70fd Mon Sep 17 00:00:00 2001 From: Thomas Kohler Date: Tue, 20 Jun 2023 19:07:24 +0200 Subject: [PATCH 18/20] build(linter): fix makezero linter issue (#965) --- .golangci.yml | 3 +-- robot_work_test.go | 6 ++++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 68e4a90a6..c1b5f1f2e 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -32,7 +32,7 @@ linters: # currently active linters: # #INFO [lintersdb] Active 35 linters: [asasalint asciicheck bidichk contextcheck decorder depguard durationcheck errcheck exportloopref - # gocheckcompilerdirectives gomoddirectives gomodguard goprintffuncname gosimple govet grouper ineffassign mirror musttag + # gocheckcompilerdirectives gomoddirectives gomodguard goprintffuncname gosimple govet grouper ineffassign makezero mirror musttag # nilerr nilnil nolintlint nosprintfhostport prealloc reassign revive staticcheck tagalign tenv testableexamples tparallel typecheck unused wastedassign] enable-all: true @@ -74,7 +74,6 @@ linters: - zerologlint # not needed (related to zerolog package) # important to have - gofmt # important to prevent "format tsunami" ("gofmt -s -w" missed), disabled due to "https://github.com/golangci/golangci-lint-action/issues/535" - - makezero # very important (find/reduce bugs, e.g. in robot_work_test.go) - nakedret # very useful together with "nonamedreturns" (reduce bugs) - nonamedreturns # very useful (reduce bugs) - unconvert # very useful (reduce bugs, simplify code) diff --git a/robot_work_test.go b/robot_work_test.go index 761dd28c6..36ed3b4bd 100644 --- a/robot_work_test.go +++ b/robot_work_test.go @@ -94,8 +94,10 @@ func TestRobotAutomationFunctions(t *testing.T) { func collectStringKeysFromWorkRegistry(rwr *RobotWorkRegistry) []string { keys := make([]string, len(rwr.r)) - for k := range rwr.r { - keys = append(keys, k) + var idx int + for key := range rwr.r { + keys[idx] = key + idx++ } return keys } From b0ee8b931e9ffa5c17a5c11d82dad41cacf8800d Mon Sep 17 00:00:00 2001 From: Thomas Kohler Date: Thu, 6 Jul 2023 19:05:12 +0200 Subject: [PATCH 19/20] doc: adjust README.md regarding to your first project (#970) --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 9b56dd39c..560c40eb4 100644 --- a/README.md +++ b/README.md @@ -41,12 +41,14 @@ Create a new folder and a new Go module project. ```sh mkdir ~/my_gobot_example +cd ~/my_gobot_example go mod init my.gobot.example.com ``` Copy your example file besides the go.mod file, import the requirements and build. ```sh +cp //examples/raspi_blink.go ~/my_gobot_example/ go mod tidy env GOOS=linux GOARCH=arm GOARM=5 go build -o ./output/my_raspi_bink raspi_blink.go ``` From f92890384a1a7d737fb432fe68b9ab6c5972da52 Mon Sep 17 00:00:00 2001 From: Thomas Kohler Date: Thu, 6 Jul 2023 19:32:50 +0200 Subject: [PATCH 20/20] build(deps): module update (#971) --- go.mod | 10 +++++----- go.sum | 20 ++++++++++---------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/go.mod b/go.mod index 2281cc52f..044643eea 100644 --- a/go.mod +++ b/go.mod @@ -10,14 +10,15 @@ require ( github.com/hashicorp/go-multierror v1.1.1 github.com/hybridgroup/go-ardrone v0.0.0-20140402002621-b9750d8d7b78 github.com/hybridgroup/mjpeg v0.0.0-20140228234708-4680f319790e - github.com/nats-io/nats.go v1.27.0 + github.com/nats-io/nats.go v1.27.1 github.com/sigurn/crc8 v0.0.0-20220107193325-2243fe600f9f github.com/stretchr/testify v1.8.4 github.com/veandco/go-sdl2 v0.4.35 github.com/warthog618/gpiod v0.8.1 go.bug.st/serial v1.5.0 gocv.io/x/gocv v0.33.0 - golang.org/x/net v0.11.0 + golang.org/x/net v0.12.0 + golang.org/x/sys v0.10.0 periph.io/x/conn/v3 v3.7.0 periph.io/x/host/v3 v3.8.2 tinygo.org/x/bluetooth v0.7.0 @@ -32,7 +33,7 @@ require ( github.com/golang/protobuf v1.5.0 // indirect github.com/gorilla/websocket v1.5.0 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect - github.com/klauspost/compress v1.16.6 // indirect + github.com/klauspost/compress v1.16.7 // indirect github.com/muka/go-bluetooth v0.0.0-20221213043340-85dc80edc4e1 // indirect github.com/nats-io/nats-server/v2 v2.7.4 // indirect github.com/nats-io/nkeys v0.4.4 // indirect @@ -41,9 +42,8 @@ require ( github.com/saltosystems/winrt-go v0.0.0-20230613063811-c792451fa808 // indirect github.com/sirupsen/logrus v1.9.3 // indirect github.com/tinygo-org/cbgo v0.0.4 // indirect - golang.org/x/crypto v0.10.0 // indirect + golang.org/x/crypto v0.11.0 // indirect golang.org/x/sync v0.3.0 // indirect - golang.org/x/sys v0.9.0 // indirect google.golang.org/protobuf v1.28.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 48bfa4d04..f590e4b61 100644 --- a/go.sum +++ b/go.sum @@ -44,8 +44,8 @@ github.com/hybridgroup/go-ardrone v0.0.0-20140402002621-b9750d8d7b78 h1:7of6LJZ4 github.com/hybridgroup/go-ardrone v0.0.0-20140402002621-b9750d8d7b78/go.mod h1:YllNbhGM1UEcySxCv1BWK5lre7QLmJJ+O0ADUOo2nbc= github.com/hybridgroup/mjpeg v0.0.0-20140228234708-4680f319790e h1:xCcwD5FOXul+j1dn8xD16nbrhJkkum/Cn+jTd/u1LhY= github.com/hybridgroup/mjpeg v0.0.0-20140228234708-4680f319790e/go.mod h1:eagM805MRKrioHYuU7iKLUyFPVKqVV6um5DAvCkUtXs= -github.com/klauspost/compress v1.16.6 h1:91SKEy4K37vkp255cJ8QesJhjyRO0hn9i9G0GoUwLsk= -github.com/klauspost/compress v1.16.6/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= +github.com/klauspost/compress v1.16.7 h1:2mk3MPGNzKyxErAw8YaohYh69+pa4sIQSC0fPGCFR9I= +github.com/klauspost/compress v1.16.7/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= @@ -59,8 +59,8 @@ github.com/muka/go-bluetooth v0.0.0-20221213043340-85dc80edc4e1/go.mod h1:dMCjic github.com/nats-io/jwt/v2 v2.2.1-0.20220113022732-58e87895b296 h1:vU9tpM3apjYlLLeY23zRWJ9Zktr5jp+mloR942LEOpY= github.com/nats-io/nats-server/v2 v2.7.4 h1:c+BZJ3rGzUKCBIM4IXO8uNT2u1vajGbD1kPA6wqCEaM= github.com/nats-io/nats-server/v2 v2.7.4/go.mod h1:1vZ2Nijh8tcyNe8BDVyTviCd9NYzRbubQYiEHsvOQWc= -github.com/nats-io/nats.go v1.27.0 h1:3o9fsPhmoKm+yK7rekH2GtWoE+D9jFbw8N3/ayI1C00= -github.com/nats-io/nats.go v1.27.0/go.mod h1:XpbWUlOElGwTYbMR7imivs7jJj9GtK7ypv321Wp6pjc= +github.com/nats-io/nats.go v1.27.1 h1:OuYnal9aKVSnOzLQIzf7554OXMCG7KbaTkCSBHRcSoo= +github.com/nats-io/nats.go v1.27.1/go.mod h1:XpbWUlOElGwTYbMR7imivs7jJj9GtK7ypv321Wp6pjc= github.com/nats-io/nkeys v0.4.4 h1:xvBJ8d69TznjcQl9t6//Q5xXuVhyYiSos6RPtvQNTwA= github.com/nats-io/nkeys v0.4.4/go.mod h1:XUkxdLPTufzlihbamfzQ7mw/VGx6ObUs+0bN5sNvt64= github.com/nats-io/nuid v1.0.1 h1:5iA8DT8V7q8WK2EScv2padNa/rTESc1KdnPw4TC2paw= @@ -114,8 +114,8 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.10.0 h1:LKqV2xt9+kDzSTfOhx4FrkEBcMrAgHSYgzywV9zcGmM= -golang.org/x/crypto v0.10.0/go.mod h1:o4eNf7Ede1fv+hwOwZsTHl9EsPFO6q6ZvYR8vYfY45I= +golang.org/x/crypto v0.11.0 h1:6Ewdq3tDic1mg5xRO4milcWCfMVQhI4NkqWWvqejpuA= +golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio= golang.org/x/image v0.0.0-20210628002857-a66eb6448b8d/go.mod h1:023OzeP/+EPmXeapQh35lcL3II3LrY8Ic+EFFKVhULM= golang.org/x/image v0.0.0-20220617043117-41969df76e82/go.mod h1:doUCurBvlfPMKfmIpRIywoHmhN3VyhnoFDbvIEWF4hY= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= @@ -127,8 +127,8 @@ golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81R golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.11.0 h1:Gi2tvZIJyBtO9SDr1q9h5hEQCp/4L2RQ+ar0qjx2oNU= -golang.org/x/net v0.11.0/go.mod h1:2L/ixqYpgIVXmeoSA/4Lu7BzTG4KIyPIryS4IsOd1oQ= +golang.org/x/net v0.12.0 h1:cfawfvKITfUsFCeJIHJrbSxpeu/E81khclypR0GVT50= +golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -147,8 +147,8 @@ golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220624220833-87e55d714810/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220829200755-d48e67d00261/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s= -golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= +golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=