mirror of
https://github.com/eried/portapack-mayhem.git
synced 2024-12-17 19:54:35 -05:00
Loadmodule emergency fix
This commit is contained in:
parent
44d26d1789
commit
ba94ce55ef
@ -105,14 +105,14 @@ void m4_switch(const char * hash) {
|
|||||||
modhash = const_cast<char*>(hash);
|
modhash = const_cast<char*>(hash);
|
||||||
|
|
||||||
// Ask M4 to enter wait loop in RAM
|
// Ask M4 to enter wait loop in RAM
|
||||||
BasebandConfiguration baseband_switch {
|
/*BasebandConfiguration baseband_switch {
|
||||||
.mode = 255, // DEBUG
|
.mode = 255,
|
||||||
.sampling_rate = 0,
|
.sampling_rate = 0,
|
||||||
.decimation_factor = 1,
|
.decimation_factor = 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
BasebandConfigurationMessage message { baseband_switch };
|
BasebandConfigurationMessage message { baseband_switch };
|
||||||
shared_memory.baseband_queue.push(message);
|
shared_memory.baseband_queue.push(message);*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void m4_request_shutdown() {
|
void m4_request_shutdown() {
|
||||||
|
@ -192,7 +192,7 @@ LCRView::LCRView(
|
|||||||
|
|
||||||
transmitter_model.set_baseband_configuration({
|
transmitter_model.set_baseband_configuration({
|
||||||
.mode = 1,
|
.mode = 1,
|
||||||
.sampling_rate = 1536000, // Is this right ?
|
.sampling_rate = 2280000, // Is this right ?
|
||||||
.decimation_factor = 1,
|
.decimation_factor = 1,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -323,7 +323,7 @@ LCRView::LCRView(
|
|||||||
transmitter_model.enable();
|
transmitter_model.enable();
|
||||||
};
|
};
|
||||||
|
|
||||||
button_txsetup.on_select = [&nav, &transmitter_model](Button&){
|
button_txsetup.on_select = [&nav](Button&){
|
||||||
nav.push(new AFSKSetupView { nav });
|
nav.push(new AFSKSetupView { nav });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ private:
|
|||||||
|
|
||||||
Checkbox checkbox_am_a {
|
Checkbox checkbox_am_a {
|
||||||
{ 16, 68 },
|
{ 16, 68 },
|
||||||
20,
|
0,
|
||||||
""
|
""
|
||||||
};
|
};
|
||||||
Button button_setam_a {
|
Button button_setam_a {
|
||||||
@ -94,7 +94,7 @@ private:
|
|||||||
};
|
};
|
||||||
Checkbox checkbox_am_b {
|
Checkbox checkbox_am_b {
|
||||||
{ 16, 68+40 },
|
{ 16, 68+40 },
|
||||||
20,
|
0,
|
||||||
""
|
""
|
||||||
};
|
};
|
||||||
Button button_setam_b {
|
Button button_setam_b {
|
||||||
@ -103,7 +103,7 @@ private:
|
|||||||
};
|
};
|
||||||
Checkbox checkbox_am_c {
|
Checkbox checkbox_am_c {
|
||||||
{ 16, 68+40+40 },
|
{ 16, 68+40+40 },
|
||||||
20,
|
0,
|
||||||
" "
|
" "
|
||||||
};
|
};
|
||||||
Button button_setam_c {
|
Button button_setam_c {
|
||||||
@ -112,7 +112,7 @@ private:
|
|||||||
};
|
};
|
||||||
Checkbox checkbox_am_d {
|
Checkbox checkbox_am_d {
|
||||||
{ 16, 68+40+40+40 },
|
{ 16, 68+40+40+40 },
|
||||||
20,
|
0,
|
||||||
""
|
""
|
||||||
};
|
};
|
||||||
Button button_setam_d {
|
Button button_setam_d {
|
||||||
@ -121,7 +121,7 @@ private:
|
|||||||
};
|
};
|
||||||
Checkbox checkbox_am_e {
|
Checkbox checkbox_am_e {
|
||||||
{ 16, 68+40+40+40+40 },
|
{ 16, 68+40+40+40+40 },
|
||||||
20,
|
0,
|
||||||
""
|
""
|
||||||
};
|
};
|
||||||
Button button_setam_e {
|
Button button_setam_e {
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
using namespace hackrf::one;
|
using namespace portapack;
|
||||||
|
|
||||||
namespace ui {
|
namespace ui {
|
||||||
|
|
||||||
@ -53,31 +53,20 @@ void LoadModuleView::on_hide() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void LoadModuleView::on_show() {
|
void LoadModuleView::on_show() {
|
||||||
// Ask for MD5 signature and compare
|
char md5_signature[16];
|
||||||
ModuleIDMessage message;
|
uint8_t c;
|
||||||
|
|
||||||
//message_map.unregister_handler(Message::ID::ModuleID);
|
|
||||||
|
|
||||||
EventDispatcher::message_map().register_handler(Message::ID::ModuleID,
|
memcpy(md5_signature, (const void *)(0x10087FF0), 16);
|
||||||
[this](Message* const p) {
|
for (c=0; c<16; c++) {
|
||||||
uint8_t c;
|
if (md5_signature[c] != _hash[c]) break;
|
||||||
const auto message = static_cast<const ModuleIDMessage*>(p);
|
}
|
||||||
if (message->query == false) { // Shouldn't be needed
|
if (c == 16) {
|
||||||
for (c=0;c<16;c++) {
|
text_info.set("Module already loaded :)");
|
||||||
if (message->md5_signature[c] != _hash[c]) break;
|
_mod_loaded = true;
|
||||||
}
|
} else {
|
||||||
if (c == 16) {
|
text_info.set("Loading module");
|
||||||
text_info.set("Module already loaded :)");
|
loadmodule();
|
||||||
_mod_loaded = true;
|
}
|
||||||
} else {
|
|
||||||
loadmodule();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
message.query = true;
|
|
||||||
shared_memory.baseband_queue.push(message);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int LoadModuleView::load_image() {
|
int LoadModuleView::load_image() {
|
||||||
@ -133,9 +122,11 @@ int LoadModuleView::load_image() {
|
|||||||
void LoadModuleView::loadmodule() {
|
void LoadModuleView::loadmodule() {
|
||||||
//message_map.unregister_handler(Message::ID::ReadyForSwitch);
|
//message_map.unregister_handler(Message::ID::ReadyForSwitch);
|
||||||
|
|
||||||
EventDispatcher::message_map().register_handler(Message::ID::ReadyForSwitch,
|
m4_switch(_hash);
|
||||||
|
|
||||||
|
/*EventDispatcher::message_map().register_handler(Message::ID::ReadyForSwitch,
|
||||||
[this](Message* const p) {
|
[this](Message* const p) {
|
||||||
(void)p;
|
(void)p;*/
|
||||||
if (load_image()) {
|
if (load_image()) {
|
||||||
text_info.set(to_string_hex(*((unsigned int*)0x10080000),8));
|
text_info.set(to_string_hex(*((unsigned int*)0x10080000),8));
|
||||||
//text_infob.set(to_string_hex(*((unsigned int*)0x10080004),8));
|
//text_infob.set(to_string_hex(*((unsigned int*)0x10080004),8));
|
||||||
@ -145,10 +136,9 @@ void LoadModuleView::loadmodule() {
|
|||||||
text_info.set("Module not found :(");
|
text_info.set("Module not found :(");
|
||||||
_mod_loaded = false;
|
_mod_loaded = false;
|
||||||
}
|
}
|
||||||
}
|
// }
|
||||||
);
|
//);
|
||||||
|
|
||||||
m4_switch(_hash);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LoadModuleView::LoadModuleView(
|
LoadModuleView::LoadModuleView(
|
||||||
@ -166,7 +156,7 @@ LoadModuleView::LoadModuleView(
|
|||||||
_hash = hash;
|
_hash = hash;
|
||||||
|
|
||||||
button_ok.on_select = [this,&nav,new_view](Button&){
|
button_ok.on_select = [this,&nav,new_view](Button&){
|
||||||
nav.pop();
|
//nav.pop();
|
||||||
if (_mod_loaded == true) nav.push(new_view);
|
if (_mod_loaded == true) nav.push(new_view);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
Binary file not shown.
@ -123,6 +123,22 @@ void BasebandThread::run() {
|
|||||||
delete baseband_buffer;
|
delete baseband_buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char ram_loop[32];
|
||||||
|
typedef int (*fn_ptr)(void);
|
||||||
|
fn_ptr loop_ptr;
|
||||||
|
|
||||||
|
void ram_loop_fn(void) {
|
||||||
|
while(1) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
void BasebandThread::wait_for_switch(void) {
|
||||||
|
memcpy(&ram_loop[0], reinterpret_cast<char*>(&ram_loop_fn), 32);
|
||||||
|
loop_ptr = reinterpret_cast<fn_ptr>(&ram_loop[0]);
|
||||||
|
ReadyForSwitchMessage message;
|
||||||
|
shared_memory.application_queue.push(message);
|
||||||
|
(*loop_ptr)();
|
||||||
|
}
|
||||||
|
|
||||||
BasebandProcessor* BasebandThread::create_processor(const int32_t mode) {
|
BasebandProcessor* BasebandThread::create_processor(const int32_t mode) {
|
||||||
switch(mode) {
|
switch(mode) {
|
||||||
case 0: return new NarrowbandAMAudio();
|
case 0: return new NarrowbandAMAudio();
|
||||||
@ -132,6 +148,7 @@ BasebandProcessor* BasebandThread::create_processor(const int32_t mode) {
|
|||||||
case 4: return new WidebandSpectrum();
|
case 4: return new WidebandSpectrum();
|
||||||
case 5: return new TPMSProcessor();
|
case 5: return new TPMSProcessor();
|
||||||
case 6: return new ERTProcessor();
|
case 6: return new ERTProcessor();
|
||||||
|
case 255: wait_for_switch();
|
||||||
default: return nullptr;
|
default: return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -45,6 +45,8 @@ public:
|
|||||||
return baseband::Direction::Receive;
|
return baseband::Direction::Receive;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wait_for_switch(void);
|
||||||
|
|
||||||
Thread* thread_main { nullptr };
|
Thread* thread_main { nullptr };
|
||||||
Thread* thread_rssi { nullptr };
|
Thread* thread_rssi { nullptr };
|
||||||
BasebandProcessor* baseband_processor { nullptr };
|
BasebandProcessor* baseband_processor { nullptr };
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
const char md5_baseband[16] = {0xba,0x35,0x2a,0xd7,0x2c,0x17,0x40,0x68,0x54,0x8a,0x5f,0x9a,0x98,0x8b,0x9d,0x73,};
|
const char md5_baseband[16] = {0x03,0x77,0xc0,0x0b,0x13,0x5b,0x84,0x72,0x8f,0x4b,0xbb,0x51,0x48,0x54,0x82,0xd3,};
|
||||||
const char md5_baseband_tx[16] = {0x65,0x3a,0x50,0x6c,0xf4,0x93,0x69,0xce,0x8c,0x8d,0x3c,0xb6,0x9e,0x21,0xba,0xd8,};
|
const char md5_baseband_tx[16] = {0xa3,0xb9,0xd4,0x35,0xb5,0xe0,0x66,0x82,0xac,0x61,0x59,0xa1,0x27,0x36,0x0b,0xfe,};
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user