Sfoglia il codice sorgente

Fixed row num for WriteString int Stab module.

Vladimir N. Shilov 1 anno fa
parent
commit
6307c6ad43
2 ha cambiato i file con 39 aggiunte e 44 eliminazioni
  1. 39 39
      lib/stab/stab.c
  2. 0 5
      main.c

+ 39 - 39
lib/stab/stab.c

@@ -738,10 +738,10 @@ static void ADC_cb(ADCDriver *adcp) {
     int32_t temp_32 = (TM2_current + PHASE) << Km; // Разность фаз
 
     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 += ( temp_32 - PID_err_old ) >> Kd;
     PID_err_old = temp_32;
@@ -763,10 +763,10 @@ static void ADC_cb(ADCDriver *adcp) {
  */
 static void RefreshMenu (void) {
   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
 
 #else
@@ -778,30 +778,30 @@ static void RefreshMenu (void) {
  #ifdef INTERFACE_ALT
       chsnprintf(buf, 24, "%3u V", U_LINE);
       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
       ST7735_WriteString(X_position(8, 0, 7), 0, "/введите Рном", Font_7x10, ST7735_BLUE, ST7735_BLACK);
       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
-      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;
     }
 
     case 1:  { //Если мы в меню выбора уставки, то...
  #ifdef INTERFACE_ALT
-      ST7735_WriteString(0, 1, "Руст=         Вт", Font_7x10, ST7735_BLUE, ST7735_BLACK);
+      ST7735_WriteString(0, 10, "Руст=         Вт", Font_7x10, ST7735_BLUE, ST7735_BLACK);
 #else
       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
-      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
       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
       break;
@@ -855,15 +855,15 @@ void Stab_Init(void) {
   //ST7735_Init(); // done in main()
   ST7735_FillScreen(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
-  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
-  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
-  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
   EEPROM_read_Pnoms(); // Прочитаем из EEPROM записанные номиналы ТЭНов
 #endif
@@ -954,7 +954,7 @@ void Stab_WorkCycle(void) {
 #ifdef INTERFACE_ALT
           ST7735_WriteString(X_position(3, 0, 11), 0, "****", Font_11x18, ST7735_BLUE, ST7735_BLACK);
 #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
         } else if ((Pnomold != Pnom) || fl.dspRefresh) {
           Pnomold = Pnom;
@@ -962,7 +962,7 @@ void Stab_WorkCycle(void) {
 #ifdef INTERFACE_ALT
           ST7735_WriteString(X_position(6, Pnom, 11), 0, buf, Font_11x18, ST7735_BLUE, ST7735_BLACK);
 #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
         }
         fl.dspRefresh = 0;
@@ -977,13 +977,13 @@ void Stab_WorkCycle(void) {
 #ifdef INTERFACE_ALT
           ST7735_WriteString(X_position(6, p, 11), 0, buf, Font_11x18, ST7735_BLUE, ST7735_BLACK);
 #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
 #ifdef USE_EEPROM
           if (PDMset[1][cnt_PDMcount]) { // Если значение записано в EEPROM
             ST7735_WriteString(X_position(20, 0, 7), 1, "R", Font_7x10, ST7735_BLUE, ST7735_BLACK); // поставим значок
           } 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
         }
@@ -993,20 +993,20 @@ void Stab_WorkCycle(void) {
       default: { // А если не в меню, то...
 #ifdef INTERFACE_ALT
 #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
 #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
 
         if (fl.dspRefresh) {  //Обновляем дисплей

+ 0 - 5
main.c

@@ -91,11 +91,6 @@ int main(void) {
    */
   ST7735_Init();
 
-  ST7735_FillScreen(ST7735_BLACK);
-  ST7735_WriteString(0,  0, "LiberM_7x10, red on black, lorem ipsum dolor sit amet", LiberM_7x10, ST7735_RED, ST7735_BLACK);
-  ST7735_WriteString(0, 32, "Font_7x10, green on black, lorem ipsum dolor sit amet", Font_7x10, ST7735_GREEN, ST7735_BLACK);
-  ST7735_WriteString(0, 82, "Font_7x10, blue on black, lorem ipsum dolor sit amet", Font_7x10, ST7735_BLUE, ST7735_BLACK);
-
   /* 
    * Launch Stab
    */