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