Playdead default sequence and validity check

This commit is contained in:
furrtek 2016-12-26 13:49:23 +01:00
parent a0b4212c92
commit f033782d4b
5 changed files with 29 additions and 12 deletions

View File

@ -23,30 +23,30 @@
// Color bitmaps generated with: // Color bitmaps generated with:
// Gimp image > indexed colors (16), then "xxd -i *.bmp" // Gimp image > indexed colors (16), then "xxd -i *.bmp"
//BUG: Xylos doesn't play last tone ?
//BUG (fixed ?): Unistroke text entry screen doesn't care about string max length parameter
//TEST: Imperial in whipcalc //TEST: Imperial in whipcalc
//TEST: Numbers //TEST: Numbers
//TEST: Jammer //TEST: Jammer
//TEST: Frequency manager + save/load //TEST: Frequency manager + save/load
//BUG: Xylos doesn't play last tone ?
//TODO: Morse coder for foxhunts
//TODO: Finish EPAR tx
//TODO: Test dual tone in proc_tones and remove proc_dtmf_tx
//TODO: IQ replay
//TODO: Waveform widget ?
//TODO: Wav visualizer
//BUG: POCSAG RX sometimes misses the first codeword after SYNC //BUG: POCSAG RX sometimes misses the first codeword after SYNC
//BUG: Check AFSK transmit end, skips last bits ? //BUG: Check AFSK transmit end, skips last bits ?
//BUG: RDS doesn't stop baseband when stopping tx ? //BUG: RDS doesn't stop baseband when stopping tx ?
//TODO: File browser ? //TODO: File browser ?
//TODO: Mousejack ? //TODO: Mousejack ?
//TODO: Waveform widget ?
//TODO: Wav visualizer
//TODO: Move frequencykeypad from ui_receiver to ui_widget (used everywhere) //TODO: Move frequencykeypad from ui_receiver to ui_widget (used everywhere)
//TODO: ADS-B draw trajectory + GPS coordinates + scale, and playback //TODO: ADS-B draw trajectory + GPS coordinates + scale, and playback
//TODO: Finish EPAR tx
//TODO: Analog TV tx with camcorder font character generator //TODO: Analog TV tx with camcorder font character generator
//TODO: Test dual tone in proc_tones and remove proc_dtmf_tx
//TODO: Morse coder for foxhunts
//TODO: Make Morse coder and Whistle use proc_tones //TODO: Make Morse coder and Whistle use proc_tones
//TODO: RDS multiple groups (sequence) //TODO: RDS multiple groups (sequence)
//TODO: IQ replay
//TODO: Use ModalMessageView confirmation for TX ? //TODO: Use ModalMessageView confirmation for TX ?
//TODO: Show address/data bit fields in OOK TX //TODO: Show address/data bit fields in OOK TX
//TODO: Scan for OOK TX //TODO: Scan for OOK TX

View File

@ -393,6 +393,8 @@ SystemView::SystemView(
this->status_view.set_title(new_view.title()); this->status_view.set_title(new_view.title());
}; };
// portapack::persistent_memory::set_playdead_sequence(0x8D1);
// Initial view // Initial view
if ((portapack::persistent_memory::playing_dead() == 0x5920C1DF) || // Enable code if ((portapack::persistent_memory::playing_dead() == 0x5920C1DF) || // Enable code
(portapack::persistent_memory::ui_config() & 16)) { // Login option (portapack::persistent_memory::ui_config() & 16)) { // Login option
@ -459,7 +461,7 @@ PlayDeadView::PlayDeadView(NavigationView& nav) {
text_playdead3.hidden(true); text_playdead3.hidden(true);
button_seq_entry.on_dir = [this](Button&, KeyEvent key){ button_seq_entry.on_dir = [this](Button&, KeyEvent key){
sequence = (sequence << 3) | static_cast<std::underlying_type<KeyEvent>::type>(key); sequence = (sequence << 3) | (static_cast<std::underlying_type<KeyEvent>::type>(key) + 1);
return true; return true;
}; };

View File

@ -22,6 +22,7 @@
#include "ui_setup.hpp" #include "ui_setup.hpp"
#include "ui_navigation.hpp"
#include "ui_touch_calibration.hpp" #include "ui_touch_calibration.hpp"
#include "portapack_persistent_memory.hpp" #include "portapack_persistent_memory.hpp"
@ -193,9 +194,13 @@ SetPlayDeadView::SetPlayDeadView(NavigationView& nav) {
button_cancel.hidden(true); button_cancel.hidden(true);
set_dirty(); set_dirty();
} else { } else {
if (sequence == 0x8D1) // U D L R
nav.display_modal("Warning", "Default sequence entered !", ABORT, nullptr);
else {
persistent_memory::set_playdead_sequence(sequence); persistent_memory::set_playdead_sequence(sequence);
nav.pop(); nav.pop();
} }
}
}; };
button_enter.on_dir = [this](Button&, KeyEvent key){ button_enter.on_dir = [this](Button&, KeyEvent key){
@ -210,7 +215,7 @@ SetPlayDeadView::SetPlayDeadView(NavigationView& nav) {
else if (key_code == 3) else if (key_code == 3)
sequence_txt[keycount] = 'U'; sequence_txt[keycount] = 'U';
text_sequence.set(sequence_txt); text_sequence.set(sequence_txt);
sequence = (sequence << 3) | key_code; sequence = (sequence << 3) | (key_code + 1);
keycount++; keycount++;
return true; return true;
} }

View File

@ -72,6 +72,7 @@ struct data_t {
uint32_t afsk_config; uint32_t afsk_config;
// Play dead unlock // Play dead unlock
uint32_t playdead_magic;
uint32_t playing_dead; uint32_t playing_dead;
uint32_t playdead_sequence; uint32_t playdead_sequence;
@ -168,20 +169,29 @@ void set_afsk_config(const uint32_t new_value) {
data->afsk_config = new_value; data->afsk_config = new_value;
} }
static constexpr uint32_t playdead_magic = 0x88d3bb57;
uint32_t playing_dead() { uint32_t playing_dead() {
return data->playing_dead; return data->playing_dead;
} }
void set_playing_dead(const uint32_t new_value) { void set_playing_dead(const uint32_t new_value) {
if( data->playdead_magic != playdead_magic ) {
set_playdead_sequence(0x8D1); // U D L R
}
data->playing_dead = new_value; data->playing_dead = new_value;
} }
uint32_t playdead_sequence() { uint32_t playdead_sequence() {
if( data->playdead_magic != playdead_magic ) {
set_playdead_sequence(0x8D1); // U D L R
}
return data->playdead_sequence; return data->playdead_sequence;
} }
void set_playdead_sequence(const uint32_t new_value) { void set_playdead_sequence(const uint32_t new_value) {
data->playdead_sequence = new_value; data->playdead_sequence = new_value;
data->playdead_magic = playdead_magic;
} }
bool stealth_mode() { bool stealth_mode() {

Binary file not shown.