- полная перетряска
This commit is contained in:
parent
1376baf7b2
commit
a1c0efec84
723
car.ino
723
car.ino
|
@ -4,13 +4,16 @@
|
|||
#include <OneWire.h>
|
||||
#include <DallasTemperature.h>
|
||||
#include "button.h"
|
||||
#include "variables.h"
|
||||
#include <EEPROM.h>
|
||||
#include "pitches.h"
|
||||
#include "i18n.h"
|
||||
|
||||
//Для руссификации, нужно glcdfont.c поместить в C:\Users\USER\Documents\Arduino\libraries\Adafruit_GFX_Library. У вас путь до библиотеки может отличаться.
|
||||
// Для руссификации, нужно glcdfont.c поместить в C:\Users\USER\Documents\Arduino\libraries\Adafruit_GFX_Library. У вас путь до библиотеки может отличаться.
|
||||
// Конвертор из UTF-8 в бинарную строку здесь: https://грибовы.рф/rusifikaciya-displeya-ssd1306/
|
||||
|
||||
i18n __lang(1); // 0 - английский язык, 1 - русский язык
|
||||
|
||||
Adafruit_SSD1306 display = Adafruit_SSD1306(128, 64, &Wire);
|
||||
|
||||
#define ONE_WIRE_BUS 2
|
||||
OneWire oneWire(ONE_WIRE_BUS);
|
||||
DallasTemperature sensors(&oneWire);
|
||||
|
@ -18,484 +21,390 @@ button btn1(4); // указываем пин кнопки 1
|
|||
button btn2(5); // указываем пин кнопки 2
|
||||
int piezoPin = 3; // пин бипера
|
||||
int LightPin = A2; // пин подсветки кнопок
|
||||
boolean grib=false;
|
||||
|
||||
// Вольтметр
|
||||
int analogInput = A0; // Аналоговый порт куда подключается выход с делителя напряжения
|
||||
double inaccuracy = 0.5;
|
||||
float R1 = 10000.0; // Сопротивление R1 (10K) в ОМАХ
|
||||
float R2 = 2000.0; // Сопротивление R2 (2K)в ОМАХ
|
||||
const int analogInput PROGMEM = A0; // Аналоговый порт куда подключается выход с делителя напряжения
|
||||
const double inaccuracy PROGMEM = 0.5;
|
||||
const float R1 PROGMEM= 10000.0; // Сопротивление R1 (10K) в ОМАХ
|
||||
const float R2 PROGMEM = 2000.0; // Сопротивление R2 (2K)в ОМАХ
|
||||
float vout = 0.0;
|
||||
float vin = 0.0;
|
||||
int value = 0;
|
||||
|
||||
// моточасы по умолчанию
|
||||
int temp=0;
|
||||
struct SavedData {
|
||||
byte beeper=0; // 1 - звук кнопок есть, 0 - нет
|
||||
byte light=0; // 1 - подсветка кнопок есть, 0 - нет
|
||||
int motoclock_motor=13200; // замена масла двигателя
|
||||
int motoclock_kpp=26000; // замена масла МКПП
|
||||
long motoclock_most=132000; // замена масла мосты
|
||||
long motoclock_grm=132000; // замена ремня грм
|
||||
long motoclock_most=79200; // замена масла мосты
|
||||
long motoclock_grm=79200; // замена ремня грм
|
||||
};
|
||||
SavedData ee_data;
|
||||
SavedData etalon;
|
||||
SavedData ee_data; // данные с нестираемой памяти
|
||||
SavedData etalon; // данные по умолчанию
|
||||
|
||||
long old_milis,old_milis_2;
|
||||
byte layout=0; // текущий экран 0 - температура, 1 - моточасы
|
||||
float celsius1,celsius2,celsius3;
|
||||
|
||||
extern int __bss_end;
|
||||
extern void *__brkval;
|
||||
|
||||
const unsigned char ico_street [] PROGMEM = {
|
||||
// 'ico_street, 16x16px
|
||||
0x00, 0x00, 0x1c, 0x00, 0x1c, 0x60, 0x36, 0x0c, 0x36, 0xf0, 0x36, 0xf0, 0x37, 0xfe, 0x36, 0xf0,
|
||||
0x36, 0xf0, 0x36, 0x0c, 0x63, 0x40, 0x63, 0x00, 0x63, 0x00, 0x3e, 0x00, 0x1c, 0x00, 0x00, 0x00
|
||||
};
|
||||
|
||||
const unsigned char ico_dvig [] PROGMEM = {
|
||||
// 'ico_dvig, 16x16px
|
||||
0x00, 0x70, 0x00, 0x88, 0x00, 0xa8, 0x00, 0xa8, 0x00, 0xa8, 0x00, 0xa8, 0x00, 0xa8, 0x00, 0xa8,
|
||||
0x3b, 0xa8, 0x00, 0xa8, 0x0e, 0xa8, 0x31, 0x24, 0x01, 0x24, 0x3f, 0x04, 0x00, 0x88, 0x00, 0x70
|
||||
};
|
||||
|
||||
const unsigned char ico_salo [] PROGMEM = {
|
||||
// 'температура_салон, 16x16px
|
||||
0x00, 0x00, 0x02, 0x40, 0x11, 0x88, 0x17, 0xe8, 0x4d, 0xb2, 0x51, 0x8a, 0x30, 0x0c, 0xa0, 0x05,
|
||||
0xa4, 0xa5, 0x2c, 0x24, 0x20, 0x04, 0x30, 0x0c, 0x10, 0x08, 0x0c, 0x30, 0x07, 0xe0, 0x00, 0x00
|
||||
};
|
||||
|
||||
// 'батарейка', 32x32px
|
||||
const unsigned char ico_bat [] PROGMEM = {
|
||||
0x00, 0x00, 0x0f, 0xf0, 0x18, 0x18, 0x33, 0xcd, 0x67, 0xe7, 0x44, 0x2e, 0x05, 0xa2, 0x05, 0xa0,
|
||||
0x04, 0x20, 0x44, 0x20, 0x75, 0xa2, 0xe4, 0x26, 0xb7, 0xec, 0x18, 0x18, 0x0f, 0xf0, 0x00, 0x00
|
||||
};
|
||||
|
||||
// 'grib', 37x36px
|
||||
const unsigned char ico_grib [] PROGMEM = {
|
||||
0x00, 0x0f, 0xfe, 0x00, 0x00, 0x00, 0x3f, 0xff, 0xc0, 0x00, 0x00, 0xfe, 0x1f, 0xf0, 0x00, 0x03,
|
||||
0xde, 0x1f, 0xfc, 0x00, 0x07, 0x0c, 0x1f, 0xce, 0x00, 0x0e, 0x00, 0x0f, 0x87, 0x00, 0x1f, 0x8e,
|
||||
0x00, 0x03, 0x80, 0x1f, 0x9f, 0x00, 0x01, 0xc0, 0x3f, 0xdf, 0x00, 0x0c, 0xe0, 0x3f, 0xdf, 0x00,
|
||||
0x1e, 0x60, 0x7f, 0x84, 0x38, 0x1e, 0x30, 0x7f, 0x80, 0xfe, 0x0e, 0x30, 0xef, 0x01, 0xff, 0x00,
|
||||
0x38, 0xc0, 0x01, 0xff, 0x00, 0x18, 0xc0, 0x03, 0xff, 0x80, 0x18, 0xc0, 0x03, 0xff, 0x8f, 0x98,
|
||||
0xf8, 0x03, 0xff, 0x9f, 0x98, 0xf8, 0x31, 0xff, 0x1f, 0xd8, 0xf8, 0x78, 0xfe, 0x1f, 0xf0, 0x78,
|
||||
0xf8, 0x7c, 0x1f, 0xe0, 0x3c, 0xf8, 0x00, 0x0f, 0xc0, 0x1f, 0xf8, 0x00, 0x7f, 0x00, 0x03, 0xff,
|
||||
0xff, 0xfc, 0x00, 0x00, 0x3f, 0xff, 0x80, 0x00, 0x00, 0x1f, 0xff, 0x80, 0x00, 0x00, 0x1f, 0xff,
|
||||
0xc0, 0x00, 0x00, 0x1f, 0xff, 0xc0, 0x00, 0x00, 0x3f, 0xff, 0xc0, 0x00, 0x00, 0x3f, 0xff, 0xc0,
|
||||
0x00, 0x00, 0x3f, 0xff, 0xc0, 0x00, 0x00, 0x3f, 0xff, 0xc0, 0x00, 0x00, 0x3f, 0xff, 0xc0, 0x00,
|
||||
0x00, 0x3f, 0xff, 0xc0, 0x00, 0x00, 0x1f, 0xff, 0xc0, 0x00, 0x00, 0x1f, 0xff, 0x80, 0x00, 0x00,
|
||||
0x07, 0xfe, 0x00, 0x00
|
||||
};
|
||||
|
||||
|
||||
// 'fxf3', 59x32px
|
||||
const unsigned char fxf3 [] PROGMEM = {
|
||||
0x00, 0xd0, 0x3e, 0x00, 0x00, 0x78, 0x3c, 0x00, 0x01, 0x0f, 0x81, 0x00, 0x01, 0x07, 0xc0, 0x80,
|
||||
0x02, 0x30, 0x32, 0x80, 0x00, 0x30, 0x1a, 0x40, 0x00, 0xfe, 0xff, 0x40, 0x02, 0xfe, 0xff, 0x20,
|
||||
0x05, 0x2f, 0x07, 0xa0, 0x00, 0x97, 0x87, 0xa0, 0x01, 0x0f, 0x0f, 0xa0, 0x05, 0x07, 0x07, 0xa0,
|
||||
0x0a, 0x0e, 0x0f, 0x2b, 0xa9, 0x0f, 0x0f, 0xa0, 0x02, 0x1e, 0x0f, 0x04, 0x02, 0x0e, 0x0f, 0x00,
|
||||
0x14, 0x1e, 0x1e, 0x79, 0x96, 0x1e, 0x0f, 0x40, 0x04, 0x3c, 0x1f, 0xde, 0xfc, 0x1e, 0x1e, 0x00,
|
||||
0x28, 0x3c, 0x3f, 0x8e, 0x4c, 0x3c, 0x1e, 0x80, 0x08, 0x78, 0x3e, 0x0c, 0x18, 0x3c, 0x1e, 0x80,
|
||||
0x50, 0x78, 0x3e, 0x00, 0x38, 0x78, 0x1d, 0x00, 0x50, 0x00, 0x1d, 0x00, 0x30, 0x00, 0x1c, 0x80,
|
||||
0xa0, 0x00, 0x3d, 0x00, 0x70, 0x00, 0x1e, 0x80, 0xa0, 0x00, 0x3d, 0x00, 0xf0, 0x00, 0x1e, 0x80,
|
||||
0xb0, 0x00, 0x7f, 0x01, 0xf8, 0x00, 0x3e, 0x80, 0x5f, 0xe0, 0xfd, 0x03, 0xfb, 0xf0, 0xfc, 0x80,
|
||||
0x4f, 0xe0, 0xff, 0x03, 0xcf, 0xf0, 0xfe, 0x80, 0x27, 0xe1, 0xf6, 0x03, 0xc7, 0xe0, 0xf8, 0x80,
|
||||
0x13, 0xc1, 0xe4, 0x03, 0xb3, 0xa1, 0xe7, 0x00, 0x08, 0x41, 0xe8, 0x01, 0xa8, 0x41, 0xe8, 0x00,
|
||||
0x07, 0x43, 0xd0, 0x01, 0xc1, 0x41, 0xe8, 0x00, 0x02, 0x83, 0xe0, 0x41, 0xd1, 0x41, 0xc0, 0x00,
|
||||
0x02, 0x83, 0xc0, 0xe1, 0xd0, 0x43, 0xd0, 0x00, 0x02, 0xa3, 0xc9, 0xe3, 0xd2, 0xa3, 0xd0, 0x00,
|
||||
0x02, 0xff, 0xff, 0xff, 0xd2, 0xff, 0xd0, 0x00, 0x02, 0x7f, 0xff, 0xff, 0xe1, 0x7f, 0xa0, 0x00,
|
||||
0x01, 0x3f, 0xbf, 0xdf, 0xc8, 0xbf, 0xa0, 0x00, 0x00, 0x87, 0x00, 0x8e, 0x10, 0x43, 0xa0, 0x00,
|
||||
0x00, 0x00, 0x72, 0x20, 0x60, 0x20, 0x00, 0x00, 0x00, 0x1f, 0x80, 0x8f, 0x80, 0x1f, 0x80, 0x00
|
||||
};
|
||||
|
||||
// 'fxf', 79x64px
|
||||
const unsigned char fxf [] PROGMEM = {
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf2, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe6, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0,
|
||||
0xff, 0xff, 0xff, 0xfd, 0xbd, 0xff, 0xff, 0xce, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0,
|
||||
0xff, 0xff, 0xff, 0xfd, 0x9d, 0xff, 0xff, 0x9f, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0,
|
||||
0xff, 0xff, 0xff, 0xbd, 0x99, 0x8f, 0xff, 0x3f, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0,
|
||||
0xff, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xfe, 0x7f, 0x00, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0,
|
||||
0xff, 0xff, 0xfd, 0xc0, 0x00, 0x07, 0xff, 0xfe, 0x00, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0,
|
||||
0xff, 0xff, 0xff, 0x60, 0x00, 0x02, 0x00, 0xfe, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0,
|
||||
0xff, 0xff, 0xec, 0x60, 0x00, 0x7f, 0xff, 0x7e, 0x00, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0,
|
||||
0xff, 0xff, 0xf8, 0x30, 0x00, 0x00, 0x00, 0x06, 0x00, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0,
|
||||
0xff, 0xff, 0xe0, 0x30, 0x00, 0xfe, 0x00, 0x1b, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0,
|
||||
0xff, 0xff, 0xc0, 0x30, 0x06, 0x82, 0xb3, 0xf7, 0x00, 0x00, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xf0,
|
||||
0xff, 0xff, 0xc0, 0x18, 0x1f, 0x9e, 0x87, 0xf9, 0x80, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xf0,
|
||||
0xff, 0xff, 0xc0, 0x1f, 0x7f, 0x1e, 0xfe, 0xb9, 0x80, 0x00, 0x00, 0x7f, 0xff, 0xff, 0xff, 0xf0,
|
||||
0xff, 0xff, 0xc0, 0x1e, 0xff, 0x5d, 0xde, 0xbe, 0xc0, 0x00, 0x00, 0x7f, 0xff, 0xff, 0xff, 0xf0,
|
||||
0xff, 0xfb, 0xe0, 0x7b, 0xdd, 0x5f, 0xca, 0x94, 0x60, 0x00, 0x00, 0x3f, 0xff, 0xff, 0xff, 0xf0,
|
||||
0xff, 0xf7, 0xe1, 0xff, 0x0f, 0x5c, 0x2f, 0xfc, 0x30, 0x00, 0x01, 0x1f, 0xff, 0xff, 0xff, 0xf0,
|
||||
0xff, 0xef, 0xe3, 0xfc, 0x0e, 0x07, 0xff, 0xf8, 0xe0, 0x00, 0x03, 0x0f, 0xff, 0xff, 0xff, 0xf0,
|
||||
0xff, 0xef, 0xef, 0xf8, 0x06, 0x60, 0x1f, 0xfb, 0xe0, 0x00, 0x0f, 0x07, 0xff, 0xff, 0xff, 0xf0,
|
||||
0xff, 0xff, 0xff, 0xf0, 0x00, 0x1c, 0x1f, 0xf5, 0xc0, 0x00, 0x1f, 0x03, 0xff, 0xff, 0xbf, 0xf0,
|
||||
0xff, 0xff, 0xff, 0xf0, 0x00, 0x03, 0x9f, 0xf1, 0xc0, 0x00, 0x3f, 0x01, 0xff, 0xdf, 0x3f, 0xf0,
|
||||
0xff, 0xff, 0xff, 0xf0, 0x30, 0x00, 0x4c, 0x00, 0xc0, 0x00, 0x7f, 0xc0, 0xff, 0x9f, 0x1f, 0xf0,
|
||||
0xff, 0xdf, 0xff, 0xf0, 0x0e, 0x80, 0x00, 0x02, 0x60, 0x00, 0xff, 0xc0, 0x7f, 0x9f, 0x3f, 0xf0,
|
||||
0xff, 0xdf, 0xff, 0xf0, 0x0b, 0x80, 0x00, 0x04, 0xe0, 0x01, 0xff, 0xe0, 0x3f, 0x9f, 0x1f, 0xf0,
|
||||
0xff, 0xff, 0xff, 0xf0, 0x02, 0xc0, 0x00, 0x02, 0x30, 0x03, 0xff, 0xf0, 0x1f, 0x0e, 0x0f, 0xf0,
|
||||
0xff, 0xff, 0xff, 0xf0, 0x4e, 0x00, 0x00, 0x10, 0x30, 0x07, 0xff, 0xf8, 0x0e, 0x04, 0x0f, 0xf0,
|
||||
0xff, 0xff, 0xff, 0xb0, 0x26, 0x80, 0xff, 0xca, 0x90, 0x0f, 0x3f, 0x98, 0x07, 0x0e, 0x1f, 0xf0,
|
||||
0xff, 0xff, 0xfe, 0x70, 0x21, 0xef, 0xc0, 0x09, 0x30, 0x1c, 0x0f, 0x04, 0x03, 0x06, 0x0f, 0xf0,
|
||||
0xff, 0xf7, 0x79, 0xf0, 0x17, 0x80, 0x00, 0x08, 0x10, 0x30, 0x1e, 0x00, 0x00, 0x00, 0x07, 0xf0,
|
||||
0xff, 0xc3, 0x67, 0xd8, 0x11, 0x60, 0x00, 0x05, 0x18, 0x40, 0x1c, 0x00, 0x00, 0x00, 0x03, 0xf0,
|
||||
0xff, 0x83, 0x9f, 0x60, 0x17, 0x60, 0x04, 0x05, 0x18, 0x00, 0x30, 0x00, 0x00, 0x00, 0x01, 0xf0,
|
||||
0xff, 0x03, 0xbd, 0x80, 0x10, 0x40, 0x13, 0x0c, 0x18, 0x00, 0x20, 0x00, 0x00, 0x00, 0x07, 0xf0,
|
||||
0xff, 0x03, 0xb6, 0x00, 0x17, 0x26, 0x0f, 0xb8, 0x18, 0x00, 0x40, 0x00, 0x00, 0x00, 0x07, 0xf0,
|
||||
0xff, 0x00, 0x18, 0x00, 0x16, 0x1f, 0xff, 0x90, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xf0,
|
||||
0xff, 0x02, 0x60, 0x1c, 0x31, 0x1f, 0xff, 0xc0, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xf0,
|
||||
0xff, 0x09, 0x00, 0x67, 0x66, 0x1f, 0xff, 0xe0, 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0,
|
||||
0xff, 0x05, 0x80, 0x3f, 0x04, 0x18, 0x3f, 0xc0, 0xf3, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70,
|
||||
0xff, 0x84, 0x81, 0xfc, 0x00, 0x00, 0x18, 0x03, 0x80, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x03, 0xb0,
|
||||
0xff, 0x82, 0x00, 0x08, 0x00, 0x20, 0x0c, 0x06, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x01, 0xf0,
|
||||
0xfd, 0x82, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x01, 0xf0,
|
||||
0xff, 0x83, 0xc0, 0x00, 0x0f, 0xd8, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0,
|
||||
0xdf, 0x80, 0x00, 0x18, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70,
|
||||
0xfe, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70,
|
||||
0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30,
|
||||
0xfc, 0xff, 0xfc, 0xff, 0xff, 0xff, 0xe0, 0x7f, 0xff, 0x3f, 0xff, 0x1f, 0xfc, 0x7f, 0xff, 0x30,
|
||||
0xf9, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0, 0x7f, 0xff, 0x7f, 0xff, 0x1f, 0xfc, 0x7f, 0xff, 0x30,
|
||||
0xf9, 0xff, 0xfd, 0xff, 0xf7, 0xff, 0xc0, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xfc, 0x7f, 0xff, 0x30,
|
||||
0xf1, 0xff, 0xfd, 0xff, 0xef, 0xff, 0x80, 0xff, 0xfe, 0xff, 0xfe, 0x3f, 0xfc, 0xff, 0xff, 0x30,
|
||||
0xf3, 0xf9, 0xff, 0xf8, 0x0f, 0xe0, 0x00, 0xfe, 0xfe, 0xfc, 0xfe, 0x7e, 0xfc, 0xfe, 0x7e, 0x30,
|
||||
0xf3, 0xfb, 0xfb, 0xff, 0xef, 0xff, 0x7d, 0xff, 0xff, 0xfc, 0xfe, 0xfe, 0xfc, 0xfc, 0xfe, 0x70,
|
||||
0xe7, 0xf3, 0xfb, 0xff, 0xdf, 0xff, 0x7d, 0xff, 0xfd, 0xfc, 0xfc, 0xfd, 0xfd, 0xfc, 0xfe, 0x70,
|
||||
0xe7, 0xf3, 0xf7, 0xff, 0xdf, 0xff, 0x7d, 0xff, 0xfd, 0xf9, 0xfd, 0xff, 0xfd, 0xfc, 0xfc, 0x70,
|
||||
0xe7, 0xe7, 0xf7, 0xff, 0x9f, 0xfe, 0x03, 0xff, 0xfb, 0xf9, 0xfd, 0xff, 0xfd, 0xf9, 0xfc, 0xf0,
|
||||
0xcf, 0xff, 0xff, 0xe0, 0x3f, 0x80, 0x03, 0xfb, 0xfb, 0xff, 0xfb, 0xff, 0xff, 0xff, 0xfc, 0xf0,
|
||||
0xcf, 0xff, 0xef, 0xe0, 0x3f, 0x80, 0x03, 0xfb, 0xfb, 0xff, 0xff, 0xf1, 0xff, 0xff, 0xf8, 0xf0,
|
||||
0xcf, 0xff, 0xef, 0xe0, 0x3f, 0x00, 0x07, 0xf3, 0xfb, 0xff, 0xff, 0xf1, 0xff, 0xff, 0xf9, 0xf0,
|
||||
0xc7, 0xff, 0x8f, 0xc0, 0x3f, 0x00, 0x07, 0xf3, 0xfb, 0xff, 0xe7, 0xe1, 0xfb, 0xff, 0xf1, 0xf0,
|
||||
0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xf0,
|
||||
0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xf0,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0
|
||||
};
|
||||
|
||||
|
||||
void setup() {
|
||||
unsigned char i1,i2,c3;
|
||||
|
||||
void setup() {
|
||||
Serial.begin(9600);
|
||||
//Serial.println(EEPROM.length());
|
||||
display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
|
||||
|
||||
// инициализирую дисплей
|
||||
display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
|
||||
display.cp437(true);
|
||||
display.clearDisplay();
|
||||
display.drawBitmap(0, 0, fxf, 124, 64, WHITE);
|
||||
display.drawBitmap(0, 0, fxf, 128, 64, WHITE);
|
||||
display.display();
|
||||
sensors.begin();
|
||||
|
||||
|
||||
// инициализация ног
|
||||
pinMode(piezoPin, OUTPUT);
|
||||
pinMode(analogInput, INPUT);
|
||||
pinMode(LightPin, OUTPUT);
|
||||
|
||||
ee_data.beeper=1;
|
||||
beep();delay(1000);beep();
|
||||
beep(ee_data.beeper,piezoPin);delay(1000);beep(ee_data.beeper,piezoPin); // два бипа - успешно включились
|
||||
|
||||
// читаем данные из энергонезависимой памяти
|
||||
EEPROM.get(2,ee_data);
|
||||
if (ee_data.beeper>0){
|
||||
ee_data.beeper=1;
|
||||
};
|
||||
if (ee_data.beeper>0){ee_data.beeper=1;};
|
||||
|
||||
// если данных нет, то ставим их "по умолчанию"
|
||||
if ((ee_data.motoclock_motor<0) or (ee_data.motoclock_kpp<0) or (ee_data.motoclock_most<0) or (ee_data.motoclock_grm<0)){
|
||||
ee_data=etalon;
|
||||
};
|
||||
|
||||
if (ee_data.light==1){
|
||||
digitalWrite(LightPin, HIGH);
|
||||
} else {
|
||||
digitalWrite(LightPin, LOW);
|
||||
};
|
||||
// включаем подсветку кнопок если нужно
|
||||
if (ee_data.light==1){digitalWrite(LightPin, HIGH);} else {digitalWrite(LightPin, LOW);};
|
||||
|
||||
old_milis=millis(); // засекаем время начало работы адулины
|
||||
old_milis_2=millis(); // засекаем время начало работы адулины
|
||||
|
||||
|
||||
display.clearDisplay();
|
||||
LayoutScreen(true,0);
|
||||
}
|
||||
void beep(){
|
||||
if (ee_data.beeper==1) {
|
||||
for (int i=0; i <= 100; i++){
|
||||
digitalWrite(piezoPin, HIGH);
|
||||
delay(1);
|
||||
digitalWrite(piezoPin, LOW);
|
||||
delay(1);
|
||||
}
|
||||
} else {
|
||||
delay(500);
|
||||
}
|
||||
}
|
||||
void PutMenu_1(byte curpoz){
|
||||
display.cp437(true);
|
||||
display.clearDisplay();
|
||||
display.setTextSize(1);
|
||||
display.setTextColor(WHITE);
|
||||
display.setCursor(0,0);
|
||||
for (int i=0; i <= 3; i++){
|
||||
if (curpoz==i){
|
||||
display.print(("> "));
|
||||
}
|
||||
if (i==0){display.println("\314\356\362\356\367\340\361\373");}; // моточасы
|
||||
if (i==1){display.println("\307\342\363\352 \352\355\356\357\356\352");}; // звук кнопок
|
||||
if (i==2){display.println("\317\356\344\361\342\345\362\352\340");}; // подсветка кнопок
|
||||
if (i==3){display.println("\302\373\365\356\344");}; // выход
|
||||
|
||||
}
|
||||
display.display();
|
||||
};
|
||||
void PutMenu_2(byte curpoz){
|
||||
display.cp437(true);
|
||||
display.clearDisplay();
|
||||
display.setTextSize(1);
|
||||
display.setTextColor(WHITE);
|
||||
display.setCursor(0,0);
|
||||
for (int i=0; i <= 2; i++){
|
||||
if (curpoz==i){
|
||||
display.print("> ");
|
||||
};
|
||||
if (i==0){display.println("\304\340");}; // Да
|
||||
if (i==1){display.println("\315\345\362");}; // Нет
|
||||
if (i==2){display.println("\302\373\365\356\344");}; // Выход
|
||||
};
|
||||
display.display();
|
||||
};
|
||||
void PutMenu_3(byte curpoz){
|
||||
display.cp437(true);
|
||||
display.clearDisplay();
|
||||
display.setTextSize(1);
|
||||
display.setTextColor(WHITE);
|
||||
display.setCursor(0,0);
|
||||
for (int i=0; i <= 4; i++){
|
||||
if (curpoz==i){
|
||||
display.print(("> "));
|
||||
}
|
||||
if (i==0){
|
||||
display.print("\314\340\361\353\356 \344\342\350\343.:"); // масло
|
||||
display.println(ee_data.motoclock_motor);
|
||||
};
|
||||
if (i==1){
|
||||
display.print("\314\340\361\353\356 \312\317\317:");
|
||||
display.println(ee_data.motoclock_kpp);
|
||||
};
|
||||
if (i==2){
|
||||
display.print("\314\340\361\353\356 \354\356\361\362\373:");
|
||||
display.println(ee_data.motoclock_most);
|
||||
};
|
||||
if (i==3){
|
||||
display.print("\320\345\354\345\355\374 \303\320\314:");
|
||||
display.println(ee_data.motoclock_grm);
|
||||
};
|
||||
if (i==4){display.print("\302\373\365\356\344");};
|
||||
}
|
||||
display.display();
|
||||
LayoutScreen(true,0); // Показываем основной экран
|
||||
|
||||
//ee_data.motoclock_motor=9;
|
||||
}
|
||||
|
||||
|
||||
byte MainMenu(){
|
||||
byte curpoz=0;
|
||||
PutMenu_1(curpoz);
|
||||
while(true){
|
||||
if (btn1.click()) {
|
||||
curpoz=curpoz+1;
|
||||
if (curpoz>3){curpoz=0;};
|
||||
PutMenu_1(curpoz);
|
||||
beep();
|
||||
};
|
||||
if (btn2.click()) {
|
||||
beep();
|
||||
return curpoz;
|
||||
}
|
||||
|
||||
};
|
||||
int memoryFree(){
|
||||
int freeValue;
|
||||
if((int)__brkval == 0)
|
||||
freeValue = ((int)&freeValue) - ((int)&__bss_end);
|
||||
else
|
||||
freeValue = ((int)&freeValue) - ((int)__brkval);
|
||||
return freeValue;
|
||||
}
|
||||
|
||||
// звуковой сигнал по нажатию кнопки
|
||||
void beep(bool beeper,int piezoPin){
|
||||
if (beeper==1) {
|
||||
for (int i=0; i <= 100; i++){
|
||||
digitalWrite(piezoPin, HIGH);
|
||||
delay(1);
|
||||
digitalWrite(piezoPin, LOW);
|
||||
delay(1);
|
||||
}
|
||||
} else {
|
||||
delay(500);
|
||||
}
|
||||
}
|
||||
|
||||
// отобразить текущий экран
|
||||
// refresh true/false - стереть всё предварительно
|
||||
// lay - экарн. 0 - температура, 1 - моточасы
|
||||
// lay - экран. 0 - температура, 1 - моточасы
|
||||
void LayoutScreen(boolean refresh,byte lay){
|
||||
if (refresh==true){
|
||||
display.clearDisplay();
|
||||
display.drawBitmap(65, 32, fxf3, 59, 32, WHITE);
|
||||
};
|
||||
if (lay==0){
|
||||
if (refresh==true){
|
||||
display.clearDisplay();
|
||||
if (grib==false){
|
||||
display.drawBitmap(65, 32, fxf3, 59, 32, WHITE);
|
||||
grib=true;
|
||||
} else {
|
||||
display.drawBitmap(87, 28, ico_grib, 37, 36, WHITE);
|
||||
grib=false;
|
||||
};
|
||||
display.display();
|
||||
};
|
||||
display.setTextColor(WHITE, BLACK);
|
||||
|
||||
// улица
|
||||
//display.drawBitmap(0, 4, ico_street, 16, 16, WHITE);
|
||||
display.setTextSize(2);
|
||||
display.setCursor(50, 0);
|
||||
display.setCursor(50, 1);
|
||||
//display.print(F("Street:"));
|
||||
display.print(celsius1);display.print("c");
|
||||
|
||||
// салон
|
||||
// салон
|
||||
display.setTextSize(1);
|
||||
//display.drawBitmap(0, , ico_salo, 16, 16, WHITE);
|
||||
display.setCursor(4, 2);
|
||||
display.setCursor(4, 1);
|
||||
//display.print(F("Int:"));
|
||||
display.print(celsius2);display.print("c");
|
||||
|
||||
// двигатель
|
||||
display.drawBitmap(0, 22, ico_dvig, 16, 16, WHITE);
|
||||
display.drawBitmap(1, 22, ico_dvig, 16, 16, WHITE);
|
||||
display.setCursor(20, 26);
|
||||
display.print(celsius3);display.print("c");
|
||||
|
||||
// батарея
|
||||
display.drawBitmap(0, 42, ico_bat, 16, 16, WHITE);
|
||||
display.drawBitmap(1, 42, ico_bat, 16, 16, WHITE);
|
||||
display.setCursor(20, 46);
|
||||
display.print(vin);display.print("v");
|
||||
display.print(vin);display.print("v");
|
||||
|
||||
display.display();
|
||||
|
||||
} else {
|
||||
if (refresh==true){
|
||||
display.clearDisplay();
|
||||
if (grib==false){
|
||||
display.drawBitmap(65, 32, fxf3, 59, 32, WHITE);
|
||||
grib=true;
|
||||
} else {
|
||||
display.drawBitmap(87, 28, ico_grib, 37, 36, WHITE);
|
||||
grib=false;
|
||||
};
|
||||
display.display();
|
||||
};
|
||||
display.setTextColor(WHITE, BLACK);
|
||||
display.setCursor(0, 0);
|
||||
display.print("\314\340\361\353\356:");display.print(ee_data.motoclock_motor/60);display.print("\367");
|
||||
display.setCursor(0, 10);
|
||||
display.print("\312\317\317:");display.print(ee_data.motoclock_kpp/60);display.print("\367");
|
||||
display.setCursor(0, 20);
|
||||
display.print("\314\356\361\362:");display.print(ee_data.motoclock_most/60);display.print("\367");
|
||||
display.setCursor(0, 30);
|
||||
display.print("\303\320\314:");display.print(ee_data.motoclock_grm/60);display.print("\367");
|
||||
display.setCursor(1, 1);
|
||||
display.print(__lang.translate(F("Motoclock:")));display.print(ee_data.motoclock_motor/60);display.print(__lang.translate(F("h")));
|
||||
display.setCursor(1, 10);
|
||||
display.print(__lang.translate(F("Transmission:")));display.print(ee_data.motoclock_kpp/60);display.print(__lang.translate(F("h")));
|
||||
display.setCursor(1, 20);
|
||||
display.print(__lang.translate(F("Bridge:")));display.print(ee_data.motoclock_most/60);display.print(__lang.translate(F("h")));
|
||||
display.setCursor(1, 30);
|
||||
display.print(__lang.translate(F("GRM ribbon:")));display.print(ee_data.motoclock_grm/60);display.print(__lang.translate(F("h")));
|
||||
|
||||
display.display();
|
||||
};
|
||||
}
|
||||
|
||||
byte MotoChange(){
|
||||
byte curpoz=0;
|
||||
PutMenu_3(curpoz);
|
||||
while(true){
|
||||
if (btn1.click()) {
|
||||
curpoz=curpoz+1;
|
||||
if (curpoz>4){curpoz=0;};
|
||||
PutMenu_3(curpoz);
|
||||
beep();
|
||||
void PutStringMenu(int curpoz,int cursor,String myPointer){
|
||||
if (curpoz==cursor){
|
||||
display.print("> ");
|
||||
};
|
||||
if (btn2.click()) {
|
||||
beep();
|
||||
return curpoz;
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
display.println(myPointer);
|
||||
};
|
||||
|
||||
byte YesNo(){
|
||||
byte curpoz=0;
|
||||
PutMenu_2(curpoz);
|
||||
void PutCharMenu(int curpoz,int cursor,char *myPointer, int length){
|
||||
if (curpoz==cursor){
|
||||
display.print("> ");
|
||||
};
|
||||
for (byte i = 0; i < length; i++) {
|
||||
display.print(*(myPointer + i));
|
||||
};
|
||||
display.println();
|
||||
|
||||
};
|
||||
void PutYouSure(int poz){
|
||||
display.clearDisplay();
|
||||
display.setCursor(1, 1);
|
||||
display.println("You sure?");
|
||||
display.setCursor(1, 15);
|
||||
|
||||
PutCharMenu(1,poz,"No",2); // Нет
|
||||
PutCharMenu(2,poz,"Yes",3); // Да
|
||||
|
||||
display.display();
|
||||
}
|
||||
int AreYouSure(){
|
||||
int poz=1;
|
||||
PutYouSure(poz);
|
||||
while(true){
|
||||
if (btn1.click()) {
|
||||
curpoz=curpoz+1;
|
||||
if (curpoz>2){curpoz=0;};
|
||||
PutMenu_2(curpoz);
|
||||
beep();
|
||||
};
|
||||
if (btn2.click()) {
|
||||
beep();
|
||||
return curpoz;
|
||||
}
|
||||
|
||||
};
|
||||
if (btn1.click()) {
|
||||
beep(ee_data.beeper,piezoPin);
|
||||
poz=poz+1;
|
||||
if (poz>=3){
|
||||
poz=1;
|
||||
};
|
||||
PutYouSure(poz);
|
||||
};
|
||||
if (btn2.click()) {
|
||||
return poz;
|
||||
};
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
void loop() {
|
||||
|
||||
|
||||
if (millis()-old_milis_2>1000){
|
||||
sensors.requestTemperatures();
|
||||
celsius1=sensors.getTempCByIndex(0);
|
||||
celsius2=sensors.getTempCByIndex(1);
|
||||
celsius3=sensors.getTempCByIndex(2);
|
||||
|
||||
value = analogRead(analogInput);
|
||||
vout = (value * 5.0) / 1024.0;
|
||||
vin = vout / (R2/(R1+R2))-inaccuracy;
|
||||
|
||||
old_milis_2=millis();
|
||||
LayoutScreen(false,layout);
|
||||
//Serial.println("refresh screen");
|
||||
}
|
||||
|
||||
|
||||
void ClearedTxt(){
|
||||
display.clearDisplay();
|
||||
display.setCursor(1, 20);
|
||||
display.println(F("Cleared"));
|
||||
display.display();
|
||||
delay(1000);
|
||||
};
|
||||
void VerifyAllMoto(){
|
||||
if ((ee_data.motoclock_motor<10) or (ee_data.motoclock_kpp<10) or (ee_data.motoclock_most<10) or (ee_data.motoclock_grm<10)){
|
||||
display.clearDisplay();
|
||||
display.setCursor(1, 0);
|
||||
display.println(F("Its time to:"));
|
||||
if (ee_data.motoclock_motor<10){
|
||||
display.println(F("-Replace engine oil"));
|
||||
};
|
||||
if (ee_data.motoclock_kpp<10){
|
||||
display.println(F("-Replace kpp oil"));
|
||||
};
|
||||
if (ee_data.motoclock_most<10){
|
||||
display.println(F("-Replace brige oil"));
|
||||
};
|
||||
if (ee_data.motoclock_grm<10){
|
||||
display.println(F("-Replace grm"));
|
||||
};
|
||||
display.display();
|
||||
beep(ee_data.beeper,piezoPin);delay(1000);beep(ee_data.beeper,piezoPin);
|
||||
beep(ee_data.beeper,piezoPin);delay(1000);beep(ee_data.beeper,piezoPin);
|
||||
LayoutScreen(true,layout);
|
||||
};
|
||||
};
|
||||
void PutMotoMenu(int poz){
|
||||
display.clearDisplay();
|
||||
display.setCursor(1, 1);
|
||||
PutStringMenu(1,poz,F("Engine oil")); // Масло двигателя
|
||||
PutStringMenu(2,poz,F("Gear oil")); // Масло в КПП
|
||||
PutStringMenu(3,poz,F("Bridge oil")); // Масло в мостах
|
||||
PutStringMenu(4,poz,F("Ribbon")); // ремень ГРМ
|
||||
PutStringMenu(5,poz,F("Exit"));
|
||||
display.display();
|
||||
}
|
||||
void SaveData(){
|
||||
EEPROM.put(2,ee_data);
|
||||
}
|
||||
void MenuMoto(){
|
||||
int poz=1;
|
||||
PutMotoMenu(poz);
|
||||
while(true){
|
||||
if (btn1.click()) {
|
||||
poz=poz+1;
|
||||
if (poz>=6){
|
||||
poz=1;
|
||||
};
|
||||
PutMotoMenu(poz);
|
||||
beep(ee_data.beeper,piezoPin);
|
||||
};
|
||||
if (btn2.click()) {
|
||||
// сброс моточасы масло двигателя
|
||||
if (poz==1){
|
||||
int sure=AreYouSure();
|
||||
if (sure==2){
|
||||
ee_data.motoclock_motor=etalon.motoclock_motor;
|
||||
SaveData();
|
||||
ClearedTxt();
|
||||
};
|
||||
};
|
||||
// сброс моточасы масло кпп
|
||||
if (poz==2){
|
||||
int sure=AreYouSure();
|
||||
if (sure==2){
|
||||
ee_data.motoclock_kpp=etalon.motoclock_kpp;
|
||||
SaveData();
|
||||
ClearedTxt();
|
||||
};
|
||||
};
|
||||
// сброс моточасы масло мосты
|
||||
if (poz==3){
|
||||
int sure=AreYouSure();
|
||||
if (sure==2){
|
||||
ee_data.motoclock_most=etalon.motoclock_most;
|
||||
SaveData();
|
||||
ClearedTxt();
|
||||
};
|
||||
};
|
||||
// сброс моточасы ремень ГРМ
|
||||
if (poz==4){
|
||||
int sure=AreYouSure();
|
||||
if (sure==2){
|
||||
ee_data.motoclock_grm=etalon.motoclock_grm;
|
||||
SaveData();
|
||||
ClearedTxt();
|
||||
};
|
||||
};
|
||||
if (poz==5){
|
||||
return 0;
|
||||
}
|
||||
PutMotoMenu(poz);
|
||||
beep(ee_data.beeper,piezoPin);
|
||||
};
|
||||
};
|
||||
};
|
||||
void PutMainMenu(int poz){
|
||||
display.clearDisplay();
|
||||
display.setCursor(1, 1);
|
||||
PutStringMenu(1,poz,F("Motoclock"));
|
||||
if (ee_data.beeper==1){
|
||||
PutStringMenu(2,poz,F("Sound: Yes"));
|
||||
} else {
|
||||
PutStringMenu(2,poz,F("Sound: No"));
|
||||
};
|
||||
if (ee_data.light==1){
|
||||
PutStringMenu(3,poz,F("Light: Yes"));
|
||||
ee_data.light=1;
|
||||
} else {
|
||||
PutStringMenu(3,poz,F("Light: No"));
|
||||
ee_data.light=0;
|
||||
};
|
||||
PutStringMenu(4,poz,F("Exit"));
|
||||
display.display();
|
||||
}
|
||||
void MainMenu(){
|
||||
int poz=1;
|
||||
PutMainMenu(poz);
|
||||
while(true){
|
||||
if (btn1.click()) {
|
||||
poz=poz+1;
|
||||
if (poz>=5){
|
||||
poz=1;
|
||||
};
|
||||
PutMainMenu(poz);
|
||||
beep(ee_data.beeper,piezoPin);
|
||||
};
|
||||
if (btn2.click()) {
|
||||
// сброс моточасов
|
||||
if (poz==1){
|
||||
MenuMoto();
|
||||
PutMainMenu(poz);
|
||||
};
|
||||
// Звук кнопок
|
||||
if (poz==2){
|
||||
if (ee_data.beeper==1){
|
||||
ee_data.beeper=0;
|
||||
} else {
|
||||
ee_data.beeper=1;
|
||||
};
|
||||
SaveData();
|
||||
PutMainMenu(poz);
|
||||
};
|
||||
// подсветка кнопок
|
||||
if (poz==3){
|
||||
if (ee_data.light==1){
|
||||
ee_data.light=0;
|
||||
digitalWrite(LightPin, LOW);
|
||||
} else {
|
||||
ee_data.light=1;
|
||||
digitalWrite(LightPin, HIGH);
|
||||
};
|
||||
SaveData();
|
||||
PutMainMenu(poz);
|
||||
};
|
||||
if (poz==4){ // Exit
|
||||
return 0;
|
||||
};
|
||||
beep(ee_data.beeper,piezoPin);
|
||||
};
|
||||
};
|
||||
}
|
||||
void GetDataSensors(){
|
||||
// читаем показания датчиков температуры
|
||||
sensors.requestTemperatures();
|
||||
celsius1=sensors.getTempCByIndex(0); if (celsius1<-120){celsius1=0;};
|
||||
celsius2=sensors.getTempCByIndex(1); if (celsius2<-120){celsius2=0;};
|
||||
celsius3=sensors.getTempCByIndex(2); if (celsius3<-120){celsius3=0;};
|
||||
// читаем показания вольтметра
|
||||
value = analogRead(analogInput);
|
||||
vout = (value * 5.0) / 1024.0;
|
||||
vin = vout / (R2/(R1+R2))-inaccuracy;
|
||||
old_milis_2=millis();
|
||||
};
|
||||
void loop() {
|
||||
if (millis()-old_milis_2>1000){ // раз в секунду читаем показания
|
||||
GetDataSensors();
|
||||
LayoutScreen(false,layout);
|
||||
Serial.println(memoryFree());
|
||||
};
|
||||
if (millis()-old_milis>60000){
|
||||
old_milis=millis();
|
||||
Serial.println("timer! save data to eerom");
|
||||
Serial.println(F("Timer! save to eerom"));
|
||||
if (ee_data.motoclock_motor>0){ee_data.motoclock_motor=ee_data.motoclock_motor-1;};
|
||||
if (ee_data.motoclock_kpp>0){ee_data.motoclock_kpp=ee_data.motoclock_kpp-1;};
|
||||
if (ee_data.motoclock_most>0){ee_data.motoclock_most=ee_data.motoclock_most-1;};
|
||||
if (ee_data.motoclock_grm>0){ee_data.motoclock_grm=ee_data.motoclock_grm-1;};
|
||||
EEPROM.put(2,ee_data);
|
||||
SaveData();
|
||||
VerifyAllMoto();
|
||||
}
|
||||
|
||||
if (btn1.click()) {
|
||||
beep();
|
||||
byte res=MainMenu();
|
||||
// звук кнопок
|
||||
if (res==1){
|
||||
byte ress=YesNo();
|
||||
if (ress==0){ee_data.beeper=1;};
|
||||
if (ress==1){ee_data.beeper=0;};
|
||||
EEPROM.put(2,ee_data);
|
||||
};
|
||||
// подсветка кнопок
|
||||
if (res==2){
|
||||
byte ress=YesNo();
|
||||
if (ress==0){ee_data.light=1;};
|
||||
if (ress==1){ee_data.light=0;};
|
||||
EEPROM.put(2,ee_data);
|
||||
if (ee_data.light==1){
|
||||
digitalWrite(LightPin, HIGH);
|
||||
} else {
|
||||
digitalWrite(LightPin, LOW);
|
||||
};
|
||||
};
|
||||
// сброс моточасов
|
||||
if (res==0){
|
||||
byte ress=MotoChange();
|
||||
if (ress==0){
|
||||
byte ressyn=YesNo();
|
||||
if (ress==0){ee_data.motoclock_motor=etalon.motoclock_motor;EEPROM.put(2,ee_data);};
|
||||
};
|
||||
if (ress==1){
|
||||
byte ressyn=YesNo();
|
||||
if (ress==0){ee_data.motoclock_kpp=etalon.motoclock_kpp;EEPROM.put(2,ee_data);};
|
||||
};
|
||||
if (ress==2){
|
||||
byte ressyn=YesNo();
|
||||
if (ress==0){ee_data.motoclock_most=etalon.motoclock_most;EEPROM.put(2,ee_data);};
|
||||
};
|
||||
if (ress==3){
|
||||
byte ressyn=YesNo();
|
||||
if (ress==0){ee_data.motoclock_grm=etalon.motoclock_grm;EEPROM.put(2,ee_data);};
|
||||
};
|
||||
|
||||
};
|
||||
LayoutScreen(true,layout);
|
||||
}
|
||||
|
||||
if (btn2.click()) {
|
||||
if (btn1.click()) {
|
||||
MainMenu();
|
||||
LayoutScreen(true,layout);
|
||||
};
|
||||
if (btn2.click()) {
|
||||
layout=layout+1;
|
||||
if (layout>1){layout=0;};
|
||||
LayoutScreen(true,layout);
|
||||
beep();
|
||||
}
|
||||
|
||||
display.display();
|
||||
|
||||
}
|
||||
LayoutScreen(true,layout);
|
||||
beep(ee_data.beeper,piezoPin);
|
||||
};
|
||||
};
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
class i18n {
|
||||
public:
|
||||
i18n (byte lang) {
|
||||
_lang = lang;
|
||||
}
|
||||
const String translate(const String en){
|
||||
if (_lang<1){
|
||||
return en;
|
||||
};
|
||||
if (en==F("Exit")){return "\302\373\365\356\344";};
|
||||
if (en==F("Motoclock:")){return "\314\340\361\353\356 \344\342\350\343\340\362\345\353\374:";};
|
||||
if (en==F("Transmission:")){return "\314\340\361\353\356 \312\317\317:";};
|
||||
if (en==F("Bridge:")){return "\314\340\361\353\356 \354\356\361\362\373:";};
|
||||
if (en==F("GRM ribbon:")){return "\320\345\354\355\350:";};
|
||||
if (en==F("h")){return "\367";};
|
||||
return en;
|
||||
};
|
||||
private:
|
||||
byte _lang;
|
||||
};
|
|
@ -0,0 +1,100 @@
|
|||
// 'fxf', 79x64px
|
||||
const unsigned char fxf [] PROGMEM = {
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf2, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe6, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0,
|
||||
0xff, 0xff, 0xff, 0xfd, 0xbd, 0xff, 0xff, 0xce, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0,
|
||||
0xff, 0xff, 0xff, 0xfd, 0x9d, 0xff, 0xff, 0x9f, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0,
|
||||
0xff, 0xff, 0xff, 0xbd, 0x99, 0x8f, 0xff, 0x3f, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0,
|
||||
0xff, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xfe, 0x7f, 0x00, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0,
|
||||
0xff, 0xff, 0xfd, 0xc0, 0x00, 0x07, 0xff, 0xfe, 0x00, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0,
|
||||
0xff, 0xff, 0xff, 0x60, 0x00, 0x02, 0x00, 0xfe, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0,
|
||||
0xff, 0xff, 0xec, 0x60, 0x00, 0x7f, 0xff, 0x7e, 0x00, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0,
|
||||
0xff, 0xff, 0xf8, 0x30, 0x00, 0x00, 0x00, 0x06, 0x00, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0,
|
||||
0xff, 0xff, 0xe0, 0x30, 0x00, 0xfe, 0x00, 0x1b, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0,
|
||||
0xff, 0xff, 0xc0, 0x30, 0x06, 0x82, 0xb3, 0xf7, 0x00, 0x00, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xf0,
|
||||
0xff, 0xff, 0xc0, 0x18, 0x1f, 0x9e, 0x87, 0xf9, 0x80, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xf0,
|
||||
0xff, 0xff, 0xc0, 0x1f, 0x7f, 0x1e, 0xfe, 0xb9, 0x80, 0x00, 0x00, 0x7f, 0xff, 0xff, 0xff, 0xf0,
|
||||
0xff, 0xff, 0xc0, 0x1e, 0xff, 0x5d, 0xde, 0xbe, 0xc0, 0x00, 0x00, 0x7f, 0xff, 0xff, 0xff, 0xf0,
|
||||
0xff, 0xfb, 0xe0, 0x7b, 0xdd, 0x5f, 0xca, 0x94, 0x60, 0x00, 0x00, 0x3f, 0xff, 0xff, 0xff, 0xf0,
|
||||
0xff, 0xf7, 0xe1, 0xff, 0x0f, 0x5c, 0x2f, 0xfc, 0x30, 0x00, 0x01, 0x1f, 0xff, 0xff, 0xff, 0xf0,
|
||||
0xff, 0xef, 0xe3, 0xfc, 0x0e, 0x07, 0xff, 0xf8, 0xe0, 0x00, 0x03, 0x0f, 0xff, 0xff, 0xff, 0xf0,
|
||||
0xff, 0xef, 0xef, 0xf8, 0x06, 0x60, 0x1f, 0xfb, 0xe0, 0x00, 0x0f, 0x07, 0xff, 0xff, 0xff, 0xf0,
|
||||
0xff, 0xff, 0xff, 0xf0, 0x00, 0x1c, 0x1f, 0xf5, 0xc0, 0x00, 0x1f, 0x03, 0xff, 0xff, 0xbf, 0xf0,
|
||||
0xff, 0xff, 0xff, 0xf0, 0x00, 0x03, 0x9f, 0xf1, 0xc0, 0x00, 0x3f, 0x01, 0xff, 0xdf, 0x3f, 0xf0,
|
||||
0xff, 0xff, 0xff, 0xf0, 0x30, 0x00, 0x4c, 0x00, 0xc0, 0x00, 0x7f, 0xc0, 0xff, 0x9f, 0x1f, 0xf0,
|
||||
0xff, 0xdf, 0xff, 0xf0, 0x0e, 0x80, 0x00, 0x02, 0x60, 0x00, 0xff, 0xc0, 0x7f, 0x9f, 0x3f, 0xf0,
|
||||
0xff, 0xdf, 0xff, 0xf0, 0x0b, 0x80, 0x00, 0x04, 0xe0, 0x01, 0xff, 0xe0, 0x3f, 0x9f, 0x1f, 0xf0,
|
||||
0xff, 0xff, 0xff, 0xf0, 0x02, 0xc0, 0x00, 0x02, 0x30, 0x03, 0xff, 0xf0, 0x1f, 0x0e, 0x0f, 0xf0,
|
||||
0xff, 0xff, 0xff, 0xf0, 0x4e, 0x00, 0x00, 0x10, 0x30, 0x07, 0xff, 0xf8, 0x0e, 0x04, 0x0f, 0xf0,
|
||||
0xff, 0xff, 0xff, 0xb0, 0x26, 0x80, 0xff, 0xca, 0x90, 0x0f, 0x3f, 0x98, 0x07, 0x0e, 0x1f, 0xf0,
|
||||
0xff, 0xff, 0xfe, 0x70, 0x21, 0xef, 0xc0, 0x09, 0x30, 0x1c, 0x0f, 0x04, 0x03, 0x06, 0x0f, 0xf0,
|
||||
0xff, 0xf7, 0x79, 0xf0, 0x17, 0x80, 0x00, 0x08, 0x10, 0x30, 0x1e, 0x00, 0x00, 0x00, 0x07, 0xf0,
|
||||
0xff, 0xc3, 0x67, 0xd8, 0x11, 0x60, 0x00, 0x05, 0x18, 0x40, 0x1c, 0x00, 0x00, 0x00, 0x03, 0xf0,
|
||||
0xff, 0x83, 0x9f, 0x60, 0x17, 0x60, 0x04, 0x05, 0x18, 0x00, 0x30, 0x00, 0x00, 0x00, 0x01, 0xf0,
|
||||
0xff, 0x03, 0xbd, 0x80, 0x10, 0x40, 0x13, 0x0c, 0x18, 0x00, 0x20, 0x00, 0x00, 0x00, 0x07, 0xf0,
|
||||
0xff, 0x03, 0xb6, 0x00, 0x17, 0x26, 0x0f, 0xb8, 0x18, 0x00, 0x40, 0x00, 0x00, 0x00, 0x07, 0xf0,
|
||||
0xff, 0x00, 0x18, 0x00, 0x16, 0x1f, 0xff, 0x90, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xf0,
|
||||
0xff, 0x02, 0x60, 0x1c, 0x31, 0x1f, 0xff, 0xc0, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xf0,
|
||||
0xff, 0x09, 0x00, 0x67, 0x66, 0x1f, 0xff, 0xe0, 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0,
|
||||
0xff, 0x05, 0x80, 0x3f, 0x04, 0x18, 0x3f, 0xc0, 0xf3, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70,
|
||||
0xff, 0x84, 0x81, 0xfc, 0x00, 0x00, 0x18, 0x03, 0x80, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x03, 0xb0,
|
||||
0xff, 0x82, 0x00, 0x08, 0x00, 0x20, 0x0c, 0x06, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x01, 0xf0,
|
||||
0xfd, 0x82, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x01, 0xf0,
|
||||
0xff, 0x83, 0xc0, 0x00, 0x0f, 0xd8, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0,
|
||||
0xdf, 0x80, 0x00, 0x18, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70,
|
||||
0xfe, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70,
|
||||
0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30,
|
||||
0xfc, 0xff, 0xfc, 0xff, 0xff, 0xff, 0xe0, 0x7f, 0xff, 0x3f, 0xff, 0x1f, 0xfc, 0x7f, 0xff, 0x30,
|
||||
0xf9, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0, 0x7f, 0xff, 0x7f, 0xff, 0x1f, 0xfc, 0x7f, 0xff, 0x30,
|
||||
0xf9, 0xff, 0xfd, 0xff, 0xf7, 0xff, 0xc0, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xfc, 0x7f, 0xff, 0x30,
|
||||
0xf1, 0xff, 0xfd, 0xff, 0xef, 0xff, 0x80, 0xff, 0xfe, 0xff, 0xfe, 0x3f, 0xfc, 0xff, 0xff, 0x30,
|
||||
0xf3, 0xf9, 0xff, 0xf8, 0x0f, 0xe0, 0x00, 0xfe, 0xfe, 0xfc, 0xfe, 0x7e, 0xfc, 0xfe, 0x7e, 0x30,
|
||||
0xf3, 0xfb, 0xfb, 0xff, 0xef, 0xff, 0x7d, 0xff, 0xff, 0xfc, 0xfe, 0xfe, 0xfc, 0xfc, 0xfe, 0x70,
|
||||
0xe7, 0xf3, 0xfb, 0xff, 0xdf, 0xff, 0x7d, 0xff, 0xfd, 0xfc, 0xfc, 0xfd, 0xfd, 0xfc, 0xfe, 0x70,
|
||||
0xe7, 0xf3, 0xf7, 0xff, 0xdf, 0xff, 0x7d, 0xff, 0xfd, 0xf9, 0xfd, 0xff, 0xfd, 0xfc, 0xfc, 0x70,
|
||||
0xe7, 0xe7, 0xf7, 0xff, 0x9f, 0xfe, 0x03, 0xff, 0xfb, 0xf9, 0xfd, 0xff, 0xfd, 0xf9, 0xfc, 0xf0,
|
||||
0xcf, 0xff, 0xff, 0xe0, 0x3f, 0x80, 0x03, 0xfb, 0xfb, 0xff, 0xfb, 0xff, 0xff, 0xff, 0xfc, 0xf0,
|
||||
0xcf, 0xff, 0xef, 0xe0, 0x3f, 0x80, 0x03, 0xfb, 0xfb, 0xff, 0xff, 0xf1, 0xff, 0xff, 0xf8, 0xf0,
|
||||
0xcf, 0xff, 0xef, 0xe0, 0x3f, 0x00, 0x07, 0xf3, 0xfb, 0xff, 0xff, 0xf1, 0xff, 0xff, 0xf9, 0xf0,
|
||||
0xc7, 0xff, 0x8f, 0xc0, 0x3f, 0x00, 0x07, 0xf3, 0xfb, 0xff, 0xe7, 0xe1, 0xfb, 0xff, 0xf1, 0xf0,
|
||||
0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xf0,
|
||||
0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xf0,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0
|
||||
};
|
||||
|
||||
const unsigned char ico_dvig [] PROGMEM = {
|
||||
// 'ico_dvig, 16x16px
|
||||
0x00, 0x70, 0x00, 0x88, 0x00, 0xa8, 0x00, 0xa8, 0x00, 0xa8, 0x00, 0xa8, 0x00, 0xa8, 0x00, 0xa8,
|
||||
0x3b, 0xa8, 0x00, 0xa8, 0x0e, 0xa8, 0x31, 0x24, 0x01, 0x24, 0x3f, 0x04, 0x00, 0x88, 0x00, 0x70
|
||||
};
|
||||
|
||||
// 'батарейка', 32x32px
|
||||
const unsigned char ico_bat [] PROGMEM = {
|
||||
0x00, 0x00, 0x0f, 0xf0, 0x18, 0x18, 0x33, 0xcd, 0x67, 0xe7, 0x44, 0x2e, 0x05, 0xa2, 0x05, 0xa0,
|
||||
0x04, 0x20, 0x44, 0x20, 0x75, 0xa2, 0xe4, 0x26, 0xb7, 0xec, 0x18, 0x18, 0x0f, 0xf0, 0x00, 0x00
|
||||
};
|
||||
|
||||
|
||||
// 'fxf3', 59x32px
|
||||
const unsigned char fxf3 [] PROGMEM = {
|
||||
0x00, 0xd0, 0x3e, 0x00, 0x00, 0x78, 0x3c, 0x00, 0x01, 0x0f, 0x81, 0x00, 0x01, 0x07, 0xc0, 0x80,
|
||||
0x02, 0x30, 0x32, 0x80, 0x00, 0x30, 0x1a, 0x40, 0x00, 0xfe, 0xff, 0x40, 0x02, 0xfe, 0xff, 0x20,
|
||||
0x05, 0x2f, 0x07, 0xa0, 0x00, 0x97, 0x87, 0xa0, 0x01, 0x0f, 0x0f, 0xa0, 0x05, 0x07, 0x07, 0xa0,
|
||||
0x0a, 0x0e, 0x0f, 0x2b, 0xa9, 0x0f, 0x0f, 0xa0, 0x02, 0x1e, 0x0f, 0x04, 0x02, 0x0e, 0x0f, 0x00,
|
||||
0x14, 0x1e, 0x1e, 0x79, 0x96, 0x1e, 0x0f, 0x40, 0x04, 0x3c, 0x1f, 0xde, 0xfc, 0x1e, 0x1e, 0x00,
|
||||
0x28, 0x3c, 0x3f, 0x8e, 0x4c, 0x3c, 0x1e, 0x80, 0x08, 0x78, 0x3e, 0x0c, 0x18, 0x3c, 0x1e, 0x80,
|
||||
0x50, 0x78, 0x3e, 0x00, 0x38, 0x78, 0x1d, 0x00, 0x50, 0x00, 0x1d, 0x00, 0x30, 0x00, 0x1c, 0x80,
|
||||
0xa0, 0x00, 0x3d, 0x00, 0x70, 0x00, 0x1e, 0x80, 0xa0, 0x00, 0x3d, 0x00, 0xf0, 0x00, 0x1e, 0x80,
|
||||
0xb0, 0x00, 0x7f, 0x01, 0xf8, 0x00, 0x3e, 0x80, 0x5f, 0xe0, 0xfd, 0x03, 0xfb, 0xf0, 0xfc, 0x80,
|
||||
0x4f, 0xe0, 0xff, 0x03, 0xcf, 0xf0, 0xfe, 0x80, 0x27, 0xe1, 0xf6, 0x03, 0xc7, 0xe0, 0xf8, 0x80,
|
||||
0x13, 0xc1, 0xe4, 0x03, 0xb3, 0xa1, 0xe7, 0x00, 0x08, 0x41, 0xe8, 0x01, 0xa8, 0x41, 0xe8, 0x00,
|
||||
0x07, 0x43, 0xd0, 0x01, 0xc1, 0x41, 0xe8, 0x00, 0x02, 0x83, 0xe0, 0x41, 0xd1, 0x41, 0xc0, 0x00,
|
||||
0x02, 0x83, 0xc0, 0xe1, 0xd0, 0x43, 0xd0, 0x00, 0x02, 0xa3, 0xc9, 0xe3, 0xd2, 0xa3, 0xd0, 0x00,
|
||||
0x02, 0xff, 0xff, 0xff, 0xd2, 0xff, 0xd0, 0x00, 0x02, 0x7f, 0xff, 0xff, 0xe1, 0x7f, 0xa0, 0x00,
|
||||
0x01, 0x3f, 0xbf, 0xdf, 0xc8, 0xbf, 0xa0, 0x00, 0x00, 0x87, 0x00, 0x8e, 0x10, 0x43, 0xa0, 0x00,
|
||||
0x00, 0x00, 0x72, 0x20, 0x60, 0x20, 0x00, 0x00, 0x00, 0x1f, 0x80, 0x8f, 0x80, 0x1f, 0x80, 0x00
|
||||
};
|
Loading…
Reference in New Issue