mirror of
https://github.com/eried/portapack-mayhem.git
synced 2024-10-01 01:26:06 -04:00
Compare commits
5 Commits
c88c52dffd
...
958a7c05c2
Author | SHA1 | Date | |
---|---|---|---|
|
958a7c05c2 | ||
|
b43eaa8786 | ||
|
b19ed5fec5 | ||
|
c52c48090a | ||
|
fd0124ac48 |
@ -98,7 +98,6 @@ rf::Frequency GlassView::get_freq_from_bin_pos(uint8_t pos) {
|
||||
freq_at_pos = f_center_ini + ((pos - 120) * ((looking_glass_range - ((16 * looking_glass_range) / SPEC_NB_BINS)) / 2)) / (SCREEN_W / 2);
|
||||
} else
|
||||
freq_at_pos = f_min + (2 * offset * each_bin_size) + (pos * looking_glass_range) / SCREEN_W;
|
||||
|
||||
return freq_at_pos;
|
||||
}
|
||||
|
||||
@ -257,7 +256,7 @@ void GlassView::on_range_changed() {
|
||||
bin_length = SCREEN_W;
|
||||
ignore_dc = 0;
|
||||
looking_glass_bandwidth = looking_glass_range;
|
||||
looking_glass_sampling_rate = looking_glass_bandwidth;
|
||||
looking_glass_sampling_rate = looking_glass_range;
|
||||
each_bin_size = looking_glass_bandwidth / SCREEN_W;
|
||||
looking_glass_step = looking_glass_bandwidth;
|
||||
f_center_ini = f_min + (looking_glass_bandwidth / 2); // Initial center frequency for sweep
|
||||
@ -265,7 +264,7 @@ void GlassView::on_range_changed() {
|
||||
// view is made in multiple pass, use original bin picking
|
||||
mode = scan_type.selected_index_value();
|
||||
looking_glass_bandwidth = LOOKING_GLASS_SLICE_WIDTH_MAX;
|
||||
looking_glass_sampling_rate = LOOKING_GLASS_SLICE_WIDTH_MAX;
|
||||
looking_glass_sampling_rate = LOOKING_GLASS_MAX_SAMPLERATE;
|
||||
each_bin_size = LOOKING_GLASS_SLICE_WIDTH_MAX / SPEC_NB_BINS;
|
||||
if (mode == LOOKING_GLASS_FASTSCAN) {
|
||||
offset = 2;
|
||||
@ -315,8 +314,8 @@ void GlassView::update_min(int32_t v) {
|
||||
int32_t min_size = steps;
|
||||
if (locked_range)
|
||||
min_size = search_span;
|
||||
if (min_size < 2)
|
||||
min_size = 2;
|
||||
if (min_size < 1)
|
||||
min_size = 1;
|
||||
if (v > 7200 - min_size) {
|
||||
v = 7200 - min_size;
|
||||
}
|
||||
@ -332,8 +331,8 @@ void GlassView::update_max(int32_t v) {
|
||||
int32_t min_size = steps;
|
||||
if (locked_range)
|
||||
min_size = search_span;
|
||||
if (min_size < 2)
|
||||
min_size = 2;
|
||||
if (min_size < 1)
|
||||
min_size = 1;
|
||||
if (v < min_size) {
|
||||
v = min_size;
|
||||
}
|
||||
@ -487,7 +486,12 @@ GlassView::GlassView(
|
||||
range_presets.set_selected_index(preset_index);
|
||||
|
||||
field_marker.on_encoder_change = [this](TextField&, EncoderEvent delta) {
|
||||
marker_pixel_index = clip<uint8_t>(marker_pixel_index + delta, 0, SCREEN_W);
|
||||
if ((marker_pixel_index + delta) < 0)
|
||||
marker_pixel_index = marker_pixel_index + delta + SCREEN_W;
|
||||
else if ((marker_pixel_index + delta) > SCREEN_W)
|
||||
marker_pixel_index = marker_pixel_index + delta - SCREEN_W;
|
||||
else
|
||||
marker_pixel_index = marker_pixel_index + delta;
|
||||
on_marker_change();
|
||||
};
|
||||
|
||||
|
@ -40,6 +40,7 @@
|
||||
namespace ui {
|
||||
|
||||
#define LOOKING_GLASS_SLICE_WIDTH_MAX 20000000
|
||||
#define LOOKING_GLASS_MAX_SAMPLERATE 20000000
|
||||
#define MHZ_DIV 1000000
|
||||
|
||||
// blanked DC (16 centered bins ignored ) and top left and right (2 bins ignored on each side )
|
||||
|
@ -32,6 +32,8 @@
|
||||
#include "chprintf.h"
|
||||
#include "portapack.hpp"
|
||||
|
||||
#include "platform_detect.h"
|
||||
|
||||
/**
|
||||
* @brief Shell termination event source.
|
||||
*/
|
||||
@ -65,6 +67,39 @@ static void list_commands(BaseSequentialStream* chp, const ShellCommand* scp) {
|
||||
}
|
||||
}
|
||||
|
||||
static const char* get_board_revision_string(board_rev_t rev) {
|
||||
switch (rev) {
|
||||
case BOARD_REV_HACKRF1_OLD:
|
||||
return "HackRF R1-R5";
|
||||
case BOARD_REV_HACKRF1_R6:
|
||||
return "HackRF R6";
|
||||
case BOARD_REV_HACKRF1_R7:
|
||||
return "HackRF R7";
|
||||
case BOARD_REV_HACKRF1_R8:
|
||||
return "HackRF R8";
|
||||
case BOARD_REV_HACKRF1_R9:
|
||||
return "HackRF R9";
|
||||
case BOARD_REV_HACKRF1_R10:
|
||||
return "HackRF R10";
|
||||
case BOARD_REV_GSG_HACKRF1_R6:
|
||||
return "GSG HackRF R6";
|
||||
case BOARD_REV_GSG_HACKRF1_R7:
|
||||
return "GSG HackRF R7";
|
||||
case BOARD_REV_GSG_HACKRF1_R8:
|
||||
return "GSG HackRF R8";
|
||||
case BOARD_REV_GSG_HACKRF1_R9:
|
||||
return "GSG HackRF R9";
|
||||
case BOARD_REV_GSG_HACKRF1_R10:
|
||||
return "GSG HackRF R10";
|
||||
case BOARD_REV_UNRECOGNIZED:
|
||||
return "Unrecognized";
|
||||
case BOARD_REV_UNDETECTED:
|
||||
return "Undetected";
|
||||
default:
|
||||
return "Unknown";
|
||||
}
|
||||
}
|
||||
|
||||
static void cmd_info(BaseSequentialStream* chp, int argc, char* argv[]) {
|
||||
(void)argv;
|
||||
if (argc > 0) {
|
||||
@ -92,7 +127,11 @@ static void cmd_info(BaseSequentialStream* chp, int argc, char* argv[]) {
|
||||
#ifdef VERSION_STRING
|
||||
chprintf(chp, "Mayhem Version: %s\r\n", VERSION_STRING);
|
||||
#endif
|
||||
chprintf(chp, "HackRF Board Rev: %s\r\n", hackrf_r9 ? "R9" : "R1-R8");
|
||||
|
||||
// Usage
|
||||
board_rev_t revision = detected_revision();
|
||||
const char* revision_string = get_board_revision_string(revision);
|
||||
chprintf(chp, "HackRF Board Rev: %s\r\n", revision_string);
|
||||
chprintf(chp, "Reference Source: %s\r\n", portapack::clock_manager.get_source().c_str());
|
||||
chprintf(chp, "Reference Freq: %s\r\n", portapack::clock_manager.get_freq().c_str());
|
||||
#ifdef __DATE__
|
||||
|
@ -37,6 +37,8 @@ class USBSerial {
|
||||
void on_channel_closed();
|
||||
void setEventDispatcher(EventDispatcher* ed) { _eventDispatcher = ed; }
|
||||
|
||||
bool serial_connected() { return connected; }
|
||||
|
||||
private:
|
||||
void enable_xtal();
|
||||
void disable_pll0();
|
||||
|
@ -23,6 +23,7 @@
|
||||
*/
|
||||
|
||||
#include "usb_serial_asyncmsg.hpp"
|
||||
#include "usb_serial.hpp"
|
||||
|
||||
/// value
|
||||
// to_string_bin/ to_string_decimal/ to_string_hex/ to_string_hex_array/ to_string_dec_uint/ to_string_dec_int etc seems usellss so i didn't add them here
|
||||
@ -30,7 +31,7 @@
|
||||
|
||||
template <>
|
||||
void UsbSerialAsyncmsg::asyncmsg<int64_t>(const int64_t& data) {
|
||||
if (!portapack::async_tx_enabled) {
|
||||
if (!portapack::async_tx_enabled || !portapack::usb_serial.serial_connected()) {
|
||||
return;
|
||||
}
|
||||
chprintf((BaseSequentialStream*)&SUSBD1, "%s\r\n", to_string_dec_int(data).c_str());
|
||||
@ -38,7 +39,7 @@ void UsbSerialAsyncmsg::asyncmsg<int64_t>(const int64_t& data) {
|
||||
|
||||
template <>
|
||||
void UsbSerialAsyncmsg::asyncmsg<int32_t>(const int32_t& data) {
|
||||
if (!portapack::async_tx_enabled) {
|
||||
if (!portapack::async_tx_enabled || !portapack::usb_serial.serial_connected()) {
|
||||
return;
|
||||
}
|
||||
chprintf((BaseSequentialStream*)&SUSBD1, "%s\r\n", to_string_dec_int(data).c_str());
|
||||
@ -46,7 +47,7 @@ void UsbSerialAsyncmsg::asyncmsg<int32_t>(const int32_t& data) {
|
||||
|
||||
template <>
|
||||
void UsbSerialAsyncmsg::asyncmsg<int16_t>(const int16_t& data) {
|
||||
if (!portapack::async_tx_enabled) {
|
||||
if (!portapack::async_tx_enabled || !portapack::usb_serial.serial_connected()) {
|
||||
return;
|
||||
}
|
||||
chprintf((BaseSequentialStream*)&SUSBD1, "%s\r\n", to_string_dec_int(data).c_str());
|
||||
@ -54,7 +55,7 @@ void UsbSerialAsyncmsg::asyncmsg<int16_t>(const int16_t& data) {
|
||||
|
||||
template <>
|
||||
void UsbSerialAsyncmsg::asyncmsg<int8_t>(const int8_t& data) {
|
||||
if (!portapack::async_tx_enabled) {
|
||||
if (!portapack::async_tx_enabled || !portapack::usb_serial.serial_connected()) {
|
||||
return;
|
||||
}
|
||||
chprintf((BaseSequentialStream*)&SUSBD1, "%s\r\n", to_string_dec_int(data).c_str());
|
||||
@ -62,7 +63,7 @@ void UsbSerialAsyncmsg::asyncmsg<int8_t>(const int8_t& data) {
|
||||
|
||||
template <>
|
||||
void UsbSerialAsyncmsg::asyncmsg<uint8_t>(const uint8_t& data) {
|
||||
if (!portapack::async_tx_enabled) {
|
||||
if (!portapack::async_tx_enabled || !portapack::usb_serial.serial_connected()) {
|
||||
return;
|
||||
}
|
||||
chprintf((BaseSequentialStream*)&SUSBD1, "%s\r\n", to_string_dec_int(data).c_str());
|
||||
@ -70,7 +71,7 @@ void UsbSerialAsyncmsg::asyncmsg<uint8_t>(const uint8_t& data) {
|
||||
|
||||
template <>
|
||||
void UsbSerialAsyncmsg::asyncmsg<uint16_t>(const uint16_t& data) {
|
||||
if (!portapack::async_tx_enabled) {
|
||||
if (!portapack::async_tx_enabled || !portapack::usb_serial.serial_connected()) {
|
||||
return;
|
||||
}
|
||||
chprintf((BaseSequentialStream*)&SUSBD1, "%s\r\n", to_string_dec_int(data).c_str());
|
||||
@ -78,7 +79,7 @@ void UsbSerialAsyncmsg::asyncmsg<uint16_t>(const uint16_t& data) {
|
||||
|
||||
template <>
|
||||
void UsbSerialAsyncmsg::asyncmsg<uint32_t>(const uint32_t& data) {
|
||||
if (!portapack::async_tx_enabled) {
|
||||
if (!portapack::async_tx_enabled || !portapack::usb_serial.serial_connected()) {
|
||||
return;
|
||||
}
|
||||
chprintf((BaseSequentialStream*)&SUSBD1, "%s\r\n", to_string_dec_int(data).c_str());
|
||||
@ -86,7 +87,7 @@ void UsbSerialAsyncmsg::asyncmsg<uint32_t>(const uint32_t& data) {
|
||||
|
||||
template <>
|
||||
void UsbSerialAsyncmsg::asyncmsg<uint64_t>(const uint64_t& data) {
|
||||
if (!portapack::async_tx_enabled) {
|
||||
if (!portapack::async_tx_enabled || !portapack::usb_serial.serial_connected()) {
|
||||
return;
|
||||
}
|
||||
chprintf((BaseSequentialStream*)&SUSBD1, "%s\r\n", to_string_dec_int(data).c_str());
|
||||
@ -94,7 +95,7 @@ void UsbSerialAsyncmsg::asyncmsg<uint64_t>(const uint64_t& data) {
|
||||
|
||||
template <>
|
||||
void UsbSerialAsyncmsg::asyncmsg<float>(const float& data) {
|
||||
if (!portapack::async_tx_enabled) {
|
||||
if (!portapack::async_tx_enabled || !portapack::usb_serial.serial_connected()) {
|
||||
return;
|
||||
}
|
||||
chprintf((BaseSequentialStream*)&SUSBD1, "%s\r\n", to_string_decimal(data, 7).c_str());
|
||||
@ -105,7 +106,7 @@ void UsbSerialAsyncmsg::asyncmsg<float>(const float& data) {
|
||||
template <>
|
||||
// usage: UsbSerialAsyncmsg::asyncmsg(path);
|
||||
void UsbSerialAsyncmsg::asyncmsg<std::filesystem::path>(const std::filesystem::path& data) {
|
||||
if (!portapack::async_tx_enabled) {
|
||||
if (!portapack::async_tx_enabled || !portapack::usb_serial.serial_connected()) {
|
||||
return;
|
||||
}
|
||||
std::string path_str = data.string();
|
||||
@ -114,7 +115,7 @@ void UsbSerialAsyncmsg::asyncmsg<std::filesystem::path>(const std::filesystem::p
|
||||
|
||||
template <>
|
||||
void UsbSerialAsyncmsg::asyncmsg<std::filesystem::path::string_type>(const std::filesystem::path::string_type& data) {
|
||||
if (!portapack::async_tx_enabled) {
|
||||
if (!portapack::async_tx_enabled || !portapack::usb_serial.serial_connected()) {
|
||||
return;
|
||||
}
|
||||
std::string str_data(data.begin(), data.end());
|
||||
@ -127,7 +128,7 @@ void UsbSerialAsyncmsg::asyncmsg<std::filesystem::path::string_type>(const std::
|
||||
template <>
|
||||
// usage: UsbSerialAsyncmsg::asyncmsg(str);
|
||||
void UsbSerialAsyncmsg::asyncmsg<std::string>(const std::string& data) {
|
||||
if (!portapack::async_tx_enabled) {
|
||||
if (!portapack::async_tx_enabled || !portapack::usb_serial.serial_connected()) {
|
||||
return;
|
||||
}
|
||||
chprintf((BaseSequentialStream*)&SUSBD1, "%s\r\n", data.c_str());
|
||||
@ -136,7 +137,7 @@ void UsbSerialAsyncmsg::asyncmsg<std::string>(const std::string& data) {
|
||||
// string literal AKA char[]
|
||||
// usage: UsbSerialAsyncmsg::asyncmsg("abc");
|
||||
void UsbSerialAsyncmsg::asyncmsg(const char* data) {
|
||||
if (!portapack::async_tx_enabled) {
|
||||
if (!portapack::async_tx_enabled || !portapack::usb_serial.serial_connected()) {
|
||||
return;
|
||||
}
|
||||
chprintf((BaseSequentialStream*)&SUSBD1, "%s\r\n", data);
|
||||
@ -146,7 +147,7 @@ void UsbSerialAsyncmsg::asyncmsg(const char* data) {
|
||||
template <>
|
||||
// usage: UsbSerialAsyncmsg::asyncmsg(true);
|
||||
void UsbSerialAsyncmsg::asyncmsg<bool>(const bool& data) {
|
||||
if (!portapack::async_tx_enabled) {
|
||||
if (!portapack::async_tx_enabled || !portapack::usb_serial.serial_connected()) {
|
||||
return;
|
||||
}
|
||||
chprintf((BaseSequentialStream*)&SUSBD1, "%s\r\n", data ? "true" : "false");
|
||||
|
@ -61,7 +61,7 @@ class UsbSerialAsyncmsg {
|
||||
// ussgae: UsbSerialAsyncmsg::asyncmsg(vec);
|
||||
template <typename VECTORCOVER>
|
||||
void UsbSerialAsyncmsg::asyncmsg(const std::vector<VECTORCOVER>& data) {
|
||||
if (!portapack::async_tx_enabled) {
|
||||
if (!portapack::async_tx_enabled || !portapack::usb_serial.serial_connected()) {
|
||||
return;
|
||||
}
|
||||
for (const auto& item : data) {
|
||||
|
Loading…
Reference in New Issue
Block a user