mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2025-08-25 12:47:34 +00:00
Loadmodule emergency fix
This commit is contained in:
@@ -105,14 +105,14 @@ void m4_switch(const char * hash) {
|
||||
modhash = const_cast<char*>(hash);
|
||||
|
||||
// Ask M4 to enter wait loop in RAM
|
||||
BasebandConfiguration baseband_switch {
|
||||
.mode = 255, // DEBUG
|
||||
/*BasebandConfiguration baseband_switch {
|
||||
.mode = 255,
|
||||
.sampling_rate = 0,
|
||||
.decimation_factor = 1,
|
||||
};
|
||||
|
||||
BasebandConfigurationMessage message { baseband_switch };
|
||||
shared_memory.baseband_queue.push(message);
|
||||
shared_memory.baseband_queue.push(message);*/
|
||||
}
|
||||
|
||||
void m4_request_shutdown() {
|
||||
|
@@ -192,7 +192,7 @@ LCRView::LCRView(
|
||||
|
||||
transmitter_model.set_baseband_configuration({
|
||||
.mode = 1,
|
||||
.sampling_rate = 1536000, // Is this right ?
|
||||
.sampling_rate = 2280000, // Is this right ?
|
||||
.decimation_factor = 1,
|
||||
});
|
||||
|
||||
@@ -323,7 +323,7 @@ LCRView::LCRView(
|
||||
transmitter_model.enable();
|
||||
};
|
||||
|
||||
button_txsetup.on_select = [&nav, &transmitter_model](Button&){
|
||||
button_txsetup.on_select = [&nav](Button&){
|
||||
nav.push(new AFSKSetupView { nav });
|
||||
};
|
||||
|
||||
|
@@ -85,7 +85,7 @@ private:
|
||||
|
||||
Checkbox checkbox_am_a {
|
||||
{ 16, 68 },
|
||||
20,
|
||||
0,
|
||||
""
|
||||
};
|
||||
Button button_setam_a {
|
||||
@@ -94,7 +94,7 @@ private:
|
||||
};
|
||||
Checkbox checkbox_am_b {
|
||||
{ 16, 68+40 },
|
||||
20,
|
||||
0,
|
||||
""
|
||||
};
|
||||
Button button_setam_b {
|
||||
@@ -103,7 +103,7 @@ private:
|
||||
};
|
||||
Checkbox checkbox_am_c {
|
||||
{ 16, 68+40+40 },
|
||||
20,
|
||||
0,
|
||||
" "
|
||||
};
|
||||
Button button_setam_c {
|
||||
@@ -112,7 +112,7 @@ private:
|
||||
};
|
||||
Checkbox checkbox_am_d {
|
||||
{ 16, 68+40+40+40 },
|
||||
20,
|
||||
0,
|
||||
""
|
||||
};
|
||||
Button button_setam_d {
|
||||
@@ -121,7 +121,7 @@ private:
|
||||
};
|
||||
Checkbox checkbox_am_e {
|
||||
{ 16, 68+40+40+40+40 },
|
||||
20,
|
||||
0,
|
||||
""
|
||||
};
|
||||
Button button_setam_e {
|
||||
|
@@ -35,7 +35,7 @@
|
||||
#include <cstring>
|
||||
#include <stdio.h>
|
||||
|
||||
using namespace hackrf::one;
|
||||
using namespace portapack;
|
||||
|
||||
namespace ui {
|
||||
|
||||
@@ -53,31 +53,20 @@ void LoadModuleView::on_hide() {
|
||||
}
|
||||
|
||||
void LoadModuleView::on_show() {
|
||||
// Ask for MD5 signature and compare
|
||||
ModuleIDMessage message;
|
||||
|
||||
//message_map.unregister_handler(Message::ID::ModuleID);
|
||||
char md5_signature[16];
|
||||
uint8_t c;
|
||||
|
||||
EventDispatcher::message_map().register_handler(Message::ID::ModuleID,
|
||||
[this](Message* const p) {
|
||||
uint8_t c;
|
||||
const auto message = static_cast<const ModuleIDMessage*>(p);
|
||||
if (message->query == false) { // Shouldn't be needed
|
||||
for (c=0;c<16;c++) {
|
||||
if (message->md5_signature[c] != _hash[c]) break;
|
||||
}
|
||||
if (c == 16) {
|
||||
text_info.set("Module already loaded :)");
|
||||
_mod_loaded = true;
|
||||
} else {
|
||||
loadmodule();
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
message.query = true;
|
||||
shared_memory.baseband_queue.push(message);
|
||||
memcpy(md5_signature, (const void *)(0x10087FF0), 16);
|
||||
for (c=0; c<16; c++) {
|
||||
if (md5_signature[c] != _hash[c]) break;
|
||||
}
|
||||
if (c == 16) {
|
||||
text_info.set("Module already loaded :)");
|
||||
_mod_loaded = true;
|
||||
} else {
|
||||
text_info.set("Loading module");
|
||||
loadmodule();
|
||||
}
|
||||
}
|
||||
|
||||
int LoadModuleView::load_image() {
|
||||
@@ -133,9 +122,11 @@ int LoadModuleView::load_image() {
|
||||
void LoadModuleView::loadmodule() {
|
||||
//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) {
|
||||
(void)p;
|
||||
(void)p;*/
|
||||
if (load_image()) {
|
||||
text_info.set(to_string_hex(*((unsigned int*)0x10080000),8));
|
||||
//text_infob.set(to_string_hex(*((unsigned int*)0x10080004),8));
|
||||
@@ -145,10 +136,9 @@ void LoadModuleView::loadmodule() {
|
||||
text_info.set("Module not found :(");
|
||||
_mod_loaded = false;
|
||||
}
|
||||
}
|
||||
);
|
||||
// }
|
||||
//);
|
||||
|
||||
m4_switch(_hash);
|
||||
}
|
||||
|
||||
LoadModuleView::LoadModuleView(
|
||||
@@ -166,7 +156,7 @@ LoadModuleView::LoadModuleView(
|
||||
_hash = hash;
|
||||
|
||||
button_ok.on_select = [this,&nav,new_view](Button&){
|
||||
nav.pop();
|
||||
//nav.pop();
|
||||
if (_mod_loaded == true) nav.push(new_view);
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user