diff --git a/examples/CompButton/CompButton.HMI b/examples/CompButton/CompButton_v0_32.HMI old mode 100644 new mode 100755 similarity index 99% rename from examples/CompButton/CompButton.HMI rename to examples/CompButton/CompButton_v0_32.HMI index a53da84..3427061 Binary files a/examples/CompButton/CompButton.HMI and b/examples/CompButton/CompButton_v0_32.HMI differ diff --git a/examples/CompButton/CompButton.ino b/examples/CompButton/CompButton_v0_32.ino old mode 100644 new mode 100755 similarity index 90% rename from examples/CompButton/CompButton.ino rename to examples/CompButton/CompButton_v0_32.ino index b3d02fb..1865294 --- a/examples/CompButton/CompButton.ino +++ b/examples/CompButton/CompButton_v0_32.ino @@ -7,6 +7,8 @@ * * @author Wu Pengfei (email:) * @date 2015/7/10 + * @updated 2016/12/25 bring HMI up to v0.32 to avoid too old issues + * @convert by Patrick Martin, no other changes made * @copyright * Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n * This program is free software; you can redistribute it and/or diff --git a/examples/CompCrop/CompCrop.HMI b/examples/CompCrop/CompCrop_v0_32.HMI old mode 100644 new mode 100755 similarity index 99% rename from examples/CompCrop/CompCrop.HMI rename to examples/CompCrop/CompCrop_v0_32.HMI index d1df570..926e6d3 Binary files a/examples/CompCrop/CompCrop.HMI and b/examples/CompCrop/CompCrop_v0_32.HMI differ diff --git a/examples/CompCrop/CompCrop.ino b/examples/CompCrop/CompCrop_v0_32.ino old mode 100644 new mode 100755 similarity index 87% rename from examples/CompCrop/CompCrop.ino rename to examples/CompCrop/CompCrop_v0_32.ino index e8dac8d..9bd1287 --- a/examples/CompCrop/CompCrop.ino +++ b/examples/CompCrop/CompCrop_v0_32.ino @@ -7,6 +7,8 @@ * * @author Wu Pengfei (email:) * @date 2015/7/10 + * @updated 2016/12/25 bring HMI up to v0.32 to avoid too old issues + * @convert by Patrick Martin, no other changes made * @copyright * Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n * This program is free software; you can redistribute it and/or diff --git a/examples/CompDualStateButton/CompDualStateButton.HMI b/examples/CompDualStateButton/CompDualStateButton_v0_32.HMI old mode 100644 new mode 100755 similarity index 99% rename from examples/CompDualStateButton/CompDualStateButton.HMI rename to examples/CompDualStateButton/CompDualStateButton_v0_32.HMI index cd624dc..6865da9 Binary files a/examples/CompDualStateButton/CompDualStateButton.HMI and b/examples/CompDualStateButton/CompDualStateButton_v0_32.HMI differ diff --git a/examples/CompDualStateButton/CompDualStateButton.ino b/examples/CompDualStateButton/CompDualStateButton_v0_32.ino old mode 100644 new mode 100755 similarity index 90% rename from examples/CompDualStateButton/CompDualStateButton.ino rename to examples/CompDualStateButton/CompDualStateButton_v0_32.ino index 7d85535..176a1c6 --- a/examples/CompDualStateButton/CompDualStateButton.ino +++ b/examples/CompDualStateButton/CompDualStateButton_v0_32.ino @@ -1,94 +1,96 @@ -/** - * @example CompDualStateButton.ino - * - * @par How to Use - * This example shows that when the dual state button component on the Nextion screen is released, - * the text of Text component will change one every time. - * - * @author huang xianming (email:) - * @date 2015/11/11 - * @copyright - * Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - */ - -#include "Nextion.h" - -/* - * Declare a dual state button object [page id:0,component id:1, component name: "bt0"]. - */ -NexDSButton bt0 = NexDSButton(0, 1, "bt0"); - -NexText t0 = NexText(0, 2, "t0"); - - -char buffer[100] = {0}; - -/* - * Register a dual state button object to the touch event list. - */ -NexTouch *nex_listen_list[] = -{ - &bt0, - NULL -}; - -/* - * Dual state button component pop callback function. - * In this example,the button's text value will plus one every time when it is released. - */ -void bt0PopCallback(void *ptr) -{ - uint32_t dual_state; - NexDSButton *btn = (NexDSButton *)ptr; - dbSerialPrintln("b0PopCallback"); - dbSerialPrint("ptr="); - dbSerialPrintln((uint32_t)ptr); - memset(buffer, 0, sizeof(buffer)); - - /* Get the state value of dual state button component . */ - bt0.getValue(&dual_state); - if(dual_state) - { - t0.setText("HI! OPEN STATE"); - } - else - { - t0.setText("HI! OFF STATE"); - } -} - -void setup(void) -{ - /* Set the baudrate which is for debug and communicate with Nextion screen. */ - nexInit(); - - /* Register the pop event callback function of the dual state button component. */ - bt0.attachPop(bt0PopCallback, &bt0); - - dbSerialPrintln("setup done"); -} - -void loop(void) -{ - /* - * When a pop or push event occured every time, - * the corresponding component[right page id and component id] in touch event list will be asked. - */ - nexLoop(nex_listen_list); -} - - - - - - - - - - - - +/** + * @example CompDualStateButton.ino + * + * @par How to Use + * This example shows that when the dual state button component on the Nextion screen is released, + * the text of Text component will change one every time. + * + * @author huang xianming (email:) + * @date 2015/11/11 + * @updated 2016/12/25 bring HMI up to v0.32 to avoid too old issues + * @convert by Patrick Martin, no other changes made + * @copyright + * Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + */ + +#include "Nextion.h" + +/* + * Declare a dual state button object [page id:0,component id:1, component name: "bt0"]. + */ +NexDSButton bt0 = NexDSButton(0, 1, "bt0"); + +NexText t0 = NexText(0, 2, "t0"); + + +char buffer[100] = {0}; + +/* + * Register a dual state button object to the touch event list. + */ +NexTouch *nex_listen_list[] = +{ + &bt0, + NULL +}; + +/* + * Dual state button component pop callback function. + * In this example,the button's text value will plus one every time when it is released. + */ +void bt0PopCallback(void *ptr) +{ + uint32_t dual_state; + NexDSButton *btn = (NexDSButton *)ptr; + dbSerialPrintln("b0PopCallback"); + dbSerialPrint("ptr="); + dbSerialPrintln((uint32_t)ptr); + memset(buffer, 0, sizeof(buffer)); + + /* Get the state value of dual state button component . */ + bt0.getValue(&dual_state); + if(dual_state) + { + t0.setText("HI! OPEN STATE"); + } + else + { + t0.setText("HI! OFF STATE"); + } +} + +void setup(void) +{ + /* Set the baudrate which is for debug and communicate with Nextion screen. */ + nexInit(); + + /* Register the pop event callback function of the dual state button component. */ + bt0.attachPop(bt0PopCallback, &bt0); + + dbSerialPrintln("setup done"); +} + +void loop(void) +{ + /* + * When a pop or push event occured every time, + * the corresponding component[right page id and component id] in touch event list will be asked. + */ + nexLoop(nex_listen_list); +} + + + + + + + + + + + + diff --git a/examples/CompGauge/CompGauge.HMI b/examples/CompGauge/CompGauge_v0_32.HMI old mode 100644 new mode 100755 similarity index 99% rename from examples/CompGauge/CompGauge.HMI rename to examples/CompGauge/CompGauge_v0_32.HMI index 6f256cb..159582c Binary files a/examples/CompGauge/CompGauge.HMI and b/examples/CompGauge/CompGauge_v0_32.HMI differ diff --git a/examples/CompGauge/CompGauge.ino b/examples/CompGauge/CompGauge_v0_32.ino old mode 100644 new mode 100755 similarity index 81% rename from examples/CompGauge/CompGauge.ino rename to examples/CompGauge/CompGauge_v0_32.ino index 8af7d2a..9465cf4 --- a/examples/CompGauge/CompGauge.ino +++ b/examples/CompGauge/CompGauge_v0_32.ino @@ -3,11 +3,13 @@ * * @par How to Use * This example shows that ,when the "btn_up" component on the Nextion screen is released, - * the value of gauge component will plus 5,when the "btn_down" component released ,the value of - * gauge component will minus 5 every time. + * the value of gauge component will plus 5, when the "btn_down" component released, + * the value of gauge component will minus 5 every time. * * @author Wu Pengfei (email:) * @date 2015/7/10 + * @updated 2016/12/25 bring HMI up to v0.32 to avoid too old issues + * @convert by Patrick Martin, no other changes made * @copyright * Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n * This program is free software; you can redistribute it and/or diff --git a/examples/CompHotspot/CompHotSpot_v0_32.HMI b/examples/CompHotspot/CompHotSpot_v0_32.HMI new file mode 100755 index 00000000..159582c Binary files /dev/null and b/examples/CompHotspot/CompHotSpot_v0_32.HMI differ diff --git a/examples/CompHotspot/CompHotspot.HMI b/examples/CompHotspot/CompHotspot.HMI deleted file mode 100644 index 5b3aa58..00000000 Binary files a/examples/CompHotspot/CompHotspot.HMI and /dev/null differ diff --git a/examples/CompHotspot/CompHotspot.ino b/examples/CompHotspot/CompHotspot_v0_32.ino old mode 100644 new mode 100755 similarity index 89% rename from examples/CompHotspot/CompHotspot.ino rename to examples/CompHotspot/CompHotspot_v0_32.ino index f06fbb1..41dccdc --- a/examples/CompHotspot/CompHotspot.ino +++ b/examples/CompHotspot/CompHotspot_v0_32.ino @@ -7,6 +7,8 @@ * * @author Wu Pengfei (email:) * @date 2015/7/10 + * @updated 2016/12/25 bring HMI up to v0.32 to avoid too old issues + * @convert by Patrick Martin, no other changes made * @copyright * Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n * This program is free software; you can redistribute it and/or diff --git a/examples/CompNumber/CompNumber.HMI b/examples/CompNumber/CompNumber_v0_32.HMI old mode 100644 new mode 100755 similarity index 99% rename from examples/CompNumber/CompNumber.HMI rename to examples/CompNumber/CompNumber_v0_32.HMI index edc4d9f..51e9e33 Binary files a/examples/CompNumber/CompNumber.HMI and b/examples/CompNumber/CompNumber_v0_32.HMI differ diff --git a/examples/CompNumber/CompNumber.ino b/examples/CompNumber/CompNumber_v0_32.ino old mode 100644 new mode 100755 similarity index 92% rename from examples/CompNumber/CompNumber.ino rename to examples/CompNumber/CompNumber_v0_32.ino index 29f8c63..10d4e0f --- a/examples/CompNumber/CompNumber.ino +++ b/examples/CompNumber/CompNumber_v0_32.ino @@ -1,122 +1,124 @@ -/** - * @example CompNumber.ino - * - * @par How to Use - * This example shows that ,when the "+" component on the Nextion screen is released, - * the value of number component will plus 1,when the "-" component released ,the value of - * number component will minus 1 every time. - * - * @author huang xianming (email:) - * @date 2015/11/10 - * @copyright - * Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - */ - -#include "Nextion.h" - -void n0PopCallback(void *ptr); -void b0PopCallback(void *ptr); -void b1PopCallback(void *ptr); - -/* - * Declare a number object [page id:0,component id:3, component name: "n0"]. - */ -NexNumber n0 = NexNumber(0, 3, "n0"); - -/* - * Declare a button object [page id:0,component id:1, component name: "b0"]. - */ -NexButton b0 = NexButton(0, 1, "b0"); - -/* - * Declare a button object [page id:0,component id:2, component name: "b1"]. - */ -NexButton b1 = NexButton(0, 2, "b1"); - -char buffer[100] = {0}; - -/* - * Register object n0, b0, b1, to the touch event list. - */ -NexTouch *nex_listen_list[] = -{ - &n0, - &b0, - &b1, - NULL -}; - -/* - * number component pop callback function. - */ -void n0PopCallback(void *ptr) -{ - dbSerialPrintln("n0PopCallback"); - n0.setValue(50); -} - -/* - * Button0 component pop callback function. - * In this example,the value of the number component will plus one every time when button0 is released. - */ -void b0PopCallback(void *ptr) -{ - uint32_t number; - - dbSerialPrintln("b0PopCallback"); - - n0.getValue(&number); - - number += 1; - - n0.setValue(number); -} - -/* - * Button1 component pop callback function. - * In this example,the value of the number component will minus one every time when button1 is released. - */ -void b1PopCallback(void *ptr) -{ - uint32_t number; - - dbSerialPrintln("b1PopCallback"); - - n0.getValue(&number); - - number -= 1; - - n0.setValue(number); -} - -void setup(void) -{ - /* Set the baudrate which is for debug and communicate with Nextion screen. */ - nexInit(); - - /* Register the pop event callback function of the current number component. */ - n0.attachPop(n0PopCallback); - - /* Register the pop event callback function of the current button0 component. */ - b0.attachPop(b0PopCallback); - - /* Register the pop event callback function of the current button1 component. */ - b1.attachPop(b1PopCallback); - - dbSerialPrintln("setup done"); -} - -void loop(void) -{ - /* - * When a pop or push event occured every time, - * the corresponding component[right page id and component id] in touch event list will be asked. - */ - nexLoop(nex_listen_list); -} - - +/** + * @example CompNumber.ino + * + * @par How to Use + * This example shows that ,when the "+" component on the Nextion screen is released, + * the value of number component will plus 1,when the "-" component released ,the value of + * number component will minus 1 every time. + * + * @author huang xianming (email:) + * @date 2015/11/10 + * @updated 2016/12/25 bring HMI up to v0.32 to avoid too old issues + * @convert by Patrick Martin, no other changes made + * @copyright + * Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + */ + +#include "Nextion.h" + +void n0PopCallback(void *ptr); +void b0PopCallback(void *ptr); +void b1PopCallback(void *ptr); + +/* + * Declare a number object [page id:0,component id:3, component name: "n0"]. + */ +NexNumber n0 = NexNumber(0, 3, "n0"); + +/* + * Declare a button object [page id:0,component id:1, component name: "b0"]. + */ +NexButton b0 = NexButton(0, 1, "b0"); + +/* + * Declare a button object [page id:0,component id:2, component name: "b1"]. + */ +NexButton b1 = NexButton(0, 2, "b1"); + +char buffer[100] = {0}; + +/* + * Register object n0, b0, b1, to the touch event list. + */ +NexTouch *nex_listen_list[] = +{ + &n0, + &b0, + &b1, + NULL +}; + +/* + * number component pop callback function. + */ +void n0PopCallback(void *ptr) +{ + dbSerialPrintln("n0PopCallback"); + n0.setValue(50); +} + +/* + * Button0 component pop callback function. + * In this example,the value of the number component will plus one every time when button0 is released. + */ +void b0PopCallback(void *ptr) +{ + uint32_t number; + + dbSerialPrintln("b0PopCallback"); + + n0.getValue(&number); + + number += 1; + + n0.setValue(number); +} + +/* + * Button1 component pop callback function. + * In this example,the value of the number component will minus one every time when button1 is released. + */ +void b1PopCallback(void *ptr) +{ + uint32_t number; + + dbSerialPrintln("b1PopCallback"); + + n0.getValue(&number); + + number -= 1; + + n0.setValue(number); +} + +void setup(void) +{ + /* Set the baudrate which is for debug and communicate with Nextion screen. */ + nexInit(); + + /* Register the pop event callback function of the current number component. */ + n0.attachPop(n0PopCallback); + + /* Register the pop event callback function of the current button0 component. */ + b0.attachPop(b0PopCallback); + + /* Register the pop event callback function of the current button1 component. */ + b1.attachPop(b1PopCallback); + + dbSerialPrintln("setup done"); +} + +void loop(void) +{ + /* + * When a pop or push event occured every time, + * the corresponding component[right page id and component id] in touch event list will be asked. + */ + nexLoop(nex_listen_list); +} + + diff --git a/examples/CompPage/CompPage.HMI b/examples/CompPage/CompPage_v0_32.HMI old mode 100644 new mode 100755 similarity index 99% rename from examples/CompPage/CompPage.HMI rename to examples/CompPage/CompPage_v0_32.HMI index 071c9c1..b974d76 Binary files a/examples/CompPage/CompPage.HMI and b/examples/CompPage/CompPage_v0_32.HMI differ diff --git a/examples/CompPage/CompPage.ino b/examples/CompPage/CompPage_v0_32.ino old mode 100644 new mode 100755 similarity index 88% rename from examples/CompPage/CompPage.ino rename to examples/CompPage/CompPage_v0_32.ino index 619ef8e..b728ca0 --- a/examples/CompPage/CompPage.ino +++ b/examples/CompPage/CompPage_v0_32.ino @@ -6,6 +6,8 @@ * * @author Wu Pengfei (email:) * @date 2015/7/10 + * @updated 2016/12/25 bring HMI up to v0.32 to avoid too old issues + * @convert by Patrick Martin, no other changes made * @copyright * Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n * This program is free software; you can redistribute it and/or diff --git a/examples/CompPicture/CompPicture.HMI b/examples/CompPicture/CompPicture_v0_32.HMI old mode 100644 new mode 100755 similarity index 99% rename from examples/CompPicture/CompPicture.HMI rename to examples/CompPicture/CompPicture_v0_32.HMI index 15aebbe..5e47853 Binary files a/examples/CompPicture/CompPicture.HMI and b/examples/CompPicture/CompPicture_v0_32.HMI differ diff --git a/examples/CompPicture/CompPicture.ino b/examples/CompPicture/CompPicture_v0_32.ino old mode 100644 new mode 100755 similarity index 86% rename from examples/CompPicture/CompPicture.ino rename to examples/CompPicture/CompPicture_v0_32.ino index 01d0889..5802885 --- a/examples/CompPicture/CompPicture.ino +++ b/examples/CompPicture/CompPicture_v0_32.ino @@ -7,6 +7,8 @@ * * @author Wu Pengfei (email:) * @date 2015/7/10 + * @updated 2016/12/25 bring HMI up to v0.32 to avoid too old issues + * @convert by Patrick Martin, no other changes made * @copyright * Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n * This program is free software; you can redistribute it and/or diff --git a/examples/CompProgressBar/CompProgressBar.HMI b/examples/CompProgressBar/CompProgressBar_v0_32.HMI old mode 100644 new mode 100755 similarity index 99% rename from examples/CompProgressBar/CompProgressBar.HMI rename to examples/CompProgressBar/CompProgressBar_v0_32.HMI index 7843978..7a4d7d3 Binary files a/examples/CompProgressBar/CompProgressBar.HMI and b/examples/CompProgressBar/CompProgressBar_v0_32.HMI differ diff --git a/examples/CompProgressBar/CompProgressBar.ino b/examples/CompProgressBar/CompProgressBar_v0_32.ino old mode 100644 new mode 100755 similarity index 89% rename from examples/CompProgressBar/CompProgressBar.ino rename to examples/CompProgressBar/CompProgressBar_v0_32.ino index 0bed956..f5357a6 --- a/examples/CompProgressBar/CompProgressBar.ino +++ b/examples/CompProgressBar/CompProgressBar_v0_32.ino @@ -8,6 +8,8 @@ * * @author Wu Pengfei (email:) * @date 2015/7/10 + * @updated 2016/12/25 bring HMI up to v0.32 to avoid too old issues + * @convert by Patrick Martin, no other changes made * @copyright * Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n * This program is free software; you can redistribute it and/or diff --git a/examples/CompSlider/CompSlider.HMI b/examples/CompSlider/CompSlider_v0_32.HMI old mode 100644 new mode 100755 similarity index 95% rename from examples/CompSlider/CompSlider.HMI rename to examples/CompSlider/CompSlider_v0_32.HMI index cbea278..6930419 Binary files a/examples/CompSlider/CompSlider.HMI and b/examples/CompSlider/CompSlider_v0_32.HMI differ diff --git a/examples/CompSlider/CompSlider.ino b/examples/CompSlider/CompSlider_v0_32.ino old mode 100644 new mode 100755 similarity index 86% rename from examples/CompSlider/CompSlider.ino rename to examples/CompSlider/CompSlider_v0_32.ino index 420f78c..aed6e0f --- a/examples/CompSlider/CompSlider.ino +++ b/examples/CompSlider/CompSlider_v0_32.ino @@ -7,6 +7,8 @@ * * @author Wu Pengfei (email:) * @date 2015/8/11 + * @updated 2016/12/25 bring HMI up to v0.32 to avoid too old issues + * @convert by Patrick Martin, no other changes made * @copyright * Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n * This program is free software; you can redistribute it and/or diff --git a/examples/CompText/CompText.HMI b/examples/CompText/CompText_v0_32.HMI old mode 100644 new mode 100755 similarity index 99% rename from examples/CompText/CompText.HMI rename to examples/CompText/CompText_v0_32.HMI index 3359de4..959a605 Binary files a/examples/CompText/CompText.HMI and b/examples/CompText/CompText_v0_32.HMI differ diff --git a/examples/CompText/CompText.ino b/examples/CompText/CompText_v0_32.ino similarity index 92% rename from examples/CompText/CompText.ino rename to examples/CompText/CompText_v0_32.ino index 5f54c12..93f833e 100755 --- a/examples/CompText/CompText.ino +++ b/examples/CompText/CompText_v0_32.ino @@ -8,6 +8,8 @@ * * @author Wu Pengfei (email:) * @date 2015/7/10 + * @updated 2016/12/25 bring HMI up to v0.32 to avoid too old issues + * @convert by Patrick Martin, no other changes made * @copyright * Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n * This program is free software; you can redistribute it and/or diff --git a/examples/CompTimer/CompTimer.HMI b/examples/CompTimer/CompTimer.HMI deleted file mode 100644 index b6b4477..00000000 Binary files a/examples/CompTimer/CompTimer.HMI and /dev/null differ diff --git a/examples/CompTimer/CompTimer_v0_32.HMI b/examples/CompTimer/CompTimer_v0_32.HMI new file mode 100755 index 00000000..5c3b37e Binary files /dev/null and b/examples/CompTimer/CompTimer_v0_32.HMI differ diff --git a/examples/CompTimer/CompTimer.ino b/examples/CompTimer/CompTimer_v0_32.ino old mode 100644 new mode 100755 similarity index 92% rename from examples/CompTimer/CompTimer.ino rename to examples/CompTimer/CompTimer_v0_32.ino index 88760d6..f844272 --- a/examples/CompTimer/CompTimer.ino +++ b/examples/CompTimer/CompTimer_v0_32.ino @@ -1,123 +1,125 @@ -/** - * @example CompTimer.ino - * - * @par How to Use - * This example shows that ,when the OFF button component on the Nextion screen is released, - * the timer will opened,the text will show number changed and push the ADDTIME button timer - * cycle value will increase,when push the DECTIME button timer cycle value will reduce. - * - * @author huang xianming (email:) - * @date 2015/8/25 - * @copyright - * Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - */ - -#include "Nextion.h" - -NexButton b0 = NexButton(0, 2, "b0"); -NexButton b1 = NexButton(0, 5, "b1"); -NexButton b2 = NexButton(0, 6, "b2"); -NexText t0 = NexText(0, 3, "t0"); -NexText t1 = NexText(0, 4, "t1"); -NexTimer tm0 = NexTimer(0, 1, "tm0"); - - -char buffer[100] = {0}; -uint32_t number_timer = 0; -uint32_t number_enable = 0; -uint32_t number_cycle = 100; - - - -NexTouch *nex_listen_list[] = -{ - &b0, - &b1, - &b2, - &t0, - &t1, - &tm0, - NULL -}; -/* - * Button component pop callback function. - * In this example,the button can open the timer when it is released. - */ -void b0PopCallback(void *ptr) -{ - if(number_enable == 1) - { - tm0.enable(); - number_enable = 0; - b0.setText("ON"); - } - else if (number_enable ==0) - { - tm0.disable(); - number_enable =1; - b0.setText("OFF"); - } -} -/* - * Button component pop callback function. - * In this example,the timer's cycle value will increase when it is released. - */ -void b1PopCallback(void *ptr) -{ - tm0.getCycle(&number_cycle); - number_cycle = number_cycle + 100; - tm0.setCycle(number_cycle); - memset(buffer, 0, sizeof(buffer)); - itoa(number_cycle, buffer, 10); - t1.setText(buffer); -} - -/* - * Button component pop callback function. - * In this example,the timer's cycle value will reduce when it is released. - */ - -void b2PopCallback(void *ptr) -{ - tm0.getCycle(&number_cycle); - if (number_cycle >100) - { - number_cycle = number_cycle - 100; - } - tm0.setCycle(number_cycle); - memset(buffer, 0, sizeof(buffer)); - itoa(number_cycle, buffer, 10); - t1.setText(buffer); -} - -/* - * The timer respond function - * In this example,the timer will respond when set cycle time done and puls one for a variable. - */ - -void tm0TimerCallback(void *ptr) -{ - number_timer++; - memset(buffer, 0, sizeof(buffer)); - itoa(number_timer, buffer, 10); - t0.setText(buffer); -} -void setup(void) -{ - nexInit(); - b0.attachPop(b0PopCallback); - tm0.attachTimer(tm0TimerCallback); - b1.attachPop(b1PopCallback); - b2.attachPop(b2PopCallback); - dbSerialPrintln("setup done"); -} - -void loop(void) -{ - nexLoop(nex_listen_list); -} - +/** + * @example CompTimer.ino + * + * @par How to Use + * This example shows that ,when the OFF button component on the Nextion screen is released, + * the timer will opened,the text will show number changed and push the ADDTIME button timer + * cycle value will increase,when push the DECTIME button timer cycle value will reduce. + * + * @author huang xianming (email:) + * @date 2015/8/25 + * @updated 2016/12/25 bring HMI up to v0.32 to avoid too old issues + * @convert by Patrick Martin, no other changes made + * @copyright + * Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + */ + +#include "Nextion.h" + +NexButton b0 = NexButton(0, 2, "b0"); +NexButton b1 = NexButton(0, 5, "b1"); +NexButton b2 = NexButton(0, 6, "b2"); +NexText t0 = NexText(0, 3, "t0"); +NexText t1 = NexText(0, 4, "t1"); +NexTimer tm0 = NexTimer(0, 1, "tm0"); + + +char buffer[100] = {0}; +uint32_t number_timer = 0; +uint32_t number_enable = 0; +uint32_t number_cycle = 100; + + + +NexTouch *nex_listen_list[] = +{ + &b0, + &b1, + &b2, + &t0, + &t1, + &tm0, + NULL +}; +/* + * Button component pop callback function. + * In this example,the button can open the timer when it is released. + */ +void b0PopCallback(void *ptr) +{ + if(number_enable == 1) + { + tm0.enable(); + number_enable = 0; + b0.setText("ON"); + } + else if (number_enable ==0) + { + tm0.disable(); + number_enable =1; + b0.setText("OFF"); + } +} +/* + * Button component pop callback function. + * In this example,the timer's cycle value will increase when it is released. + */ +void b1PopCallback(void *ptr) +{ + tm0.getCycle(&number_cycle); + number_cycle = number_cycle + 100; + tm0.setCycle(number_cycle); + memset(buffer, 0, sizeof(buffer)); + itoa(number_cycle, buffer, 10); + t1.setText(buffer); +} + +/* + * Button component pop callback function. + * In this example,the timer's cycle value will reduce when it is released. + */ + +void b2PopCallback(void *ptr) +{ + tm0.getCycle(&number_cycle); + if (number_cycle >100) + { + number_cycle = number_cycle - 100; + } + tm0.setCycle(number_cycle); + memset(buffer, 0, sizeof(buffer)); + itoa(number_cycle, buffer, 10); + t1.setText(buffer); +} + +/* + * The timer respond function + * In this example,the timer will respond when set cycle time done and puls one for a variable. + */ + +void tm0TimerCallback(void *ptr) +{ + number_timer++; + memset(buffer, 0, sizeof(buffer)); + itoa(number_timer, buffer, 10); + t0.setText(buffer); +} +void setup(void) +{ + nexInit(); + b0.attachPop(b0PopCallback); + tm0.attachTimer(tm0TimerCallback); + b1.attachPop(b1PopCallback); + b2.attachPop(b2PopCallback); + dbSerialPrintln("setup done"); +} + +void loop(void) +{ + nexLoop(nex_listen_list); +} + diff --git a/examples/CompWaveform/CompWaveform.HMI b/examples/CompWaveform/CompWaveform_v0_32.HMI old mode 100644 new mode 100755 similarity index 96% rename from examples/CompWaveform/CompWaveform.HMI rename to examples/CompWaveform/CompWaveform_v0_32.HMI index 49f5cb8..a2d2541 Binary files a/examples/CompWaveform/CompWaveform.HMI and b/examples/CompWaveform/CompWaveform_v0_32.HMI differ diff --git a/examples/CompWaveform/CompWaveform.ino b/examples/CompWaveform/CompWaveform_v0_32.ino old mode 100644 new mode 100755 similarity index 89% rename from examples/CompWaveform/CompWaveform.ino rename to examples/CompWaveform/CompWaveform_v0_32.ino index ae2d952..e1395a5 --- a/examples/CompWaveform/CompWaveform.ino +++ b/examples/CompWaveform/CompWaveform_v0_32.ino @@ -6,6 +6,8 @@ * * @author Wu Pengfei (email:) * @date 2015/8/11 + * @updated 2016/12/25 bring HMI up to v0.32 to avoid too old issues + * @convert by Patrick Martin, no other changes made * @copyright * Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n * This program is free software; you can redistribute it and/or