Procházet zdrojové kódy

Fix cyrillic print.

Vladimir N. Shilov před 1 rokem
rodič
revize
691890ba50
2 změnil soubory, kde provedl 49 přidání a 49 odebrání
  1. 48 48
      lib/stab/stab.c
  2. 1 1
      main.c

+ 48 - 48
lib/stab/stab.c

@@ -763,45 +763,45 @@ static void ADC_cb(ADCDriver *adcp) {
  */
 static void RefreshMenu (void) {
   ST7735_FillScreen(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);
+  ST7735_WriteString(0, 60, "Ст Принять и записать", LiberM_7x10, ST7735_BLUE, ST7735_BLACK);
+  ST7735_WriteString(0, 70, "Рз Принять без записи", LiberM_7x10, ST7735_BLUE, ST7735_BLACK);
+  ST7735_WriteString(X_position(1, 0, 7), 30, "Управление:", LiberM_7x10, ST7735_BLUE, ST7735_BLACK);
+  ST7735_WriteString(0, 40, "P- Выбор", LiberM_7x10, ST7735_BLUE, ST7735_BLACK);
 #ifdef INTERFACE_ALT
 
 #else
-  ST7735_WriteString(0, 0, "Выберите", Font_7x10, ST7735_BLUE, ST7735_BLACK);
+  ST7735_WriteString(0, 0, "Выберите", LiberM_7x10, ST7735_BLUE, ST7735_BLACK);
 #endif
   //
   switch (cnt_dspMenu) { //Проверяем режимы меню
     case 2:  { //Если мы в начальном меню, то...
  #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, 10, "Рном=         Вт", Font_7x10, ST7735_BLUE, ST7735_BLACK);
+      ST7735_WriteString(X_position(16, 0, 7), 0, buf, LiberM_7x10, ST7735_BLUE, ST7735_BLACK);
+      ST7735_WriteString(0, 10, "Рном=         Вт", LiberM_7x10, ST7735_BLUE, ST7735_BLACK);
  #else
-      ST7735_WriteString(X_position(8, 0, 7), 0, "/введите Рном", Font_7x10, ST7735_BLUE, ST7735_BLACK);
+      ST7735_WriteString(X_position(8, 0, 7), 0, "/введите Рном", LiberM_7x10, ST7735_BLUE, ST7735_BLACK);
       chsnprintf(buf, 24, "Рном=      Вт, (%3u V)", U_LINE);
-      ST7735_WriteString(0, 10, buf, Font_7x10, ST7735_BLUE, ST7735_BLACK);
+      ST7735_WriteString(0, 10, buf, LiberM_7x10, ST7735_BLUE, ST7735_BLACK);
  #endif
-      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);
+      ST7735_WriteString(0, 20, "==Мощность нагрузки==", LiberM_7x10, ST7735_BLUE, ST7735_BLACK);
+      ST7735_WriteString(X_position(8, 0, 7), 40, "/уменьшение", LiberM_7x10, ST7735_BLUE, ST7735_BLACK);
+      ST7735_WriteString(0, 50, "P+ Увеличение", LiberM_7x10, ST7735_BLUE, ST7735_BLACK);
       break;
     }
 
     case 1:  { //Если мы в меню выбора уставки, то...
  #ifdef INTERFACE_ALT
-      ST7735_WriteString(0, 10, "Руст=         Вт", Font_7x10, ST7735_BLUE, ST7735_BLACK);
+      ST7735_WriteString(0, 10, "Руст=         Вт", LiberM_7x10, ST7735_BLUE, ST7735_BLACK);
 #else
-      ST7735_WriteString(X_position(9, 0, 7), 0, "уставку", Font_7x10, ST7735_BLUE, ST7735_BLACK);
-      ST7735_WriteString(0, 10, "Руст=      Вт", Font_7x10, ST7735_BLUE, ST7735_BLACK);
+      ST7735_WriteString(X_position(9, 0, 7), 0, "уставку", LiberM_7x10, ST7735_BLUE, ST7735_BLACK);
+      ST7735_WriteString(0, 10, "Руст=      Вт", LiberM_7x10, ST7735_BLUE, ST7735_BLACK);
 #endif
-      ST7735_WriteString(0, 20, "=======Уставка=======", Font_7x10, ST7735_BLUE, ST7735_BLACK);
-      ST7735_WriteString(0, 50, "P+ Выбор", Font_7x10, ST7735_BLUE, ST7735_BLACK);
+      ST7735_WriteString(0, 20, "=======Уставка=======", LiberM_7x10, ST7735_BLUE, ST7735_BLACK);
+      ST7735_WriteString(0, 50, "P+ Выбор", LiberM_7x10, ST7735_BLUE, ST7735_BLACK);
 #ifdef USE_EEPROM
       if (!fl.writable) {  // Если уставки не пишутся в EEPROM, то...
-        ST7735_WriteString(0, 60, "Ст Принять без записи", Font_7x10, ST7735_BLUE, ST7735_BLACK);
+        ST7735_WriteString(0, 60, "Ст Принять без записи", LiberM_7x10, ST7735_BLUE, ST7735_BLACK);
       }
 #endif
       break;
@@ -817,7 +817,7 @@ static void RefreshMenu (void) {
  * @param str - номер строки, куда печатать минуса
  */
 static void menu_print_minus(const uint8_t str) {
-  ST7735_WriteString(0, str, "----------------------", Font_7x10, ST7735_RED, ST7735_BLACK);
+  ST7735_WriteString(0, str, "----------------------", LiberM_7x10, ST7735_RED, ST7735_BLACK);
 }
 
 /**
@@ -854,20 +854,20 @@ 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), 10, "ТЭНа", Font_7x10, ST7735_BLUE, ST7735_BLACK);
+  ST7735_WriteString(X_centred(21), 5, "Стабилизатор мощности", LiberM_7x10, ST7735_YELLOW, ST7735_BLACK);
+  ST7735_WriteString(X_centred(4), 15, "ТЭНа", LiberM_7x10, ST7735_YELLOW, ST7735_BLACK);
 #ifdef INTERFACE_ALT
-  ST7735_WriteString(X_centred(16), 20, "STAB-AVR", Font_11x18, ST7735_BLUE, ST7735_BLACK);
+  ST7735_WriteString(X_centred(12), 50, "STAB-AVR", Font_11x18, ST7735_BLUE, ST7735_BLACK);
 #else
-  ST7735_WriteString(X_centred(8), 20, "STAB-AVR", Font_7x10, ST7735_BLUE, ST7735_BLACK);
+  ST7735_WriteString(X_centred(8), 50, "STAB-AVR", LiberM_7x10, ST7735_BLUE, ST7735_BLACK);
 #endif
-  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);
+  ST7735_WriteString(X_centred(VERSION_LEN), 70, VERSION, LiberM_7x10, ST7735_RED, ST7735_BLACK);
+  ST7735_WriteString(X_centred(10), 100, "JohnJohnov", LiberM_7x10, ST7735_SILVER, ST7735_BLACK);
+  ST7735_WriteString(X_centred(17), 110, "alcodistillers.ru", LiberM_7x10, ST7735_SILVER, ST7735_BLACK);
 #ifdef USE_EEPROM
   EEPROM_read_Pnoms(); // Прочитаем из EEPROM записанные номиналы ТЭНов
 #endif
-  pp_Delay(800);       // Подождем 600 полупериодов, пережидаем переходные процессы и любуемся заставкой
+  pp_Delay(400); // Подождем x полупериодов, пережидаем переходные процессы и любуемся заставкой
 
   fl.dspRefresh = 1;
 
@@ -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), 10, "****", Font_7x10, ST7735_BLUE, ST7735_BLACK);
+          ST7735_WriteString(X_position(6, 0, 7), 10, "****", LiberM_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), 10, buf, Font_7x10, ST7735_BLUE, ST7735_BLACK);
+          ST7735_WriteString(X_position(9, Pnom, 7), 10, buf, LiberM_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), 10, buf, Font_7x10, ST7735_BLUE, ST7735_BLACK);
+          ST7735_WriteString(X_position(9, p, 7), 10, buf, LiberM_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); // поставим значок
+            ST7735_WriteString(X_position(20, 0, 7), 1, "R", LiberM_7x10, ST7735_BLUE, ST7735_BLACK); // поставим значок
           } else {
-            ST7735_WriteString(X_position(20, 0, 7), 10, " ", Font_7x10, ST7735_BLUE, ST7735_BLACK); // а если не записано - уберем
+            ST7735_WriteString(X_position(20, 0, 7), 10, " ", LiberM_7x10, ST7735_BLUE, ST7735_BLACK); // а если не записано - уберем
           }
 #endif
         }
@@ -1012,14 +1012,14 @@ void Stab_WorkCycle(void) {
         if (fl.dspRefresh) {  //Обновляем дисплей
           ST7735_FillScreen(ST7735_BLACK);
 #ifdef INTERFACE_ALT
-          ST7735_WriteString(X_position(8, 0, 7), str_ust, "Вт       ,  %", Font_7x10, ST7735_BLUE, ST7735_BLACK);
+          ST7735_WriteString(X_position(8, 0, 7), str_ust, "Вт       ,  %", LiberM_7x10, ST7735_BLUE, ST7735_BLACK);
 #else
-          ST7735_WriteString(0, str_ust, "Руст      Вт;    ,  %", Font_7x10, ST7735_BLUE, ST7735_BLACK);
+          ST7735_WriteString(0, str_ust, "Руст      Вт;    ,  %", LiberM_7x10, ST7735_BLUE, ST7735_BLACK);
 #endif
-          ST7735_WriteString(0, str_Ureal, "Напр.сети        ,  В", Font_7x10, ST7735_BLUE, ST7735_BLACK);
+          ST7735_WriteString(0, str_Ureal, "Напр.сети        ,  В", LiberM_7x10, ST7735_BLUE, ST7735_BLACK);
           chsnprintf(buf, 24, "Ном. мощность %u Вт", Pnom);
-          ST7735_WriteString(0, str_Pnom, buf, Font_7x10, ST7735_BLUE, ST7735_BLACK);
-          //ST7735_WriteString(X_position(0, 0, 7), str_Relay, "Реле ", Font_7x10, ST7735_BLUE, ST7735_BLACK);
+          ST7735_WriteString(0, str_Pnom, buf, LiberM_7x10, ST7735_BLUE, ST7735_BLACK);
+          //ST7735_WriteString(X_position(0, 0, 7), str_Relay, "Реле ", LiberM_7x10, ST7735_BLUE, ST7735_BLACK);
         }
 
         static uint16_t U_real_old = 0;
@@ -1029,7 +1029,7 @@ void Stab_WorkCycle(void) {
 #ifdef INTERFACE_ALT
           ST7735_WriteString(X_position(7, U_real_old, 11) + 5, str_Ureal_big, buf, Font_11x18, ST7735_BLUE, ST7735_BLACK);
 #else
-          ST7735_WriteString(X_position(16, U_real_old, 7), str_Ureal, buf, Font_7x10, ST7735_BLUE, ST7735_BLACK);
+          ST7735_WriteString(X_position(16, U_real_old, 7), str_Ureal, buf, LiberM_7x10, ST7735_BLUE, ST7735_BLACK);
 #endif
         }
         static uint8_t U_real_dec_old = 0;
@@ -1050,7 +1050,7 @@ void Stab_WorkCycle(void) {
 #ifdef INTERFACE_ALT
           ST7735_WriteString(X_position(3,Pust_old,11), str_ust_big, buf, Font_11x18, ST7735_BLUE, ST7735_BLACK);
 #else
-          ST7735_WriteString(X_position(8,Pust_old,7), str_ust, buf, Font_7x10, ST7735_BLUE, ST7735_BLACK);
+          ST7735_WriteString(X_position(8,Pust_old,7), str_ust, buf, LiberM_7x10, ST7735_BLUE, ST7735_BLACK);
 #endif
         }
 
@@ -1065,14 +1065,14 @@ void Stab_WorkCycle(void) {
 #ifdef INTERFACE_ALT
           ST7735_WriteString(X_position(7,100,11) + 5, str_ust_big, buf, Font_11x18, ST7735_BLUE, ST7735_BLACK);
 #else
-          ST7735_WriteString(X_position(13, 0, 7), str_ust, buf, Font_7x10, ST7735_BLUE, ST7735_BLACK);
+          ST7735_WriteString(X_position(13, 0, 7), str_ust, buf, LiberM_7x10, ST7735_BLUE, ST7735_BLACK);
 #endif
         }
 
         if (fl.Udown || fl.NotZero) {
-          ST7735_WriteString(0, str_Ustat, "-----Авария сети-----", Font_7x10, ST7735_BLUE, ST7735_BLACK);
+          ST7735_WriteString(0, str_Ustat, "-----Авария сети-----", LiberM_7x10, ST7735_BLUE, ST7735_BLACK);
         } else if (fl.Ulow) {
-          ST7735_WriteString(0, str_Ustat, "--Недост.напр. сети--", Font_7x10, ST7735_BLUE, ST7735_BLACK);
+          ST7735_WriteString(0, str_Ustat, "--Недост.напр. сети--", LiberM_7x10, ST7735_BLUE, ST7735_BLACK);
         } else {
           menu_print_minus(str_Ustat);
         }
@@ -1081,9 +1081,9 @@ void Stab_WorkCycle(void) {
           static uint8_t count_1 = 0;
           uint8_t x1 = 5 - count_1;
           uint8_t x2 = 20 - x1;
-          ST7735_WriteString(0, str_Razgon, "------<Разгон!>------", Font_7x10, ST7735_BLUE, ST7735_BLACK);
-          ST7735_WriteString(X_position(x1, 0, 7), str_Razgon, "<", Font_7x10, ST7735_BLUE, ST7735_BLACK);
-          ST7735_WriteString(X_position(x2, 0, 7), str_Razgon, ">", Font_7x10, ST7735_BLUE, ST7735_BLACK);
+          ST7735_WriteString(0, str_Razgon, "------<Разгон!>------", LiberM_7x10, ST7735_BLUE, ST7735_BLACK);
+          ST7735_WriteString(X_position(x1, 0, 7), str_Razgon, "<", LiberM_7x10, ST7735_BLUE, ST7735_BLACK);
+          ST7735_WriteString(X_position(x2, 0, 7), str_Razgon, ">", LiberM_7x10, ST7735_BLUE, ST7735_BLACK);
           if (++count_1 > 5) count_1 = 0;
         } else {
           menu_print_minus(str_Razgon);
@@ -1092,7 +1092,7 @@ void Stab_WorkCycle(void) {
         {
           static uint8_t trigger = 1;
           if (trigger && fl.stab_off) {
-            ST7735_WriteString(0, str_Relay, "!!АВАРИЙНЫЙ ОСТАНОВ!!", Font_7x10, ST7735_BLUE, ST7735_BLACK);
+            ST7735_WriteString(0, str_Relay, "!!АВАРИЙНЫЙ ОСТАНОВ!!", LiberM_7x10, ST7735_BLUE, ST7735_BLACK);
             trigger = 0;
           } else {
             menu_print_minus(str_Relay);
@@ -1101,9 +1101,9 @@ void Stab_WorkCycle(void) {
         }
 
         //if (fl.TRelay) {
-        //  ST7735_WriteString(X_position(5, 0, 7), str_Relay, "включено", Font_7x10, ST7735_BLUE, ST7735_BLACK);
+        //  ST7735_WriteString(X_position(5, 0, 7), str_Relay, "включено", LiberM_7x10, ST7735_BLUE, ST7735_BLACK);
         //} else {
-        //  ST7735_WriteString(X_position(5, 0, 7), str_Relay, "        ", Font_7x10, ST7735_BLUE, ST7735_BLACK);
+        //  ST7735_WriteString(X_position(5, 0, 7), str_Relay, "        ", LiberM_7x10, ST7735_BLUE, ST7735_BLACK);
         //}
         fl.dspRefresh = 0;
       }

+ 1 - 1
main.c

@@ -90,7 +90,7 @@ int main(void) {
    * LCD
    */
   ST7735_Init();
-
+  
   /* 
    * Launch Stab
    */