"At least it builds !"

This commit is contained in:
furrtek 2016-04-21 22:12:51 +02:00
parent 1b0da68d65
commit 2fcfdba9ea
19 changed files with 46 additions and 87 deletions

View file

@ -172,9 +172,6 @@ private:
NoTouch,
TouchDetected,
};
static float cmx;
static float cmy;
static constexpr uint32_t width_pixels = 240;
static constexpr uint32_t height_pixels = 320;
@ -183,12 +180,12 @@ private:
static constexpr size_t touch_count_threshold { 4 };
static constexpr uint32_t touch_stable_bound { 4 };
static constexpr float calib_x_low = 0.15f;
static constexpr float calib_x_high = 0.93f;
static constexpr float calib_x_low = 0.07f;
static constexpr float calib_x_high = 0.94f;
static constexpr float calib_x_range = calib_x_high - calib_x_low;
static constexpr float calib_y_low = 0.05f;
static constexpr float calib_y_high = 0.84f;
static constexpr float calib_y_low = 0.04f;
static constexpr float calib_y_high = 0.91f;
static constexpr float calib_y_range = calib_y_high - calib_y_low;
// Ensure filter length is equal or less than touch_count_threshold,
@ -212,8 +209,6 @@ private:
};
}
ui::Point raw_point() const ;
void touch_started() {
fire_event(ui::TouchEvent::Type::Start);
}
@ -228,7 +223,7 @@ private:
void fire_event(ui::TouchEvent::Type type) {
if( on_event ) {
on_event({ filtered_point(), type, raw_point() });
on_event({ filtered_point(), type });
}
}
};

View file

@ -26,6 +26,7 @@
#include "ymdata.hpp"
#include "portapack.hpp"
#include "audio.hpp"
#include "event_m0.hpp"
#include "ui_about.hpp"
@ -73,7 +74,7 @@ void AboutView::on_show() {
transmitter_model.set_tuning_frequency(92200000); // 92.2MHz, change !
portapack::audio_codec.set_headphone_volume(volume_t::decibel(0 - 99) + wolfson::wm8731::headphone_gain_range.max);
audio::headphone::set_volume(volume_t::decibel(0 - 99) + audio::headphone::volume_range().max);
transmitter_model.enable();
}
@ -350,7 +351,7 @@ void AboutView::update() {
// Slowly increase volume to avoid jumpscare
if (headphone_vol < (70<<2)) {
portapack::audio_codec.set_headphone_volume(volume_t::decibel((headphone_vol/4) - 99) + wolfson::wm8731::headphone_gain_range.max);
audio::headphone::set_volume(volume_t::decibel((headphone_vol/4) - 99) + audio::headphone::volume_range().max);
headphone_vol++;
}
}

View file

@ -25,7 +25,7 @@
#include "ui_painter.hpp"
#include "ui_menu.hpp"
#include "ui_navigation.hpp"
#include "m4_startup.hpp"
#include "core_control.hpp"
#include "ui_font_fixed_8x16.hpp"
namespace ui {

View file

@ -52,20 +52,10 @@ void MenuItemView::paint(Painter& painter) {
r,
paint_style.background
);
ui::Color final_item_color = item.color;
if (final_item_color.v == paint_style.background.v) final_item_color = paint_style.foreground;
Style text_style {
.font = paint_style.font,
.background = paint_style.background,
.foreground = final_item_color
};
painter.draw_string(
{ static_cast<Coord>(r.pos.x + 8), static_cast<Coord>(r.pos.y + (r.size.h - font_height) / 2) },
text_style,
{ r.pos.x + 8, r.pos.y + (r.size.h - font_height) / 2 },
paint_style,
item.text
);
}

View file

@ -34,7 +34,6 @@ namespace ui {
struct MenuItem {
std::string text;
ui::Color color;
std::function<void(void)> on_select;
// TODO: Prevent default-constructed MenuItems.

View file

@ -23,7 +23,7 @@
#include "portapack.hpp"
#include "event_m0.hpp"
#include "portapack_persistent_memory.hpp"
#include "splash.hpp"
#include "ui_about.hpp"
@ -299,7 +299,7 @@ BMPView::BMPView(NavigationView& nav) {
button_done.on_select = [this,&nav](Button&){
nav.pop();
nav.push(new SystemMenuView { nav });
nav.push<SystemMenuView>();
};
}
@ -316,7 +316,7 @@ void PlayDeadView::focus() {
PlayDeadView::PlayDeadView(NavigationView& nav, bool booting) {
_booting = booting;
persistent_memory::set_playing_dead(0x59);
portapack::persistent_memory::set_playing_dead(0x59);
add_children({ {
&text_playdead1,
@ -329,8 +329,8 @@ PlayDeadView::PlayDeadView(NavigationView& nav, bool booting) {
};
button_done.on_select = [this,&nav](Button&){
if (sequence == persistent_memory::playdead_sequence()) {
persistent_memory::set_playing_dead(0);
if (sequence == portapack::persistent_memory::playdead_sequence()) {
portapack::persistent_memory::set_playing_dead(0);
if (_booting) {
nav.pop();
nav.push<SystemMenuView>();

View file

@ -187,8 +187,8 @@ void SetTouchCalibView::focus() {
bool SetTouchCalibView::on_touch(const TouchEvent event) {
if (event.type == ui::TouchEvent::Type::Start) {
text_debugx.set(to_string_dec_uint(round(event.rawpoint.x), 4));
text_debugy.set(to_string_dec_uint(round(event.rawpoint.y), 4));
text_debugx.set(to_string_dec_uint(round(event.point.x), 4));
text_debugy.set(to_string_dec_uint(round(event.point.y), 4));
}
return true;
}
@ -441,6 +441,15 @@ void ModInfoView::focus() {
SetupMenuView::SetupMenuView(NavigationView& nav) {
add_items<7>({ {
{ "SD card modules", [&nav](){ nav.push<ModInfoView>(); } },
{ "Date/Time", [&nav](){ nav.push<SetDateTimeView>(); } },
{ "Frequency correction", [&nav](){ nav.push<SetFrequencyCorrectionView>(); } },
{ "Antenna Bias Voltage", [&nav](){ nav.push<AntennaBiasSetupView>(); } },
{ "Touch screen", [&nav](){ nav.push<SetTouchCalibView>(); } },
{ "Play dead", [&nav](){ nav.push<SetPlayDeadView>(); } },
{ "UI", [&nav](){ nav.push<SetUIView>(); } },
} });
/*add_items<7>({ {
{ "SD card modules", ui::Color::white(), [&nav](){ nav.push<ModInfoView>(); } },
{ "Date/Time", ui::Color::white(), [&nav](){ nav.push<SetDateTimeView>(); } },
{ "Frequency correction", ui::Color::white(), [&nav](){ nav.push<SetFrequencyCorrectionView>(); } },
@ -448,7 +457,7 @@ SetupMenuView::SetupMenuView(NavigationView& nav) {
{ "Touch screen", ui::Color::white(), [&nav](){ nav.push<SetTouchCalibView>(); } },
{ "Play dead", ui::Color::red(), [&nav](){ nav.push<SetPlayDeadView>(); } },
{ "UI", ui::Color::white(), [&nav](){ nav.push<SetUIView>(); } },
} });
} });*/
on_left = [&nav](){ nav.pop(); };
}

View file

@ -26,6 +26,7 @@
#include "hackrf_hal.hpp"
#include "event_m0.hpp"
#include "audio.hpp"
#include "ui_alphanum.hpp"
#include "ff.h"
#include "hackrf_gpio.hpp"
@ -204,7 +205,7 @@ void XylosView::journuit() {
upd_message();
portapack::audio_codec.set_headphone_volume(volume_t::decibel(90 - 99) + wolfson::wm8731::headphone_gain_range.max);
audio::headphone::set_volume(volume_t::decibel(90 - 99) + audio::headphone::volume_range().max);
shared_memory.xylos_transmit_done = false;
memcpy(shared_memory.xylosdata, ccirmessage, 21);
transmitter_model.enable();
@ -326,7 +327,7 @@ XylosView::XylosView(
[this,&transmitter_model](Message* const p) {
const auto message = static_cast<const TXDoneMessage*>(p);
if (message->n == 25) {
portapack::audio_codec.set_headphone_volume(volume_t::decibel(0 - 99) + wolfson::wm8731::headphone_gain_range.max);
audio::headphone::set_volume(volume_t::decibel(0 - 99) + audio::headphone::volume_range().max);
transmitter_model.disable();
txing = false;
button_txtest.set_style(&style_val);
@ -341,7 +342,7 @@ XylosView::XylosView(
transmitter_model.set_tuning_frequency(xylos_freqs[options_freq.selected_index()]);
portapack::audio_codec.set_headphone_volume(volume_t::decibel(90 - 99) + wolfson::wm8731::headphone_gain_range.max);
audio::headphone::set_volume(volume_t::decibel(90 - 99) + audio::headphone::volume_range().max);
txing = true;
button_txtest.set_style(&style_cancel);
@ -362,7 +363,7 @@ XylosView::XylosView(
char progress[21];
const auto message = static_cast<const TXDoneMessage*>(p);
if (message->n == 25) {
portapack::audio_codec.set_headphone_volume(volume_t::decibel(0 - 99) + wolfson::wm8731::headphone_gain_range.max);
audio::headphone::set_volume(volume_t::decibel(0 - 99) + audio::headphone::volume_range().max);
transmitter_model.disable();
for (c=0;c<20;c++)
progress[c] = ' ';
@ -390,7 +391,7 @@ XylosView::XylosView(
transmitter_model.set_tuning_frequency(xylos_freqs[options_freq.selected_index()]);
portapack::audio_codec.set_headphone_volume(volume_t::decibel(90 - 99) + wolfson::wm8731::headphone_gain_range.max);
audio::headphone::set_volume(volume_t::decibel(90 - 99) + audio::headphone::volume_range().max);
txing = true;
button_transmit.set_style(&style_cancel);