Custom waterfall colors (#2617)

* Custom waterfall gradient
* Installing a custom waterfall gradient via fileman
* default file for user friendly swap
Co-authored-by: gullradriel <gullradriel@no-mail.com>
This commit is contained in:
Oleg Belousov
2025-04-11 13:46:04 +03:00
committed by GitHub
parent eff214cc79
commit f941ae871a
20 changed files with 250 additions and 269 deletions

View File

@@ -21,8 +21,6 @@
#include "ui_spectrum.hpp"
#include "spectrum_color_lut.hpp"
#include "portapack.hpp"
using namespace portapack;
@@ -271,12 +269,12 @@ void WaterfallWidget::on_channel_spectrum(
std::array<Color, 240> pixel_row;
for (size_t i = 0; i < 120; i++) {
const auto pixel_color = spectrum_rgb3_lut[spectrum.db[256 - 120 + i]];
const auto pixel_color = gradient.lut[spectrum.db[256 - 120 + i]];
pixel_row[i] = pixel_color;
}
for (size_t i = 120; i < 240; i++) {
const auto pixel_color = spectrum_rgb3_lut[spectrum.db[i - 120]];
const auto pixel_color = gradient.lut[spectrum.db[i - 120]];
pixel_row[i] = pixel_color;
}
@@ -305,6 +303,10 @@ WaterfallView::WaterfallView(const bool cursor) {
frequency_scale.on_select = [this](int32_t offset) {
if (on_select) on_select(offset);
};
if (!waterfall_widget.gradient.load_file(default_gradient_file)) {
waterfall_widget.gradient.set_default();
}
}
void WaterfallView::on_show() {

View File

@@ -24,6 +24,7 @@
#include "ui.hpp"
#include "ui_widget.hpp"
#include "gradient.hpp"
#include "event_m0.hpp"
@@ -111,6 +112,8 @@ class FrequencyScale : public Widget {
class WaterfallWidget : public Widget {
public:
Gradient gradient{};
void on_show() override;
void on_hide() override;
void paint(Painter&) override {}