-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
359 additions
and
266 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
}; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 // таймаут быстрого поворота (энкодер) |
Oops, something went wrong.