Skip to content

CI integrated, sketch dependencies files added #3

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

Merged
merged 1 commit into from
Jul 22, 2021
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# docs: <https://editorconfig.org/>

root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 2
trim_trailing_whitespace = true
3 changes: 3 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# docs: <https://help.github.com/en/articles/about-code-owners>

* @AlexGyver
107 changes: 107 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
name: tests

on:
push:
branches: [master, main]
paths-ignore: ['**.md']
pull_request:
paths-ignore: ['**.md']

jobs: # Docs: <https://help.github.com/en/articles/workflow-syntax-for-github-actions>
lint:
name: Lint the sketches
runs-on: ubuntu-20.04
steps:
- name: Check out code
uses: actions/checkout@v2

# Its focus is on the structure, metadata, and configuration of Arduino projects, rather than the code
- name: Run the linter
uses: arduino/arduino-lint-action@v1 # https://github.com/arduino/arduino-lint-action
with:
project-type: sketch
recursive: true
library-manager: update
compliance: specification

search-for-sketches:
name: Search for sketches
runs-on: ubuntu-20.04
steps:
- name: Check out code
uses: actions/checkout@v2

- id: set-sketches-matrix
run: |
echo "::set-output name=matrix::$(\
find . -mindepth 2 -type f -name "*.ino" -exec dirname "{}" \; |\
sort |\
uniq |\
jq -c -M --slurp --raw-input 'split("\n")[:-1]'\
)"
outputs:
matrix: ${{ steps.set-sketches-matrix.outputs.matrix }}

compile-sketch:
name: Compile the sketch (${{ matrix.sketch-directory }})
runs-on: ubuntu-20.04
needs: [search-for-sketches]
strategy:
fail-fast: false
matrix:
sketch-directory: ${{ fromJson(needs.search-for-sketches.outputs.matrix) }}
platform: ['arduino:avr']
fqbn: ['arduino:avr:uno']
steps:
- name: Check out code
uses: actions/checkout@v2

- name: Setup Arduino CLI
uses: arduino/setup-arduino-cli@v1 # https://github.com/arduino/setup-arduino-cli

- name: Setup arduino-deps-installer # https://github.com/tarampampam/arduino-deps-installer
env:
VERSION: '0.0.1'
run: |
curl -SsL -o ./arduino-deps-installer \
"https://github.com/tarampampam/arduino-deps-installer/releases/download/v$VERSION/arduino-deps-installer-linux-amd64"
chmod +x ./arduino-deps-installer
sudo mv ./arduino-deps-installer /usr/bin/arduino-deps-installer

- name: Get Arduino CLI data directory
id: arduino-cli-data
run: echo "::set-output name=dir::$(arduino-cli config dump --format json | jq -r .directories.data)"

- name: Generate cache key values
id: cache-values
run: |
echo "::set-output name=salt::`\
echo $(date +'%U')'-${{ matrix.sketch-directory }}-${{ matrix.platform }}-${{ matrix.fqbn }}' |\
sha256sum |\
cut -d' ' -f 1\
`"
echo "::set-output name=requirements-file::${{ matrix.sketch-directory }}/requirements.txt"

- name: Cache Arduino CLI data
id: arduino-cli-cache
uses: actions/cache@v2
with:
path: ${{ steps.arduino-cli-data.outputs.dir }}
key: arduino-cli-data-v1-${{ steps.cache-values.outputs.salt }}-${{ hashFiles(steps.cache-values.outputs.requirements-file) }}
restore-keys: arduino-cli-data-v1-

- name: Updates the index of cores to the latest version
if: steps.arduino-cli-cache.outputs.cache-hit != 'true'
run: arduino-cli core update-index

- name: Install the platform
if: steps.arduino-cli-cache.outputs.cache-hit != 'true'
run: arduino-cli core install ${{ matrix.platform }}

- name: Install sketch dependencies
working-directory: ${{ matrix.sketch-directory }}
run: test -f ./requirements.txt && arduino-deps-installer install || true

- name: Compile the sketch
working-directory: ${{ matrix.sketch-directory }}
run: arduino-cli compile --warnings all --fqbn "${{ matrix.fqbn }}" .
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
## IDEs
/.vscode
/.idea

## Temp files/dirs
/tmp
/temp
/ignore
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
# Примеры к урокам

[![Build Status][badge_build]][link_build]

Сборник примеров к видеоурокам на канале [Заметки Ардуинщика](https://www.youtube.com/channel/UC4axiS76D784-ofoTdo5zOA/videos)

## Как скачать?
Я использую этот репозиторий просто как облачное хранилище с возможностью удобно посмотреть код в браузере.
- Можно скачать любой нужный файл, открыв его содержимое / правой кнопкой мыши по кнопке **Raw** в правом верхнем углу экрана / сохранить ссылку как.
Я использую этот репозиторий просто как облачное хранилище с возможностью удобно посмотреть код в браузере.
- Можно скачать любой нужный файл, открыв его содержимое / правой кнопкой мыши по кнопке **Raw** в правом верхнем углу экрана / сохранить ссылку как.
- Также можно скачать весь репозиторий целиком, нажав **Code/Download ZIP** на главной странице репозитория (где вы читаете этот текст), либо кликнуть вот [по этой ссылке](https://github.com/AlexGyver/tutorials/archive/refs/heads/master.zip).
![img](https://raw.githubusercontent.com/AlexGyver/tutorials/master/download.png)

> Все библиотеки, которые нужно установить для использования того или иного скетча описаны в файле `requirements.txt`, который расположен в самой директории скетча.

## Что внутри?
### menu/encoder - примеры с меню
+ [Видос](https://www.youtube.com/watch?v=81HO2n6urjc)
Expand Down Expand Up @@ -56,7 +61,7 @@
+ **physics** - [Урок #2](https://youtu.be/78N0t5BxQyY)

### soft_pwm_lesson - программный ШИМ
+ [Видос](https://youtu.be/UvxOwSfa3Zg)
+ [Видос](https://youtu.be/UvxOwSfa3Zg)

### strings - работа со String и cstring
+ [Видос](https://youtu.be/1VgePUaF7R8)
Expand All @@ -80,3 +85,6 @@

### superMeteoClock - метеостанция мечты №2 (урок как написать скетч)
+ [Видос](https://youtu.be/P3xp2ZM8bA0)

[badge_build]:https://img.shields.io/github/workflow/status/AlexGyver/tutorials/tests?maxAge=30
[link_build]:https://github.com/AlexGyver/tutorials/actions
8 changes: 4 additions & 4 deletions menu/buttons/loop_menu_progmem/loop_menu_progmem.ino
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
Пример меню со статическим указателем (перемещаются сами пукты меню)
*/

#define OLED_SOFT_BUFFER_64 // Буфер на стороне МК
#include <GyverOLED.h> // Библиотека дисплея
GyverOLED oled; // Обьект дисплея
#define OLED_SOFT_BUFFER_64 // Буфер на стороне МК
#include <GyverOLED.h> // Библиотека дисплея
GyverOLED<SSH1106_128x64> oled; // Обьект дисплея

#include <GyverButton.h> // Либа кнопок
GButton up(3, HIGH_PULL); // Кнопки
Expand Down Expand Up @@ -35,7 +35,7 @@ const char* const names[] PROGMEM = // Создаем массив с
};

void setup() {
oled.init(OLED128x64, 500);
oled.init();
oled.setContrast(255);
}

Expand Down
5 changes: 5 additions & 0 deletions menu/buttons/loop_menu_progmem/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# https://github.com/GyverLibs/GyverButton
GyverButton

# https://github.com/GyverLibs/GyverOLED
GyverOLED
14 changes: 7 additions & 7 deletions menu/buttons/multipage_fmacro/multipage_fmacro.ino
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
Пример простого многостраничного меню (F macro)
*/

#define OLED_SOFT_BUFFER_64 // Буфер на стороне МК
#include <GyverOLED.h> // Библиотека дисплея
GyverOLED oled; // Обьект дисплея
#define OLED_SOFT_BUFFER_64 // Буфер на стороне МК
#include <GyverOLED.h> // Библиотека дисплея
GyverOLED<SSH1106_128x64> oled; // Обьект дисплея

#include <GyverButton.h> // Либа кнопок
GButton up(3, HIGH_PULL); // Кнопки
Expand All @@ -19,8 +19,8 @@ const uint8_t ptr_bmp[] PROGMEM = {
};

void setup() {
oled.init(OLED128x64, 500); // Инциализация дисплея
oled.setContrast(255); // Макс. яркость
oled.init(); // Инциализация дисплея
oled.setContrast(255); // Макс. яркость
}

void loop() {
Expand All @@ -34,11 +34,11 @@ void loop() {
if (up.isClick() or up.isHold()) { // Если кнопку нажали или удерживают
pointer = constrain(pointer - 1, 0, ITEMS - 1); // Двигаем указатель в пределах дисплея
}

if (down.isClick() or down.isHold()) {
pointer = constrain(pointer + 1, 0, ITEMS - 1);
}

if (ok.isClick()) { // Нажатие на ОК - переход в пункт меню
switch (pointer) { // По номеру указателей располагаем вложенные функции (можно вложенные меню)
case 0: func(); break; // По нажатию на ОК при наведении на 0й пункт вызвать функцию
Expand Down
5 changes: 5 additions & 0 deletions menu/buttons/multipage_fmacro/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# https://github.com/GyverLibs/GyverButton
GyverButton

# https://github.com/GyverLibs/GyverOLED
GyverOLED
16 changes: 8 additions & 8 deletions menu/buttons/onepage_fmacro/onepage_fmacro.ino
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
Пример простого одностраничного меню (F macro)
*/

#define OLED_SOFT_BUFFER_64 // Буфер на стороне МК
#include <GyverOLED.h> // Библиотека дисплея
GyverOLED oled; // Обьект дисплея
#define OLED_SOFT_BUFFER_64 // Буфер на стороне МК
#include <GyverOLED.h> // Библиотека дисплея
GyverOLED<SSH1106_128x64> oled; // Обьект дисплея

#include <GyverButton.h> // Либа кнопок
GButton up(3, HIGH_PULL); // Кнопки
Expand All @@ -19,8 +19,8 @@ const uint8_t ptr_bmp[] PROGMEM = {
};

void setup() {
oled.init(OLED128x64, 500); // Инциализация дисплея
oled.setContrast(255); // Макс. яркость
oled.init(); // Инциализация дисплея
oled.setContrast(255); // Макс. яркость
}

void loop() {
Expand All @@ -34,14 +34,14 @@ void loop() {
if (up.isClick() or up.isHold()) { // Если кнопку нажали или удерживают
pointer = constrain(pointer - 1, 0, ITEMS - 1); // Двигаем указатель в пределах дисплея
}

if (down.isClick() or down.isHold()) {
pointer = constrain(pointer + 1, 0, ITEMS - 1);
}

if (ok.isClick()) { // Нажатие на ОК - переход в пункт меню
switch (pointer) { // По номеру указателей располагаем вложенные функции (можно вложенные меню)
case 0: func(); break; // По нажатию на ОК при наведении на 0й пункт вызвать функцию
case 0: func(); break; // По нажатию на ОК при наведении на 0й пункт вызвать функцию
case 1: break;
case 2: break;
case 3: break;
Expand Down
5 changes: 5 additions & 0 deletions menu/buttons/onepage_fmacro/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# https://github.com/GyverLibs/GyverButton
GyverButton

# https://github.com/GyverLibs/GyverOLED
GyverOLED
14 changes: 7 additions & 7 deletions menu/buttons/onepage_param_fmacro/onepage_param_fmacro.ino
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
Пример одностраничного меню с прямой регулировкой параметров (F macro)
*/

#define OLED_SOFT_BUFFER_64 // Буфер на стороне МК
#include <GyverOLED.h> // Библиотека дисплея
GyverOLED oled; // Обьект дисплея
#define OLED_SOFT_BUFFER_64 // Буфер на стороне МК
#include <GyverOLED.h> // Библиотека дисплея
GyverOLED<SSH1106_128x64> oled; // Обьект дисплея

#include <GyverButton.h> // Либа кнопок
GButton up(3, HIGH_PULL); // Кнопки
Expand All @@ -22,8 +22,8 @@ uint8_t data[ITEMS]; // Массив для параметров
bool flag = true; // Флаг выбора

void setup() {
oled.init(OLED128x64, 500); // Инциализация дисплея
oled.setContrast(255); // Макс. яркость
oled.init(); // Инциализация дисплея
oled.setContrast(255); // Макс. яркость
}

void loop() {
Expand Down Expand Up @@ -71,8 +71,8 @@ void loop() {

for (uint8_t i = 0; i < 8; i++) { // Цикл для вывода параметров (8 строк)
oled.setCursor(14, i); // Ставим курсор на позицию 14го сивола и номер строки
oled.print(data[i]); // Выводим значение параметра
}
oled.print(data[i]); // Выводим значение параметра
}

printPointer(pointer); // Вывод указателя
oled.update(); // Выводим кадр на дисплей
Expand Down
5 changes: 5 additions & 0 deletions menu/buttons/onepage_param_fmacro/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# https://github.com/GyverLibs/GyverButton
GyverButton

# https://github.com/GyverLibs/GyverOLED
GyverOLED
10 changes: 5 additions & 5 deletions menu/buttons/onepage_simple_progmem/onepage_simple_progmem.ino
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
Пример простого вывода пунктов меню из PROGMEM по их номеру
*/

#define OLED_SOFT_BUFFER_64 // Буфер на стороне МК
#include <GyverOLED.h> // Библиотека дисплея
GyverOLED oled; // Обьект дисплея
#define OLED_SOFT_BUFFER_64 // Буфер на стороне МК
#include <GyverOLED.h> // Библиотека дисплея
GyverOLED<SSH1106_128x64> oled; // Обьект дисплея

#include <GyverButton.h> // Либа кнопок
GButton up(3, HIGH_PULL); // Кнопки
Expand Down Expand Up @@ -35,8 +35,8 @@ const char* const names[] PROGMEM = // Создаем массив с
};

void setup() {
oled.init(OLED128x64, 500); // Инциализация дисплея
oled.setContrast(255); // Макс. яркость
oled.init(); // Инциализация дисплея
oled.setContrast(255); // Макс. яркость
}

void loop() {
Expand Down
5 changes: 5 additions & 0 deletions menu/buttons/onepage_simple_progmem/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# https://github.com/GyverLibs/GyverButton
GyverButton

# https://github.com/GyverLibs/GyverOLED
GyverOLED
5 changes: 5 additions & 0 deletions menu/buttons/scrollpage_param_progmem/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# https://github.com/GyverLibs/GyverButton
GyverButton

# https://github.com/GyverLibs/GyverOLED
GyverOLED
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
Пример меню с вертикальным скроллингом при достижении указателем последней строки и прямым управлением параметрами
*/

#define OLED_SOFT_BUFFER_64 // Буфер на стороне МК
#include <GyverOLED.h> // Библиотека дисплея
GyverOLED oled; // Обьект дисплея
#define OLED_SOFT_BUFFER_64 // Буфер на стороне МК
#include <GyverOLED.h> // Библиотека дисплея
GyverOLED<SSH1106_128x64> oled; // Обьект дисплея

#include <GyverButton.h> // Либа кнопок
GButton up(3, HIGH_PULL); // Кнопки
Expand Down Expand Up @@ -38,8 +38,8 @@ uint8_t data[ITEMS]; // Массив для параметров
bool flag = true; // Флаг выбора

void setup() {
oled.init(OLED128x64, 500); // Инциализация дисплея
oled.setContrast(255); // Макс. яркость
oled.init(); // Инциализация дисплея
oled.setContrast(255); // Макс. яркость
}

void loop() {
Expand Down
5 changes: 5 additions & 0 deletions menu/buttons/scrollpage_progmem/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# https://github.com/GyverLibs/GyverButton
GyverButton

# https://github.com/GyverLibs/GyverOLED
GyverOLED
Loading