mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2026-09-10 00:29:33 +00:00
remove const temp measurement from core to the ext app. we don't need it (#3259)
This commit is contained in:
@@ -239,7 +239,6 @@ set(CPPSRC
|
||||
serializer.cpp
|
||||
spectrum_color_lut.cpp
|
||||
string_format.cpp
|
||||
temperature_logger.cpp
|
||||
theme.cpp
|
||||
touch.cpp
|
||||
tone_key.cpp
|
||||
|
||||
@@ -400,8 +400,6 @@ void EventDispatcher::handle_local_queue() {
|
||||
void EventDispatcher::handle_rtc_tick() {
|
||||
sd_card::poll_inserted();
|
||||
|
||||
portapack::temperature_logger.second_tick();
|
||||
|
||||
const auto backlight_timer = portapack::persistent_memory::config_backlight_timer();
|
||||
if (backlight_timer.timeout_enabled()) {
|
||||
if (portapack::bl_tick_counter == backlight_timer.timeout_seconds())
|
||||
|
||||
@@ -169,6 +169,7 @@ set(EXTCPPSRC
|
||||
#mcu_temperature 112
|
||||
external/mcu_temperature/main.cpp
|
||||
external/mcu_temperature/mcu_temperature.cpp
|
||||
external/mcu_temperature/temperature_logger.cpp
|
||||
|
||||
#fmradio 640
|
||||
external/fmradio/main.cpp
|
||||
|
||||
@@ -8,14 +8,12 @@ using namespace portapack;
|
||||
namespace ui::external_app::mcu_temperature {
|
||||
|
||||
void McuTemperatureWidget::paint(Painter& painter) {
|
||||
const auto logger = portapack::temperature_logger;
|
||||
|
||||
const auto rect = screen_rect();
|
||||
const Color color_background{0, 0, 64};
|
||||
const Color color_foreground = Theme::getInstance()->fg_green->foreground;
|
||||
const Color color_reticle{128, 128, 128};
|
||||
|
||||
const auto graph_width = static_cast<int>(logger.capacity()) * bar_width;
|
||||
const auto graph_width = static_cast<int>(temperature_logger.capacity()) * bar_width;
|
||||
const Rect graph_rect{
|
||||
rect.left() + (rect.width() - graph_width) / 2, rect.top() + 8,
|
||||
graph_width, rect.height()};
|
||||
@@ -25,7 +23,7 @@ void McuTemperatureWidget::paint(Painter& painter) {
|
||||
painter.draw_rectangle(frame_rect, color_reticle);
|
||||
painter.fill_rectangle(graph_rect, color_background);
|
||||
|
||||
const auto history = logger.history();
|
||||
const auto history = temperature_logger.history();
|
||||
for (size_t i = 0; i < history.size(); i++) {
|
||||
const Coord x = graph_rect.right() - (history.size() - i) * bar_width;
|
||||
const auto sample = history[i];
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
#include "portapack.hpp"
|
||||
#include "memory_map.hpp"
|
||||
#include "irq_controls.hpp"
|
||||
|
||||
#include "temperature_logger.hpp"
|
||||
#include <functional>
|
||||
#include <utility>
|
||||
|
||||
@@ -43,14 +43,25 @@ class McuTemperatureWidget : public Widget {
|
||||
explicit McuTemperatureWidget(
|
||||
Rect parent_rect)
|
||||
: Widget{parent_rect} {
|
||||
signal_token_tick_second = rtc_time::signal_tick_second += [this]() {
|
||||
this->on_tick_second();
|
||||
};
|
||||
}
|
||||
~McuTemperatureWidget() {
|
||||
rtc_time::signal_tick_second -= signal_token_tick_second;
|
||||
}
|
||||
void on_tick_second() {
|
||||
temperature_logger.second_tick();
|
||||
set_dirty();
|
||||
}
|
||||
|
||||
void paint(Painter& painter) override;
|
||||
|
||||
private:
|
||||
TemperatureLogger temperature_logger{};
|
||||
|
||||
using sample_t = uint32_t;
|
||||
using temperature_t = int32_t;
|
||||
|
||||
SignalToken signal_token_tick_second{};
|
||||
temperature_t temperature(const sample_t sensor_value) const;
|
||||
Coord screen_y(const temperature_t temperature, const Rect& screen_rect) const;
|
||||
|
||||
|
||||
+4
@@ -25,6 +25,8 @@
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
namespace ui::external_app::mcu_temperature {
|
||||
|
||||
void TemperatureLogger::second_tick() {
|
||||
sample_phase++;
|
||||
if (sample_phase >= sample_interval) {
|
||||
@@ -67,3 +69,5 @@ void TemperatureLogger::push_sample(const TemperatureLogger::sample_t sample) {
|
||||
samples_count++;
|
||||
sample_phase = 0;
|
||||
}
|
||||
|
||||
} // namespace ui::external_app::mcu_temperature
|
||||
+4
@@ -27,6 +27,8 @@
|
||||
#include <array>
|
||||
#include <vector>
|
||||
|
||||
namespace ui::external_app::mcu_temperature {
|
||||
|
||||
class TemperatureLogger {
|
||||
public:
|
||||
using sample_t = int8_t;
|
||||
@@ -49,4 +51,6 @@ class TemperatureLogger {
|
||||
void push_sample(const sample_t sample);
|
||||
};
|
||||
|
||||
} // namespace ui::external_app::mcu_temperature
|
||||
|
||||
#endif /*__TEMPERATURE_LOGGER_H__*/
|
||||
@@ -102,8 +102,6 @@ AK4951 audio_codec_ak4951{i2c0, 0x12};
|
||||
ReceiverModel receiver_model;
|
||||
TransmitterModel transmitter_model;
|
||||
|
||||
TemperatureLogger temperature_logger;
|
||||
|
||||
bool antenna_bias{false};
|
||||
uint32_t bl_tick_counter{0};
|
||||
uint16_t touch_threshold{32};
|
||||
|
||||
@@ -36,7 +36,6 @@
|
||||
|
||||
#include "radio.hpp"
|
||||
#include "clock_manager.hpp"
|
||||
#include "temperature_logger.hpp"
|
||||
#include "theme.hpp"
|
||||
|
||||
/* TODO: This would be better as a class to add
|
||||
@@ -69,8 +68,6 @@ extern TransmitterModel transmitter_model;
|
||||
extern uint32_t bl_tick_counter;
|
||||
extern uint16_t touch_threshold;
|
||||
|
||||
extern TemperatureLogger temperature_logger;
|
||||
|
||||
/* Get or set the antenna_bias flag.
|
||||
* NB: Does not actually update the radio state. */
|
||||
void set_antenna_bias(const bool v);
|
||||
|
||||
Reference in New Issue
Block a user