message: arduino_library_install: remove pointless sleeps

diff:
#!/bin/bash
[ ! -d $HOME/Arduino/libraries/FastLED ] && arduino --install-library "FastLED"
-sleep 1
[ ! -d $HOME/Arduino/libraries/MIDIUSB ] && arduino --install-library "MIDIUSB"
-sleep 1
[ ! -d $HOME/Arduino/libraries/TinyWireM ] && arduino --install-library "TinyWireM"
-sleep 1
# These are generated:
[ ! -d $HOME/Arduino/libraries/Adafruit_ADS1X15 ] && arduino --install-library "Adafruit ADS1X15"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_ADXL345 ] && arduino --install-library "Adafruit ADXL345"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_AHRS ] && arduino --install-library "Adafruit AHRS"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_AM2315 ] && arduino --install-library "Adafruit AM2315"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_AM2320_sensor_library ] && arduino --install-library "Adafruit AM2320 sensor library"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_AMG88xx_Library ] && arduino --install-library "Adafruit AMG88xx Library"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_AM_radio_library ] && arduino --install-library "Adafruit AM radio library"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_APDS9960_Library ] && arduino --install-library "Adafruit APDS9960 Library"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_BLEFirmata ] && arduino --install-library "Adafruit BLEFirmata"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_BluefruitLE_nRF51 ] && arduino --install-library "Adafruit BluefruitLE nRF51"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_BME280_Library ] && arduino --install-library "Adafruit BME280 Library"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_BME680_Library ] && arduino --install-library "Adafruit BME680 Library"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_BMP085_Library ] && arduino --install-library "Adafruit BMP085 Library"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_BMP085_Unified ] && arduino --install-library "Adafruit BMP085 Unified"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_BMP183_Library ] && arduino --install-library "Adafruit BMP183 Library"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_BMP183_Unified_Library ] && arduino --install-library "Adafruit BMP183 Unified Library"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_BMP280_Library ] && arduino --install-library "Adafruit BMP280 Library"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_BMP3XX_Library ] && arduino --install-library "Adafruit BMP3XX Library"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_BNO055 ] && arduino --install-library "Adafruit BNO055"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_CAP1188_Library ] && arduino --install-library "Adafruit CAP1188 Library"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_CC3000_Library ] && arduino --install-library "Adafruit CC3000 Library"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_CCS811_Library ] && arduino --install-library "Adafruit CCS811 Library"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_Circuit_Playground ] && arduino --install-library "Adafruit Circuit Playground"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_composite_video_Library ] && arduino --install-library "Adafruit composite video Library"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_DAP_library ] && arduino --install-library "Adafruit DAP library"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_DMA_neopixel_library ] && arduino --install-library "Adafruit DMA neopixel library"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_DotStar ] && arduino --install-library "Adafruit DotStar"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_DRV2605_Library ] && arduino --install-library "Adafruit DRV2605 Library"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_EPD ] && arduino --install-library "Adafruit EPD"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_ESP8266 ] && arduino --install-library "Adafruit ESP8266"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_Fingerprint_Sensor_Library ] && arduino --install-library "Adafruit Fingerprint Sensor Library"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_Flora_Pixel_Library ] && arduino --install-library "Adafruit Flora Pixel Library"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_FONA_Library ] && arduino --install-library "Adafruit FONA Library"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_FRAM_I2C ] && arduino --install-library "Adafruit FRAM I2C"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_FRAM_SPI ] && arduino --install-library "Adafruit FRAM SPI"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_FreeTouch_Library ] && arduino --install-library "Adafruit FreeTouch Library"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_FT6206_Library ] && arduino --install-library "Adafruit FT6206 Library"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_FXAS21002C ] && arduino --install-library "Adafruit FXAS21002C"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_FXOS8700 ] && arduino --install-library "Adafruit FXOS8700"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_GFX_Library ] && arduino --install-library "Adafruit GFX Library"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_GPS_Library ] && arduino --install-library "Adafruit GPS Library"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_Graphic_VFD_Display_Library ] && arduino --install-library "Adafruit Graphic VFD Display Library"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_HDC1000_Library ] && arduino --install-library "Adafruit HDC1000 Library"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_HMC5883_Unified ] && arduino --install-library "Adafruit HMC5883 Unified"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_HTU21DF_Library ] && arduino --install-library "Adafruit HTU21DF Library"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_HX8340B ] && arduino --install-library "Adafruit HX8340B"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_HX8357_Library ] && arduino --install-library "Adafruit HX8357 Library"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_ILI9341 ] && arduino --install-library "Adafruit ILI9341"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_ImageReader_Library ] && arduino --install-library "Adafruit ImageReader Library"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_INA219 ] && arduino --install-library "Adafruit INA219"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_IO_Arduino ] && arduino --install-library "Adafruit IO Arduino"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_IS31FL3731_Library ] && arduino --install-library "Adafruit IS31FL3731 Library"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_Keypad ] && arduino --install-library "Adafruit Keypad"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_L3GD20_U ] && arduino --install-library "Adafruit L3GD20 U"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_LED_Backpack_Library ] && arduino --install-library "Adafruit LED Backpack Library"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_LiquidCrystal ] && arduino --install-library "Adafruit LiquidCrystal"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_LIS3DH ] && arduino --install-library "Adafruit LIS3DH"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_LSM303DLHC ] && arduino --install-library "Adafruit LSM303DLHC"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_LSM9DS0_Library ] && arduino --install-library "Adafruit LSM9DS0 Library"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_LSM9DS1_Library ] && arduino --install-library "Adafruit LSM9DS1 Library"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_MAX31855_library ] && arduino --install-library "Adafruit MAX31855 library"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_MAX31856_library ] && arduino --install-library "Adafruit MAX31856 library"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_MAX31865_library ] && arduino --install-library "Adafruit MAX31865 library"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_MCP23008_library ] && arduino --install-library "Adafruit MCP23008 library"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_MCP23017_Arduino_Library ] && arduino --install-library "Adafruit MCP23017 Arduino Library"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_MCP3008 ] && arduino --install-library "Adafruit MCP3008"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_MCP4725 ] && arduino --install-library "Adafruit MCP4725"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_MCP9808_Library ] && arduino --install-library "Adafruit MCP9808 Library"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_MFRC630_RFID ] && arduino --install-library "Adafruit MFRC630 RFID"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_microbit_Library ] && arduino --install-library "Adafruit microbit Library"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_MiniMLX90614 ] && arduino --install-library "Adafruit MiniMLX90614"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_MLX90614_Library ] && arduino --install-library "Adafruit MLX90614 Library"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_MMA8451_Library ] && arduino --install-library "Adafruit MMA8451 Library"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_Motor_Shield_library ] && arduino --install-library "Adafruit Motor Shield library"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_Motor_Shield_V2_Library ] && arduino --install-library "Adafruit Motor Shield V2 Library"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_mp3 ] && arduino --install-library "Adafruit_mp3"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_MPL115A2 ] && arduino --install-library "Adafruit MPL115A2"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_MPL3115A2_Library ] && arduino --install-library "Adafruit MPL3115A2 Library"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_MPR121 ] && arduino --install-library "Adafruit MPR121"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_MPRLS_Library ] && arduino --install-library "Adafruit MPRLS Library"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_MQTT_Library ] && arduino --install-library "Adafruit MQTT Library"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_NeoMatrix ] && arduino --install-library "Adafruit NeoMatrix"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_NeoMatrix_ZeroDMA_library ] && arduino --install-library "Adafruit NeoMatrix ZeroDMA library"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_NeoPixel ] && arduino --install-library "Adafruit NeoPixel"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_NeoPXL8 ] && arduino --install-library "Adafruit NeoPXL8"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_NeoTrellis_M4_Library ] && arduino --install-library "Adafruit NeoTrellis M4 Library"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_nRF8001 ] && arduino --install-library "Adafruit nRF8001"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_PCD8544_Nokia_5110_LCD_library ] && arduino --install-library "Adafruit PCD8544 Nokia 5110 LCD library"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_PN532 ] && arduino --install-library "Adafruit PN532"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_PS2_Trackpad ] && arduino --install-library "Adafruit PS2 Trackpad"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_PWM_Servo_Driver_Library ] && arduino --install-library "Adafruit PWM Servo Driver Library"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_QSPI ] && arduino --install-library "Adafruit QSPI"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_RA8875 ] && arduino --install-library "Adafruit RA8875"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_RGB_LCD_Shield_Library ] && arduino --install-library "Adafruit RGB LCD Shield Library"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_seesaw_Library ] && arduino --install-library "Adafruit seesaw Library"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_SGP30_Sensor ] && arduino --install-library "Adafruit SGP30 Sensor"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_SHARP_Memory_Display ] && arduino --install-library "Adafruit SHARP Memory Display"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_SHT31_Library ] && arduino --install-library "Adafruit SHT31 Library"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_SI1145_Library ] && arduino --install-library "Adafruit SI1145 Library"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_Si4713_Library ] && arduino --install-library "Adafruit Si4713 Library"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_Si5351_Library ] && arduino --install-library "Adafruit Si5351 Library"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_Si7021_Library ] && arduino --install-library "Adafruit Si7021 Library"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_SleepyDog_Library ] && arduino --install-library "Adafruit SleepyDog Library"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_SoftServo ] && arduino --install-library "Adafruit SoftServo"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_Soundboard_library ] && arduino --install-library "Adafruit Soundboard library"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_SPIFlash ] && arduino --install-library "Adafruit SPIFlash"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_SSD1306 ] && arduino --install-library "Adafruit SSD1306"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_SSD1306_Wemos_Mini_OLED ] && arduino --install-library "Adafruit SSD1306 Wemos Mini OLED"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_SSD1325 ] && arduino --install-library "Adafruit SSD1325"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_SSD1331_OLED_Driver_Library_for_Arduino ] && arduino --install-library "Adafruit SSD1331 OLED Driver Library for Arduino"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_SSD1351_library ] && arduino --install-library "Adafruit SSD1351 library"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_ST7735_and_ST7789_Library ] && arduino --install-library "Adafruit ST7735 and ST7789 Library"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_STMPE610 ] && arduino --install-library "Adafruit STMPE610"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_TCS34725 ] && arduino --install-library "Adafruit TCS34725"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_Thermal_Printer_Library ] && arduino --install-library "Adafruit Thermal Printer Library"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_TiCoServo ] && arduino --install-library "Adafruit TiCoServo"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_TinyFlash ] && arduino --install-library "Adafruit TinyFlash"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_TinyRGBLCDShield ] && arduino --install-library "Adafruit TinyRGBLCDShield"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_TLC5947 ] && arduino --install-library "Adafruit TLC5947"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_TLC59711 ] && arduino --install-library "Adafruit TLC59711"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_TMP006 ] && arduino --install-library "Adafruit TMP006"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_TMP007_Library ] && arduino --install-library "Adafruit TMP007 Library"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_TouchScreen ] && arduino --install-library "Adafruit TouchScreen"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_TPA2016_Library ] && arduino --install-library "Adafruit TPA2016 Library"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_Trellis_Library ] && arduino --install-library "Adafruit Trellis Library"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_TSL2561 ] && arduino --install-library "Adafruit TSL2561"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_TSL2591_Library ] && arduino --install-library "Adafruit TSL2591 Library"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_Unified_Sensor ] && arduino --install-library "Adafruit Unified Sensor"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_UNTZtrument ] && arduino --install-library "Adafruit UNTZtrument"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_VC0706_Serial_Camera_Library ] && arduino --install-library "Adafruit VC0706 Serial Camera Library"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_VCNL4010 ] && arduino --install-library "Adafruit_VCNL4010"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_VEML6070_Library ] && arduino --install-library "Adafruit VEML6070 Library"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_VEML6075_Library ] && arduino --install-library "Adafruit VEML6075 Library"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_VL53L0X ] && arduino --install-library "Adafruit_VL53L0X"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_VL6180X ] && arduino --install-library "Adafruit_VL6180X"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_VS1053_Library ] && arduino --install-library "Adafruit VS1053 Library"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_WS2801_Library ] && arduino --install-library "Adafruit WS2801 Library"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_Zero_DMA_Library ] && arduino --install-library "Adafruit Zero DMA Library"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_Zero_FFT_Library ] && arduino --install-library "Adafruit Zero FFT Library"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_Zero_I2S_Library ] && arduino --install-library "Adafruit Zero I2S Library"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_Zero_PDM_Library ] && arduino --install-library "Adafruit Zero PDM Library"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_ZeroTimer_Library ] && arduino --install-library "Adafruit ZeroTimer Library"
-sleep 1
[ ! -d $HOME/Arduino/libraries/U8g2_for_Adafruit_GFX ] && arduino --install-library "U8g2_for_Adafruit_GFX"
-sleep 1
[ ! -d $HOME/Arduino/libraries/Wemos_Matrix_Adafruit_GFX ] && arduino --install-library "Wemos Matrix Adafruit GFX"
-sleep 1


message: travis ci: check cached libraries

change_type: MODIFY

diff:
@@ -23,7 +23,7 @@ before_install:
- source <(curl -SLs https://raw.githubusercontent.com/adafruit/travis-ci-arduino/platform_check_only_if_file/install.sh)
install:
- - ./arduino_library_install
+ - ./arduino_libinstall
- pip install --force-reinstall pylint==1.9.2
script:

change_type: RENAME

diff:
#!/bin/bash
+echo "Cached Arduino libraries:"
+ls -l "$HOME/Arduino/libraries"
+
+echo "Installing libraries:"
[ ! -d $HOME/Arduino/libraries/FastLED ] && arduino --install-library "FastLED"
[ ! -d $HOME/Arduino/libraries/MIDIUSB ] && arduino --install-library "MIDIUSB"
[ ! -d $HOME/Arduino/libraries/TinyWireM ] && arduino --install-library "TinyWireM"

license: MIT License

original_message: travis ci: check cached libraries


message: update README with test info

diff:
-# Adafruit_Learning_System_Guides
-Smaller programs and scripts to display "inline" in Adafruit Learning System guides
+![build status](https://travis-ci.com/adafruit/Adafruit_Learning_System_Guides.svg?branch=master "Build Status")
+
+# Introduction
+
+This is a collection of smaller programs and scripts to display "inline" in
+[Adafruit Learning System][learn] guides. Subdirectories here will generally
+contain a README with a link to their corresponding guide.
+
+## Testing
+
+The code here is partially [checked by Travis CI][travis] against Pylint (for
+CircuitPython code) or the Arduino compilation process using
+[travis-ci-arduino][travis-ci-arduino].
+
+Code in directories containing a file called `.circuitpython.skip` will be
+skipped by Pylint checks.
+
+Code in directories containing a `.[platformname].test` file, such as
+`.uno.test` will be compiled against the corresponding platform.
+
+This is a work in progress.
+
+[learn]: https://learn.adafruit.com/
+[travis]: https://travis-ci.com/adafruit/Adafruit_Learning_System_Guides/
+[travis-ci-arduino]: https://github.com/adafruit/travis-ci-arduino/

original_message: update README with test info


message: travis ci: exit 0 from arduino_libinstall

diff:
@@ -153,3 +153,5 @@ echo "Installing libraries:"
[ ! -d $HOME/Arduino/libraries/Adafruit_ZeroTimer_Library ] && arduino --install-library "Adafruit ZeroTimer Library"
[ ! -d $HOME/Arduino/libraries/U8g2_for_Adafruit_GFX ] && arduino --install-library "U8g2_for_Adafruit_GFX"
[ ! -d $HOME/Arduino/libraries/Wemos_Matrix_Adafruit_GFX ] && arduino --install-library "Wemos Matrix Adafruit GFX"
+
+exit 0


message: .travis.yml: switch to master version of travis-ci-arduino

diff:
@@ -20,7 +20,7 @@ env:
- PLATFORM_CHECK_ONLY_ON_FILE=true
before_install:
- - source <(curl -SLs https://raw.githubusercontent.com/adafruit/travis-ci-arduino/platform_check_only_if_file/install.sh)
+ - source <(curl -SLs https://raw.githubusercontent.com/adafruit/travis-ci-arduino/master/install.sh)
install:
- ./arduino_libinstall


message: fixes per review notes

diff:
@@ -12,7 +12,6 @@ from adafruit_pyportal import PyPortal
cwd = os.getcwd() # the current working directory (where this file is)
wrap = 35 # text wrap value
-firstload = True
# create pyportal object w no data source (we'll feed it text later)
pyportal = PyPortal(url = None,
@@ -27,17 +26,11 @@ pyportal = PyPortal(url = None,
)
pyportal.set_text("loading ...") # display while user waits
-
pyportal.preload_font() # speed things up by preloading font
+pyportal.set_text("OBLIQUE STRATEGIES\nBrian Eno / Peter Schmidt") # show title
while True:
- # show title on first load
- if firstload:
- pyportal.set_text("OBLIQUE STRATEGIES\nBrian Eno / Peter Schmidt")
- firstload = False
- touch = pyportal.touchscreen.touch_point
- if touch:
- print(touch)
+ if pyportal.touchscreen.touch_point:
# get random string from array and wrap
index = random.randint(0, len(strategies)-1)
strat = pyportal.wrap_nicely(strategies[index], wrap)
@@ -47,4 +40,6 @@ while True:
outstring += s + "\n"
# load new text
pyportal.set_text(outstring, 0)
- time.sleep(0.5)
\ No newline at end of file
+ # don't repeat until a new touch is detected
+ while pyportal.touchscreen.touch_point:
+ continue
\ No newline at end of file

original_message: fixes per review notes


message: to appease travis

diff:
@@ -3,10 +3,9 @@ This code will display a random strategy from strategies.py when the
PyPortal screen is pressed. See the original Oblique Strategies
by Brian Eno & Peter Schmidt here: https://www.enoshop.co.uk/product/oblique-strategies
"""
-import time
-import board
import os
import random
+import board
from strategies import strategies
from adafruit_pyportal import PyPortal

original_message: to appease travis


message: formatting for travis round 2

diff:
@@ -83,7 +83,8 @@ strategies = [
"Remove specifics and convert to ambiguities",
"Repetition is a form of change",
"Reverse",
- "Short circuit (example: a man eating peas with the idea that they will improve his virility shovels them straight into his lap)",
+ "Short circuit (example: a man eating peas with the idea that they will improve
+ his virility shovels them straight into his lap)",
"Shut the door and listen from outside",
"Simple subtraction",
"Spectrum analysis",

original_message: formatting for travis round 2


message:
reverting formatting change
strategies.py has a string w 134 chars.
travis objected to line length. inserting line break breaks syntax.

diff:
@@ -83,8 +83,7 @@ strategies = [
"Remove specifics and convert to ambiguities",
"Repetition is a form of change",
"Reverse",
- "Short circuit (example: a man eating peas with the idea that they will improve
- his virility shovels them straight into his lap)",
+ "Short circuit (example: a man eating peas with the idea that they will improve his virility shovels them straight into his lap)",
"Shut the door and listen from outside",
"Simple subtraction",
"Spectrum analysis",


message: revisions per limor

diff:
@@ -9,8 +9,7 @@ import board
from strategies import strategies
from adafruit_pyportal import PyPortal
-cwd = os.getcwd() # the current working directory (where this file is)
-wrap = 35 # text wrap value
+cwd = ("/"+__file__).rsplit('/', 1)[0] # the current working directory (where this file is)
# create pyportal object w no data source (we'll feed it text later)
pyportal = PyPortal(url = None,
@@ -18,10 +17,8 @@ pyportal = PyPortal(url = None,
status_neopixel = board.NEOPIXEL,
default_bg = None,
text_font = cwd+"fonts/Arial-ItalicMT-17.bdf",
- text_position = (30, 100),
+ text_position = (30, 120),
text_color = 0xFFFFFF,
- text_wrap = wrap,
- text_maxlen = 180, # max text size for quote & author
)
pyportal.set_text("loading ...") # display while user waits
@@ -31,14 +28,11 @@ pyportal.set_text("OBLIQUE STRATEGIES\nBrian Eno / Peter Schmidt") # show title
while True:
if pyportal.touchscreen.touch_point:
# get random string from array and wrap
- index = random.randint(0, len(strategies)-1)
- strat = pyportal.wrap_nicely(strategies[index], wrap)
+ strat = pyportal.wrap_nicely(random.choice(strategies), 35)
# convert wrap array into line breaks
- outstring = ""
- for s in strat:
- outstring += s + "\n"
- # load new text
+ outstring = '\n'.join(strat)
+ # display new text
pyportal.set_text(outstring, 0)
- # don't repeat until a new touch is detected
+ # don't repeat until a new touch begins
while pyportal.touchscreen.touch_point:
continue

original_message: revisions per limor


message: fixing fixes

diff:
@@ -3,7 +3,6 @@ This code will display a random strategy from strategies.py when the
PyPortal screen is pressed. See the original Oblique Strategies
by Brian Eno & Peter Schmidt here: https://www.enoshop.co.uk/product/oblique-strategies
"""
-import os
import random
import board
from strategies import strategies
@@ -27,9 +26,8 @@ pyportal.set_text("OBLIQUE STRATEGIES\nBrian Eno / Peter Schmidt") # show title
while True:
if pyportal.touchscreen.touch_point:
- # get random string from array and wrap
+ # get random string from array and wrap w line breaks
strat = pyportal.wrap_nicely(random.choice(strategies), 35)
- # convert wrap array into line breaks
outstring = '\n'.join(strat)
# display new text
pyportal.set_text(outstring, 0)

original_message: fixing fixes


message:
a typo
via learn guide feedback

diff:
@@ -45,7 +45,7 @@ for pin in buttonpins:
button.pull = Pull.UP
buttons.append(button)
-# make all LED objects, make them inputs w/pullups
+# make all LED objects, make them outputs
for pin in ledpins:
led = DigitalInOut(pin)
led.direction = Direction.OUTPUT

original_message:
a typo

via learn guide feedback


message: Disco Tie added

change_type: ADD

diff:
+"""
+LED Disco Tie with Bluetooth
+=========================================================
+Give your suit an sound-reactive upgrade with Circuit
+Playground Bluefruit & Neopixels. Set color and animation
+mode using the Bluefruit LE Connect app.
+
+Author: Collin Cunningham for Adafruit Industries, 2019
+"""
+
+import time
+import array
+import math
+import audiobusio
+import board
+import neopixel
+from adafruit_ble.uart_server import UARTServer
+from adafruit_bluefruit_connect.packet import Packet
+from adafruit_bluefruit_connect.color_packet import ColorPacket
+from adafruit_bluefruit_connect.button_packet import ButtonPacket
+
+uart_server = UARTServer()
+
+# User input vars
+mode = 0 # 0=audio, 1=rainbow, 2=larsen_scanner, 3=solid
+user_color= (127,0,0)
+speed = 5.0 # for larsen scanner
+
+# Audio meter vars
+PEAK_COLOR = (100, 0, 255)
+NUM_PIXELS = 10
+CURVE = 2
+SCALE_EXPONENT = math.pow(10, CURVE * -0.1)
+NUM_SAMPLES = 160
+
+# Restrict value to be between floor and ceiling.
+def constrain(value, floor, ceiling):
+ return max(floor, min(value, ceiling))
+
+# Scale input_value between output_min and output_max, exponentially.
+def log_scale(input_value, input_min, input_max, output_min, output_max):
+ normalized_input_value = (input_value - input_min) / \
+ (input_max - input_min)
+ return output_min + \
+ math.pow(normalized_input_value, SCALE_EXPONENT) \
+ * (output_max - output_min)
+
+# Remove DC bias before computing RMS.
+def normalized_rms(values):
+ minbuf = int(mean(values))
+ samples_sum = sum(
+ float(sample - minbuf) * (sample - minbuf)
+ for sample in values
+ )
+
+ return math.sqrt(samples_sum / len(values))
+
+def mean(values):
+ return sum(values) / len(values)
+
+def volume_color(volume):
+ return 200, volume * (255 // NUM_PIXELS), 0
+
+# Set up NeoPixels and turn them all off.
+pixels = neopixel.NeoPixel(board.A1, NUM_PIXELS, brightness=0.1, auto_write=False)
+pixels.fill(0)
+pixels.show()
+
+mic = audiobusio.PDMIn(board.MICROPHONE_CLOCK, board.MICROPHONE_DATA,
+ sample_rate=16000, bit_depth=16)
+
+# Record an initial sample to calibrate. Assume it's quiet when we start.
+samples = array.array('H', [0] * NUM_SAMPLES)
+mic.record(samples, len(samples))
+# Set lowest level to expect, plus a little.
+input_floor = normalized_rms(samples) + 10
+# Corresponds to sensitivity: lower means more pixels light up with lower sound
+input_ceiling = input_floor + 500
+peak = 0
+
+def wheel(pos):
+ # Input a value 0 to 255 to get a color value.
+ # The colours are a transition r - g - b - back to r.
+ if pos < 0 or pos > 255:
+ r = g = b = 0
+ elif pos < 85:
+ r = int(pos * 3)
+ g = int(255 - pos*3)
+ b = 0
+ elif pos < 170:
+ pos -= 85
+ r = int(255 - pos*3)
+ g = 0
+ b = int(pos*3)
+ else:
+ pos -= 170
+ r = 0
+ g = int(pos*3)
+ b = int(255 - pos*3)
+ return (r, g, b)
+
+def rainbow_cycle(wait):
+ for j in range(255):
+ for i in range(NUM_PIXELS):
+ pixel_index = (i * 256 // NUM_PIXELS) + j
+ pixels[i] = wheel(pixel_index & 255)
+ pixels.show()
+ time.sleep(wait)
+
+def audio_meter():
+ mic.record(samples, len(samples))
+ magnitude = normalized_rms(samples)
+ global peak
+
+ # Compute scaled logarithmic reading in the range 0 to NUM_PIXELS
+ c = log_scale(constrain(magnitude, input_floor, input_ceiling),
+ input_floor, input_ceiling, 0, NUM_PIXELS)
+
+ # Light up pixels that are below the scaled and interpolated magnitude.
+ pixels.fill(0)
+ for i in range(NUM_PIXELS):
+ if i < c:
+ pixels[i] = volume_color(i)
+ # Light up the peak pixel and animate it slowly dropping.
+ if c >= peak:
+ peak = min(c, NUM_PIXELS - 1)
+ elif peak > 0:
+ peak = peak - 1
+ if peak > 0:
+ pixels[int(peak)] = PEAK_COLOR
+ pixels.show()
+
+pos = 0 # position
+direction = 1 # direction of "eye"
+
+def larsen_set(index, color):
+ if index < 0:
+ return
+ else:
+ pixels[index] = color
+
+def larsen(wait):
+ global pos
+ global direction
+
+ color_dark = (int(user_color[0]/8), int(user_color[1]/8),
+ int(user_color[2]/8))
+ color_med = (int(user_color[0]/2), int(user_color[1]/2),
+ int(user_color[2]/2))
+
+ larsen_set(pos - 2, color_dark)
+ larsen_set(pos - 1, color_med)
+ larsen_set(pos, user_color)
+ larsen_set(pos + 1, color_med)
+
+ if (pos + 2) < NUM_PIXELS:
+ # Dark red, do not exceed number of pixels
+ larsen_set(pos + 2, color_dark)
+
+ pixels.write()
+ time.sleep(wait)
+
+ # Erase all and draw a new one next time
+ for j in range(-2, 2):
+ larsen_set(pos + j, (0, 0, 0))
+ if (pos + 2) < NUM_PIXELS:
+ larsen_set(pos + 2, (0, 0, 0))
+
+ # Bounce off ends of strip
+ pos += direction
+ if pos < 0:
+ pos = 1
+ direction = -direction
+ elif pos >= (NUM_PIXELS - 1):
+ pos = NUM_PIXELS - 2
+ direction = -direction
+
+def solid():
+ global user_color
+ pixels.fill(user_color)
+ pixels.show()
+
+def map_value(value, in_min, in_max, out_min, out_max):
+ return out_min + (out_max - out_min) * ((value - in_min)
+ / (in_max - in_min))
+
+def change_speed(val):
+ global speed
+ new_speed = speed + val
+ if new_speed > 10.0:
+ new_speed = 10.0
+ elif new_speed < 1.0:
+ new_speed = 1.0
+ speed = new_speed
+ print("set speed " + str(speed))
+
+while True:
+ # While BLE is *not* connected
+ if not uart_server.connected:
+ # OK to call again even if already advertising
+ uart_server.start_advertising()
+
+ # While BLE is connected
+ else:
+ if uart_server.in_waiting:
+ packet = Packet.from_stream(uart_server)
+
+ # Received ColorPacket
+ if isinstance(packet, ColorPacket):
+ print("color received: " + str(packet.color))
+ user_color = packet.color
+
+ # Received ButtonPacket
+ elif isinstance(packet, ButtonPacket):
+ if packet.pressed:
+ if packet.button == ButtonPacket.UP:
+ change_speed(1)
+ elif packet.button == ButtonPacket.DOWN:
+ change_speed(-1)
+ elif packet.button == ButtonPacket.BUTTON_1:
+ mode = 0
+ elif packet.button == ButtonPacket.BUTTON_2:
+ mode = 1
+ elif packet.button == ButtonPacket.BUTTON_3:
+ mode = 2
+ elif packet.button == ButtonPacket.BUTTON_4:
+ mode = 3
+
+ # Determine animation based on mode
+ if mode == 0:
+ audio_meter()
+ elif mode == 1:
+ rainbow_cycle(0.001)
+ elif mode == 2:
+ larsen(map_value(speed, 10.0, 0.0, 0.01, 0.3))
+ elif mode == 3:
+ solid()

original_message: Disco Tie added


message: updated from local linting

diff:
@@ -25,7 +25,7 @@ uart_server = UARTServer()
# User input vars
mode = 0 # 0=audio, 1=rainbow, 2=larsen_scanner, 3=solid
user_color= (127,0,0)
-speed = 5.0 # for larsen scanner
+speed = 6.0 # for larsen scanner
# Audio meter vars
PEAK_COLOR = (100, 0, 255)
@@ -194,7 +194,6 @@ def change_speed(val):
elif new_speed < 1.0:
new_speed = 1.0
speed = new_speed
- print("set speed " + str(speed))
while True:
# While BLE is *not* connected
@@ -209,7 +208,6 @@ while True:
# Received ColorPacket
if isinstance(packet, ColorPacket):
- print("color received: " + str(packet.color))
user_color = packet.color
# Received ButtonPacket

original_message: updated from local linting


message: removed most globals

diff:
@@ -25,7 +25,6 @@ uart_server = UARTServer()
# User input vars
mode = 0 # 0=audio, 1=rainbow, 2=larsen_scanner, 3=solid
user_color= (127,0,0)
-speed = 6.0 # for larsen scanner
# Audio meter vars
PEAK_COLOR = (100, 0, 255)
@@ -100,18 +99,17 @@ def wheel(wheel_pos):
b = int(255 - wheel_pos*3)
return (r, g, b)
-def rainbow_cycle(wait):
+def rainbow_cycle(delay):
for j in range(255):
for i in range(NUM_PIXELS):
pixel_index = (i * 256 // NUM_PIXELS) + j
pixels[i] = wheel(pixel_index & 255)
pixels.show()
- time.sleep(wait)
+ time.sleep(delay)
-def audio_meter():
+def audio_meter(new_peak):
mic.record(samples, len(samples))
magnitude = normalized_rms(samples)
- global peak
# Compute scaled logarithmic reading in the range 0 to NUM_PIXELS
c = log_scale(constrain(magnitude, input_floor, input_ceiling),
@@ -123,13 +121,14 @@ def audio_meter():
if i < c:
pixels[i] = volume_color(i)
# Light up the peak pixel and animate it slowly dropping.
- if c >= peak:
- peak = min(c, NUM_PIXELS - 1)
- elif peak > 0:
- peak = peak - 1
- if peak > 0:
- pixels[int(peak)] = PEAK_COLOR
+ if c >= new_peak:
+ new_peak = min(c, NUM_PIXELS - 1)
+ elif new_peak > 0:
+ new_peak = new_peak - 1
+ if new_peak > 0:
+ pixels[int(new_peak)] = PEAK_COLOR
pixels.show()
+ return new_peak
pos = 0 # position
direction = 1 # direction of "eye"
@@ -140,10 +139,9 @@ def larsen_set(index, color):
else:
pixels[index] = color
-def larsen(wait):
+def larsen(delay):
global pos
global direction
-
color_dark = (int(user_color[0]/8), int(user_color[1]/8),
int(user_color[2]/8))
color_med = (int(user_color[0]/2), int(user_color[1]/2),
@@ -159,7 +157,7 @@ def larsen(wait):
larsen_set(pos + 2, color_dark)
pixels.write()
- time.sleep(wait)
+ time.sleep(delay)
# Erase all and draw a new one next time
for j in range(-2, 2):
@@ -176,9 +174,8 @@ def larsen(wait):
pos = NUM_PIXELS - 2
direction = -direction
-def solid():
- global user_color
- pixels.fill(user_color)
+def solid(new_color):
+ pixels.fill(new_color)
pixels.show()
def map_value(value, in_min, in_max, out_min, out_max):
@@ -186,14 +183,12 @@ def map_value(value, in_min, in_max, out_min, out_max):
in_range = in_max - in_min
return out_min + out_range * ((value - in_min) / in_range)
-def change_speed(val):
- global speed
- new_speed = speed + val
- if new_speed > 10.0:
- new_speed = 10.0
- elif new_speed < 1.0:
- new_speed = 1.0
- speed = new_speed
+speed = 6.0
+wait = 0.097
+
+def change_speed(mod, old_speed):
+ new_speed = constrain(old_speed + mod, 1.0, 10.0)
+ return(new_speed, map_value(new_speed, 10.0, 0.0, 0.01, 0.3))
while True:
# While BLE is *not* connected
@@ -214,9 +209,9 @@ while True:
elif isinstance(packet, ButtonPacket):
if packet.pressed:
if packet.button == ButtonPacket.UP:
- change_speed(1)
+ speed, wait = change_speed(1, speed)
elif packet.button == ButtonPacket.DOWN:
- change_speed(-1)
+ speed, wait = change_speed(-1, speed)
elif packet.button == ButtonPacket.BUTTON_1:
mode = 0
elif packet.button == ButtonPacket.BUTTON_2:
@@ -228,10 +223,10 @@ while True:
# Determine animation based on mode
if mode == 0:
- audio_meter()
+ peak = audio_meter(peak)
elif mode == 1:
rainbow_cycle(0.001)
elif mode == 2:
- larsen(map_value(speed, 10.0, 0.0, 0.01, 0.3))
+ larsen(wait)
elif mode == 3:
- solid()
+ solid(user_color)

original_message: removed most globals


message:
Disco Tie - fix for animating while disconnected
Moved animation calls to new animate(pause, top) function, called while both connected and not connected.

diff:
@@ -198,10 +198,23 @@ def change_speed(mod, old_speed):
new_speed = constrain(old_speed + mod, 1.0, 10.0)
return(new_speed, map_value(new_speed, 10.0, 0.0, 0.01, 0.3))
+def animate(pause, top):
+ # Determine animation based on mode
+ if mode == 0:
+ top = audio_meter(top)
+ elif mode == 1:
+ rainbow_cycle(0.001)
+ elif mode == 2:
+ larsen(pause)
+ elif mode == 3:
+ solid(user_color)
+ return top
+
while True:
ble.start_advertising(advertisement)
while not ble.connected:
- pass
+ # Animate while disconnected
+ peak = animate(wait, peak)
# While BLE is connected
while ble.connected:
@@ -232,12 +245,5 @@ while True:
elif packet.button == ButtonPacket.BUTTON_4:
mode = 3
- # Determine animation based on mode
- if mode == 0:
- peak = audio_meter(peak)
- elif mode == 1:
- rainbow_cycle(0.001)
- elif mode == 2:
- larsen(wait)
- elif mode == 3:
- solid(user_color)
+ # Animate while connected
+ peak = animate(wait, peak)


message:
AutoSunglasses updated for current libs
changed from using simpleio.Servo to pulseio & adafruit_motor

diff:
@@ -14,13 +14,15 @@ All text above must be included in any redistribution.
import time
import board
-import simpleio
+import pulseio
from adafruit_circuitplayground.express import cpx
+from adafruit_motor import servo
-servo = simpleio.Servo(board.A1)
+pwm = pulseio.PWMOut(board.A1, duty_cycle=2 ** 15, frequency=50)
+my_servo = servo.Servo(pwm)
cpx.pixels.fill((0, 0, 0))
-servo.angle = 90
+my_servo.angle = 90
while True:
light_level = cpx.light
@@ -30,8 +32,8 @@ while True:
else:
cpx.pixels.fill((0, 0, 0))
if light_level < 200:
- servo.angle = 90
+ my_servo.angle = 90
else:
- servo.angle = 0
+ my_servo.angle = 0
time.sleep(0.25)


message: Increased B button debounce

diff:
@@ -37,7 +37,7 @@ while True:
time.sleep(0.25)
if clue.button_b:
two_subjects = not two_subjects
- time.sleep(0.25)
+ time.sleep(0.5)
screen[1].text = activity
screen[3].text = subject_a

original_message: Increased B button debounce


message: updated for new libraries

diff:
import board
from digitalio import DigitalInOut, Direction, Pull
-import adafruit_dotstar as dotstar
+import usb_hid
from adafruit_hid.keyboard import Keyboard
from adafruit_hid.keycode import Keycode
from adafruit_hid.keyboard_layout_us import KeyboardLayoutUS
-dot = dotstar.DotStar(board.APA102_SCK, board.APA102_MOSI, 1, brightness=0.2)
-dot[0] = (0, 0, 0)
-
-kbd = Keyboard()
+kbd = Keyboard(usb_hid.devices)
kbdLayout = KeyboardLayoutUS(kbd)
state = []
pins = {}
@@ -58,8 +55,7 @@ while True:
for oldID in oldState:
if not oldID in newState:
kbd.release(buttonIDtoKeycode[oldID])
- dot[0] = (0, 0, 0)
if newBtn:
kbd.press(buttonIDtoKeycode[newBtn])
- dot[0] = (255, 0, 0)
state = newState
+
\ No newline at end of file

original_message: updated for new libraries


message: Added Pet Feeder

diff:
+import ipaddress
+import ssl
+import wifi
+import socketpool
+import adafruit_requests
+import secrets
+import time
+import terminalio
+import displayio
+from adafruit_display_text import label
+from adafruit_bitmap_font import bitmap_font
+from adafruit_magtag.magtag import MagTag
+
+TEXT_URL = "http://wifitest.adafruit.com/testwifi/index.html"
+JSON_QUOTES_URL = "https://www.adafruit.com/api/quotes.php"
+JSON_STARS_URL = "https://api.github.com/repos/adafruit/circuitpython"
+
+# Get wifi details and more from a secrets.py file
+try:
+ from secrets import secrets
+except ImportError:
+ print("WiFi secrets are kept in secrets.py, please add them there!")
+ raise
+
+# Get our username, key and desired timezone
+aio_username = secrets["aio_username"]
+aio_key = secrets["aio_key"]
+#location = secrets.get("timezone", None)
+TIME_URL = "https://io.adafruit.com/api/v2/%s/integrations/time/strftime?x-aio-key=%s" % (aio_username, aio_key)
+TIME_URL += "&fmt=%25Y-%25m-%25d+%25H%3A%25M%3A%25S.%25L+%25j+%25u+%25z+%25Z"
+
+# in seconds, we can refresh about 100 times on a battery
+PET_NAME = "Midi"
+TIME_BETWEEN_REFRESHES = 24 * 60 * 60 # once a day delay
+
+magtag = MagTag()
+
+small_font = bitmap_font.load_font("/Lato-Bold-ltd-25.bdf")
+time_font = bitmap_font.load_font("/Montserrat-Regular-78.bdf")
+label_group = displayio.Group(max_size=3)
+
+fed_label = label.Label(small_font, max_glyphs = 50, color=0x000000)
+fed_label.anchor_point = (0,0)
+fed_label.anchored_position = (10, 5)
+label_group.append(fed_label)
+
+time_label = label.Label(time_font, text="TIME", max_glyphs = 10, color=0x000000)
+time_label.anchor_point = (0,0)
+time_label.anchored_position = (10, 50)
+label_group.append(time_label)
+
+#add group
+magtag.splash.append(label_group)
+
+#magtag.display.refresh()
+
+magtag.get_local_time()
+now = time.localtime()
+print(now)
+
+print("Connecting to %s"%secrets["ssid"])
+wifi.radio.connect(secrets["ssid"], secrets["password"])
+print("Connected to %s!"%secrets["ssid"])
+pool = socketpool.SocketPool(wifi.radio)
+requests = adafruit_requests.Session(pool, ssl.create_default_context())
+
+while(True):
+
+ if magtag.peripherals.button_a_pressed:
+ print("button pressed")
+ response = requests.get(TIME_URL)
+ parts = response.text.split(" ") #['2020-12-09', '15:56:27.988', '344', '3', '-0500', 'EST']
+
+ #format date
+ date = parts[0].split("-")
+ date_string = date[1] + "/" + date[2] + "/" + date[0][-2:]
+ print(date_string)
+ fed_label.text = PET_NAME + " was fed " + date_string + " @"
+
+ #format time
+ time_string = parts[1][:5].lstrip("0")
+ hour = int(time_string.split(":")[0])
+ suffix = "a" if hour < 12 else "p"
+ time_string += suffix
+ print(time_string)
+ time_label.text = time_string
+
+ magtag.display.refresh()
+
+ time.sleep(2)
+
+ time.sleep(0.01)
\ No newline at end of file

original_message: Added Pet Feeder


message: revised for magtag library usage

diff:
-import ipaddress
-import ssl
-import wifi
-import socketpool
-import adafruit_requests
-import secrets
import time
-import terminalio
-import displayio
-from adafruit_display_text import label
-from adafruit_bitmap_font import bitmap_font
from adafruit_magtag.magtag import MagTag
+import rtc
-TEXT_URL = "http://wifitest.adafruit.com/testwifi/index.html"
-JSON_QUOTES_URL = "https://www.adafruit.com/api/quotes.php"
-JSON_STARS_URL = "https://api.github.com/repos/adafruit/circuitpython"
-
-# Get wifi details and more from a secrets.py file
-try:
- from secrets import secrets
-except ImportError:
- print("WiFi secrets are kept in secrets.py, please add them there!")
- raise
-
-# Get our username, key and desired timezone
-aio_username = secrets["aio_username"]
-aio_key = secrets["aio_key"]
-#location = secrets.get("timezone", None)
-TIME_URL = "https://io.adafruit.com/api/v2/%s/integrations/time/strftime?x-aio-key=%s" % (aio_username, aio_key)
-TIME_URL += "&fmt=%25Y-%25m-%25d+%25H%3A%25M%3A%25S.%25L+%25j+%25u+%25z+%25Z"
-
-# in seconds, we can refresh about 100 times on a battery
PET_NAME = "Midi"
-TIME_BETWEEN_REFRESHES = 24 * 60 * 60 # once a day delay
magtag = MagTag()
-
-small_font = bitmap_font.load_font("/Lato-Bold-ltd-25.bdf")
-time_font = bitmap_font.load_font("/Montserrat-Regular-78.bdf")
-label_group = displayio.Group(max_size=3)
-
-fed_label = label.Label(small_font, max_glyphs = 50, color=0x000000)
-fed_label.anchor_point = (0,0)
-fed_label.anchored_position = (10, 5)
-label_group.append(fed_label)
-
-time_label = label.Label(time_font, text="TIME", max_glyphs = 10, color=0x000000)
-time_label.anchor_point = (0,0)
-time_label.anchored_position = (10, 50)
-label_group.append(time_label)
-
-#add group
-magtag.splash.append(label_group)
-
-#magtag.display.refresh()
-
-magtag.get_local_time()
-now = time.localtime()
-print(now)
-
-print("Connecting to %s"%secrets["ssid"])
-wifi.radio.connect(secrets["ssid"], secrets["password"])
-print("Connected to %s!"%secrets["ssid"])
-pool = socketpool.SocketPool(wifi.radio)
-requests = adafruit_requests.Session(pool, ssl.create_default_context())
+magtag.network.connect()
+
+magtag.add_text(
+ text_font="/Lato-Bold-ltd-25.bdf",
+ text_position=(10,5),
+ text_anchor_point=(0,0),
+ is_data=False,
+)
+
+magtag.add_text(
+ text_font="/Montserrat-Regular-78.bdf",
+ text_position=(10,45),
+ text_anchor_point=(0,0),
+ is_data=False,
+)
while(True):
if magtag.peripherals.button_a_pressed:
- print("button pressed")
- response = requests.get(TIME_URL)
- parts = response.text.split(" ") #['2020-12-09', '15:56:27.988', '344', '3', '-0500', 'EST']
-
- #format date
- date = parts[0].split("-")
- date_string = date[1] + "/" + date[2] + "/" + date[0][-2:]
- print(date_string)
- fed_label.text = PET_NAME + " was fed " + date_string + " @"
-
- #format time
- time_string = parts[1][:5].lstrip("0")
- hour = int(time_string.split(":")[0])
- suffix = "a" if hour < 12 else "p"
- time_string += suffix
+ magtag.network.get_local_time()
+ now = rtc.RTC().datetime
+ #set date
+ date = (str(now.tm_mon), str(now.tm_mday), str(now.tm_year)[-2:])
+ date = "/".join(date)
+ magtag.set_text(PET_NAME + " was fed " + date, index = 0)
+ #set time
+ hour = now.tm_hour if now.tm_hour <= 12 else now.tm_hour - 12
+ suffix = "a" if now.tm_hour < 12 else "p"
+ time_string = str(hour) + ":" + str(now.tm_min) + suffix
print(time_string)
- time_label.text = time_string
-
- magtag.display.refresh()
-
+ magtag.set_text(time_string, index = 1)
time.sleep(2)
time.sleep(0.01)
\ No newline at end of file

original_message: revised for magtag library usage


message: 2 clock version initial commit

diff:
@@ -5,37 +5,50 @@ import rtc
PET_NAME = "Midi"
magtag = MagTag()
+magtag.auto_refresh = False
magtag.network.connect()
+mid_x = magtag.graphics.display.width // 2 - 1
magtag.add_text(
- text_font="/Lato-Bold-ltd-25.bdf",
- text_position=(10,5),
+ text_font="/Montserrat-Regular-78.bdf",
+ text_position=(mid_x,6),
+ text_anchor_point=(0.5,0),
+ is_data=False,
+)
+magtag.set_text("00:00")
+
+magtag.add_text(
+ text_font="/CourierNewPSMT-18.bdf",
+ text_position=(20,80),
text_anchor_point=(0,0),
is_data=False,
)
+magtag.set_text("test:", index = 1)
magtag.add_text(
- text_font="/Montserrat-Regular-78.bdf",
- text_position=(10,45),
+ text_font="/Montserrat-Regular-39.bdf",
+ text_position=(132,80),
text_anchor_point=(0,0),
is_data=False,
)
+magtag.set_text("00:00", index = 2)
+
+def network_time():
+ magtag.network.get_local_time()
+ now = rtc.RTC().datetime
+ return now
while(True):
if magtag.peripherals.button_a_pressed:
- magtag.network.get_local_time()
- now = rtc.RTC().datetime
- #set date
- date = (str(now.tm_mon), str(now.tm_mday), str(now.tm_year)[-2:])
- date = "/".join(date)
- magtag.set_text(PET_NAME + " was fed " + date, index = 0)
+ now = network_time()
#set time
hour = now.tm_hour if now.tm_hour <= 12 else now.tm_hour - 12
suffix = "a" if now.tm_hour < 12 else "p"
time_string = str(hour) + ":" + str(now.tm_min) + suffix
print(time_string)
- magtag.set_text(time_string, index = 1)
+ magtag.set_text(time_string, index = 2)
+ #magtag.show()
time.sleep(2)
time.sleep(0.01)
\ No newline at end of file

original_message: 2 clock version initial commit


message: clean up for guide

diff:
@@ -2,13 +2,14 @@ import time
from adafruit_magtag.magtag import MagTag
import rtc
-PET_NAME = "Midi"
USE_AMPM_TIME = True
-weekdays = ("mon", "tues", "wed", "thurs", "fri", "sat", "sun")
+weekdays = ("mon", "tue", "wed", "thur", "fri", "sat", "sun")
+last_sync = None
+last_minute = None
magtag = MagTag()
-magtag.graphics.set_background("/cat_clock_background3.bmp")
+magtag.graphics.set_background("/background.bmp")
mid_x = magtag.graphics.display.width // 2 - 1
magtag.add_text(
@@ -17,7 +18,7 @@ magtag.add_text(
text_anchor_point=(0.5,0),
is_data=False,
)
-magtag.set_text("00:00", auto_refresh = False)
+magtag.set_text("00:00a", auto_refresh = False)
magtag.add_text(
text_font="/BebasNeueRegular-41.bdf",
@@ -25,7 +26,7 @@ magtag.add_text(
text_anchor_point=(0,0),
is_data=False,
)
-magtag.set_text("DAY 00:00", index = 1)
+magtag.set_text("DAY 00:00a", index = 1, auto_refresh = False)
def hh_mm(time_struct, twelve_hour=True):
""" Given a time.struct_time, return a string as H:MM or HH:MM, either
@@ -46,12 +47,9 @@ def hh_mm(time_struct, twelve_hour=True):
hour_string = '{hh:02d}'.format(hh=time_struct.tm_hour)
return hour_string + ':{mm:02d}'.format(mm=time_struct.tm_min) + postfix
-last_sync = None
-last_minute = None
-
while(True):
if not last_sync or (time.monotonic() - last_sync) > 3600:
- # at start or once an ho
+ # at start or once an hour
magtag.network.get_local_time()
last_sync = time.monotonic()

original_message: clean up for guide


message: Delete .pylintrc

change_type: DELETE

diff:
-[MASTER]
-
-# A comma-separated list of package or module names from where C extensions may
-# be loaded. Extensions are loading into the active Python interpreter and may
-# run arbitrary code
-extension-pkg-whitelist=
-
-# Add files or directories to the blacklist. They should be base names, not
-# paths.
-ignore=CVS
-
-# Add files or directories matching the regex patterns to the blacklist. The
-# regex matches against base names, not paths.
-ignore-patterns=
-
-# Python code to execute, usually for sys.path manipulation such as
-# pygtk.require().
-#init-hook=
-
-# Use multiple processes to speed up Pylint.
-# jobs=1
-jobs=2
-
-# List of plugins (as comma separated values of python modules names) to load,
-# usually to register additional checkers.
-load-plugins=
-
-# Pickle collected data for later comparisons.
-persistent=yes
-
-# Specify a configuration file.
-#rcfile=
-
-# Allow loading of arbitrary C extensions. Extensions are imported into the
-# active Python interpreter and may run arbitrary code.
-unsafe-load-any-extension=no
-
-
-[MESSAGES CONTROL]
-
-# Only show warnings with the listed confidence levels. Leave empty to show
-# all. Valid levels: HIGH, INFERENCE, INFERENCE_FAILURE, UNDEFINED
-confidence=
-
-# Disable the message, report, category or checker with the given id(s). You
-# can either give multiple identifiers separated by comma (,) or put this
-# option multiple times (only on the command line, not in the configuration
-# file where it should appear only once).You can also use "--disable=all" to
-# disable everything first and then reenable specific checks. For example, if
-# you want to run only the similarities checker, you can use "--disable=all
-# --enable=similarities". If you want to run only the classes checker, but have
-# no Warning level messages displayed, use"--disable=all --enable=classes
-# --disable=W"
-# disable=import-error,print-statement,parameter-unpacking,unpacking-in-except,old-raise-syntax,backtick,long-suffix,old-ne-operator,old-octal-literal,import-star-module-level,raw-checker-failed,bad-inline-option,locally-disabled,locally-enabled,file-ignored,suppressed-message,useless-suppression,deprecated-pragma,apply-builtin,basestring-builtin,buffer-builtin,cmp-builtin,coerce-builtin,execfile-builtin,file-builtin,long-builtin,raw_input-builtin,reduce-builtin,standarderror-builtin,unicode-builtin,xrange-builtin,coerce-method,delslice-method,getslice-method,setslice-method,no-absolute-import,old-division,dict-iter-method,dict-view-method,next-method-called,metaclass-assignment,indexing-exception,raising-string,reload-builtin,oct-method,hex-method,nonzero-method,cmp-method,input-builtin,round-builtin,intern-builtin,unichr-builtin,map-builtin-not-iterating,zip-builtin-not-iterating,range-builtin-not-iterating,filter-builtin-not-iterating,using-cmp-argument,eq-without-hash,div-method,idiv-method,rdiv-method,exception-message-attribute,invalid-str-codec,sys-max-int,bad-python3-import,deprecated-string-function,deprecated-str-translate-call
-disable=too-many-instance-attributes,len-as-condition,too-few-public-methods,anomalous-backslash-in-string,no-else-return,simplifiable-if-statement,too-many-arguments,duplicate-code,no-name-in-module,no-member,print-statement,parameter-unpacking,unpacking-in-except,old-raise-syntax,backtick,long-suffix,old-ne-operator,old-octal-literal,import-star-module-level,raw-checker-failed,bad-inline-option,locally-disabled,locally-enabled,file-ignored,suppressed-message,useless-suppression,deprecated-pragma,apply-builtin,basestring-builtin,buffer-builtin,cmp-builtin,coerce-builtin,execfile-builtin,file-builtin,long-builtin,raw_input-builtin,reduce-builtin,standarderror-builtin,unicode-builtin,xrange-builtin,coerce-method,delslice-method,getslice-method,setslice-method,no-absolute-import,old-division,dict-iter-method,dict-view-method,next-method-called,metaclass-assignment,indexing-exception,raising-string,reload-builtin,oct-method,hex-method,nonzero-method,cmp-method,input-builtin,round-builtin,intern-builtin,unichr-builtin,map-builtin-not-iterating,zip-builtin-not-iterating,range-builtin-not-iterating,filter-builtin-not-iterating,using-cmp-argument,eq-without-hash,div-method,idiv-method,rdiv-method,exception-message-attribute,invalid-str-codec,sys-max-int,bad-python3-import,deprecated-string-function,deprecated-str-translate-call,import-error,missing-docstring,invalid-name,bad-whitespace,consider-using-enumerate,unexpected-keyword-arg
-
-# Enable the message, report, category or checker with the given id(s). You can
-# either give multiple identifier separated by comma (,) or put this option
-# multiple time (only on the command line, not in the configuration file where
-# it should appear only once). See also the "--disable" option for examples.
-enable=
-
-
-[REPORTS]
-
-# Python expression which should return a note less than 10 (10 is the highest
-# note). You have access to the variables errors warning, statement which
-# respectively contain the number of errors / warnings messages and the total
-# number of statements analyzed. This is used by the global evaluation report
-# (RP0004).
-evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)
-
-# Template used to display messages. This is a python new-style format string
-# used to format the message information. See doc for all details
-msg-template='{path} {line}: {msg} ({symbol})'
-
-# Set the output format. Available formats are text, parseable, colorized, json
-# and msvs (visual studio).You can also give a reporter class, eg
-# mypackage.mymodule.MyReporterClass.
-output-format=text
-
-# Tells whether to display a full report or only the messages
-reports=no
-
-# Activate the evaluation score.
-score=yes
-
-
-[REFACTORING]
-
-# Maximum number of nested blocks for function / method body
-max-nested-blocks=5
-
-
-[LOGGING]
-
-# Logging modules to check that the string format arguments are in logging
-# function parameter format
-logging-modules=logging
-
-
-[SPELLING]
-
-# Spelling dictionary name. Available dictionaries: none. To make it working
-# install python-enchant package.
-spelling-dict=
-
-# List of comma separated words that should not be checked.
-spelling-ignore-words=
-
-# A path to a file that contains private dictionary; one word per line.
-spelling-private-dict-file=
-
-# Tells whether to store unknown words to indicated private dictionary in
-# --spelling-private-dict-file option instead of raising a message.
-spelling-store-unknown-words=no
-
-
-[MISCELLANEOUS]
-
-# List of note tags to take in consideration, separated by a comma.
-# notes=FIXME,XXX,TODO
-notes=FIXME,XXX
-
-
-[TYPECHECK]
-
-# List of decorators that produce context managers, such as
-# contextlib.contextmanager. Add to this list to register other decorators that
-# produce valid context managers.
-contextmanager-decorators=contextlib.contextmanager
-
-# List of members which are set dynamically and missed by pylint inference
-# system, and so shouldn't trigger E1101 when accessed. Python regular
-# expressions are accepted.
-generated-members=
-
-# Tells whether missing members accessed in mixin class should be ignored. A
-# mixin class is detected if its name ends with "mixin" (case insensitive).
-ignore-mixin-members=yes
-
-# This flag controls whether pylint should warn about no-member and similar
-# checks whenever an opaque object is returned when inferring. The inference
-# can return multiple potential results while evaluating a Python object, but
-# some branches might not be evaluated, which results in partial inference. In
-# that case, it might be useful to still emit no-member and other checks for
-# the rest of the inferred objects.
-ignore-on-opaque-inference=yes
-
-# List of class names for which member attributes should not be checked (useful
-# for classes with dynamically set attributes). This supports the use of
-# qualified names.
-ignored-classes=optparse.Values,thread._local,_thread._local
-
-# List of module names for which member attributes should not be checked
-# (useful for modules/projects where namespaces are manipulated during runtime
-# and thus existing member attributes cannot be deduced by static analysis. It
-# supports qualified module names, as well as Unix pattern matching.
-ignored-modules=
-
-# Show a hint with possible names when a member name was not found. The aspect
-# of finding the hint is based on edit distance.
-missing-member-hint=yes
-
-# The minimum edit distance a name should have in order to be considered a
-# similar match for a missing member name.
-missing-member-hint-distance=1
-
-# The total number of similar names that should be taken in consideration when
-# showing a hint for a missing member.
-missing-member-max-choices=1
-
-
-[VARIABLES]
-
-# List of additional names supposed to be defined in builtins. Remember that
-# you should avoid to define new builtins when possible.
-additional-builtins=
-
-# Tells whether unused global variables should be treated as a violation.
-allow-global-unused-variables=yes
-
-# List of strings which can identify a callback function by name. A callback
-# name must start or end with one of those strings.
-callbacks=cb_,_cb
-
-# A regular expression matching the name of dummy variables (i.e. expectedly
-# not used).
-dummy-variables-rgx=_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored_|^unused_
-
-# Argument names that match this expression will be ignored. Default to name
-# with leading underscore
-ignored-argument-names=_.*|^ignored_|^unused_
-
-# Tells whether we should check for unused import in __init__ files.
-init-import=no
-
-# List of qualified module names which can have objects that can redefine
-# builtins.
-redefining-builtins-modules=six.moves,future.builtins
-
-
-[FORMAT]
-
-# Expected format of line ending, e.g. empty (any line ending), LF or CRLF.
-# expected-line-ending-format=
-expected-line-ending-format=LF
-
-# Regexp for a line that is allowed to be longer than the limit.
-ignore-long-lines=^\s*(# )?<?https?://\S+>?$
-
-# Number of spaces of indent required inside a hanging or continued line.
-indent-after-paren=4
-
-# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1
-# tab).
-indent-string=' '
-
-# Maximum number of characters on a single line.
-max-line-length=100
-
-# Maximum number of lines in a module
-max-module-lines=1000
-
-# List of optional constructs for which whitespace checking is disabled. `dict-
-# separator` is used to allow tabulation in dicts, etc.: {1 : 1,\n222: 2}.
-# `trailing-comma` allows a space between comma and closing bracket: (a, ).
-# `empty-line` allows space-only lines.
-no-space-check=trailing-comma,dict-separator
-
-# Allow the body of a class to be on the same line as the declaration if body
-# contains single statement.
-single-line-class-stmt=no
-
-# Allow the body of an if to be on the same line as the test if there is no
-# else.
-single-line-if-stmt=no
-
-
-[SIMILARITIES]
-
-# Ignore comments when computing similarities.
-ignore-comments=yes
-
-# Ignore docstrings when computing similarities.
-ignore-docstrings=yes
-
-# Ignore imports when computing similarities.
-ignore-imports=no
-
-# Minimum lines number of a similarity.
-min-similarity-lines=4
-
-
-[BASIC]
-
-# Naming hint for argument names
-argument-name-hint=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
-
-# Regular expression matching correct argument names
-argument-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
-
-# Naming hint for attribute names
-attr-name-hint=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
-
-# Regular expression matching correct attribute names
-attr-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
-
-# Bad variable names which should always be refused, separated by a comma
-bad-names=foo,bar,baz,toto,tutu,tata
-
-# Naming hint for class attribute names
-class-attribute-name-hint=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$
-
-# Regular expression matching correct class attribute names
-class-attribute-rgx=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$
-
-# Naming hint for class names
-# class-name-hint=[A-Z_][a-zA-Z0-9]+$
-class-name-hint=[A-Z_][a-zA-Z0-9_]+$
-
-# Regular expression matching correct class names
-# class-rgx=[A-Z_][a-zA-Z0-9]+$
-class-rgx=[A-Z_][a-zA-Z0-9_]+$
-
-# Naming hint for constant names
-const-name-hint=(([A-Z_][A-Z0-9_]*)|(__.*__))$
-
-# Regular expression matching correct constant names
-const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__))$
-
-# Minimum line length for functions/classes that require docstrings, shorter
-# ones are exempt.
-docstring-min-length=-1
-
-# Naming hint for function names
-function-name-hint=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
-
-# Regular expression matching correct function names
-function-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
-
-# Good variable names which should always be accepted, separated by a comma
-# good-names=i,j,k,ex,Run,_
-good-names=r,g,b,w,i,j,k,n,x,y,z,ex,ok,Run,_
-
-# Include a hint for the correct naming format with invalid-name
-include-naming-hint=no
-
-# Naming hint for inline iteration names
-inlinevar-name-hint=[A-Za-z_][A-Za-z0-9_]*$
-
-# Regular expression matching correct inline iteration names
-inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$
-
-# Naming hint for method names
-method-name-hint=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
-
-# Regular expression matching correct method names
-method-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
-
-# Naming hint for module names
-module-name-hint=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$
-
-# Regular expression matching correct module names
-module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$
-
-# Colon-delimited sets of names that determine each other's naming style when
-# the name regexes allow several styles.
-name-group=
-
-# Regular expression which should only match function or class names that do
-# not require a docstring.
-no-docstring-rgx=^_
-
-# List of decorators that produce properties, such as abc.abstractproperty. Add
-# to this list to register other decorators that produce valid properties.
-property-classes=abc.abstractproperty
-
-# Naming hint for variable names
-variable-name-hint=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
-
-# Regular expression matching correct variable names
-variable-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
-
-
-[IMPORTS]
-
-# Allow wildcard imports from modules that define __all__.
-allow-wildcard-with-all=no
-
-# Analyse import fallback blocks. This can be used to support both Python 2 and
-# 3 compatible code, which means that the block might have code that exists
-# only in one or another interpreter, leading to false positives when analysed.
-analyse-fallback-blocks=no
-
-# Deprecated modules which should not be used, separated by a comma
-deprecated-modules=optparse,tkinter.tix
-
-# Create a graph of external dependencies in the given file (report RP0402 must
-# not be disabled)
-ext-import-graph=
-
-# Create a graph of every (i.e. internal and external) dependencies in the
-# given file (report RP0402 must not be disabled)
-import-graph=
-
-# Create a graph of internal dependencies in the given file (report RP0402 must
-# not be disabled)
-int-import-graph=
-
-# Force import order to recognize a module as part of the standard
-# compatibility libraries.
-known-standard-library=
-
-# Force import order to recognize a module as part of a third party library.
-known-third-party=enchant
-
-
-[CLASSES]
-
-# List of method names used to declare (i.e. assign) instance attributes.
-defining-attr-methods=__init__,__new__,setUp
-
-# List of member names, which should be excluded from the protected access
-# warning.
-exclude-protected=_asdict,_fields,_replace,_source,_make
-
-# List of valid names for the first argument in a class method.
-valid-classmethod-first-arg=cls
-
-# List of valid names for the first argument in a metaclass class method.
-valid-metaclass-classmethod-first-arg=mcs
-
-
-[DESIGN]
-
-# Maximum number of arguments for function / method
-max-args=5
-
-# Maximum number of attributes for a class (see R0902).
-# max-attributes=7
-max-attributes=11
-
-# Maximum number of boolean expressions in a if statement
-max-bool-expr=5
-
-# Maximum number of branch for function / method body
-max-branches=12
-
-# Maximum number of locals for function / method body
-max-locals=15
-
-# Maximum number of parents for a class (see R0901).
-max-parents=7
-
-# Maximum number of public methods for a class (see R0904).
-max-public-methods=20
-
-# Maximum number of return / yield for function / method body
-max-returns=6
-
-# Maximum number of statements in function / method body
-max-statements=50
-
-# Minimum number of public methods for a class (see R0903).
-min-public-methods=1
-
-
-[EXCEPTIONS]
-
-# Exceptions that will emit a warning when being caught. Defaults to
-# "Exception"
-overgeneral-exceptions=Exception

original_message: Delete .pylintrc


diff:
%module javaupm_htu21d
%include "../upm.i"
+%include "typemaps.i"
+
+%apply float *OUTPUT {float *fHum};
+%apply float *OUTPUT {float *fHumTemp};
+%apply float *OUTPUT {float *fDewPt};
+%inline %{
+ extern int getHumidityData(float* fHum, float* fHumTemp, float* fDewPt);
+%}
%{
#include "htu21d.hpp"

diff:
%include "arrays_java.i";
%include "../java_buffer.i"
+%apply unsigned char *OUTPUT { uint8_t *val };
+
+%inline %{
+ extern void setValueAsBytes(int nodeId, int index, uint8_t *val, uint8_t len);
+%}
+
%include "ozw.hpp"
%{
#include "ozw.hpp"

repo: eclipse/upm

original_message:
java: solved unclean Java bindings for: htu21d, ozw

Signed-off-by: Bogdan Ichim <bogdan.ichim@rinftech.com>
Signed-off-by: Stefan Andritoiu <stefan.andritoiu@gmail.com>


diff:
%apply unsigned char *OUTPUT { uint8_t *val };
-%inline %{
- extern void setValueAsBytes(int nodeId, int index, uint8_t *val, uint8_t len);
-%}
-
%include "ozw.hpp"
%{
#include "ozw.hpp"

original_message:
java: removed unnecessary method definitions from htu21d and ozw interface file

Signed-off-by: Stefan Andritoiu <stefan.andritoiu@gmail.com>


diff:
%include "../upm.i"
%include "typemaps.i"
-%apply float *OUTPUT {float *fHum};
-%apply float *OUTPUT {float *fHumTemp};
-%apply float *OUTPUT {float *fDewPt};
+%ignore getHumidityData(float*, float*, float*);
%{
#include "htu21d.hpp"

original_message:
java: ignored function that returns output through pointers in C++ (single element arrays in Java), as the same functionality is provided by other methods of the class.

Signed-off-by: Stefan Andritoiu <stefan.andritoiu@gmail.com>


message: java: Fixed HTU21DSample

diff:
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-//NOT TESTED!!!
public class HTU21DSample {
public static void main(String[] args) throws InterruptedException {
// ! [Interesting]
- float humidity = 0;
- float temperature = 0;
- float compRH = 0;
-
upm_htu21d.HTU21D sensor = new upm_htu21d.HTU21D(0);
sensor.testSensor();
while (true) {
- compRH = sensor.getCompRH();
- humidity = sensor.getHumidity();
- temperature = sensor.getTemperature();
+ sensor.sampleData();
- System.out.println("Humidity: " + humidity + ", Temperature: " + temperature
- + ", compensated RH: " + compRH);
+ System.out.println("Humidity: " + sensor.getHumidity() + "%");
+ System.out.println("Compensated RH: " + sensor.getCompRH() + "%");
+ System.out.println("Temperature: " + sensor.getTemperature() + "C");
+ System.out.println("Dew Point: " + sensor.getDewPoint() + "C");
- Thread.sleep(5000);
+ Thread.sleep(1000);
}
// ! [Interesting]
}

original_message:
java: Fixed HTU21DSample

Signed-off-by: Stefan Andritoiu <stefan.andritoiu@gmail.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>


diff:
%module javaupm_bma250e
%include "../upm.i"
%include "typemaps.i"
-%include "../upm_vectortypes.i"
+%include "std_vector.i"
%ignore getAccelerometer(float *, float *, float *);
+%template(floatVector) std::vector<float>;
+
%include "bma250e_defs.h"
%include "bma250e.hpp"
%{

diff:
%module javaupm_bmg160
%include "../upm.i"
%include "typemaps.i"
-%include "../upm_vectortypes.i"
+%include "std_vector.i"
%ignore getGyroscope(float *, float *, float *);
+%template(floatVector) std::vector<float>;
+
%include "bmg160_defs.h"
%include "bmg160.hpp"
%{

diff:
%module javaupm_bmm150
%include "../upm.i"
%include "typemaps.i"
-%include "../upm_vectortypes.i"
+%include "std_vector.i"
%ignore getMagnetometer(float *, float *, float *);
+%template(floatVector) std::vector<float>;
+
%include "bmm150_defs.h"
%include "bmm150.hpp"
%{

diff:
%include "../upm.i"
%include "cpointer.i"
%include "typemaps.i"
-%include "../upm_vectortypes.i"
+%include "std_vector.i"
%apply int {mraa::Edge};
%ignore getMagnetometer(float *, float *, float *);
%ignore getGyroscope(float *, float *, float *);
+%template(floatVector) std::vector<float>;
+
%include "bmg160_defs.h"
%include "bma250e_defs.h"
%include "bmm150_defs.h"

diff:
%include "../upm.i"
%include "cpointer.i"
%include "typemaps.i"
-%include "../upm_vectortypes.i"
+%include "std_vector.i"
+%include "stdint.i"
%ignore getCalibrationStatus(int *, int *, int *, int *);
%ignore getAccelerometer(float *, float *, float *);
%ignore getLinearAcceleration(float *, float *, float *);
%ignore getGravityVectors(float *, float *, float *);
+%template(floatVector) std::vector<float>;
+%template(byteVector) std::vector<uint8_t>;
+%template(intVector) std::vector<int>;
+
%include "bno055_regs.h"
%include "bno055.hpp"
%{

diff:
%module javaupm_jhd1313m1
%include "../upm.i"
-%include "../upm_vectortypes.i"
%include "typemaps.i"
+%include "std_vector.i"
+%include "stdint.i"
+
+%template(byteVector) std::vector<uint8_t>;
%include "jhd1313m1.hpp"
%{

diff:
%module javaupm_lcdks
%include "../upm.i"
-%include "../upm_vectortypes.i"
%include "typemaps.i"
+%include "std_vector.i"
+%include "stdint.i"
+
+%template(byteVector) std::vector<uint8_t>;
%include "lcdks.hpp"
%{

diff:
%module javaupm_lcm1602
%include "../upm.i"
-%include "../upm_vectortypes.i"
%include "typemaps.i"
+%include "std_vector.i"
+%include "stdint.i"
+
+%template(byteVector) std::vector<uint8_t>;
%include "lcm1602.hpp"
%{

diff:
%module javaupm_lsm303agr
%include "../upm.i"
%include "typemaps.i"
-%include "../upm_vectortypes.i"
+%include "std_vector.i"
%ignore getMagnetometer(float *, float *, float *);
%ignore getAccelerometer(float *, float *, float *);
+%template(floatVector) std::vector<float>;
+
%include "lsm303agr_defs.h"
%include "lsm303agr.hpp"
%{

diff:
%module javaupm_lsm303d
%include "../upm.i"
%include "typemaps.i"
-%include "../upm_vectortypes.i"
+%include "std_vector.i"
%ignore getMagnetometer(float *, float *, float *);
%ignore getAccelerometer(float *, float *, float *);
+%template(floatVector) std::vector<float>;
+
%include "lsm303d_defs.h"
%include "lsm303d.hpp"
%{

original_message:
java: removed unnecessary generated wrapper objects for std::vector

Signed-off-by: Bogdan Ichim <bogdan.ichim@rinftech.com>
Signed-off-by: Stefan Andritoiu <stefan.andritoiu@gmail.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>


diff:
+// Java typemaps for autoboxing in return types of generics
+%define AUTOBOX(CTYPE, JTYPE)
+%typemap(autobox) CTYPE, const CTYPE&, CTYPE& "JTYPE"
+%enddef
+AUTOBOX(double, Double)
+AUTOBOX(float, Float)
+AUTOBOX(boolean, Boolean)
+AUTOBOX(signed char, Byte)
+AUTOBOX(short, Short)
+AUTOBOX(int, Integer)
+AUTOBOX(long, Long)
+AUTOBOX(SWIGTYPE, $typemap(jstype,$1_basetype))
\ No newline at end of file

diff:
%module javaupm_bma250e
%include "../upm.i"
%include "typemaps.i"
-%include "std_vector.i"
+%include "../upm_stdvector.i"
%ignore getAccelerometer(float *, float *, float *);
+%typemap(javaimports) SWIGTYPE %{
+import java.util.AbstractList;
+import java.lang.Float;
+%}
+
+%typemap(javaout) upm::BMA250E {
+ return new $&javaclassname($jnicall, true);
+}
+%typemap(javaout) std::vector<float> {
+ return (AbstractList<Float>)(new $&javaclassname($jnicall, true));
+}
+%typemap(jstype) std::vector<float> "AbstractList<Float>"
+
%template(floatVector) std::vector<float>;
%include "bma250e_defs.h"

diff:
%module javaupm_bmg160
%include "../upm.i"
%include "typemaps.i"
-%include "std_vector.i"
+%include "../upm_stdvector.i"
%ignore getGyroscope(float *, float *, float *);
+%typemap(javaimports) SWIGTYPE %{
+import java.util.AbstractList;
+import java.lang.Float;
+%}
+
+%typemap(javaout) SWIGTYPE {
+ return new $&javaclassname($jnicall, true);
+}
+%typemap(javaout) std::vector<float> {
+ return (AbstractList<Float>)(new $&javaclassname($jnicall, true));
+}
+%typemap(jstype) std::vector<float> "AbstractList<Float>"
+
%template(floatVector) std::vector<float>;
%include "bmg160_defs.h"

diff:
%module javaupm_bmm150
%include "../upm.i"
%include "typemaps.i"
-%include "std_vector.i"
+%include "../upm_stdvector.i"
%ignore getMagnetometer(float *, float *, float *);
+%typemap(javaimports) SWIGTYPE %{
+import java.util.AbstractList;
+import java.lang.Float;
+%}
+
+%typemap(javaout) SWIGTYPE {
+ return new $&javaclassname($jnicall, true);
+}
+%typemap(javaout) std::vector<float> {
+ return (AbstractList<Float>)(new $&javaclassname($jnicall, true));
+}
+%typemap(jstype) std::vector<float> "AbstractList<Float>"
+
%template(floatVector) std::vector<float>;
%include "bmm150_defs.h"

diff:
%include "../upm.i"
%include "cpointer.i"
%include "typemaps.i"
-%include "std_vector.i"
+%include "../upm_stdvector.i"
%apply int {mraa::Edge};
%ignore getMagnetometer(float *, float *, float *);
%ignore getGyroscope(float *, float *, float *);
+%typemap(javaimports) SWIGTYPE %{
+import java.util.AbstractList;
+import java.lang.Float;
+%}
+
+%typemap(javaout) SWIGTYPE {
+ return new $&javaclassname($jnicall, true);
+}
+%typemap(javaout) std::vector<float> {
+ return (AbstractList<Float>)(new $&javaclassname($jnicall, true));
+}
+%typemap(jstype) std::vector<float> "AbstractList<Float>"
+
%template(floatVector) std::vector<float>;
%include "bmg160_defs.h"

diff:
%module javaupm_lsm303agr
%include "../upm.i"
%include "typemaps.i"
-%include "std_vector.i"
+%include "../upm_stdvector.i"
%ignore getMagnetometer(float *, float *, float *);
%ignore getAccelerometer(float *, float *, float *);
+%typemap(javaimports) SWIGTYPE %{
+import java.util.AbstractList;
+import java.lang.Float;
+%}
+
+%typemap(javaout) SWIGTYPE {
+ return new $&javaclassname($jnicall, true);
+}
+%typemap(javaout) std::vector<float> {
+ return (AbstractList<Float>)(new $&javaclassname($jnicall, true));
+}
+%typemap(jstype) std::vector<float> "AbstractList<Float>"
+
%template(floatVector) std::vector<float>;
%include "lsm303agr_defs.h"

diff:
%module javaupm_lsm303d
%include "../upm.i"
%include "typemaps.i"
-%include "std_vector.i"
+%include "../upm_stdvector.i"
%ignore getMagnetometer(float *, float *, float *);
%ignore getAccelerometer(float *, float *, float *);
+%typemap(javaimports) SWIGTYPE %{
+import java.util.AbstractList;
+import java.lang.Float;
+%}
+
+%typemap(javaout) SWIGTYPE {
+ return new $&javaclassname($jnicall, true);
+}
+%typemap(javaout) std::vector<float> {
+ return (AbstractList<Float>)(new $&javaclassname($jnicall, true));
+}
+%typemap(jstype) std::vector<float> "AbstractList<Float>"
+
%template(floatVector) std::vector<float>;
%include "lsm303d_defs.h"

diff:
+%include "autobox.i"
+
+%{
+#include <vector>
+#include <stdexcept>
+%}
+
+%include <stdint.i>
+%include <std_except.i>
+
+namespace std {
+
+ template<class T> class vector {
+ public:
+ typedef size_t size_type;
+ typedef T value_type;
+ typedef const value_type& const_reference;
+ vector();
+ vector(size_type n);
+ vector(const vector& o);
+ size_type capacity() const;
+ void reserve(size_type n);
+ %rename(isEmpty) empty;
+ bool empty() const;
+ void clear();
+ void push_back(const value_type& x);
+ %extend {
+ const_reference get_impl(int i) throw (std::out_of_range) {
+ // at will throw if needed, swig will handle
+ return self->at(i);
+ }
+ value_type set(int i, const value_type& VECTOR_VALUE_IN) throw (std::out_of_range) {
+ const T old = $self->at(i);
+ $self->at(i) = VECTOR_VALUE_IN;
+ return old;
+ }
+ int32_t size() const {
+ return $self->size();
+ }
+ void removeRange(int32_t from, int32_t to) {
+ $self->erase($self->begin()+from, $self->begin()+to);
+ }
+ }
+ };
+}
+
+%typemap(javabase) std::vector "java.util.AbstractList<$typemap(autobox,$1_basetype::value_type)>"
+%typemap(javainterface) std::vector "java.util.RandomAccess"
+%typemap(jstype) std::vector set "$typemap(autobox,$1_basetype)"
+%typemap(jstype) std::vector &VECTOR_VALUE_IN "$typemap(autobox,$1_basetype)"
+%typemap(javacode) std::vector %{
+ $javaclassname(java.util.Collection<$typemap(autobox,$1_basetype::value_type)> e) {
+ this.reserve(e.size());
+ for($typemap(autobox,$1_basetype::value_type) value : e) {
+ this.push_back(value);
+ }
+ }
+ public $typemap(autobox,$1_basetype::value_type) get(int idx) {
+ return get_impl(idx);
+ }
+%}
\ No newline at end of file

original_message:
java: converted wrappers for std::vector to inherit from AbstractList<>

Signed-off-by: Bogdan Ichim <bogdan.ichim@rinftech.com>
Signed-off-by: Stefan Andritoiu <stefan.andritoiu@gmail.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>


diff:
*/
import upm_bma250e.BMA250E;
+import java.util.AbstractList;
+import java.lang.Float;
public class BMA250E_Example
{
@@ -42,7 +44,7 @@ public class BMA250E_Example
// update our values from the sensor
sensor.update();
- upm_bma250e.floatVector dataA = sensor.getAccelerometer();
+ AbstractList<Float> dataA = sensor.getAccelerometer();
System.out.println("Accelerometer x: " + dataA.get(0)
+ " y: " + dataA.get(1)

diff:
*/
import upm_bmx055.BMC150;
+import java.util.AbstractList;
+import java.lang.Float;
public class BMC150_Example
{
@@ -40,7 +42,7 @@ public class BMC150_Example
// update our values from the sensor
sensor.update();
- upm_bmx055.floatVector data = sensor.getAccelerometer();
+ AbstractList<Float> data = sensor.getAccelerometer();
System.out.println("Accelerometer x: " + data.get(0)
+ " y: " + data.get(1)

diff:
*/
import upm_bmg160.BMG160;
+import java.util.AbstractList;
+import java.lang.Float;
public class BMG160_Example
{
@@ -42,7 +44,7 @@ public class BMG160_Example
// update our values from the sensor
sensor.update();
- upm_bmg160.floatVector data = sensor.getGyroscope();
+ AbstractList<Float> data = sensor.getGyroscope();
System.out.println("Gyroscope x: " + data.get(0)
+ " y: " + data.get(1)

diff:
*/
import upm_bmx055.BMI055;
+import java.util.AbstractList;
+import java.lang.Float;
public class BMI055_Example
{
@@ -40,7 +42,7 @@ public class BMI055_Example
// update our values from the sensor
sensor.update();
- upm_bmx055.floatVector data = sensor.getAccelerometer();
+ AbstractList<Float> data = sensor.getAccelerometer();
System.out.println("Accelerometer x: " + data.get(0)
+ " y: " + data.get(1)

diff:
*/
import upm_bmm150.BMM150;
+import java.util.AbstractList;
+import java.lang.Float;
public class BMM150_Example
{
@@ -44,7 +46,7 @@ public class BMM150_Example
// update our values from the sensor
sensor.update();
- upm_bmm150.floatVector data = sensor.getMagnetometer();
+ AbstractList<Float> data = sensor.getMagnetometer();
System.out.println("Magnetometer x: " + data.get(0)
+ " y: " + data.get(1)

diff:
*/
import upm_bmx055.BMX055;
+import java.util.AbstractList;
+import java.lang.Float;
public class BMX055_Example
{
@@ -40,7 +42,7 @@ public class BMX055_Example
// update our values from the sensor
sensor.update();
- upm_bmx055.floatVector data = sensor.getAccelerometer();
+ AbstractList<Float> data = sensor.getAccelerometer();
System.out.println("Accelerometer x: " + data.get(0)
+ " y: " + data.get(1)

diff:
*/
import upm_lsm303agr.LSM303AGR;
+import java.util.AbstractList;
+import java.lang.Float;
public class LSM303AGR_Example
{
@@ -40,7 +42,7 @@ public class LSM303AGR_Example
// update our values from the sensor
sensor.update();
- upm_lsm303agr.floatVector data = sensor.getAccelerometer();
+ AbstractList<Float> data = sensor.getAccelerometer();
System.out.println("Accelerometer x: " + data.get(0)
+ " y: " + data.get(1)

diff:
*/
import upm_lsm303d.LSM303D;
+import java.util.AbstractList;
+import java.lang.Float;
public class LSM303D_Example
{
@@ -40,7 +42,7 @@ public class LSM303D_Example
// update our values from the sensor
sensor.update();
- upm_lsm303d.floatVector data = sensor.getAccelerometer();
+ AbstractList<Float> data = sensor.getAccelerometer();
System.out.println("Accelerometer x: " + data.get(0)
+ " y: " + data.get(1)

original_message:
java: updated examples to use AbstractList<> for data containers

Signed-off-by: Bogdan Ichim <bogdan.ichim@rinftech.com>
Signed-off-by: Stefan Andritoiu <stefan.andritoiu@gmail.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>


diff:
%module javaupm_bma250e
%include "../upm.i"
%include "typemaps.i"
-%include "../upm_stdvector.i"
+%include "../upm_javastdvector.i"
%ignore getAccelerometer(float *, float *, float *);

diff:
%module javaupm_bmg160
%include "../upm.i"
%include "typemaps.i"
-%include "../upm_stdvector.i"
+%include "../upm_javastdvector.i"
%ignore getGyroscope(float *, float *, float *);

diff:
%module javaupm_bmm150
%include "../upm.i"
%include "typemaps.i"
-%include "../upm_stdvector.i"
+%include "../upm_javastdvector.i"
%ignore getMagnetometer(float *, float *, float *);

diff:
%include "../upm.i"
%include "cpointer.i"
%include "typemaps.i"
-%include "../upm_stdvector.i"
+%include "../upm_javastdvector.i"
%apply int {mraa::Edge};

diff:
%module javaupm_lsm303agr
%include "../upm.i"
%include "typemaps.i"
-%include "../upm_stdvector.i"
+%include "../upm_javastdvector.i"
%ignore getMagnetometer(float *, float *, float *);
%ignore getAccelerometer(float *, float *, float *);

diff:
%module javaupm_lsm303d
%include "../upm.i"
%include "typemaps.i"
-%include "../upm_stdvector.i"
+%include "../upm_javastdvector.i"
%ignore getMagnetometer(float *, float *, float *);
%ignore getAccelerometer(float *, float *, float *);

original_message:
java: Renamed stdvector interface file to reflect the fact that it is only used in Java

Signed-off-by: Stefan Andritoiu <stefan.andritoiu@gmail.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>


message: Added iOrp interface

diff:
+/*
+ * Author: Mihai Stefanescu <mihai.stefanescu@rinftech.com>
+ * Copyright (c) 2018 Intel Corporation.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#pragma once
+
+namespace upm
+{
+/**
+ * @brief Interface for Oxidation/Reduction/Potential (ORP) Sensors
+*/
+ class iOrp
+ {
+ public:
+ virtual ~iOrp() {}
+
+ /**
+ * Get computed ORP (in millivolts) value from the
+ * sensor.
+ *
+ * @return ORP value in millivolts
+ */
+ virtual float getORPValue() = 0;
+ };
+}

diff:
@@ -75,6 +75,12 @@ float DFRORP::getORP()
return dfrorp_get_orp(m_dfrorp);
}
+float DFRORP::getORPValue()
+{
+ DFRORP::update();
+ return DFRORP::getORP();
+}
+
float DFRORP::getVolts()
{
return dfrorp_get_volts(m_dfrorp);

diff:
#include <string.h>
#include "dfrorp.h"
+#include <interfaces/iOrp.hpp>
namespace upm {
/**
@@ -70,7 +71,7 @@ namespace upm {
* @snippet dfrorp.cxx Interesting
*/
- class DFRORP {
+ class DFRORP : virtual public iOrp {
public:
/**
@@ -118,6 +119,14 @@ namespace upm {
*/
float getORP();
+ /**
+ * Get computed ORP (in millivolts) value from the
+ * sensor.
+ *
+ * @return ORP value in millivolts
+ */
+ virtual float getORPValue();
+
/**
* Set the calibration offset for the device. This is
* determined by disconnecting the sensor probe (but leaving the

original_message:
Added iOrp interface

Signed-off-by: Stefan Andritoiu <stefan.andritoiu@gmail.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>


message: Added interface iPH

diff:
+/*
+ * Author: Mihai Stefanescu <mihai.stefanescu@rinftech.com>
+ * Copyright (c) 2018 Intel Corporation.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#pragma once
+
+namespace upm
+{
+/**
+ * @brief Interface for PH sensors
+*/
+ class iPH
+ {
+ public:
+ virtual ~iPH() {}
+
+ /**
+ * Take a number of samples and return the detected pH value. The
+ * default number of samples is 15.
+ *
+ * @param samples The number of samples to average over, default 15
+ * @return The pH value detected
+ */
+ virtual float pH(unsigned int samples = 15) = 0;
+
+ };
+}

diff:
#include <string>
#include "dfrph.h"
+#include <interfaces/iPH.hpp>
namespace upm {
/**
@@ -88,7 +89,7 @@ namespace upm {
* @snippet dfrph.cxx Interesting
*/
- class DFRPH {
+ class DFRPH : virtual public iPH {
public:
/**
@@ -129,7 +130,7 @@ namespace upm {
* @param samples The number of samples to average over, default 15
* @return The pH value detected
*/
- float pH(unsigned int samples = 15);
+ virtual float pH(unsigned int samples = 15);
private:
/**
@@ -141,5 +142,3 @@ namespace upm {
dfrph_context _dev;
};
}
-
-

original_message:
Added interface iPH

Signed-off-by: Stefan Andritoiu <stefan.andritoiu@gmail.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>


message: Added iProximity interface

diff:
+/*
+ * Author: Mihai Stefanescu <mihai.stefanescu@rinftech.com>
+ * Copyright (c) 2018 Intel Corporation.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#pragma once
+
+namespace upm
+{
+/**
+ * @brief Interface for Proximity sensors
+*/
+ class iProximity
+ {
+ public:
+ virtual ~iProximity() {}
+
+ virtual float getValue() = 0;
+ };
+}

diff:
@@ -67,3 +67,8 @@ float GP2Y0A::value(float aref, uint8_t samples)
return volts;
}
+
+float GP2Y0A::getValue()
+{
+ return GP2Y0A::value(5.0, (uint8_t) 1);
+}

diff:
#include <iostream>
#include <string>
#include <mraa/aio.h>
+#include <interfaces/iProximity.hpp>
namespace upm {
/**
@@ -54,7 +55,7 @@ namespace upm {
* @image html gp2y0a.jpg
* @snippet gp2y0a.cxx Interesting
*/
- class GP2Y0A {
+ class GP2Y0A : virtual public iProximity {
public:
/**
@@ -78,11 +79,19 @@ namespace upm {
*/
float value(float aref, uint8_t samples);
+ /**
+ * Gets the voltage value from the sensor from a single sample
+ * A refernce voltage of 5.0V is used for the reading.
+ *
+ * @return Voltage reading from a single sample
+ */
+ virtual float getValue();
+
+
+
private:
mraa_aio_context m_aio;
// ADC resolution
int m_aRes;
};
}
-
-

diff:
@@ -58,6 +58,11 @@ MAX44000::getProximity () {
return data;
}
+float
+MAX44000::getValue() {
+ return (float) MAX44000::getProximity();
+}
+
uint16_t
MAX44000::getAmbient () {
uint16_t data = 0;

diff:
#include <string>
#include <mraa/i2c.hpp>
+#include <interfaces/iProximity.hpp>
#define ADDR 0x4A // device address
@@ -78,7 +79,7 @@ namespace upm {
*
* @snippet max44000.cxx Interesting
*/
-class MAX44000 {
+class MAX44000 : virtual public iProximity {
public:
/**
* Instantiates an MAX44000 object
@@ -99,6 +100,12 @@ class MAX44000 {
* Reads the proximity value from the sensor (based on ambient data).
*/
uint16_t getProximity ();
+
+ /**
+ * Reads the proximity value from the sensor.
+ */
+ virtual float getValue ();
+
/**
* Reads the ambient value from the sensor (based on ambient data).
*/

original_message:
Added iProximity interface

Signed-off-by: Stefan Andritoiu <stefan.andritoiu@gmail.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>


message: Added interface iRotaryAngle

diff:
@@ -34,6 +34,11 @@ namespace upm
public:
virtual ~iProximity() {}
+ /**
+ * Get proximity value from sensor data.
+ *
+ * @return Proximity value as volts.
+ */
virtual float getValue() = 0;
};
}

diff:
+/*
+ * Author: Mihai Stefanescu <mihai.stefanescu@rinftech.com>
+ * Copyright (c) 2018 Intel Corporation.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#pragma once
+
+namespace upm
+{
+/**
+ * @brief Interface for Rotary Angle sensors
+*/
+ class iRotaryAngle
+ {
+ public:
+ virtual ~iRotaryAngle() {}
+
+ /**
+ * Get rotation value from sensor data.
+ *
+ * @return rotation value.
+ */
+ virtual float getValue() = 0;
+ };
+}

diff:
@@ -77,3 +77,8 @@ float GroveRotary::rel_rad()
{
return GroveRotary::rel_deg() * M_PI / 180.0;
}
+
+float GroveRotary::getValue()
+{
+ return GroveRotary::abs_value();
+}

diff:
#include <string>
#include <mraa/aio.hpp>
#include "grovebase.hpp"
+#include <interfaces/iRotaryAngle.hpp>
namespace upm {
@@ -53,7 +54,7 @@ namespace upm {
* @image html rotaryencoder.jpg
* @snippet grove-groverotary.cxx Interesting
*/
-class GroveRotary: public Grove {
+class GroveRotary: public Grove, virtual public iRotaryAngle {
public:
/**
* Grove rotary angle sensor constructor
@@ -101,6 +102,14 @@ class GroveRotary: public Grove {
* @return Signed radians from the ADC
*/
float rel_rad();
+
+ /**
+ * Get rotation value as raw degrees from the AIO pin.
+ *
+ * @return rotation value.
+ */
+ virtual float getValue();
+
private:
mraa_aio_context m_aio;
static const int m_max_angle = 300;

diff:
@@ -76,3 +76,8 @@ float Rotary::rel_rad()
{
return Rotary::rel_deg() * M_PI / 180.0;
}
+
+ float Rotary::getValue()
+ {
+ return Rotary::abs_value();
+ }

diff:
#include <mraa/aio.hpp>
#include "rotary.hpp"
+#include <interfaces/iRotaryAngle.hpp>
namespace upm {
@@ -59,7 +60,7 @@ namespace upm {
* @image html rotary.jpg
* @snippet rotary.cxx Interesting
*/
-class Rotary{
+class Rotary : virtual public iRotaryAngle {
public:
/**
* Rotary angle sensor constructor
@@ -77,6 +78,7 @@ class Rotary{
* @return Unsigned value from the ADC
*/
float abs_value();
+
/**
* Gets absolute raw degrees from the AIO pin
*
@@ -107,6 +109,14 @@ class Rotary{
* @return Signed radians from the ADC
*/
float rel_rad();
+
+ /**
+ * Get rotation value as raw degrees from the AIO pin.
+ *
+ * @return rotation value.
+ */
+ virtual float getValue();
+
std::string name(){ return "Rotary Angle Sensor";}
private:
mraa_aio_context m_aio;

diff:
@@ -53,4 +53,6 @@ int RotaryEncoder::position()
return rotaryencoder_get_position(m_rotaryencoder);
}
-
+float RotaryEncoder::getValue() {
+ return (float) RotaryEncoder::position();
+}

diff:
#pragma once
#include "rotaryencoder.h"
+#include <interfaces/iRotaryAngle.hpp>
namespace upm {
@@ -60,7 +61,7 @@ namespace upm {
* @snippet rotaryencoder.cxx Interesting
*/
- class RotaryEncoder {
+ class RotaryEncoder : virtual public iRotaryAngle {
public:
/**
* RotaryEncoder constructor
@@ -87,6 +88,13 @@ namespace upm {
*/
int position();
+ /**
+ * Get rotation value from sensor data.
+ *
+ * @return rotation value.
+ */
+ virtual float getValue();
+
private:
/* Disable implicit copy and assignment operators */
RotaryEncoder(const RotaryEncoder&) = delete;
@@ -95,5 +103,3 @@ namespace upm {
rotaryencoder_context m_rotaryencoder;
};
}
-
-

original_message:
Added interface iRotaryAngle

Signed-off-by: Stefan Andritoiu <stefan.andritoiu@gmail.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>