📜 ⬆️ ⬇️

FLProg + Nextion HMI Enhanced



ITEAD has released a new line of Enhanced its Nextion HMI panels. Representatives of the company provided me with a copy of this line to integrate the new features of the panel into the FLProg program. In version 2.2 it was implemented. In this lesson we will look at the new features of the panel, and for example, create a programmable timer for five channels.

To begin, consider the characteristics of the panel. The built-in real-time clock, 1024 bytes of non-volatile memory, 8 digital I / O appeared in the Enhanced lineup. Each of them can be configured as an input, and as an output. Four of them (from 4th to 7th) can be configured as PWM outputs.


')
In addition to the Nextion HMI Enhanced line itself, the Expansion Board was released.



It has controls and indications attached to the GPIO panel.



Such opportunities allow to make an almost complete device on the basis of this panel. In this lesson I will focus on programming the panel itself, since there is little information on this, and a lot of pitfalls. Link to the project for the program Nextion Editor is at the end of the post.

Getting started with the Nextion Editor, its launch, the initial choice of encoding, the type of panel is discussed in my previous posts tyts , tyts , and tyts . Therefore, we will not dwell on this.
The panel program consists of three screens: Main ( Main ), Timer Setting ( SetTimer ) and Time Setting ( SetCurrentTime ).

Let's start with the main screen.



This screen displays the settings for on / off, the status of each channel, the button for changing the status of the channels, and a button for switching to the current time setting screen. When you click on the text that displays the channel settings, it switches to the setting of this channel. In addition, on this screen there are four hidden buttons necessary to bind to the physical buttons located on the Expansion Board. .



Consider the code contained on the main screen.

Preinitialilize Event (called before screen initialization).

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 //    

Here we link the physical buttons on the Expansion Board to virtual buttons on the screen.

More information about the cfgpio command - setting up physical inputs - panel outputs (this command is available only for Enhanced panels).
Syntax:
cfgpio id, state, cmp
Where:
id : input / output number (0-7)
state : operation mode (0-4)
cmp : the name of the component to bind (actual only in operation mode 1, otherwise - 0).
Pay attention to the presence of gaps. The required space after the cfgpio command is no longer allowed in the command text.

Possible modes of operation:
Mode numberDescriptionExample
0Input with pull-up to + 5 volts (built-in 50 kΩ resistor). The current state can be read from the system variable pio0 - pio7 (for 0-7 input / output, respectivelycfgpio 0,0,0
GPIO0 input / output is configured as an input pulled to + 5V. The current state can be read as follows:
n0.val = pio0
oneInput with pull-up to + 5 volts (built-in 50 kΩ resistor) and reference to the virtual element. The current state is read from the system variable pio0 - pio7 (for 0-7 input / output, respectively). Also in the state of entry into the log. 1 attached element is assigned to the pressed state, with a log. 0 the bound element is assigned the released state. This mode must be enabled in the window's Preinitialilize Event , since after the page is initialized, the binding does not occur.cfgpio 2.1, b0
GPIO2 input / output is configured as an input pulled to + 5V with reference to the virtual button b0 .
On the leading edge at this input, the b0 button is transferred to the pressed state, on the falling edge - to the released state.
2Push pull out. You can set the output value through the system variable pio0 - pio7 (for 0-7 input / output, respectively).cfgpio 1,2,0
GPIO1 in / out is configured as a push-pull output. Record high output level:
pio1 = 1
3Output PWM. Only for 4-7 in / out. Values ​​from 0 to 100. The default value is 50. The value is set using the system variables pwm4-pwm7 (for 4-7 input / output, respectively). The PWM frequency for all outputs is set using the pwmf system variable in hertz. Values ​​from 1 to 65536. The default is 1000.cfgpio 4,3,0
GPIO4 input / output is configured as a PWM output.
Record value:
pwm4 = 20
The PWM frequency reference is 2000 Hz.
pwmf = 2000
fourOpen collector outlet. You can set the output value through the system variable pio0 - pio7 (for 0-7 input / output, respectively).cfgpio 5,4,0
GPIO5 in / out is configured as a push-pull output. Record high output level:
pio5 = 1


Event Touch Press Event button b0 - "Set time"

 page 2 //       

Everything is clear without explanation

Event Touch Press Event buttons b1 - "Switch the status of the first channel"

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

First we read the channel activity from the EEPROM. Each channel can be turned off from work on the channel settings page. The repo command - “reading from EEPROM” will be discussed in more detail below. Then, if the channel is active, switch its state. The current state of the channels is stored in the variables tsr1 - tsr5 for each of the channels, respectively.

Features in the if else syntax
if (TempB.val == 1) - spaces are not allowed anywhere.
All opening and closing brackets are mandatory from a new line. No commands except brackets in this line are allowed. The exception is the expression
} else
Here it should be written this way, in one line and without spaces. It took me a decent amount of time to realize this, all the time I put a space before the else and could not understand why the compiler curses.

For the rest of the channel state change buttons ( b2 - b5 ), the Touch Press Event event code is similar. Only the address in the EEPROM and the channel status variable are changed.

Event Touch Press Event buttons b6 - "Select the previous channel." The button is invisible. Drawing mode ( sta ) - crop image (cut out image). The background image of the window is selected as the picture in the not pressed state ( picc ) and pressed state ( picc2 ). Due to this, the button is not displayed, but it works. This button on this screen is tied to a physical Up button (IO4) on the Expansion Board .

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

The SelTim variable is the number of the currently selected timer. Everything else, I think it is clear from the comments.

Event Touch Press Event button b7 - "Select the next channel." The button is invisible. This button on this screen is tied to the physical Down button (IO3) on the Expansion Board .

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

Here I think the same is clear.

Event Touch Press Event button b8 - "Edit the selected channel." The button is invisible. This button on this screen is tied to the physical Right button (IO2) on the Expansion Board .

 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 } 

Learn more about the click command - imitation of clicking or releasing an item
Syntax:
click cmpID event
Where:
cmpID : the name or ID of the item.
event : event 0 - release; 1 - press
Pay attention to the presence of gaps. Required space after the click command further in the text of the command spaces are not allowed.

Event Touch Press Event button b9 - "Switch the status of the selected channel." The button is invisible. This button on this screen is tied to the physical Left button (IO5) on the Expansion Board .

 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 } 

The Touch Press Event of the TimerText1 text field is “Displaying the status of channel 1”.

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

For other text fields ( TimerText2 - TimerText5 ), the Touch Press Event event code is similar. Only in the sys0 system variable is the corresponding channel number entered.

sys0, sys1, sys2 are global numeric variables that do not need to be created or defined. They can be used on any screen. The default value for these three variables is 0, they can be read and written, their range of values ​​is 0 ~ 4294967295. Recommended for transferring values ​​between pages.

The tm0 timer is set on this screen. This timer fires every 200 milliseconds ( tim parameter) when the page is active. The code for monitoring the status of timers and redrawing components located on the page is in the Timer Event of this timer.

Code under 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)  "+" } 


Features in the syntax of a for expression
for(n0.val=0; n0.val<100; n0.val++) — .
. .

More information about the cov command - conversion between string and numeric data.
:
cov att1,att2,lenth
Where:
att1 :
att2 :
lenth : ( 0 – )
Example:
cov number.val,text.txt,0
number text .
cov text.txt,number.val,5
text .
. cov .

Consider the location of the data in the EEPROM panel. 52 bytes are allocated for each channel. For each value - 4 bytes.
Address in EEPROM
Start offset = (channel number starting from 0) * 52
Value
Starting offsetChannel activity (0 - channel is disabled, 1 channel is enabled)
Start offset + 4The day the channel was turned on. If not counted - 10,000
Start offset + 8The month of the channel on. If not counted - 10,000
Start offset + 12The year the channel was turned on. If not counted - 10,000
Start offset + 16Hour channel on. If not counted - 10,000
Start offset + 20. -10000
+ 24. – 10000
+ 28. — 10000
+ 32. – 10000
+ 36. -10000
+ 40. -10000
+ 44. -10000
+ 48. -10000

From the main screen you have finished, move on to the timer settings screen ( the SetTimer ID = 1 )



Event Preinitialilize the Event (the screen is called before the initialization).

 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   

Here we override the binding of the physical buttons located on the Expansion Board to the needs of this screen, and pre-read the data.

Event Touch Press Event button b0 - "Go to the next field." The button is invisible. This button on this screen is tied to the physical Right button (IO2) on the Expansion Board .

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

Event Touch Press Event buttons b1 - "Go to the previous field." The button is invisible. This button on this screen is tied to the physical Left button (IO5) on the Expansion Board .

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

Event Touch Press Event button b2 - "Activate / Deactivate channel" or "Exit" (hold 2 sec). The button is invisible. This button on this screen is tied to the physical Esc button (IO0) on the Expansion Board.

 tm1.en=1 //   tm1 

. Esc (IO0) Expansion Board 2 ( tim ), ( Timer Event tm1 ), , Touch Release Event b2

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

Timer Event tm1

 click b11,1 //      b11 ("") 

Touch Press Event BYE – «/ » .

 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 

wepo – EEPROM repo – EEPROM ( Enhanced).
wepo
:
wepo att,add
Where:
att :
add : EEPROM
Example:
wepo number.val,10
number EEPROM 10. EEPROM 0. . wepo .

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

The Touch Press Event of the BYP button is “Add 1 to the selected field”.

 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 } } 

The Touch Press Event event of the BYM button is “Subtract 1 from the selected field”.

 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 } } 

Event Touch Press Event buttons b11 - "Return to the main page."

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

The TouchDD Event of the StartD text field is the “Day of the pickup setting”.

 sys1=1 //   1 

For text fields of other settings, the Touch Press Event event code is similar except for the field number.

Numbers of setting values ​​fields:

StartMo - 2 (“Month of setpoint triggering”).
StartY - 3 (“Year of operation setting”).
StartH - 4 (“Hour setting operation”).
StartMi - 5 (“Minute of the pickup setting”).
StartS - 6 (“Second of the operation setpoint”).
StopD - 7 (“Day of the shutdown setting”).
StopMo - 8 (“Month of shutdown setting„).
StopY - 9 (“Year of shutdown setting„).
StopH - 10 (“Hour of shutdown setting„).
StopMi- 11 (“Minute of shutdown settings„).
StopS - 12 (“Senda shutdown settings„).

On this screen, the timer tm0 with a triggering period of 200 milliseconds is also set. In the Timer Event of this timer, the settings field values ​​are updated.

Code under the 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   -  } 


Learn more about the vis command — changing the visibility of an element
:
vis obj,state
Where:
obj : ID .
state : 1- , 0 –
. vis .

With the channel settings screen finished, go to the current time settings screen ( SetCurrentTime ID = 2 ).



Here, as well as on other screens in the Preinitialilize Event (it is called before screen initialization), we reassociate the physical buttons to the virtual buttons on this screen.

 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 () 

Event Touch Press Event buttons b0 - "Add day to the current time."

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

Event Touch Press Event buttons b2 - "Add a month to the current time."

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

Event Touch Press Event button b4 - "Add a year to the current time."

 rtc0=rtc0+1 //            

Event Touch Press Event buttons b6 - "Add an hour to the current time."

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

Event Touch Press Event button b8 - "Add a minute to the current time."

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

Event Touch Press Event buttons b1 - "Take away the day from the current time."

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

Event Touch Press Event buttons b3 - "Take away the month from the current time."

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

Event Touch Press Event buttons b5 - "Take away the year from the current time."

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

Event Touch Press Event buttons b7 - "Take away the hour from the current time."

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

Event Touch Press Event buttons b9 - "Take away a minute from the current time."

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

Event Touch Press Event buttons b10 - "Setting seconds to 0."

 rtc5=0 //         0 

Event Touch Press Event button b11 - "Exit".

 page 0 //     

Event Touch Press Event buttons b12 - "Go to the previous field." The button is invisible. This button on this screen is tied to a physical Up button (IO4) on the Expansion Board .

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

Event Touch Press Event button b13 - "Go to the next field." The button is invisible. This button on this screen is tied to the physical Down button (IO3) on the Expansion Board .

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

Event Touch Press Event buttons b14 - "Add 1 to the value of the selected field." The button is invisible. This button on this screen is tied to the physical Right button (IO2) on the Expansion Board .

 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 ( ) } 

Event Touch Release Event button 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 ( ) } 

The Touch Press Event of the b15 button - “Subtract 1 from the value of the selected field”. The button is invisible. This button on this screen is tied to the physical Left button (IO5) on the Expansion Board .

 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 ( ) } 

Event Touch Release Event button 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 ( ) } 

Well, as in the other windows in this window, the timer tm0 is set with a trigger period of 200 milliseconds. In the Timer Event of this timer, the values ​​of the text fields are updated.

Code under the 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)    -  } 


At this point we are done with the panel. In principle, it turned out an autonomous system that can operate without additional equipment. But we cannot use channel triggering. We have only two free entries left. Here arduinka comes to the rescue.

Version 2.2 of FLProg has updated support for the Nextion HMI panels. There are new blocks for her.

  1. Block " Click on the element " - allows you to simulate pressing and releasing on any element on the panel screen.
  2. The blocks “ Get the value of the system variable ” and “ Set the value of the system variable ” allow you to read and write the values ​​of almost all the system variables of the panel.
  3. The “ GPIO Setup ” block - allows you to configure the panel I / O operation modes at any time.

Well, in this lesson (since it is still more devoted to programming the panel itself), we simply read the state of the timer channels (variables tsr1 - tsr5 ) and bring it to the LEDs.

FLProg program design for Arduino.



A small video of the device (This is still an educational project, so it is assembled according to a temporary scheme)



Applications:

  1. Project for the program Nextion Editor (firmware for the panel)
  2. FLProg project (firmware for arduino)

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


All Articles