CheeseBoard
A library for use with the CheeseBoard Cheddar platform
GfxSignalStrength.cpp
1 #include <MutilaDebug.h>
2 #include "GfxSignalStrength.h"
3 #include "CbOledDisplay.h"
4 
5 GfxSignalStrength::GfxSignalStrength() :
6  _signal(0)
7 {
8 }
9 
10 void GfxSignalStrength::draw(uint16_t xOffset, uint16_t yOffset)
11 {
12  _DBF("GfxSignalStrength draw@%d,%d : signal=%d\n", xOffset, yOffset, _signal);
13  uint8_t fullBar = height() - 4;
14  uint8_t h = fullBar * _signal / 100;
15 
16  CbOledDisplay.drawVLine(xOffset+3, yOffset+fullBar+2-h, h);
17  CbOledDisplay.drawVLine(xOffset+4, yOffset+fullBar+2-h, h);
18 }
19 
21 {
22  return 8;
23 }
24 
26 {
27  return CBOLED_MESSAGE_FONT_HEIGHT + (2*CBOLED_MESSAGE_FONT_VSEP);
28 }
29 
30 void GfxSignalStrength::setSignal(uint8_t percent)
31 {
32  if (percent > 100) {
33  _signal = 100;
34  } else {
35  _signal = percent;
36  }
37 }
void draw(uint16_t xOffset=0, uint16_t yOffset=0)