FLProg + Nextion HMI Enhanced



ITEAD lance une nouvelle gamme améliorée de ses panneaux IHM Nextion Des représentants de la société m'ont fourni une copie de cette ligne pour intégrer de nouvelles fonctionnalités de panneau dans le programme FLProg. Dans la version 2.2, cela a été implémenté. Dans cette leçon, nous allons examiner les nouvelles fonctionnalités du panneau et, par exemple, créer une minuterie programmable pour cinq canaux.

Pour commencer, considérez les caractéristiques du panneau. La ligne améliorée a une horloge en temps réel intégrée, 1024 octets de mémoire non volatile, 8 entrées / sorties numériques. Chacun d'eux peut être configuré en entrée ou en sortie. Quatre d'entre eux (du 4e au 7e) peuvent être configurés comme sorties PWM.



En plus de la gamme Nextion HMI Enhanced elle-même, la carte d'extension a également été lancée,



avec des commandes et des écrans connectés au panneau GPIO.



De telles opportunités permettent de fabriquer un appareil presque complet basé sur ce panneau. Dans cette leçon, je vais me concentrer sur la programmation du panneau lui-même, car il y a peu d'informations à ce sujet, mais il y a beaucoup d'écueils. Un lien vers le projet du programme Nextion Editor se trouve à la fin de l'article.

Le début du travail avec l'éditeur Nextion, son lancement, le choix initial de l'encodage, le type de panneau ont été discutés dans mes précédents posts tyts , tyts et tyts . Par conséquent, nous ne nous attarderons pas là-dessus.
Le programme se compose de trois panneaux écran d'accueil ( principal ), Réglage de la minuterie ( le SetTimer ) et réglage de l' heure ( de setCurrentTime ).

Commençons par l'écran principal.



Cet écran affiche les paramètres d'activation, de désactivation, l'état de chaque canal, le bouton pour modifier l'état des canaux et le bouton pour passer à l'écran des paramètres d'heure actuels. Lorsque vous cliquez sur le texte qui affiche les paramètres de la chaîne, vous accédez au paramètre de cette chaîne. De plus, sur cet écran, quatre boutons cachés sont nécessaires pour se lier aux boutons physiques situés sur la carte d'extension. .



Considérez le code contenu sur l'écran principal.

Événement Preinitialilize l'événement (l'écran est appelée avant l'initialisation).

cfgpio 0,1,b0 //  Esc (IO0)     b0 " "
cfgpio 2,1,b8 //  Right (IO2)     b8 -"  "
cfgpio 3,1,b7 //  Down (IO3)     b7 -"   "
cfgpio 4,1,b6 //  Up (IO4)     b6 -"   "
cfgpio 5,1,b9 //  Left (IO5)     b9 -"  "
SelTim.val=1 //   

Ici, nous lions les boutons physiques situés sur la carte d'extension aux boutons virtuels à l'écran.

En savoir plus sur la commande cfgpio - configuration des entrées et sorties physiques du panneau (seuls les panneaux améliorés ont cette commande).
:
cfgpio id,state,cmp
:
id: / (0-7)
state: (0-4)
cmp: ( 1, — 0).
. cfgpio .

:
0+ 5 ( 50 ). pio0 – pio7 ( 0- 7 /cfgpio 0,0,0
/ GPIO0 , +5. :
n0.val = pio0
1+ 5 ( 50 ) . pio0 – pio7 ( 0- 7 / ). . 1 , . 0 . Preinitialilize Event , , .cfgpio 2,1,b0
/ GPIO2 , +5 b0.
, b0 , – .
2. pio0 – pio7 ( 0- 7 / ).cfgpio 1,2,0
/ GPIO1 . :
pio1=1
3. 4-7 /. 0 100. – 50. pwm4- pwm7 ( 4- 7 / ). pwmf . 1 65536. – 1000.cfgpio 4,3,0
/ GPIO4 .
:
pwm4=20
– 2000 .
pwmf=2000
4. pio0 – pio7 ( 0- 7 / ).cfgpio 5,4,0
/ GPIO5 . :
pio5=1


Événement tactile Appuyez sur l' événement touche b0 - «Régler l' heure»

page 2 //      

Il est tout explicite

événement tactile Appuyez sur l' événement boutons b1 - «état de commutation du premier canal »

repo TempB.val,0 //   EEPROM   TempB   1
if(TempB.val==1) //    -   
{
  if(tsr1.val==1)//   
  {
    tsr1.val=2 //  
  }else
  {
    tsr1.val=1 //  - 
  }
}

Nous lisons d'abord l'activité du canal depuis l'EEPROM. Chaque canal peut être désactivé du travail sur la page des paramètres de canal. La commande repo «lecture de l'EEPROM» sera discutée plus en détail ci-dessous. Ensuite, si le canal est actif, changez son état. L'état actuel des canaux est stocké dans les variables tsr1 - tsr5 pour chacun des canaux, respectivement.

Fonctionnalités dans la syntaxe de l'expression if else
if(TempB.val==1) – .
. .
}else
, . , else , .

Pour les autres boutons permettant de changer l'état du canal ( b2 - b5 ), le code d' événement Touch Press est le même. Seules l'adresse dans l'EEPROM et la variable d'état du canal sont modifiées.

Événement tactile Appuyez sur l' événement touche b6 - «Sélectionner le canal précédent « . Le bouton est invisible. Mode de rendu ( sta ) - recadrer l'image (image recadrée). En tant qu'image à l' état non pressé ( picc ) et à l'état pressé ( picc2 ), l'image d'arrière-plan de la fenêtre est sélectionnée. Pour cette raison, le bouton ne s'affiche pas, mais cela fonctionne. Ce bouton sur cet écran est lié aux boutons physiques Up (IO4) sur conseil d'extension de discussion .

if(SelTim.val<2)//   1
{
  SelTim.val=5 //   5
}else
{
  SelTim.val=SelTim.val-1 //     
}

La variable SelTim contient le numéro du temporisateur actuellement sélectionné. Je pense que tout le reste ressort clairement des commentaires. Événement tactile Appuyez sur l' événement touche b7 - «pour sélectionner le canal suivant « . Le bouton est invisible. Ce bouton sur cet écran est lié aux boutons physiques vers le bas (IO3) sur conseil d'extension de discussion .



if(SelTim.val>4) //    5
{
  SelTim.val=1 //    1
}else
{
  SelTim.val=SelTim.val+1 //    
}

Ici, je pense que la même chose est claire.

Événement tactile Appuyez sur l' événement touche B8 - «Modifier le canal sélectionné « . Le bouton est invisible. Ce bouton sur cet écran est lié au bouton physique droit (IO2) sur la carte d'extension .

if(SelTim.val==1) //    1
{
  click TimerText1,1 //         1
}
if(SelTim.val==2) //    2
{
  click TimerText2,1 //         2
}
if(SelTim.val==3) //    3
{
  click TimerText3,1 //         3
}
if(SelTim.val==4) //    4
{
  click TimerText4,1 //         4
}
if(SelTim.val==5) //    5
{
  click TimerText5,1 //         1
}

Cliquez sur les détails de la commande - simulez le clic ou la libération d'un élément
:
click cmpID,event
:
cmpID: ID .
event: 0 – ; 1 –
. click .

Événement tactile Appuyez sur l' événement touche B9 - «état de commutation du canal sélectionné « . Le bouton est invisible. Ce bouton sur cet écran est lié au bouton physique gauche (IO5) sur la carte d' extension .

if(SelTim.val==1) //    1
{
  click b1,1 //     b1
}
if(SelTim.val==2) //    2
{
  click b2,1 //     b2
}
if(SelTim.val==3) //    3
{
  click b3,1 //     b3
}
if(SelTim.val==4) //    4
{
  click b4,1 //     b4
}
if(SelTim.val==5) //    5
{
  click b5,1 //     b5
}

L' événement Touch Press de la zone de texte TimerText1 est «Display Channel 1 Status».

sys0=1 //     sys0   
sys1=1 //     sys1       
page 1 //      (SetTimer - ID = 1).

Pour les autres champs de texte ( TimerText2 - TimerText5 ), le code d' événement Touch Press est le même. Ce n'est que dans la variable système sys0 que le numéro de canal correspondant est entré.

sys0, sys1, sys2 sont des variables numériques globales qui n'ont pas besoin d'être créées ou définies. Ils peuvent être utilisés sur n'importe quel écran. La valeur par défaut de ces trois variables est 0, elles peuvent être lues et écrites, leur plage de valeurs est 0 ~ 4294967295. Recommandé pour passer des valeurs entre les pages.

La minuterie tm0 est réglée sur cet écran . Cette minuterie se déclenche toutes les 200 millisecondes (paramètre tim), lorsque la page est active. Le code permettant de surveiller l'état des temporisateurs et de redessiner les composants sur la page se trouve dans l' événement de temporisation de cette temporisation.

Code sous spoler
//     CurrentTime1
//----  ----
temp.val=rtc2 //        rtc2 - "    "
tempText.txt="" //     tempText   
if(temp.val<10)//    10
{
 tempText.txt="0" //      tempText   "0"
}
cov temp.val,TT1.txt,0 //    ()       TT1
CurrentTime1.txt=tempText.txt+TT1.txt //    tempText  TT1     CurrentTime1
//----  ----
temp.val=rtc1 //        rtc1 - "    "
tempText.txt="" //     tempText   
if(temp.val<10) //    10
{
 tempText.txt="0" //      tempText   "0"
}
cov temp.val,TT1.txt,0 //    ()       TT1
CurrentTime1.txt=CurrentTime1.txt+"-"+tempText.txt+TT1.txt //      CurrentTime1    "-"     tempText  TT1
//----  ----
temp.val=rtc0 //        rtc0 - "    "
cov temp.val,TT1.txt,0 //    ()       TT1
CurrentTime1.txt=CurrentTime1.txt+"-"+TT1.txt //      CurrentTime1    "-"     TT1
//----  ----
temp.val=rtc3 //        rtc3 - "    "
tempText.txt="" //     tempText   
if(temp.val<10) //    10
{
 tempText.txt="0" //      tempText   "0"
}
cov temp.val,TT1.txt,0 //    ()       TT1
CurrentTime1.txt=CurrentTime1.txt+" "+tempText.txt+TT1.txt //      CurrentTime1      " "     tempText  TT1
//----  ----
temp.val=rtc4 //        rtc4 - "    "
tempText.txt="" //     tempText   
if(temp.val<10) //    10
{
 tempText.txt="0"//      tempText   "0"
}
cov temp.val,TT1.txt,0 //    ()       TT1
CurrentTime1.txt=CurrentTime1.txt+":"+tempText.txt+TT1.txt //      CurrentTime1    ":"     tempText  TT1
//----  ----
temp.val=rtc5 //        rtc5 - "    "
tempText.txt="" //     tempText   
if(temp.val<10) //    10
{
 tempText.txt="0" //      tempText   "0"
}
cov temp.val,TT1.txt,0 //    ()       TT1
CurrentTime1.txt=CurrentTime1.txt+":"+tempText.txt+TT1.txt //      CurrentTime1    ":"     tempText  TT1
//       / 
for(i.val=0;i.val<5;i.val++)// .   i     (  )
{
  temp.val=i.val*52 //     EEPROM   
 // ----  ----
  temp2.val=temp.val+4 //    EEPROM    
 Var0txt.txt=""//    Var0txt   
  repo temp1.val,temp2.val //   EEPROM   temp1.val    
  if(temp1.val==10000) //      ( 10000)
  {
    ts1.val=1 //       
  tempText.txt="X" //    tempText     "X"
  }else // 
  {
    if(temp1.val==rtc2) //      
    {
      ts1.val=1 //      ts1
    }else // 
    {
      ts1.val=2 //       ts1
    }
    cov temp1.val,tempText.txt,0 //      ( )    tempText
    if(temp1.val<10)//E       10
    {
    Var0txt.txt="0" //    Var0txt   "0"
    }
  }
  TT1.txt=Var0txt.txt+tempText.txt+"-"//   TT1    Var0txt, tempText    "-"
 // ----  ----
  temp2.val=temp.val+8 //    EEPROM    
 Var0txt.txt="" //    Var0txt   
  repo temp1.val,temp2.val //   EEPROM   temp1.val    
  if(temp1.val==10000)//      ( 10000)
  {
    ts2.val=1 //       
  tempText.txt="X"//    tempText     "X"
  }else // 
  {
    if(temp1.val==rtc1)//     
    {
      ts2.val=1 //      ts2
    }else // 
    {
      ts2.val=2 //       ts2
    }
    cov temp1.val,tempText.txt,0 //      ( )    tempText
    if(temp1.val<10) // E       10
    {
    Var0txt.txt="0" //    Var0txt   "0"
    }
  }
  TT1.txt=TT1.txt+Var0txt.txt+tempText.txt+"-" //     TT1    Var0txt, tempText    "-"
 // ----  ----
  temp2.val=temp.val+12 //    EEPROM    
  repo temp1.val,temp2.val//   EEPROM   temp1.val    
  if(temp1.val==10000) //      ( 10000)
  {
    ts3.val=1 //       
  tempText.txt="X"//    tempText     "X"
  }else // 
  {
    if(temp1.val==rtc0) //      
    {
      ts3.val=1 //      ts3
    }else // 
    {
      ts3.val=0 //       ts3
    }
    cov temp1.val,tempText.txt,0 //      ( )    tempText
  }
  TT1.txt=TT1.txt+tempText.txt+" " //     TT1    tempText      " "
 // ----  ----
  temp2.val=temp.val+16 //    EEPROM    
 Var0txt.txt="" //    Var0txt   
  repo temp1.val,temp2.val //   EEPROM   temp1.val    
  if(temp1.val==10000)//      ( 10000)
  {
    ts4.val=1 //       
  tempText.txt="X" //    tempText     "X"
  }else // 
  {
    if(temp1.val==rtc3) //      
    {
      ts4.val=1 //      ts4
    }else // 
    {
      ts4.val=0 //       ts4
    }
    cov temp1.val,tempText.txt,0 //      ( )    tempText
    if(temp1.val<10) // E       10
    {
    Var0txt.txt="0" //    Var0txt   "0"
    }
  }
  TT1.txt=TT1.txt+Var0txt.txt+tempText.txt+":" //     TT1    Var0txt, tempText    ":"
 // ----  ----
  temp2.val=temp.val+20 //    EEPROM    
 Var0txt.txt="" //    Var0txt   
  repo temp1.val,temp2.val //   EEPROM   temp1.val    
  if(temp1.val==10000)//      ( 10000)
  {
    ts5.val=1 //       
  tempText.txt="X" //    tempText     "X"
  }else // 
  {
    if(temp1.val==rtc4) //      
    {
      ts5.val=1//     ts5
    }else // 
    {
      ts5.val=0 //       ts5
    }
    cov temp1.val,tempText.txt,0 //      ( )    tempText
    if(temp1.val<10) // E       10
    {
    Var0txt.txt="0"//   Var0txt   "0"
    }
  }
  TT1.txt=TT1.txt+Var0txt.txt+tempText.txt+":"//    TT1    Var0txt, tempText    ":"
 // ----  ----
  temp2.val=temp.val+24 //    EEPROM    
 Var0txt.txt="" //    Var0txt   
  repo temp1.val,temp2.val //   EEPROM   temp1.val    
  if(temp1.val==10000) //      ( 10000)
  {
    ts6.val=1 //       
  tempText.txt="X" //    tempText     "X"
  }else // 
  {
    if(temp1.val==rtc5) //      
    {
      ts6.val=1 //      ts6
    }else // 
    {
      ts6.val=0 //       ts6
    }
    cov temp1.val,tempText.txt,0 //      ( )    tempText
    if(temp1.val<10) // E       10
    {
    Var0txt.txt="0" //    Var0txt   "0"
    }
  }
  TT1.txt=TT1.txt+Var0txt.txt+tempText.txt+" / " //     TT1    Var0txt, tempText       "/"
 // ----  ----
  temp2.val=temp.val+28 //    EEPROM    
 Var0txt.txt="" //    Var0txt   
  repo temp1.val,temp2.val //   EEPROM   temp1.val    
  if(temp1.val==10000) //      ( 10000)
  {
    ts7.val=1 //       
  tempText.txt="X" //    tempText     "X"
  }else // 
  {
    if(temp1.val==rtc2) //      
    {
      ts7.val=1 //      ts7
    }else // 
    {
      ts7.val=0 //       ts7
    }
    cov temp1.val,tempText.txt,0 //      ( )    tempText
    if(temp1.val<10)//E       10
    {
    Var0txt.txt="0"//   Var0txt   "0"
    }
  }
  TT1.txt=TT1.txt+Var0txt.txt+tempText.txt+"-" //     TT1    Var0txt, tempText    "-"
 // ----  ----
  temp2.val=temp.val+32 //    EEPROM    
 Var0txt.txt="" //    Var0txt   
  repo temp1.val,temp2.val//   EEPROM   temp1.val    
  if(temp1.val==10000)//      ( 10000)
  {
    ts8.val=1//      
  tempText.txt="X" //    tempText     "X"
  }else // 
  {
    if(temp1.val==rtc1) //      
    {
      ts8.val=1 //      ts8
    }else // 
    {
      ts8.val=0 //       ts8
    }
    cov temp1.val,tempText.txt,0 //      ( )    tempText
    if(temp1.val<10) // E       10
    {
    Var0txt.txt="0"//   Var0txt   "0"
    }
  }
  TT1.txt=TT1.txt+Var0txt.txt+tempText.txt+"-"//    TT1    Var0txt, tempText    "-"
 // ----  ----
  temp2.val=temp.val+36 //    EEPROM    
  repo temp1.val,temp2.val //   EEPROM   temp1.val    
  if(temp1.val==10000)//      ( 10000)
  {
    ts9.val=1 //       
  tempText.txt="X" //    tempText     "X"
  }else // 
  {
    if(temp1.val==rtc0) //      
    {
      ts9.val=1 //      ts9
    }else // 
    {
      ts9.val=0 //       ts9
    }
    cov temp1.val,tempText.txt,0 //      ( )    tempText
  }
  TT1.txt=TT1.txt+Var0txt.txt+tempText.txt+" " //     TT1    tempText      " "
 // ----  ----
  temp2.val=temp.val+40 //    EEPROM    
 Var0txt.txt="" //    Var0txt   
  repo temp1.val,temp2.val //   EEPROM   temp1.val    
  if(temp1.val==10000) //      ( 10000)
  {
    ts10.val=1//      
  tempText.txt="X" //    tempText     "X"
  }else // 
  {
    if(temp1.val==rtc3) //      
    {
      ts10.val=1 //      ts10
    }else // 
    {
      ts10.val=0 //       ts10
    }
    cov temp1.val,tempText.txt,0 //      ( )    tempText
    if(temp1.val<10) // E       10
    {
    Var0txt.txt="0" //    Var0txt   "0"
    }
  }
  TT1.txt=TT1.txt+Var0txt.txt+tempText.txt+":"//    TT1    Var0txt, tempText    ":"
 // ----  ----
  temp2.val=temp.val+44 //    EEPROM    
 Var0txt.txt="" //    Var0txt   
  repo temp1.val,temp2.val //   EEPROM   temp1.val    
  if(temp1.val==10000) //      ( 10000)
  {
    ts11.val=1 //       
  tempText.txt="X" //    tempText     "X"
  }else // 
  {
    if(temp1.val==rtc4) //      
    {
      ts11.val=1 //      ts11
    }else // 
    {
      ts11.val=0 //       ts11
    }
    cov temp1.val,tempText.txt,0 //      ( )    tempText
    if(temp1.val<10) // E       10
    {
    Var0txt.txt="0"//   Var0txt   "0"
    }
  }
  TT1.txt=TT1.txt+Var0txt.txt+tempText.txt+":" //     TT1    Var0txt, tempText    ":"
 // ----  ----
  temp2.val=temp.val+48 //    EEPROM    
 Var0txt.txt="" //    Var0txt   
  repo temp1.val,temp2.val //   EEPROM   temp1.val    
  if(temp1.val==10000) //      ( 10000)
  {
    ts12.val=1 //       
  tempText.txt="X" //    tempText     "X"
  }else // 
  {
    if(temp1.val==rtc5) //      
    {
      ts12.val=1 //      ts12
    }else // 
    {
      ts12.val=0 //       ts12
    }
    cov temp1.val,tempText.txt,0 //      ( )    tempText
    if(temp1.val<10) // E       10
    {
    Var0txt.txt="0" //    Var0txt   "0"
    }
  }
  TT1.txt=TT1.txt+Var0txt.txt+tempText.txt //     TT1    Var0txt, tempText
 // ----  ----
  repo temp1.val,temp.val //   EEPROM   temp1.val   
  tsrOn.val=0 //   tsrOn (  )  0 ( )
  if(temp1.val==1)//   
  {
    if(ts1.val==1)//     
    {
      if(ts2.val==1)//     
      {
        if(ts3.val==1)//     
        {
          if(ts4.val==1)//     
          {
            if(ts5.val==1)//     
            {
              if(ts6.val==1)//     
              {
                tsrOn.val=1//  tsrOn (  )  1 ( )
              }
            }
          }
        }
      }
    }
  }
 // ----  ----
  tsrOf.val=0 //   tsrOf (  )  0 ( )
  if(temp1.val==1)//   
  {
    if(ts7.val==1)//     
    {
      if(ts8.val==1)//     
      {
        if(ts9.val==1)//     
        {
          if(ts10.val==1)//     
          {
            if(ts11.val==1)//     
            {
              if(ts12.val==1)//     
              {
                tsrOf.val=1//  tsrOf (  )  1 (  )
              }
            }
          }
        }
      }
    }
  }else//
  {
    tsrOf.val=1//  tsrOf (  )  1 (  )
  }
 // ----    1----
  if(i.val==0)//    1
  {
    if(tsr1.val==1)//    -  (  1 -  tsr1)
    {
      if(tsrOf.val==1)//     
      {
        tsr1.val=2 //      
      }
    }else //  (    )
    {
      if(tsrOn.val==1) //     
      {
        tsr1.val=1 //       
      }
    }
    if(tsr1.val==1)//    -  (  1 -  tsr1)
    {
      TimerText1.pco=63488//   TimerText1    -  
    }else // 
    {
      if(temp1.val==1) //   
      {
        TimerText1.pco=65504 //   TimerText1    - 
      }else // (   )
      {
        TimerText1.pco=50712 //   TimerText1    - 
      }
    }
    TimerText1.txt=TT1.txt //    TimerText1        TT1
  }
  // ----    2----
  if(i.val==1) //    2
  {
    if(tsr2.val==1)//    -  (  2 -  tsr2)
    {
      if(tsrOf.val==1)//     
      {
        tsr2.val=2 //      
      }
    }else //  (    )
    {
      if(tsrOn.val==1)//     
      {
        tsr2.val=1 //       
      }
    }
    if(tsr2.val==1)//    -  (  2 -  tsr2)
    {
     TimerText2.pco=63488//   TimerText2    -  
    }else // 
    {
      if(temp1.val==1) //   
      {
       TimerText2.pco=65504 //   TimerText2    - 
      }else // (   )
      {
       TimerText2.pco=50712 //   TimerText2    - 
      }
    }
   TimerText2.txt=TT1.txt //    TimerText2        TT1
  }
 // ----    3----
  if(i.val==2) //    3
  {
    if(tsr3.val==1)//    -  (  3 -  tsr3)
    {
      if(tsrOf.val==1)//     
      {
        tsr3.val=2 //      
      }
    }else //  (    )
    {
      if(tsrOn.val==1)//     
      {
        tsr3.val=1 //       
      }
    }
    if(tsr3.val==1)//    -  (  3 -  tsr3)
    {
      TimerText3.pco=63488 //   TimerText3    -  
    }else // 
    {
      if(temp1.val==1) //   
      {
        TimerText3.pco=65504 //   TimerText3    - 
      }else // (   )
      {
        TimerText3.pco=50712//   TimerText3    - 
      }
    }
    TimerText3.txt=TT1.txt //    TimerText3        TT1
  }
 // ----    4----
  if(i.val==3) //    4
  {
    if(tsr4.val==1)//    -  (  4 -  tsr4)
    {
      if(tsrOf.val==1)//     
      {
        tsr4.val=2//     
      }
    }else //  (    )
    {
      if(tsrOn.val==1)//     
      {
        tsr4.val=1//      
      }
    }
    if(tsr4.val==1)//    -  (  4 -  tsr4)
    {
     TimerText4.pco=63488 //   TimerText4    -  
    }else//
    {
      if(temp1.val==1)//   
      {
       TimerText4.pco=65504 //   TimerText4    - 
      }else // (   )
      {
       TimerText4.pco=50712//   TimerText4    - 
      }
    }
   TimerText4.txt=TT1.txt //    TimerText4        TT1
  }
 // ----    5----
  if(i.val==4) //    5
  {
    if(tsr5.val==1)//    -  (  5 -  tsr5)
    {
      if(tsrOf.val==1)//     
      {
        tsr5.val=2//     
      }
    }else //  (    )
    {
      if(tsrOn.val==1)//     
      {
        tsr5.val=1 //       
      }
    }
    if(tsr5.val==1)//    -  (  5 -  tsr5)
    {
     TimerText5.pco=63488 //   TimerText5    -  
    }else // 
    {
      if(temp1.val==1)//   
      {
       TimerText5.pco=65504 //   TimerText5    - 
      }else // (   )
      {
       TimerText5.pco=50712 //   TimerText5    - 
      }
    }
   TimerText5.txt=TT1.txt //    TimerText5        TT1
  }
}
//   
if(SelTim.val==1) //    1 ( SelTim)
{
  b1.txt="+" //      1 (b1)  "+"
}else // 
{
  b1.txt="" //      1 (b1)  "+"
}
if(SelTim.val==2) //    2 ( SelTim)
{
  b2.txt="+" //      2 (b2)  "+"
}else//
{
  b2.txt="" //      2 (b2)  "+"
}
if(SelTim.val==3)//   3 ( SelTim)
{
  b3.txt="+" //      3 (b3)  "+"
}else//
{
  b3.txt="" //      3 (b3)  "+"
}
if(SelTim.val==4)//   4 ( SelTim)
{
  b4.txt="+" //      4 (b4)  "+"
}else//
{
  b4.txt="" //      4 (b4)  "+"
}
if(SelTim.val==5)//   5 ( SelTim)
{
  b5.txt="+" //      5 (b5)  "+"
}else//
{
  b5.txt="" //      5 (b5)  "+"
}


Fonctionnalités dans la syntaxe d'une expression for
for(n0.val=0; n0.val<100; n0.val++) — .
. .

En savoir plus sur la commande cov - conversion entre chaîne et données numériques.
:
cov att1,att2,lenth
:
att1:
att2:
lenth: ( 0 – )
:
cov number.val,text.txt,0
number text.
cov text.txt,number.val,5
text.
. cov .

Tenez compte de l'emplacement des données dans le panneau EEPROM. Chaque canal se voit allouer 52 octets. Pour chaque valeur - 4 octets.
Adresse EEPROM
Start offset = (numéro de canal commençant à 0) * 52
Valeur
Décalage de départActivité du canal (0 - canal désactivé, 1 - canal activé)
Décalage de départ + 4Journée d'inclusion des chaînes. Si non pris en compte - 10 000
Décalage de départ + 8Mois d'inclusion de chaîne. Si non pris en compte - 10 000
Décalage de départ + 12. — 10000
+ 16. — 10000
+ 20. -10000
+ 24. – 10000
+ 28. — 10000
+ 32. – 10000
+ 36. -10000
+ 40. -10000
+ 44. -10000
+ 48Canal hors seconde. Si non pris en compte -10000

A partir de l'écran principal ont terminé, passez à l'écran, le réglage de la minuterie ( le SetTimer ID = 1 )



Événement Preinitialilize l'événement (l'écran est appelée avant l'initialisation).

cfgpio 0,1,b2 //  Esc (IO0)     b2 ( "/ "  "" ( 2 ))
cfgpio 1,1,BYE //  Enter (IO1)     BYE ("/O   "  )
cfgpio 2,1,b0 //  Right (IO2)     b0 -"   "
cfgpio 3,1,BYM //  Down (IO3)     BYM -"    "
cfgpio 4,1,BYP //  Up (IO4)     BYP -"    "
cfgpio 5,1,b1 //  Left (IO5)     b1 -"   "
StAddr.val=sys0-1 //        0
StAddr.val=StAddr.val*52 //       EEPROM
repo Enable.val,StAddr.val //   Enable    EEPROM  

Ici, nous redéfinissons la liaison des boutons physiques situés sur la carte d'extension aux besoins de cet écran et lisons préalablement les données.

Événement tactile Appuyez sur l' événement touche b0 - «Aller au champ suivant « . Le bouton est invisible. Ce bouton sur cet écran est lié au bouton physique droit (IO2) sur la carte d'extension .

if(sys1>11) //    12 (  )
{
  sys1=1 //   1 (   )
}else // 
{
  sys1=sys1+1 //    
}

Événement tactile Appuyez sur l' événement boutons b1 - «Aller au champ précédent « . Le bouton est invisible. Ce bouton sur cet écran est lié au bouton physique gauche (IO5) sur la carte d' extension .

if(sys1<2) //    1 (   )
{
  sys1=12 //   12 (  )
}else // 
{
  sys1=sys1-1 //    
}

Événement tactile Appuyez sur l' événement touche b2 - « Activer / désactiver le canal » ou « Exit » (attente 2 sec). Le bouton est invisible. Ce bouton de cet écran est lié au bouton Esc physique (IO0) de la carte d' extension.

tm1.en=1 //   tm1

Ici, nous démarrons la minuterie auxiliaire. Si vous appuyez sur le bouton physique Esc (IO0) du Conseil d'extension pendant 2 secondes (propriété tim timer), le retrait se produit minuterie (événement appel minuteur de minuterie TM1 ), si le bouton est relâché avant l'événement est dû Appuyez sur Libérer l' événement bouton b2

tm1.en=0 // C    tm1
if(Enable.val==1) //     Enable ("/ ") 
{
  Enable.val=0 //      
}else // 
{
  Enable.val=1 //     
}

Événement minuteur de minuterie tm1

click b11,1 //      b11 ("")

Événement tactile Appuyez sur l' événement touche un BYE - «Activer / Désactiver Registre au fonctionnement » du champ sélectionné.

if(sys1==1) //    1(  )
{
  temp2.val=rtc2 //            
}
if(sys1==2) //    2(  )
{
  temp2.val=rtc1 //            
}
if(sys1==3) //    3(  )
{
  temp2.val=rtc0 //            
}
if(sys1==4) //    4 (  )
{
  temp2.val=rtc3 //            
}
if(sys1==5) //    5 (  )
{
  temp2.val=rtc4 //            
}
if(sys1==6) //    6 (  )
{
  temp2.val=rtc5 //            
}
if(sys1==7) //    7 (  )
{
  temp2.val=rtc2 //            
}
if(sys1==8) //    8 (  )
{
  temp2.val=rtc1 //            
}
if(sys1==9) //    9 (  )
{
  temp2.val=rtc0 //            
}
if(sys1==10)//    10 (  )
{
  temp2.val=rtc3 //            
}
if(sys1==11) //    11 (  )
{
  temp2.val=rtc4 //            
}
if(sys1==12) //    12 (  )
{
  temp2.val=rtc5 //            
}
temp3.val=sys1*4 //     EEPROM    
temp.val=StAddr.val+temp3.val//     EEPROM    
repo temp1.val,temp.val //         temp1
if(temp1.val==10000)//       (  10000)
{
  temp1.val=temp2.val //    temp1      (     )
}else //  (    )
{
  temp1.val=10000 //    temp1  10000 (     )
}
wepo temp1.val,temp.val//C    EEPROM

En savoir plus sur les commandes wepo - écrire sur EEPROM et repo - lire sur EEPROM (seuls les panneaux Enhanced ont ces commandes).
wepo
:
wepo att,add
:
att:
add: EEPROM
:
wepo number.val,10
number EEPROM 10. EEPROM 0. . wepo .

repo
:
repo att,add
:
att:
add: EEPROM
:
repo number.val,10
number EEPROM , 10. , 4 , . – txt_maxl att +1
. repo .

Événement tactile Appuyez sur l' événement touche BYP - «Ajouter 1 au champ sélectionné « .

if(sys1==1) //    1(  )
{
  temp2.val=31 //    temp2      1 - 31
}
if(sys1==2)//    2(  )
{
  temp2.val=12 //    temp2      2 - 12
}
if(sys1==3) //    3 (  )
{
  temp2.val=9999 //    temp2      2 - 9999
}
if(sys1==4) //    4 (  )
{
  temp2.val=23 //    temp2      4 - 23
}
if(sys1==5) //    5 (  )
{
  temp2.val=59 //    temp2      5 - 59
}
if(sys1==6) //    6 (  )
{
  temp2.val=59 //    temp2      6 - 59
}
if(sys1==7)//    7 (  )
{
  temp2.val=31 //    temp2      7 - 31
}
if(sys1==8) //    8 (  )
{
  temp2.val=12 //    temp2      8 - 12
}
if(sys1==9) //    9 (  )
{
  temp2.val=9999 //    temp2      9 - 9999
}
if(sys1==10) //    10 (  )
{
  temp2.val=23 //    temp2      10 - 23
}
if(sys1==11) //    11 (  )
{
  temp2.val=59 //    temp2      11 - 59
}
if(sys1==12) //    12 (  )
{
  temp2.val=59 //    temp2      12 - 59
}
temp3.val=sys1*4 //     EEPROM    
temp.val=StAddr.val+temp3.val //     EEPROM    
repo temp1.val,temp.val //         temp1
if(temp1.val!=10000)//      (   10000)
{
  if(temp1.val!=temp2.val)//         
  {
    temp1.val=temp1.val+1 //    
    wepo temp1.val,temp.val // C    EEPROM
  }
}

Événement tactile Appuyez sur l' événement touche BYM - «Soustraire 1 du champ choisi « .

temp2.val=0 //    temp2     4, 5, 6,10,11,12 - 0
if(sys1==1)//    1(  )
{
  temp2.val=1 //    temp2      1 - 1
}
if(sys1==2)//    2(  )
{
  temp2.val=1 //    temp2      2 - 1
}
if(sys1==3)//    3(  )
{
  temp2.val=2016 //    temp2      3 - 2016
}
if(sys1==7) //    7(  )
{
  temp2.val=1 //    temp2      7 - 1
}
if(sys1==8) //    8(  )
{
  temp2.val=1 //    temp2      8 - 1
}
if(sys1==9) //    9(  )
{
  temp2.val=2016 //    temp2      9 - 2016
}
temp3.val=sys1*4//    EEPROM    
temp.val=StAddr.val+temp3.val //     EEPROM    
repo temp1.val,temp.val //         temp1
if(temp1.val!=10000) //       (   10000)
{
  if(temp1.val!=temp2.val)//         
  {
    temp1.val=temp1.val-1 //    
    wepo temp1.val,temp.val // C    EEPROM
  }
}

Événement tactile Appuyez sur l' événement touche B11 - «Retour à la page d'accueil « .

wepo Enable.val,StAddr.val//   EEPROM   
sys0=0 //    sys0 
sys1=0 //    sys1 
page 0 //    

L' événement Touch Press de la zone de texte StartD est «Day Set Point Trigger ».

sys1=1 //   1

Pour les champs de texte avec d'autres paramètres, le code d' événement Touch Press est le même, à l'exception du numéro de champ.

Les numéros des champs de valeur de réglage sont:

StartMo - 2 («Mois de la consigne de fonctionnement»).
StartY - 3 («Année du déclenchement de la consigne»).
StartH - 4 («Heure du réglage de fonctionnement»).
StartMi - 5 («Consigne minute de fonctionnement»).
StartS - 6 («Deuxième point de consigne de fonctionnement»).
StopD - 7 («Réglage du jour du voyage»).
StopMo - 8 ("Réglage du mois du trajet").
StopY - 9 («Réglage de l'année du trajet»).
StopH - 10 («Réglage de l'heure du trajet»).
Stopmi- 11 («Réglage du trajet minute»).
StopS - 12 («Secondes de consigne de déclenchement»).

Le temporisateur tm0 est également réglé sur cet écran avec une période de déclenchement de 200 millisecondes. Dans l' événement Timer de ce temporisateur, les valeurs des champs de réglage sont mises à jour.

Code sous le spoiler

//  1 - (  )
temp1.val=StAddr.val+4 // O   EEPROM   
repo temp.val,temp1.val //   temp   EEPROM   
cov temp.val,tempStr.txt,0 //      temp      tempStr
if(temp.val<10)//     10 
{
  tempStr1.txt="0"+tempStr.txt //     tempStr1     ( tempStr)     "0"
}else // 
{
  tempStr1.txt=tempStr.txt //    tempStr1      ( tempStr)
}
if(temp.val==10000) //         ( = 10000)
{
  if(sys1==1)//     1
  {
    vis BYP,0 //   " "
    vis BYM,0 //   " "
  }
  StartD.txt="X"//     ""
}else //  (      (   10000))
{
  if(sys1==1) //     1
  {
    vis BYP,1 //   " "
    vis BYM,1 //   " "
  }
  StartD.txt=tempStr1.txt //        tempStr1
}
//  2 - (  )
temp1.val=StAddr.val+8 // O   EEPROM   
repo temp.val,temp1.val //   temp   EEPROM   
cov temp.val,tempStr.txt,0 //      temp      tempStr
if(temp.val<10)//     10 
{
  tempStr1.txt="0"+tempStr.txt //     tempStr1     ( tempStr)     "0"
}else // 
{
  tempStr1.txt=tempStr.txt //    tempStr1      ( tempStr)
}
if(temp.val==10000) //         ( = 10000)
{
  if(sys1==2) //     2
  {
    vis BYP,0//  " "
    vis BYM,0 //   " "
  }
  StartMo.txt="X" //     ""
}else //  (      (   10000))
{
  if(sys1==2) //     2
  {
    vis BYP,1 //   " "
    vis BYM,1 //   " "
  }
  StartMo.txt=tempStr1.txt //        tempStr1
}
//  3 - (  )
temp1.val=StAddr.val+12 // O   EEPROM   
repo temp.val,temp1.val //   temp   EEPROM   
cov temp.val,tempStr.txt,0 //      temp      tempStr
if(temp.val<10) //     10 
{
  tempStr1.txt="0"+tempStr.txt //     tempStr1     ( tempStr)     "0"
}else // 
{
  tempStr1.txt=tempStr.txt //    tempStr1      ( tempStr)
}
if(temp.val==10000) //         ( = 10000)
{
  if(sys1==3) //     3
  {
    vis BYP,0 //   " "
    vis BYM,0 //   " "
  }
  StartY.txt="X" //     ""
}else //  (      (   10000))
{
  if(sys1==3) //     3
  {
    vis BYP,1 //   " "
    vis BYM,1 //   " "
  }
  StartY.txt=tempStr1.txt //        tempStr1
}
//  4 - (  )
temp1.val=StAddr.val+16 // O   EEPROM   
repo temp.val,temp1.val //   temp   EEPROM   
cov temp.val,tempStr.txt,0 //      temp      tempStr
if(temp.val<10) //     10 
{
  tempStr1.txt="0"+tempStr.txt //     tempStr1     ( tempStr)     "0"
}else // 
{
  tempStr1.txt=tempStr.txt //    tempStr1      ( tempStr)
}
if(temp.val==10000) //         ( = 10000)
{
  if(sys1==4) //     4
  {
    vis BYP,0 //   " "
    vis BYM,0 //   " "
  }
  StartH.txt="X" //     ""
}else //  (      (   10000))
{
  if(sys1==4) //     3
  {
    vis BYP,1 //   " "
    vis BYM,1 //   " "
  }
  StartH.txt=tempStr1.txt //        tempStr1
}
//  5 - (  )
temp1.val=StAddr.val+20 // O   EEPROM   
repo temp.val,temp1.val //   temp   EEPROM   
cov temp.val,tempStr.txt,0 //      temp      tempStr
if(temp.val<10) //     10 
{
  tempStr1.txt="0"+tempStr.txt //     tempStr1     ( tempStr)     "0"
}else // 
{
  tempStr1.txt=tempStr.txt //    tempStr1      ( tempStr)
}
if(temp.val==10000) //         ( = 10000)
{
  if(sys1==5) //     5
  {
    vis BYP,0 //   " "
    vis BYM,0 //   " "
  }
  StartMi.txt="X" //     ""
}else //  (      (   10000))
{
  if(sys1==5) //     5
  {
    vis BYP,1 //   " "
    vis BYM,1 //   " "
  }
  StartMi.txt=tempStr1.txt //        tempStr1
}
//  6 - (  )
temp1.val=StAddr.val+24 // O   EEPROM   
repo temp.val,temp1.val //   temp   EEPROM   
cov temp.val,tempStr.txt,0 //      temp      tempStr
if(temp.val<10) //     10
{
  tempStr1.txt="0"+tempStr.txt //     tempStr1     ( tempStr)     "0"
}else // 
{
  tempStr1.txt=tempStr.txt //    tempStr1      ( tempStr)
}
if(temp.val==10000) //         ( = 10000)
{
  if(sys1==6) //     6
  {
    vis BYP,0 //   " "
    vis BYM,0 //   " "
  }
  StartS.txt="X" //     ""
}else// (      (   10000))
{
  if(sys1==6) //     6
  {
    vis BYP,1 //   " "
    vis BYM,1 //   " "
  }
  StartS.txt=tempStr1.txt //        tempStr1
}
//  7 - (  )
temp1.val=StAddr.val+28// O   EEPROM   
repo temp.val,temp1.val //   temp   EEPROM   
cov temp.val,tempStr.txt,0 //      temp      tempStr
if(temp.val<10) //     10
{
  tempStr1.txt="0"+tempStr.txt //     tempStr1     ( tempStr)     "0"
}else // 
{
  tempStr1.txt=tempStr.txt //    tempStr1      ( tempStr)
}
if(temp.val==10000) //         ( = 10000)
{
  if(sys1==7) //     7
  {
    vis BYP,0 //   " "
    vis BYM,0 //   " "
  }
  StopD.txt="X" //     ""
}else //  (      (   10000))
{
  if(sys1==7) //     7
  {
    vis BYP,1 //   " "
    vis BYM,1 //   " "
  }
  StopD.txt=tempStr1.txt //        tempStr1
}
//  8 - (  )
temp1.val=StAddr.val+32 // O   EEPROM   
repo temp.val,temp1.val //   temp   EEPROM   
cov temp.val,tempStr.txt,0 //      temp      tempStr
if(temp.val<10) //     10
{
  tempStr1.txt="0"+tempStr.txt //     tempStr1     ( tempStr)     "0"
}else // 
{
  tempStr1.txt=tempStr.txt //    tempStr1      ( tempStr)
}
if(temp.val==10000) //         ( = 10000)
{
  if(sys1==8) //     8
  {
    vis BYP,0 //   " "
    vis BYM,0 //   " "
  }
  StopMo.txt="X" //     ""
}else //  (      (   10000))
{
  if(sys1==8) //     8
  {
    vis BYP,1 //   " "
    vis BYM,1 //   " "
  }
  StopMo.txt=tempStr1.txt //        tempStr1
}
//  9 - (  )
temp1.val=StAddr.val+36 // O   EEPROM   
repo temp.val,temp1.val //   temp   EEPROM   
cov temp.val,tempStr.txt,0 //      temp      tempStr
if(temp.val<10) //     10
{
  tempStr1.txt="0"+tempStr.txt //     tempStr1     ( tempStr)     "0"
}else // 
{
  tempStr1.txt=tempStr.txt //    tempStr1      ( tempStr)
}
if(temp.val==10000) //         ( = 10000)
{
  if(sys1==9) //     9
  {
    vis BYP,0 //   " "
    vis BYM,0 //   " "
  }
  StopY.txt="X" //     ""
}else //  (      (   10000))
{
  if(sys1==9) //     9
  { 
    vis BYP,1 //   " "
    vis BYM,1 //   " "
  }
  StopY.txt=tempStr1.txt //        tempStr1
}
//  10 - (  )
temp1.val=StAddr.val+40 // O   EEPROM   
repo temp.val,temp1.val //   temp   EEPROM   
cov temp.val,tempStr.txt,0 //      temp      tempStr
if(temp.val<10) //     10
{
  tempStr1.txt="0"+tempStr.txt //     tempStr1     ( tempStr)     "0"
}else // 
{
  tempStr1.txt=tempStr.txt //    tempStr1      ( tempStr)
}
if(temp.val==10000) //         ( = 10000)
{
  if(sys1==10) //     10
  {
    vis BYP,0 //   " "
    vis BYM,0 //   " "
  }
  StopH.txt="X" //     ""
}else //  (      (   10000))
{
  if(sys1==10) //     10
  {
    vis BYP,1 //   " "
    vis BYM,1 //   " "
  }
  StopH.txt=tempStr1.txt //        tempStr1
}
//  11 - (  )
temp1.val=StAddr.val+44 // O   EEPROM   
repo temp.val,temp1.val //   temp   EEPROM   
cov temp.val,tempStr.txt,0 //      temp      tempStr
if(temp.val<10) //     10
{
  tempStr1.txt="0"+tempStr.txt //     tempStr1     ( tempStr)     "0"
}else // 
{
  tempStr1.txt=tempStr.txt //    tempStr1      ( tempStr)
}
if(temp.val==10000) //         ( = 10000)
{
  if(sys1==11) //     11
  {
    vis BYP,0 //   " "
    vis BYM,0 //   " "
  }
  StopMi.txt="X" //     ""
}else //  (      (   10000))
{
  if(sys1==11) //     11
  {
    vis BYP,1 //   " "
    vis BYM,1 //   " "
  }
  StopMi.txt=tempStr1.txt //        tempStr1
}
//  12 - (  )
temp1.val=StAddr.val+48 // O   EEPROM   
repo temp.val,temp1.val //   temp   EEPROM   
cov temp.val,tempStr.txt,0 //      temp      tempStr
if(temp.val<10) //     10
{
  tempStr1.txt="0"+tempStr.txt //     tempStr1     ( tempStr)     "0"
}else // 
{
  tempStr1.txt=tempStr.txt //    tempStr1      ( tempStr)
}
if(temp.val==10000) //         ( = 10000)
{
  if(sys1==12) //     12
  {
    vis BYP,0 //   " "
    vis BYM,0 //   " "
  }
  StopS.txt="X" //     ""
}else //  (      (   10000))
{
  if(sys1==12) //     12
  {
    vis BYP,1 //   " "
    vis BYM,1 //   " "
  }
  StopS.txt=tempStr1.txt //        tempStr1
}
//  
if(sys1==1) //    1 - (  )
{
  StartD.pco=63488 //  1   - 
}else // 
{
  StartD.pco=65535 //  1   - 
}
if(sys1==2) //    2 - (  )
{
  StartMo.pco=63488 //  2   - 
}else // 
{
  StartMo.pco=65535 //  2   - 
}
if(sys1==3) //    3 - (  )
{
  StartY.pco=63488 //  3   - 
}else // 
{
  StartY.pco=65535 //  3   - 
}
if(sys1==4) //    4 - (  )
{
  StartH.pco=63488 //  4   - 
}else // 
{
  StartH.pco=65535 //  4   - 
}
if(sys1==5) //    5 - (  )
{
  StartMi.pco=63488 //  5   - 
}else // 
{
  StartMi.pco=65535 //  5   - 
}
if(sys1==6) //    6 - (  )
{
  StartS.pco=63488 //  6   - 
}else // 
{
  StartS.pco=65535 //  6   - 
}
if(sys1==7) //    7 - (  )
{
  StopD.pco=63488 //  7   - 
}else // 
{
  StopD.pco=65535 //  7   - 
}
if(sys1==8) //    8 - (  )
{
  StopMo.pco=63488 //  8   - 
}else // 
{
  StopMo.pco=65535 //  8   - 
}
if(sys1==9) //    9 - (  )
{
  StopY.pco=63488 //  9   - 
}else // 
{
  StopY.pco=65535 //  9   - 
}
if(sys1==10) //    10 - (  )
{
  StopH.pco=63488 //  10   - 
}else // 
{
  StopH.pco=65535 //  10   - 
}
if(sys1==11) //    11 - (  )
{
  StopMi.pco=63488 //  11   - 
}else // 
{
  StopMi.pco=65535 //  11   - 
}
if(sys1==12) //    12 - (  )
{
  StopS.pco=63488 //  12   - 
}else // 
{
  StopS.pco=65535 //  12   - 
}


En savoir plus sur la commande vis - modification de la visibilité des éléments
:
vis obj,state
:
obj: ID .
state: 1- , 0 –
. vis .

Une fois l'écran des paramètres de canal terminé, accédez à l'écran des paramètres de l'heure actuelle ( SetCurrentTime ID = 2 ).



Ici, comme sur les autres écrans de l' événement Preinitialilize (appelé avant l'initialisation de l'écran), nous lions à nouveau les boutons physiques aux boutons virtuels de cet écran.

cfgpio 0,1,b11 //  Esc (IO0)     b1 ("")
cfgpio 1,1,b10 //  Enter (IO1)     b10 ("   0")
cfgpio 2,1,b14 //  Right (IO2)     b14 (" 1    ")
cfgpio 3,1,b13 //  Down (IO3)     b13 ("   ")
cfgpio 4,1,b12 //  Up (IO4)     b12 ("   ")
cfgpio 5,1,b15 //  Left (IO5)     b15 (" 1    ")
sel.val=1 //    1 ()

Événement tactile Appuyez sur l' événement bouton b0 - «Ajouter à la journée en cours « .

if(rtc2<31)//          31
{
  rtc2=rtc2+1 //      
}

Événement tactile Appuyez sur l' événement bouton b2 - «Ajouter mois à l'heure actuelle « .

if(rtc1<12) //          12
{
  rtc1=rtc1+1 //       
}

Événement tactile Appuyez sur l' événement bouton b4 - «Ajouter l'année à l'heure actuelle « .

rtc0=rtc0+1 //           

Événement tactile Appuyez sur l' événement bouton b6 - «Ajouter une heure à l'heure actuelle « .

if(rtc3<23) //          23
{
  rtc3=rtc3+1 //       
}

Événement tactile Appuyez sur l' événement touche B8 - «Ajouter au moment actuel du temps « .

if(rtc4<59) //          59
{
  rtc4=rtc4+1 //       
}

Événement tactile Appuyez sur l' événement boutons b1 - «Otez le jour de l'heure actuelle « .

if(rtc2>1)//          1
{
  rtc2=rtc2-1 //      
}

L' événement Touch Press du bouton b3 est «Soustraire le mois de l'heure actuelle».

if(rtc1>1) //          1
{
  rtc1=rtc1-1 //      
}

L' événement Touch Press du bouton b5 est «Soustraire l'année de l'heure actuelle».

if(rtc0>2016) //          2016
{
  rtc0=rtc0-1 //      
}

L' événement Touch Press du bouton b7 est «Soustraire une heure de l'heure actuelle».

if(rtc3>0)//          0
{
  rtc3=rtc3-1 //      
}

Événement tactile Appuyez sur l' événement touche B9 - «Otez la minute de l'heure actuelle « .

if(rtc4>0) //          0
{
  rtc4=rtc4-1 //      
}

L' événement Touch Press du bouton b10 est «Set seconds to 0».

rtc5=0 //         0

L' événement Touch Press du bouton b11 est «Exit».

page 0 //    

L' événement Touch Press du bouton b12 est «Aller au champ précédent». Le bouton est invisible. Ce bouton sur cet écran est lié aux boutons physiques Up (IO4) sur conseil d'extension de discussion .

if(sel.val<2)//    1 ()
{
  sel.val=5 //    5 ()
}else // 
{
  sel.val=sel.val-1 //    
}

Événement tactile Appuyez sur l' événement touche B13 - «Aller au champ suivant « . Le bouton est invisible. Ce bouton sur cet écran est lié aux boutons physiques vers le bas (IO3) sur conseil d'extension de discussion .

if(sel.val>4)//   - 5 ()	
{
  sel.val=1 //    1 ()
}else // 
{
  sel.val=sel.val+1 //    
}

Événement tactile Appuyez sur l' événement touche b14 - «Ajouter 1 à la valeur du champ choisi « . Le bouton est invisible. Ce bouton sur cet écran est lié au bouton physique droit (IO2) sur la carte d'extension .

if(sel.val==1)//   1()
{
  click b0,1 //     b0 ( )
}
if(sel.val==2) //    2()
{
  click b2,1 //     b2 ( )
}
if(sel.val==3)//   3()
{
  click b4,1 //     b4 ( )
}
if(sel.val==4)//   4()
{
  click b6,1 //     b6 ( )
}
if(sel.val==5)//   5()
{
  click b8,1 //     b8 ( )
}

Événement Appuyez sur Libérer l' événement bouton b14

if(sel.val==1) //    1()
{
  click b0,0 //    b0 ( )
}
if(sel.val==2) //    2()
{
  click b2,0 //    b2 ( )
}
if(sel.val==3) //    3()
{
  click b4,0 //    b4 ( )
}
if(sel.val==4) //    4()
{
  click b6,0 //    b6 ( )
}
if(sel.val==5) //    5()
{
  click b8,0 //    b8 ( )
}

L' événement Touch Press du bouton b15 est «Soustraire 1 de la valeur du champ sélectionné». Le bouton est invisible. Ce bouton sur cet écran est lié au bouton physique gauche (IO5) sur la carte d' extension .

if(sel.val==1) //    1()
{
  click b1,1 //     b1 ( )
}
if(sel.val==2) //    2()
{
  click b3,1 //     b3 ( )
}
if(sel.val==3)//   3()
{
  click b5,1 //     b5 ( )
}
if(sel.val==4)//   4()
{
  click b7,1 //     b7 ( )
}
if(sel.val==5)//   5()
{
  click b9,1//    b9 ( )
}

Événement Appuyez sur Libérer l' événement bouton b15

if(sel.val==1) //    1()
{
  click b1,0 //    b1 ( )
}
if(sel.val==2) //    2()
{
  click b3,0 //    b3 ( )
}
if(sel.val==3)//   3()
{
  click b5,0 //    b5 ( )
}
if(sel.val==4)//   4()
{
  click b7,0 //    b7 ( )
}
if(sel.val==5) //    5()
{
  click b9,0 //    b9 ( )
}

Eh bien, comme dans les autres fenêtres, le temporisateur tm0 est réglé dans cette fenêtre avec une période de réponse de 200 millisecondes. Dans l' événement Timer de ce temporisateur, les valeurs des champs de texte sont mises à jour.

Code sous le spoiler

//    
temp.val=rtc2 //   temp         (  rtc2)
tempText.txt=""//   tempText   
if(temp.val<10)//     10
{
 tempText.txt="0" //    tempText   "0"
}
cov temp.val,TT1.txt,0 //             TT1
CurrentTime1.txt=tempText.txt+TT1.txt //      CurrentTime1    tempText  TT1
temp.val=rtc1 //   temp         (  rtc1)
tempText.txt="" //    tempText   
if(temp.val<10) //      10
{
 tempText.txt="0" //    tempText   "0"
}
cov temp.val,TT1.txt,0 //             TT1
CurrentTime1.txt=CurrentTime1.txt+"-"+tempText.txt+TT1.txt //        CurrentTime1     "-"     tempText  TT1
temp.val=rtc0 //   temp         (  rtc0)
tempText.txt=""//   tempText   
if(temp.val<10)//     10
{
 tempText.txt="0"//   tempText   "0"
}
cov temp.val,TT1.txt,0 //             TT1
CurrentTime1.txt=CurrentTime1.txt+"-"+tempText.txt+TT1.txt //        CurrentTime1     "-"     tempText  TT1
temp.val=rtc3 //   temp         (  rtc3)
tempText.txt="" //    tempText   
if(temp.val<10) //      10
{
 tempText.txt="0" //    tempText   "0"
}
cov temp.val,TT1.txt,0 //             TT1
CurrentTime1.txt=CurrentTime1.txt+" "+tempText.txt+TT1.txt //        CurrentTime1       " "     tempText  TT1
temp.val=rtc4 //   temp         (  rtc4)
tempText.txt="" //    tempText   
if(temp.val<10) //      10
{
 tempText.txt="0" //    tempText   "0"
}
cov temp.val,TT1.txt,0 //             TT1
CurrentTime1.txt=CurrentTime1.txt+":"+tempText.txt+TT1.txt //        CurrentTime1     ":"     tempText  TT1
temp.val=rtc5 //   temp         (  rtc4)
tempText.txt="" //    tempText   
if(temp.val<10) //      10
{
 tempText.txt="0" //    tempText   "0"
}
cov temp.val,TT1.txt,0 //             TT1
CurrentTime1.txt=CurrentTime1.txt+":"+tempText.txt+TT1.txt //        CurrentTime1     ":"     tempText  TT1
//     (t1 - t5)
if(sel.val==1) //    1 ()
{
  t1.pco=63488 //    (t1)    - 
}else//
{
  t1.pco=65535 //    (t1)    - 
}
if(sel.val==2) //    2 ()
{
  t2.pco=63488 //    (t2)    - 
}else // 
{
  t2.pco=65535 //    (t2)    - 
}
if(sel.val==3)//   3 ()
{
  t3.pco=63488 //    (t3)    - 
}else // 
{
  t3.pco=65535 //    (t3)    - 
}
if(sel.val==4)//   4 ()
{
  t4.pco=63488 //    (t4)    - 
}else // 
{
  t4.pco=65535 //    (t4)    - 
}
if(sel.val==5)//   5 ()
{
  t5.pco=63488 //    (t5)    - 
}else // 
{
  t5.pco=65535 //    (t5)    - 
}


Nous en avons terminé avec le panneau. En principe, il s'est avéré un système autonome qui peut fonctionner sans équipement supplémentaire. Mais nous ne pouvons pas utiliser les réponses du canal. Nous n'avons que deux entrées gratuites - sorties. Ici, l'arduinka viendra à la rescousse.

Dans la version 2.2 de FLProg, la prise en charge des panneaux IHM Nextion a été mise à jour. Il y a de nouveaux blocs pour elle.

  1. Bloquer " Cliquer sur un élément " - vous permet de simuler un clic et un relâchement sur n'importe quel élément de l'écran du panneau.
  2. Les blocs « Obtenir la valeur de la variable système » et « Définir la valeur de la variable système » vous permettent de lire et d'écrire les valeurs de presque toutes les variables système du panneau
  3. Le bloc « Paramètres GPIO » - vous permet de configurer à tout moment les modes de fonctionnement des E / S du panneau

Eh bien, dans cette leçon (car elle est encore plus consacrée à la programmation du panneau lui-même), nous lisons simplement l'état des canaux de la minuterie (variables tsr1 - tsr5 ) et le transmettons aux LED.

Esquisse de projet pour Arduino dans le programme FLProg.



Une petite vidéo du fonctionnement de l'appareil (il s'agit toujours d'un projet de formation, il est donc assemblé à titre temporaire)



Applications:

  1. Projet pour Nextion Editor (firmware pour le panneau)
  2. Projet pour le programme FLProg (firmware pour arduino)

Source: https://habr.com/ru/post/fr400463/


All Articles