mirror of
https://github.com/eried/portapack-mayhem.git
synced 2024-12-15 02:34:33 -05:00
7feef9d38b
* WIP * Fixed merge * Added test code * WIP * Clean up * add reset learned params * ui fix * ui fix2 * Updated func * Fixed english * WIP * WIP testing * Added new debug app * Got new app for debug * Got new app for debug * Got one full page showing * Got app working with all reg * Got app working with all reg * Got full hex showing * Fixed dp * Fixed dp * Moved entities * Enabled apps again * SHow battery debug if ic * WIP * Refactored further * WIP * Refactor and clean up * Refactor and clean up * fix warning, add tte/ttf, add cycles counter. * wip * morse tx to ext app * fix morse crash * fix ui * Updated wording * WIP * WIP * Updated to display hours and minutes --------- Co-authored-by: HTotoo <ttotoo@gmail.com>
108 lines
3.2 KiB
C++
108 lines
3.2 KiB
C++
/*
|
|
* Copyright (C) 2015 Jared Boone, ShareBrained Technology, Inc.
|
|
* Copyright (C) 2016 Furrtek
|
|
*
|
|
* This file is part of PortaPack.
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 2, or (at your option)
|
|
* any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; see the file COPYING. If not, write to
|
|
* the Free Software Foundation, Inc., 51 Franklin Street,
|
|
* Boston, MA 02110-1301, USA.
|
|
*/
|
|
|
|
#ifndef __UI_BATTINFO_H__
|
|
#define __UI_BATTINFO_H__
|
|
|
|
#include "ui.hpp"
|
|
#include "ui_widget.hpp"
|
|
#include "ui_navigation.hpp"
|
|
#include "string_format.hpp"
|
|
|
|
namespace ui {
|
|
class BattinfoView : public View {
|
|
public:
|
|
~BattinfoView();
|
|
BattinfoView(NavigationView& nav);
|
|
BattinfoView(const BattinfoView&) = delete;
|
|
BattinfoView(BattinfoView&&) = delete;
|
|
BattinfoView& operator=(const BattinfoView&) = delete;
|
|
BattinfoView& operator=(BattinfoView&&) = delete;
|
|
|
|
void focus() override;
|
|
std::string title() const override { return "Battery"; };
|
|
|
|
private:
|
|
void update_result();
|
|
void on_timer();
|
|
NavigationView& nav_;
|
|
uint16_t timer_period = 60;
|
|
uint16_t timer_counter = 0;
|
|
uint8_t percent = 0;
|
|
uint16_t voltage = 0;
|
|
int32_t current = 0;
|
|
|
|
Labels labels{
|
|
{{2 * 8, 1 * 16}, "Percent:", Theme::getInstance()->fg_light->foreground},
|
|
{{2 * 8, 2 * 16}, "Voltage:", Theme::getInstance()->fg_light->foreground},
|
|
{{2 * 8, 3 * 16}, "Method:", Theme::getInstance()->fg_light->foreground},
|
|
};
|
|
|
|
Labels labels_opt{
|
|
{{2 * 8, 4 * 16}, "Current:", Theme::getInstance()->fg_light->foreground},
|
|
{{2 * 8, 5 * 16}, "Charge:", Theme::getInstance()->fg_light->foreground},
|
|
{{2 * 8, 6 * 16}, "TTF/E:", Theme::getInstance()->fg_light->foreground},
|
|
{{2 * 8, 7 * 16}, "Cycles:", Theme::getInstance()->fg_light->foreground},
|
|
{{2 * 8, 10 * 16}, "Change method:", Theme::getInstance()->fg_light->foreground},
|
|
};
|
|
|
|
Text text_percent{
|
|
{13 * 8, 1 * 16, 10 * 16, 16},
|
|
"-"};
|
|
Text text_voltage{
|
|
{13 * 8, 2 * 16, 10 * 16, 16},
|
|
"-"};
|
|
Text text_method{
|
|
{13 * 8, 3 * 16, 10 * 16, 16},
|
|
"-"};
|
|
Text text_current{
|
|
{13 * 8, 4 * 16, 10 * 16, 16},
|
|
"-"};
|
|
Text text_charge{
|
|
{13 * 8, 5 * 16, 10 * 16, 16},
|
|
"-"};
|
|
Text text_ttef{
|
|
{13 * 8, 6 * 16, 10 * 16, 16},
|
|
"-"};
|
|
Text text_cycles{
|
|
{13 * 8, 7 * 16, 10 * 16, 16},
|
|
"-"};
|
|
|
|
Text text_warn{
|
|
{2 * 8, 8 * 16, 30 * 8, 2 * 16},
|
|
""};
|
|
|
|
Button button_mode{
|
|
{2 * 8, 11 * 16 + 5, 5 * 16, 32},
|
|
"Volt"};
|
|
|
|
Button button_exit{
|
|
{72, 17 * 16, 96, 32},
|
|
"Back"};
|
|
static msg_t static_fn(void* arg);
|
|
Thread* thread{nullptr};
|
|
};
|
|
|
|
} /* namespace ui */
|
|
|
|
#endif /*__UI_BATTINFO__*/
|