Skip to content

Commit

Permalink
Small changes in examples
Browse files Browse the repository at this point in the history
  • Loading branch information
jyberg committed Feb 27, 2019
1 parent 0b705cb commit 7a5b54c
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 13 deletions.
7 changes: 5 additions & 2 deletions examples/CompButton/CompButton_v0_32.ino
Expand Up @@ -9,6 +9,8 @@
* @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
* @author Jyrki Berg 2/27/2019 (https://github.com/jyberg)
*
* @copyright
* Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n
* This program is free software; you can redistribute it and/or
Expand All @@ -22,7 +24,7 @@
/*
* Declare a button object [page id:0,component id:1, component name: "b0"].
*/
NexButton b0 = NexButton(0, 1, "b0");
NexButton b0(0, 1, "b0");

char buffer[100] = {0};

Expand Down Expand Up @@ -50,7 +52,8 @@ void b0PopCallback(void *ptr)
memset(buffer, 0, sizeof(buffer));

/* Get the text value of button component [the value is string type]. */
btn->getText(buffer, sizeof(buffer));
len = sizeof(buffer);
btn->getText(buffer, len );

number = atoi(buffer);
number += 1;
Expand Down
4 changes: 3 additions & 1 deletion examples/CompCrop/CompCrop_v0_43.ino
Expand Up @@ -9,6 +9,8 @@
* @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
* @author Jyrki Berg 2/27/2019 (https://github.com/jyberg)
*
* @copyright
* Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n
* This program is free software; you can redistribute it and/or
Expand All @@ -22,7 +24,7 @@
/*
* Declare a crop object [page id:0,component id:1, component name: "q0"].
*/
NexCrop q0 = NexCrop(0, 1, "q0");
NexCrop q0(0, 1, "q0");

NexTouch *nex_listen_list[] =
{
Expand Down
5 changes: 3 additions & 2 deletions examples/CompDualStateButton/CompDualStateButton_v0_43.ino
Expand Up @@ -22,9 +22,10 @@
/*
* 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");
NexDSButton bt0(0, 1, "bt0");

NexText t0(0, 2, "t0");


char buffer[100] = {0};
Expand Down
8 changes: 5 additions & 3 deletions examples/CompGauge/CompGauge_v0_43.ino
Expand Up @@ -10,6 +10,8 @@
* @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
* @author Jyrki Berg 2/27/2019 (https://github.com/jyberg)
*
* @copyright
* Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n
* This program is free software; you can redistribute it and/or
Expand All @@ -20,9 +22,9 @@

#include "Nextion.h"

NexGauge pointer = NexGauge(0, 1, "pointer");
NexButton btn_up = NexButton(0, 2, "btn_up");
NexButton btn_down = NexButton(0, 3, "btn_down");
NexGauge pointer(0, 1, "pointer");
NexButton btn_up(0, 2, "btn_up");
NexButton btn_down(0, 3, "btn_down");

NexTouch *nex_listen_list[] =
{
Expand Down
14 changes: 9 additions & 5 deletions examples/CompText/CompText_v0_43.ino
Expand Up @@ -10,6 +10,8 @@
* @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
* @author Jyrki Berg 2/27/2019 (https://github.com/jyberg)
*
* @copyright
* Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n
* This program is free software; you can redistribute it and/or
Expand All @@ -27,17 +29,17 @@ void b1PopCallback(void *ptr);
/*
* Declare a text object [page id:0,component id:1, component name: "t0"].
*/
NexText t0 = NexText(0, 1, "t0");
NexText t0(0, 1, "t0");

/*
* Declare a button object [page id:0,component id:2, component name: "b0"].
*/
NexButton b0 = NexButton(0, 2, "b0");
NexButton b0(0, 2, "b0");

/*
* Declare a button object [page id:0,component id:3, component name: "b1"].
*/
NexButton b1 = NexButton(0, 3, "b1");
NexButton b1(0, 3, "b1");

char buffer[100] = {0};

Expand Down Expand Up @@ -73,7 +75,8 @@ void b0PopCallback(void *ptr)
dbSerialPrintln("b0PopCallback");

memset(buffer, 0, sizeof(buffer));
t0.getText(buffer, sizeof(buffer));
len = sizeof(buffer);
t0.getText(buffer, len);

number = atoi(buffer);
number += 1;
Expand All @@ -96,7 +99,8 @@ void b1PopCallback(void *ptr)
dbSerialPrintln("b1PopCallback");

memset(buffer, 0, sizeof(buffer));
t0.getText(buffer, sizeof(buffer));
len = sizeof(buffer);
t0.getText(buffer, len);

number = atoi(buffer);
number -= 1;
Expand Down

0 comments on commit 7a5b54c

Please sign in to comment.