|
@@ -738,10 +738,10 @@ static void ADC_cb(ADCDriver *adcp) {
|
|
int32_t temp_32 = (TM2_current + PHASE) << Km; // Разность фаз
|
|
int32_t temp_32 = (TM2_current + PHASE) << Km; // Разность фаз
|
|
|
|
|
|
if (!fl.PP_tm) {
|
|
if (!fl.PP_tm) {
|
|
- temp_32 -= PID_reg + (1 << Km); // Разность фаз должна быть с соответствующим знаком
|
|
|
|
|
|
+ temp_32 -= PID_reg + (1 << Km); // Разность фаз должна быть с соответствующим знаком
|
|
}
|
|
}
|
|
- PID_int += (temp_32 >> Ki); // Считаем интегральную составляющую
|
|
|
|
- PID_reg += temp_32 >> Kp; // Считаем новую функцию управления
|
|
|
|
|
|
+ PID_int += (temp_32 >> Ki); // Считаем интегральную составляющую
|
|
|
|
+ PID_reg += temp_32 >> Kp; // Считаем новую функцию управления
|
|
PID_reg += PID_int;
|
|
PID_reg += PID_int;
|
|
PID_reg += ( temp_32 - PID_err_old ) >> Kd;
|
|
PID_reg += ( temp_32 - PID_err_old ) >> Kd;
|
|
PID_err_old = temp_32;
|
|
PID_err_old = temp_32;
|
|
@@ -763,10 +763,10 @@ static void ADC_cb(ADCDriver *adcp) {
|
|
*/
|
|
*/
|
|
static void RefreshMenu (void) {
|
|
static void RefreshMenu (void) {
|
|
ST7735_FillScreen(ST7735_BLACK);
|
|
ST7735_FillScreen(ST7735_BLACK);
|
|
- ST7735_WriteString(0, 6, "Ст Принять и записать", Font_7x10, ST7735_BLUE, ST7735_BLACK);
|
|
|
|
- ST7735_WriteString(0, 7, "Рз Принять без записи", Font_7x10, ST7735_BLUE, ST7735_BLACK);
|
|
|
|
- ST7735_WriteString(X_position(1, 0, 7), 3, "Управление:", Font_7x10, ST7735_BLUE, ST7735_BLACK);
|
|
|
|
- ST7735_WriteString(0, 4, "P- Выбор", Font_7x10, ST7735_BLUE, ST7735_BLACK);
|
|
|
|
|
|
+ ST7735_WriteString(0, 60, "Ст Принять и записать", Font_7x10, ST7735_BLUE, ST7735_BLACK);
|
|
|
|
+ ST7735_WriteString(0, 70, "Рз Принять без записи", Font_7x10, ST7735_BLUE, ST7735_BLACK);
|
|
|
|
+ ST7735_WriteString(X_position(1, 0, 7), 30, "Управление:", Font_7x10, ST7735_BLUE, ST7735_BLACK);
|
|
|
|
+ ST7735_WriteString(0, 40, "P- Выбор", Font_7x10, ST7735_BLUE, ST7735_BLACK);
|
|
#ifdef INTERFACE_ALT
|
|
#ifdef INTERFACE_ALT
|
|
|
|
|
|
#else
|
|
#else
|
|
@@ -778,30 +778,30 @@ static void RefreshMenu (void) {
|
|
#ifdef INTERFACE_ALT
|
|
#ifdef INTERFACE_ALT
|
|
chsnprintf(buf, 24, "%3u V", U_LINE);
|
|
chsnprintf(buf, 24, "%3u V", U_LINE);
|
|
ST7735_WriteString(X_position(16, 0, 7), 0, buf, Font_7x10, ST7735_BLUE, ST7735_BLACK);
|
|
ST7735_WriteString(X_position(16, 0, 7), 0, buf, Font_7x10, ST7735_BLUE, ST7735_BLACK);
|
|
- ST7735_WriteString(0, 1, "Рном= Вт", Font_7x10, ST7735_BLUE, ST7735_BLACK);
|
|
|
|
|
|
+ ST7735_WriteString(0, 10, "Рном= Вт", Font_7x10, ST7735_BLUE, ST7735_BLACK);
|
|
#else
|
|
#else
|
|
ST7735_WriteString(X_position(8, 0, 7), 0, "/введите Рном", Font_7x10, ST7735_BLUE, ST7735_BLACK);
|
|
ST7735_WriteString(X_position(8, 0, 7), 0, "/введите Рном", Font_7x10, ST7735_BLUE, ST7735_BLACK);
|
|
chsnprintf(buf, 24, "Рном= Вт, (%3u V)", U_LINE);
|
|
chsnprintf(buf, 24, "Рном= Вт, (%3u V)", U_LINE);
|
|
- ST7735_WriteString(0, 1, buf, Font_7x10, ST7735_BLUE, ST7735_BLACK);
|
|
|
|
|
|
+ ST7735_WriteString(0, 10, buf, Font_7x10, ST7735_BLUE, ST7735_BLACK);
|
|
#endif
|
|
#endif
|
|
- ST7735_WriteString(0, 2, "==Мощность нагрузки==", Font_7x10, ST7735_BLUE, ST7735_BLACK);
|
|
|
|
- ST7735_WriteString(X_position(8, 0, 7), 4, "/уменьшение", Font_7x10, ST7735_BLUE, ST7735_BLACK);
|
|
|
|
- ST7735_WriteString(0, 5, "P+ Увеличение", Font_7x10, ST7735_BLUE, ST7735_BLACK);
|
|
|
|
|
|
+ ST7735_WriteString(0, 20, "==Мощность нагрузки==", Font_7x10, ST7735_BLUE, ST7735_BLACK);
|
|
|
|
+ ST7735_WriteString(X_position(8, 0, 7), 40, "/уменьшение", Font_7x10, ST7735_BLUE, ST7735_BLACK);
|
|
|
|
+ ST7735_WriteString(0, 50, "P+ Увеличение", Font_7x10, ST7735_BLUE, ST7735_BLACK);
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
|
|
|
|
case 1: { //Если мы в меню выбора уставки, то...
|
|
case 1: { //Если мы в меню выбора уставки, то...
|
|
#ifdef INTERFACE_ALT
|
|
#ifdef INTERFACE_ALT
|
|
- ST7735_WriteString(0, 1, "Руст= Вт", Font_7x10, ST7735_BLUE, ST7735_BLACK);
|
|
|
|
|
|
+ ST7735_WriteString(0, 10, "Руст= Вт", Font_7x10, ST7735_BLUE, ST7735_BLACK);
|
|
#else
|
|
#else
|
|
ST7735_WriteString(X_position(9, 0, 7), 0, "уставку", Font_7x10, ST7735_BLUE, ST7735_BLACK);
|
|
ST7735_WriteString(X_position(9, 0, 7), 0, "уставку", Font_7x10, ST7735_BLUE, ST7735_BLACK);
|
|
- ST7735_WriteString(0, 1, "Руст= Вт", Font_7x10, ST7735_BLUE, ST7735_BLACK);
|
|
|
|
|
|
+ ST7735_WriteString(0, 10, "Руст= Вт", Font_7x10, ST7735_BLUE, ST7735_BLACK);
|
|
#endif
|
|
#endif
|
|
- ST7735_WriteString(0, 2, "=======Уставка=======", Font_7x10, ST7735_BLUE, ST7735_BLACK);
|
|
|
|
- ST7735_WriteString(0, 5, "P+ Выбор", Font_7x10, ST7735_BLUE, ST7735_BLACK);
|
|
|
|
|
|
+ ST7735_WriteString(0, 20, "=======Уставка=======", Font_7x10, ST7735_BLUE, ST7735_BLACK);
|
|
|
|
+ ST7735_WriteString(0, 50, "P+ Выбор", Font_7x10, ST7735_BLUE, ST7735_BLACK);
|
|
#ifdef USE_EEPROM
|
|
#ifdef USE_EEPROM
|
|
if (!fl.writable) { // Если уставки не пишутся в EEPROM, то...
|
|
if (!fl.writable) { // Если уставки не пишутся в EEPROM, то...
|
|
- ST7735_WriteString(0, 6, "Ст Принять без записи", Font_7x10, ST7735_BLUE, ST7735_BLACK);
|
|
|
|
|
|
+ ST7735_WriteString(0, 60, "Ст Принять без записи", Font_7x10, ST7735_BLUE, ST7735_BLACK);
|
|
}
|
|
}
|
|
#endif
|
|
#endif
|
|
break;
|
|
break;
|
|
@@ -855,15 +855,15 @@ void Stab_Init(void) {
|
|
//ST7735_Init(); // done in main()
|
|
//ST7735_Init(); // done in main()
|
|
ST7735_FillScreen(ST7735_BLACK);
|
|
ST7735_FillScreen(ST7735_BLACK);
|
|
ST7735_WriteString(X_centred(21), 0, "Стабилизатор мощности", Font_7x10, ST7735_BLUE, ST7735_BLACK);
|
|
ST7735_WriteString(X_centred(21), 0, "Стабилизатор мощности", Font_7x10, ST7735_BLUE, ST7735_BLACK);
|
|
- ST7735_WriteString(X_centred(4), 1, "ТЭНа", Font_7x10, ST7735_BLUE, ST7735_BLACK);
|
|
|
|
|
|
+ ST7735_WriteString(X_centred(4), 10, "ТЭНа", Font_7x10, ST7735_BLUE, ST7735_BLACK);
|
|
#ifdef INTERFACE_ALT
|
|
#ifdef INTERFACE_ALT
|
|
- ST7735_WriteString(X_centred(16), 2, "STAB-AVR", Font_11x18, ST7735_BLUE, ST7735_BLACK);
|
|
|
|
|
|
+ ST7735_WriteString(X_centred(16), 20, "STAB-AVR", Font_11x18, ST7735_BLUE, ST7735_BLACK);
|
|
#else
|
|
#else
|
|
- ST7735_WriteString(X_centred(8), 2, "STAB-AVR", Font_7x10, ST7735_BLUE, ST7735_BLACK);
|
|
|
|
|
|
+ ST7735_WriteString(X_centred(8), 20, "STAB-AVR", Font_7x10, ST7735_BLUE, ST7735_BLACK);
|
|
#endif
|
|
#endif
|
|
- ST7735_WriteString(X_centred(VERSION_LEN), 4, VERSION, Font_7x10, ST7735_BLUE, ST7735_BLACK);
|
|
|
|
- ST7735_WriteString(X_centred(10), 6, "JohnJohnov", Font_7x10, ST7735_BLUE, ST7735_BLACK);
|
|
|
|
- ST7735_WriteString(X_centred(17), 7, "alcodistillers.ru", Font_7x10, ST7735_BLUE, ST7735_BLACK);
|
|
|
|
|
|
+ ST7735_WriteString(X_centred(VERSION_LEN), 40, VERSION, Font_7x10, ST7735_BLUE, ST7735_BLACK);
|
|
|
|
+ ST7735_WriteString(X_centred(10), 60, "JohnJohnov", Font_7x10, ST7735_BLUE, ST7735_BLACK);
|
|
|
|
+ ST7735_WriteString(X_centred(17), 70, "alcodistillers.ru", Font_7x10, ST7735_BLUE, ST7735_BLACK);
|
|
#ifdef USE_EEPROM
|
|
#ifdef USE_EEPROM
|
|
EEPROM_read_Pnoms(); // Прочитаем из EEPROM записанные номиналы ТЭНов
|
|
EEPROM_read_Pnoms(); // Прочитаем из EEPROM записанные номиналы ТЭНов
|
|
#endif
|
|
#endif
|
|
@@ -954,7 +954,7 @@ void Stab_WorkCycle(void) {
|
|
#ifdef INTERFACE_ALT
|
|
#ifdef INTERFACE_ALT
|
|
ST7735_WriteString(X_position(3, 0, 11), 0, "****", Font_11x18, ST7735_BLUE, ST7735_BLACK);
|
|
ST7735_WriteString(X_position(3, 0, 11), 0, "****", Font_11x18, ST7735_BLUE, ST7735_BLACK);
|
|
#else
|
|
#else
|
|
- ST7735_WriteString(X_position(6, 0, 7), 1, "****", Font_7x10, ST7735_BLUE, ST7735_BLACK);
|
|
|
|
|
|
+ ST7735_WriteString(X_position(6, 0, 7), 10, "****", Font_7x10, ST7735_BLUE, ST7735_BLACK);
|
|
#endif
|
|
#endif
|
|
} else if ((Pnomold != Pnom) || fl.dspRefresh) {
|
|
} else if ((Pnomold != Pnom) || fl.dspRefresh) {
|
|
Pnomold = Pnom;
|
|
Pnomold = Pnom;
|
|
@@ -962,7 +962,7 @@ void Stab_WorkCycle(void) {
|
|
#ifdef INTERFACE_ALT
|
|
#ifdef INTERFACE_ALT
|
|
ST7735_WriteString(X_position(6, Pnom, 11), 0, buf, Font_11x18, ST7735_BLUE, ST7735_BLACK);
|
|
ST7735_WriteString(X_position(6, Pnom, 11), 0, buf, Font_11x18, ST7735_BLUE, ST7735_BLACK);
|
|
#else
|
|
#else
|
|
- ST7735_WriteString(X_position(9, Pnom, 7), 1, buf, Font_7x10, ST7735_BLUE, ST7735_BLACK);
|
|
|
|
|
|
+ ST7735_WriteString(X_position(9, Pnom, 7), 10, buf, Font_7x10, ST7735_BLUE, ST7735_BLACK);
|
|
#endif
|
|
#endif
|
|
}
|
|
}
|
|
fl.dspRefresh = 0;
|
|
fl.dspRefresh = 0;
|
|
@@ -977,13 +977,13 @@ void Stab_WorkCycle(void) {
|
|
#ifdef INTERFACE_ALT
|
|
#ifdef INTERFACE_ALT
|
|
ST7735_WriteString(X_position(6, p, 11), 0, buf, Font_11x18, ST7735_BLUE, ST7735_BLACK);
|
|
ST7735_WriteString(X_position(6, p, 11), 0, buf, Font_11x18, ST7735_BLUE, ST7735_BLACK);
|
|
#else
|
|
#else
|
|
- ST7735_WriteString(X_position(9, p, 7), 1, buf, Font_7x10, ST7735_BLUE, ST7735_BLACK);
|
|
|
|
|
|
+ ST7735_WriteString(X_position(9, p, 7), 10, buf, Font_7x10, ST7735_BLUE, ST7735_BLACK);
|
|
#endif
|
|
#endif
|
|
#ifdef USE_EEPROM
|
|
#ifdef USE_EEPROM
|
|
if (PDMset[1][cnt_PDMcount]) { // Если значение записано в EEPROM
|
|
if (PDMset[1][cnt_PDMcount]) { // Если значение записано в EEPROM
|
|
ST7735_WriteString(X_position(20, 0, 7), 1, "R", Font_7x10, ST7735_BLUE, ST7735_BLACK); // поставим значок
|
|
ST7735_WriteString(X_position(20, 0, 7), 1, "R", Font_7x10, ST7735_BLUE, ST7735_BLACK); // поставим значок
|
|
} else {
|
|
} else {
|
|
- ST7735_WriteString(X_position(20, 0, 7), 1, " ", Font_7x10, ST7735_BLUE, ST7735_BLACK); // а если не записано - уберем
|
|
|
|
|
|
+ ST7735_WriteString(X_position(20, 0, 7), 10, " ", Font_7x10, ST7735_BLUE, ST7735_BLACK); // а если не записано - уберем
|
|
}
|
|
}
|
|
#endif
|
|
#endif
|
|
}
|
|
}
|
|
@@ -993,20 +993,20 @@ void Stab_WorkCycle(void) {
|
|
default: { // А если не в меню, то...
|
|
default: { // А если не в меню, то...
|
|
#ifdef INTERFACE_ALT
|
|
#ifdef INTERFACE_ALT
|
|
#define str_Ureal_big 0
|
|
#define str_Ureal_big 0
|
|
-#define str_Ureal 1
|
|
|
|
-#define str_ust_big 3
|
|
|
|
-#define str_ust 4
|
|
|
|
-#define str_Ustat 2
|
|
|
|
-#define str_Razgon 5
|
|
|
|
-#define str_Pnom 6
|
|
|
|
-#define str_Relay 7
|
|
|
|
|
|
+#define str_Ureal 10
|
|
|
|
+#define str_ust_big 30
|
|
|
|
+#define str_ust 40
|
|
|
|
+#define str_Ustat 20
|
|
|
|
+#define str_Razgon 50
|
|
|
|
+#define str_Pnom 60
|
|
|
|
+#define str_Relay 70
|
|
#else
|
|
#else
|
|
#define str_Ureal 0
|
|
#define str_Ureal 0
|
|
-#define str_Ustat 1
|
|
|
|
-#define str_ust 3
|
|
|
|
-#define str_Pnom 6
|
|
|
|
-#define str_Razgon 4
|
|
|
|
-#define str_Relay 7
|
|
|
|
|
|
+#define str_Ustat 10
|
|
|
|
+#define str_ust 30
|
|
|
|
+#define str_Pnom 60
|
|
|
|
+#define str_Razgon 40
|
|
|
|
+#define str_Relay 70
|
|
#endif
|
|
#endif
|
|
|
|
|
|
if (fl.dspRefresh) { //Обновляем дисплей
|
|
if (fl.dspRefresh) { //Обновляем дисплей
|