File tree Expand file tree Collapse file tree 4 files changed +87
-0
lines changed Expand file tree Collapse file tree 4 files changed +87
-0
lines changed Original file line number Diff line number Diff line change @@ -73,3 +73,8 @@ SliderBlock* AdafruitIO_Dashboard::addSliderBlock(AdafruitIO_Feed *feed)
73
73
{
74
74
return new SliderBlock (this , feed);
75
75
}
76
+
77
+ GaugeBlock* AdafruitIO_Dashboard::addGaugeBlock (AdafruitIO_Feed *feed)
78
+ {
79
+ return new GaugeBlock (this , feed);
80
+ }
Original file line number Diff line number Diff line change 17
17
#include " blocks/ToggleBlock.h"
18
18
#include " blocks/MomentaryBlock.h"
19
19
#include " blocks/SliderBlock.h"
20
+ #include " blocks/GaugeBlock.h"
20
21
21
22
// forward declaration
22
23
class AdafruitIO ;
@@ -36,6 +37,7 @@ class AdafruitIO_Dashboard {
36
37
ToggleBlock* addToggleBlock (AdafruitIO_Feed *feed);
37
38
MomentaryBlock* addMomentaryBlock (AdafruitIO_Feed *feed);
38
39
SliderBlock* addSliderBlock (AdafruitIO_Feed *feed);
40
+ GaugeBlock* addGaugeBlock (AdafruitIO_Feed *feed);
39
41
40
42
private:
41
43
AdafruitIO *_io;
Original file line number Diff line number Diff line change
1
+ //
2
+ // Adafruit invests time and resources providing this open source code.
3
+ // Please support Adafruit and open source hardware by purchasing
4
+ // products from Adafruit!
5
+ //
6
+ // Copyright (c) 2015-2016 Adafruit Industries
7
+ // Authors: Tony DiCola, Todd Treece
8
+ // Licensed under the MIT license.
9
+ //
10
+ // All text above must be included in any redistribution.
11
+ //
12
+ #include " GaugeBlock.h"
13
+
14
+ GaugeBlock::GaugeBlock (AdafruitIO_Dashboard *d, AdafruitIO_Feed *f) : AdafruitIO_Block(d, f)
15
+ {
16
+ min = 0 ;
17
+ max = 100 ;
18
+ width = " THIN" ;
19
+ label = " Value" ;
20
+ }
21
+
22
+ GaugeBlock::~GaugeBlock (){}
23
+
24
+ String GaugeBlock::properties ()
25
+ {
26
+ int w = 0 ;
27
+
28
+ if (width == " THIN" ) {
29
+ w = 25 ;
30
+ } else {
31
+ w = 50 ;
32
+ }
33
+
34
+ String props = " {\" minValue\" :\" " ;
35
+ props += min;
36
+ props += " \" ,\" maxValue\" :\" " ;
37
+ props += max;
38
+ props += " \" ,\" ringWidth\" :\" " ;
39
+ props += w;
40
+ props += " \" ,\" label\" :\" " ;
41
+ props += label;
42
+ props += " \" }" ;
43
+
44
+ return props;
45
+ }
Original file line number Diff line number Diff line change
1
+ //
2
+ // Adafruit invests time and resources providing this open source code.
3
+ // Please support Adafruit and open source hardware by purchasing
4
+ // products from Adafruit!
5
+ //
6
+ // Copyright (c) 2015-2016 Adafruit Industries
7
+ // Authors: Tony DiCola, Todd Treece
8
+ // Licensed under the MIT license.
9
+ //
10
+ // All text above must be included in any redistribution.
11
+ //
12
+ #ifndef ADAFRUITIO_GAUGEBLOCK_H
13
+ #define ADAFRUITIO_GAUGEBLOCK_H
14
+
15
+ #include " AdafruitIO_Block.h"
16
+
17
+ class GaugeBlock : public AdafruitIO_Block {
18
+
19
+ public:
20
+ GaugeBlock (AdafruitIO_Dashboard *d, AdafruitIO_Feed *f);
21
+ ~GaugeBlock ();
22
+
23
+ int min;
24
+ int max;
25
+ const char *width;
26
+ const char *label;
27
+
28
+ String properties ();
29
+
30
+ private:
31
+ const char *_visual_type = " gauge" ;
32
+
33
+ };
34
+
35
+ #endif // ADAFRUITIO_GAUGEBLOCK_H
You can’t perform that action at this time.
0 commit comments