Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Format update for new Component Picker #186

Merged
merged 21 commits into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
61 changes: 34 additions & 27 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,15 @@ jobs:
EXIT_VALUE=0

# external contributors can modify some files
EXTERNAL_REGEX="^components\/(pin|i2c|servo|ds18x20|pwm|pixel|uart)\/.*\/(definition\.json|image\.(png|jpe?g|gif)|animation\.gif)$"
EXTERNAL_REGEX="^components\/(pin|i2c|servo|ds18x20|pwm|pixel|uart)\/.*\/(definition\.json|image\.(png|jpe?g|gif))$"

# folks with write access to the repo (Adafruit team) can change more sensitive files
INTERNAL_REGEX="^(\.github\/.*|components\/(sensors.json|(pin|i2c|servo|ds18x20|pwm|pixel|uart)\/(schema.json|.*\/(definition\.json|image\.(png|jpe?g|gif)|animation\.gif))))$"
INTERNAL_REGEX="^(\.github\/.*|components\/(sensors.json|(pin|i2c|servo|ds18x20|pwm|pixel|uart)\/(schema.json|.*\/(definition\.json|image\.(png|jpe?g|gif)))))$"

# apply the appropriate regex based on permissions of the user
if [[ $CAN_WRITE_TO_REPO ]]; then
component_definition_regex=$INTERNAL_REGEX

else
component_definition_regex=$EXTERNAL_REGEX
fi
Expand All @@ -95,12 +96,19 @@ jobs:
if [[ $file =~ [A-Z] ]]; then
echo "❌ $file (no uppercase characters allowed)"
EXIT_VALUE=1

else
echo "✅ $file"
fi
else
echo "❌ $file (only Adafruit staff may modify this file)"
if [[ $file =~ $INTERNAL_REGEX ]]; then
echo "❌ $file (only Adafruit staff may modify this file)"

else
echo "❌ $file should not exist"
fi
EXIT_VALUE=1

fi
done

Expand All @@ -125,7 +133,7 @@ jobs:
EXIT_VALUE=0

for FILE in $FILES; do
if ! [[ $FILE =~ "\.(svg|jpe?g|png)$" ]]; then
if ! [[ $FILE =~ \.(svg|jpe?g|png)$ ]]; then
continue # non-image file
fi

Expand Down Expand Up @@ -181,48 +189,53 @@ jobs:
run: |
EXIT_VALUE=0

MAX_DIMENSION=600
MAX_WIDTH=400
MAX_HEIGHT=300

echo "Evaluating Files $FILES"

for FILE in $FILES; do
if ! [[ $FILE =~ "\.(svg|jpe?g|png)$" ]]; then
if ! [[ $FILE =~ \.(svg|jpe?g|png)$ ]]; then
echo "$FILE: not an image"
continue # non-image file
fi

# use imagemagick to pull the dimensions
WIDTH=`identify -ping -format "%w" ${FILE}[0]`
HEIGHT=`identify -ping -format "%h" ${FILE}[0]`
EXPECTED_HEIGHT=$(("$WIDTH"*3/4))

NOT_SQUARE=false
if [[ "$WIDTH" -ne "$HEIGHT" ]]; then
NOT_4_3_RATIO=false
if [[ $EXPECTED_HEIGHT -ne "$HEIGHT" ]]; then
EXIT_VALUE=1
NOT_SQUARE=true
NOT_4_3_RATIO=true
fi

BAD_WIDTH=false
if [[ "$WIDTH" -gt "$MAX_DIMENSION" ]]; then
if [[ "$WIDTH" -gt "$MAX_WIDTH" ]]; then
EXIT_VALUE=1
BAD_WIDTH=true
fi

BAD_HEIGHT=false
if [[ "$HEIGHT" -gt "$MAX_DIMENSION" ]]; then
if [[ "$HEIGHT" -gt "$MAX_HEIGHT" ]]; then
EXIT_VALUE=1
BAD_HEIGHT=true
fi

if [[ $NOT_SQUARE = true || $BAD_WIDTH = true || $BAD_HEIGHT = true ]]; then
if [[ $EXIT_VALUE = 1 ]]; then
echo "❌ $FILE (${WIDTH}x${HEIGHT})"

if [[ $NOT_SQUARE = true ]]; then
echo " 🟥 width and height must be equal"
if [[ $NOT_4_3_RATIO = true ]]; then
echo " width x height must have a 4:3 ratio: resize height to ${EXPECTED_HEIGHT}"
fi

if [[ $BAD_WIDTH = true ]]; then
echo " ↔️ width must be ${MAX_DIMENSION} pixels or less"
echo " ↔️ width must be ${MAX_WIDTH} pixels or less"
fi

if [[ $BAD_HEIGHT = true ]]; then
echo " ↕️ height must be ${MAX_DIMENSION} pixels or less"
echo " ↕️ height must be ${MAX_HEIGHT} pixels or less"
fi

else
Expand All @@ -231,7 +244,7 @@ jobs:
done

if [[ $EXIT_VALUE = 1 ]]; then
echo "Fix these ☝️ issues by resizing each ❌ image to be square and fit within ${MAX_DIMENSION}x${MAX_DIMENSION}."
echo "Fix these ☝️ issues by resizing each ❌ image to be 4:3 dimension ratio and fit within ${MAX_WIDTH}x${MAX_HEIGHT}."
fi

exit $EXIT_VALUE
Expand All @@ -251,20 +264,14 @@ jobs:
EXIT_VALUE=0

MAX_FILESIZE=$((100*1024)) # 100kb
MAX_ANIGIF_FILESIZE=$((700*1024)) # 700kb

for FILE in $FILES; do
if ! [[ $FILE =~ "\.(svg|jpe?g|png)$" ]]; then
if ! [[ $FILE =~ \.(svg|jpe?g|png)$ ]]; then
continue # non-image file
fi

FILESIZE=$(stat -c%s "$FILE")

if [[ $FILE == *animation.gif ]]; then
MAX=$MAX_ANIGIF_FILESIZE
else
MAX=$MAX_FILESIZE
fi
MAX=$MAX_FILESIZE

if [[ "$FILESIZE" -gt "$MAX" ]]; then
EXIT_VALUE=1
Expand All @@ -276,14 +283,14 @@ jobs:
done

if [[ $EXIT_VALUE = 1 ]]; then
echo "Fix these issues ☝️ by compressing each ❌ file to be smaller than 100KB (700KB for animation.gif animations). You can try:"
echo "Fix these issues ☝️ by compressing each ❌ file to be smaller than 100KB. You can try:"
echo "- using an image compressor"
echo "- exporting at lower quality settings (png or jpg)"
echo "- exporting a different image format:"
echo " - photos are best saved as jpg"
echo " - screenshots and digital images are best saved as png"
echo " - svg might be efficient for images with few colors and simple shapes"
echo " - gif should only be used for animations"
echo " - gif should not be used"
fi

exit $EXIT_VALUE
Binary file removed components/ds18x20/ds18b20/animation.gif
Binary file not shown.
3 changes: 3 additions & 0 deletions components/ds18x20/ds18b20/definition.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"displayName": "DS18B20",
"vendor": "Generic",
"productURL": "https://www.adafruit.com/product/374",
"documentationURL": "https://learn.adafruit.com/using-ds18b20-temperature-sensor-with-wippersnapper",
"published": true,
"subcomponents": ["ambient-temp", "ambient-temp-fahrenheit"],
"sensorResolution": 12
Expand Down
Binary file removed components/ds18x20/ds18b20/image.jpg
Binary file not shown.
Binary file not shown.
3 changes: 3 additions & 0 deletions components/ds18x20/ds18b20_hi_temp_waterproof/definition.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"displayName": "High Temp + Waterproof DS18B20",
"vendor": "Generic",
"productURL": "https://www.adafruit.com/product/642",
"documentationURL": "https://learn.adafruit.com/using-ds18b20-temperature-sensor-with-wippersnapper",
"published": true,
"subcomponents": ["ambient-temp", "ambient-temp-fahrenheit"],
"sensorResolution": 12
Expand Down
Binary file not shown.
Binary file removed components/ds18x20/ds18b20_waterproof/animation.gif
Binary file not shown.
3 changes: 3 additions & 0 deletions components/ds18x20/ds18b20_waterproof/definition.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"displayName": "Waterproof DS18B20",
"vendor": "Generic",
"productURL": "https://www.adafruit.com/product/381",
"documentationURL": "https://learn.adafruit.com/using-ds18b20-temperature-sensor-with-wippersnapper",
"published": true,
"subcomponents": ["ambient-temp", "ambient-temp-fahrenheit"],
"sensorResolution": 12
Expand Down
Binary file removed components/ds18x20/ds18b20_waterproof/image.jpg
Binary file not shown.
24 changes: 23 additions & 1 deletion components/ds18x20/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"title": "DS18X20 Component Definition",
"description": "A DS18X20 WipperSnapper component for use in Adafruit IO",
"type": "object",
"required": [ "displayName", "subcomponents", "sensorResolution"],
"required": [ "displayName", "vendor", "subcomponents", "sensorResolution"],
"additionalProperties": false,
"properties": {
"displayName": {
Expand All @@ -15,6 +15,28 @@
"description": "If true, this component is supported by the current firmware version and will be displayed to all users. If false, it is hidden behind a developer toggle so that contributors can still work on it against the production site.",
"type": "boolean"
},
"description": {
"description": "A brief description describing this component's capabilities.",
"type": "string",
"minLength": 3,
"maxLength": 255
},
"productURL": {
"description": "Link to this component's homepage.",
"type": "string",
"format": "uri"
},
"documentationURL": {
"description": "Link to this component's documentation.",
"type": "string",
"format": "uri"
},
"vendor": {
"description": "Name of the company that makes this component.",
"type": "string",
"minLength": 3,
"maxLength": 24
},
"subcomponents": {
"description": "The ambient temperature sensor (and its fahrenheit counterpart) standard on DS18X20 Components",
"type": "array",
Expand Down
3 changes: 3 additions & 0 deletions components/i2c/adt7410/definition.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"displayName": "ADT7410",
"vendor": "Analog Devices",
"productURL": "https://www.adafruit.com/product/4089",
"documentationURL": "https://learn.adafruit.com/adt7410-breakout",
"published": true,
"i2cAddresses": [ "0x48" ],
"subcomponents": [ "ambient-temp", "ambient-temp-fahrenheit" ]
Expand Down
Binary file removed components/i2c/adt7410/image.png
Binary file not shown.
Binary file removed components/i2c/aht20/animation.gif
Binary file not shown.
4 changes: 4 additions & 0 deletions components/i2c/aht20/definition.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
{
"displayName": "AHT20",
"published": true,
"vendor": "ASAIR",
"productURL": "https://www.adafruit.com/product/4566",
"documentationURL": "https://learn.adafruit.com/adafruit-aht20",
"description": "Inexpensive temperature and humidity sensor for I2C-capable boards.",
"i2cAddresses": [ "0x38" ],
"subcomponents": [ "ambient-temp", "ambient-temp-fahrenheit", "humidity" ]
}
Binary file removed components/i2c/aht20/image.jpg
Binary file not shown.
3 changes: 3 additions & 0 deletions components/i2c/am2301b/definition.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"displayName": "AM2301B",
"vendor": "ASAIR",
"productURL": "https://www.adafruit.com/product/5181",
"documentationURL": "https://cdn-shop.adafruit.com/product-files/5181/5181_AM2301B.pdf",
"published": true,
"i2cAddresses": [ "0x38" ],
"subcomponents": [ "ambient-temp", "ambient-temp-fahrenheit", "humidity" ]
Expand Down
Binary file removed components/i2c/am2301b/image.jpg
Binary file not shown.
3 changes: 3 additions & 0 deletions components/i2c/am2315c/definition.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"displayName": "AM2315C",
"vendor": "ASAIR",
"productURL": "https://www.adafruit.com/product/5182",
"documentationURL": "https://cdn-shop.adafruit.com/product-files/5182/5182_AM2315C.pdf",
"published": true,
"i2cAddresses": [ "0x38" ],
"subcomponents": [ "ambient-temp", "ambient-temp-fahrenheit", "humidity" ]
Expand Down
Binary file removed components/i2c/am2315c/image.jpg
Binary file not shown.
3 changes: 3 additions & 0 deletions components/i2c/bh1750/definition.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"displayName": "BH1750",
"vendor": "ROHM Semiconductor",
"productURL": "https://www.adafruit.com/product/4681",
"documentationURL": "https://learn.adafruit.com/adafruit-bh1750-ambient-light-sensor",
"published": true,
"i2cAddresses": [ "0x23", "0x5C" ],
"subcomponents": [ "light" ]
Expand Down
Binary file removed components/i2c/bh1750/image.jpg
Binary file not shown.
Binary file removed components/i2c/bme280/animation.gif
Binary file not shown.
3 changes: 3 additions & 0 deletions components/i2c/bme280/definition.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"displayName": "BME280",
"vendor": "Bosch",
"productURL": "https://www.adafruit.com/product/2652",
"documentationURL": "https://learn.adafruit.com/adafruit-bme280-humidity-barometric-pressure-temperature-sensor-breakout",
"published": true,
"i2cAddresses": [ "0x76", "0x77" ],
"subcomponents": [ "ambient-temp", "ambient-temp-fahrenheit", "humidity", "pressure", "altitude" ]
Expand Down
Binary file removed components/i2c/bme280/image.jpg
Binary file not shown.
Binary file removed components/i2c/bme680/animation.gif
Binary file not shown.
3 changes: 3 additions & 0 deletions components/i2c/bme680/definition.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"displayName": "BME680",
"vendor": "Bosch",
"productURL": "https://www.adafruit.com/product/3660",
"documentationURL": "https://learn.adafruit.com/adafruit-bme680-humidity-temperature-barometic-pressure-voc-gas",
"published": true,
"i2cAddresses": [ "0x76", "0x77" ],
"subcomponents": [ "ambient-temp", "ambient-temp-fahrenheit", "humidity", "pressure", "altitude", "gas-resistance" ]
Expand Down
Binary file removed components/i2c/bme680/image.jpg
Binary file not shown.
3 changes: 3 additions & 0 deletions components/i2c/bme688/definition.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"displayName": "BME688",
"vendor": "Bosch",
"productURL": "https://www.adafruit.com/product/5046",
"documentationURL": "https://learn.adafruit.com/adafruit-bme680-humidity-temperature-barometic-pressure-voc-gas",
"published": true,
"i2cAddresses": [ "0x76", "0x77" ],
"subcomponents": [ "ambient-temp", "ambient-temp-fahrenheit", "humidity", "pressure", "altitude", "gas-resistance" ]
Expand Down
Binary file removed components/i2c/bme688/image.jpg
Binary file not shown.
3 changes: 3 additions & 0 deletions components/i2c/bmp280/definition.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"displayName": "BMP280",
"vendor": "Bosch",
"productURL": "https://www.adafruit.com/product/2651",
"documentationURL": "https://learn.adafruit.com/adafruit-bmp280-barometric-pressure-plus-temperature-sensor-breakout",
"published": true,
"i2cAddresses": [ "0x76", "0x77" ],
"subcomponents": [ "ambient-temp", "ambient-temp-fahrenheit", "pressure", "altitude" ]
Expand Down
Binary file removed components/i2c/bmp280/image.jpg
Binary file not shown.
3 changes: 3 additions & 0 deletions components/i2c/bmp388/definition.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"displayName": "BMP388",
"vendor": "Bosch",
"productURL": "https://www.adafruit.com/product/3966",
"documentationURL": "https://learn.adafruit.com/adafruit-bmp388-bmp390-bmp3xx",
"published": true,
"i2cAddresses": [ "0x76", "0x77" ],
"subcomponents": [ "ambient-temp", "ambient-temp-fahrenheit", "pressure", "altitude" ]
Expand Down
Binary file removed components/i2c/bmp388/image.jpg
Binary file not shown.
3 changes: 3 additions & 0 deletions components/i2c/bmp390/definition.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"displayName": "BMP390",
"vendor": "Bosch",
"productURL": "https://www.adafruit.com/product/4816",
"documentationURL": "https://learn.adafruit.com/adafruit-bmp388-bmp390-bmp3xx",
"published": true,
"i2cAddresses": [ "0x76", "0x77" ],
"subcomponents": [ "ambient-temp", "ambient-temp-fahrenheit", "pressure", "altitude" ]
Expand Down
Binary file removed components/i2c/bmp390/image.jpg
Binary file not shown.
3 changes: 3 additions & 0 deletions components/i2c/dht20/definition.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"displayName": "DHT20",
"vendor": "ASAIR",
"productURL": "https://www.adafruit.com/product/5183",
"documentationURL": "https://cdn-shop.adafruit.com/product-files/5183/5193_DHT20.pdf",
"published": true,
"i2cAddresses": [ "0x38" ],
"subcomponents": [ "ambient-temp", "ambient-temp-fahrenheit", "humidity" ]
Expand Down
Binary file removed components/i2c/dht20/image.jpg
Binary file not shown.
Binary file removed components/i2c/dps310/animation.gif
Binary file not shown.
3 changes: 3 additions & 0 deletions components/i2c/dps310/definition.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"displayName": "DPS310",
"vendor": "Infineon",
"productURL": "https://www.adafruit.com/product/4494",
"documentationURL": "https://learn.adafruit.com/adafruit-dps310-precision-barometric-pressure-temperature-sensor",
"published": true,
"i2cAddresses": [ "0x76", "0x77" ],
"subcomponents": [ "ambient-temp", "ambient-temp-fahrenheit", "pressure" ]
Expand Down
Binary file removed components/i2c/dps310/image.jpg
Binary file not shown.
3 changes: 3 additions & 0 deletions components/i2c/ens160/definition.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"displayName": "ENS160",
"vendor": "Sciosense",
"productURL": "https://www.adafruit.com/product/5606",
"documentationURL": "https://learn.adafruit.com/adafruit-ens160-mox-gas-sensor",
"published": true,
"i2cAddresses": [ "0x52", "0x53" ],
"subcomponents": [
Expand Down
Binary file removed components/i2c/ens160/image.jpg
Binary file not shown.
3 changes: 3 additions & 0 deletions components/i2c/hts221/definition.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"displayName": "HTS221",
"vendor": "STMicroelectronics",
"productURL": "https://www.adafruit.com/product/4535",
"documentationURL": "https://learn.adafruit.com/adafruit-hts221-temperature-humidity-sensor/overview",
"published": true,
"i2cAddresses": [ "0x5F" ],
"subcomponents": [ "ambient-temp", "ambient-temp-fahrenheit", "humidity" ]
Expand Down
Binary file removed components/i2c/hts221/image.jpg
Binary file not shown.
3 changes: 3 additions & 0 deletions components/i2c/htu21d/definition.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"displayName": "HTU21D",
"vendor": "Measurement Specialties",
"productURL": "https://www.adafruit.com/product/1899",
"documentationURL": "https://learn.adafruit.com/adafruit-htu21d-f-temperature-humidity-sensor/overview",
"published": false,
"i2cAddresses": [ "0x40" ],
"subcomponents": [ "ambient-temp", "ambient-temp-fahrenheit", "humidity" ]
Expand Down
Binary file removed components/i2c/htu21d/image.jpg
Diff not rendered.
3 changes: 3 additions & 0 deletions components/i2c/htu31d/definition.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"displayName": "HTU31D",
"vendor": "Measurement Specialties",
"productURL": "https://www.adafruit.com/product/2857",
"documentationURL": "https://learn.adafruit.com/adafruit-sht31-d-temperature-and-humidity-sensor-breakout/",
"published": false,
"i2cAddresses": [ "0x40", "0x41" ],
"subcomponents": [ "ambient-temp", "ambient-temp-fahrenheit", "humidity" ]
Expand Down
Binary file removed components/i2c/htu31d/image.jpg
Diff not rendered.
3 changes: 3 additions & 0 deletions components/i2c/ina219/definition.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"displayName": "INA219",
"vendor": "Texas Instruments",
"productURL": "https://www.adafruit.com/product/904",
"documentationURL": "https://learn.adafruit.com/adafruit-ina219-current-sensor-breakout",
"published": true,
"i2cAddresses": [ "0x40", "0x41", "0x44", "0x45" ],
"subcomponents": [ "voltage", "current" ]
Expand Down
Binary file removed components/i2c/ina219/image.jpg
Diff not rendered.
Binary file removed components/i2c/lc709203f/animation.gif
Diff not rendered.