summaryrefslogtreecommitdiff
path: root/Layout/LayoutSurveyProgress.cpp
blob: 4a50fbbd9163a3b2fe85cd848d714e06f6c1b5e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include "LayoutSurveyProgress.h"

LayoutSurveyProgress::LayoutSurveyProgress(DOGS102* lcd)
  : Layout(lcd),
    _lMsg1(5, 2, "Survey"),
    _lMsg2(7, 3, "in"),
    _lMsg3(4, 4, "Progress"),
    _fCountdownLabel(0, 6, 17),
    _fCountdown(0, 7, 9)
{}

LayoutSurveyProgress::~LayoutSurveyProgress() {}

void LayoutSurveyProgress::display() {
    clear();
    startUpdate();

    writeLabel(_lMsg1);
    writeLabel(_lMsg2);
    writeLabel(_lMsg3);

    endUpdate();
}

void LayoutSurveyProgress::updateCountdown(uint32_t seconds) {
    char buf[16];
    size_t size;

    memset(buf, 0, sizeof(buf));
    // for some reason, there's a % character that gets displayed in the last column
    // add the extra spaces to wipe it out
    writeField(_fCountdownLabel, "No Free Channel  ", true);
    size = snprintf(buf, sizeof(buf), "%lu s", seconds);
    writeField(_fCountdown, buf, size, true);
}