Skip to content

Commit

Permalink
Release 1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
tonakihan committed Mar 28, 2024
1 parent 3277e06 commit b002664
Show file tree
Hide file tree
Showing 10 changed files with 359 additions and 266 deletions.
7 changes: 3 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ include/README
lib/README
test/README

lib/Adafruit_BusIO
lib/Adafruit_MAX31855
lib/GyverPID
lib/LiquidCrystal_I2C
lib/*
!lib/myTemperature
!lib/Tonakihan_LcdMenu
26 changes: 25 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
# Arduino soldering table

Это паяльный стол на arduino.
Это паяльный стол на arduino.

## Использование
1. Настроить коэфициенты PID

initGlobalVariable.h
```cpp
pidHandlerBottom(0.1, 0.1, 0.1, 500), // Подобрать параметры PID
pidHandlerTop(0.1, 0.1, 0.1, 500); // Подобрать параметры PID
```
2. Настроит конфигурацию своего устройства
conf.h
```cpp
#define PIN_CS_term_bottom 2
#define PIN_CS_term_top 3
#define PIN_heating_bottom 7
#define PIN_heating_top 8
#define PIN_button_menu 6
#define PIN_button_down 5
#define PIN_button_up 4
#define LCD_COLS 16
#define LCD_ROWS 2
#define LCD_ADDRESS 0x27
```
79 changes: 79 additions & 0 deletions lib/Tonakihan_LcdMenu/src/Tonakihan_LcdMenu.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
/* Сделать так:
По истечении времени от последнего нажатия -> возврат
*/
#include "Tonakihan_LcdMenu.h"


// Выводит на дисплей список
void Menu::printList() {
lcd->clear();
for ( uint8_t i = 0; i < LCD_MENU_ROWS; i++ ) {
lcd->setCursor(1, i);
lcd->print(pages[activeLcdLine+i]->name);
}
}

// Отображает курсор
void Menu::printCursor() {
lcd->setCursor(0, activeLcdLine - activePage);
lcd->print(">");
}

// Принимает lcd, кол-во страниц, страницы
Menu::Menu(LiquidCrystal_I2C &lcd, uint8_t numOfPages, Page *firstPage, ...) {
this->lcd = &lcd;
this->numOfPages = numOfPages;

this->pages = new Page*[numOfPages];
this->pages[0] = firstPage;

va_list args;
va_start(args, firstPage);
for (int i = 1; i < numOfPages; i++) {
this->pages[i] = va_arg(args, Page*);
}
va_end(args);
}

Menu::~Menu() {
delete[] pages;
}

void Menu::up() {
// Если в начале меню
if (activePage <= 0) {
return;
}
activePage--;

// Если выбранная страница за пределами экрана
if (activePage < activeLcdLine) {
activeLcdLine--;
}
launch();
}

void Menu::down() {
//Если в конце меню
if (activePage >= numOfPages-1) {
return;
}
activePage++;

// Если выбранная страница за пределами экрана
if (activePage > activeLcdLine+LCD_MENU_ROWS-1) {
activeLcdLine++;
}
launch();
}

void Menu::enter() {
lcd->clear();
pages[activePage]->callback();
launch();
}

void Menu::launch() {
printList();
printCursor();
}
46 changes: 46 additions & 0 deletions lib/Tonakihan_LcdMenu/src/Tonakihan_LcdMenu.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
Обязательно настрой confMenu.h перед началом
*/
#pragma once

#include "LiquidCrystal_I2C.h"

//Настройка параметров lcd
#ifdef LCD_ROWS
#define LCD_MENU_COLS LCD_ROWS
#else
#define LCD_MENU_COLS 16
#endif
#ifdef LCD_COLS
#define LCD_MENU_ROWS (LCD_COLS)
#else
#define LCD_MENU_ROWS 2
#endif


struct Page {
String name;
void (*callback)();
};

class Menu {
private:
LiquidCrystal_I2C *lcd;
uint8_t activePage = 0; // Активная страница, также активная строка для указателя
uint8_t activeLcdLine = 0; // Отображаемая на дисплее первая строка
uint8_t numOfPages; //Количество пунктов меню
Page **pages;

// Выводит на дисплей список
void printList();
void printCursor();

public:
Menu (LiquidCrystal_I2C &lcd, uint8_t numOfPages, Page *firstPage, ...);
~Menu();

void up();
void down();
void enter();
void launch();
};
35 changes: 0 additions & 35 deletions lib/myTemperature/examples/PrintSerial.cpp

This file was deleted.

90 changes: 0 additions & 90 deletions lib/myTemperature/src/Temperature.cpp

This file was deleted.

31 changes: 0 additions & 31 deletions lib/myTemperature/src/Temperature.h

This file was deleted.

39 changes: 39 additions & 0 deletions src/conf.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#pragma once

#define PIN_CS_term_bottom 2
#define PIN_CS_term_top 3
#define PIN_heating_bottom 7
#define PIN_heating_top 8
#define PIN_button_menu 6
#define PIN_button_down 5
#define PIN_button_up 4
//
#define LCD_COLS 16
#define LCD_ROWS 2
#define LCD_ADDRESS 0x27
//
#define INTERVAL_UPDATE_TEMP 1000

/* -- EncButton -- */
// отключить поддержку pressFor/holdFor/stepFor и счётчик степов (экономит 2 байта оперативки)
#define EB_NO_FOR
// отключить обработчик событий attach (экономит 2 байта оперативки)
#define EB_NO_CALLBACK
// отключить счётчик энкодера [VirtEncoder, Encoder, EncButton] (экономит 4 байта оперативки)
#define EB_NO_COUNTER
// отключить буферизацию энкодера (экономит 2 байта оперативки)
#define EB_NO_BUFFER
//
/*
Настройка таймаутов для всех классов
- Заменяет таймауты константами, изменить их из программы (SetXxxTimeout()) будет нельзя
- Настройка влияет на все объявленные в программе кнопки/энкодеры
- Экономит 1 байт оперативки на объект за каждый таймаут
- Показаны значения по умолчанию в мс
- Значения не ограничены 4000мс, как при установке из программы (SetXxxTimeout())
*/
#define EB_DEB_TIME 100 // таймаут гашения дребезга кнопки (кнопка)
//#define EB_CLICK_TIME 100 // таймаут ожидания кликов (кнопка)
//#define EB_HOLD_TIME 300 // таймаут удержания (кнопка)
//#define EB_STEP_TIME 300 // таймаут импульсного удержания (кнопка)
//#define EB_FAST_TIME 30 // таймаут быстрого поворота (энкодер)
Loading

0 comments on commit b002664

Please sign in to comment.