summaryrefslogtreecommitdiff
path: root/Layout/LayoutSurveyProgress.cpp
blob: b3d6338ea348ed79d8b5f5ab90cb3c5e41d90ef6 (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
#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;

    // make sure the string version is used
    writeField(_fCountdownLabel, string("No Free Channel"), true);
    size = snprintf(buf, sizeof(buf), "%lu s", seconds);
    writeField(_fCountdown, buf, size, true);
}