Add HackRF Pro (PRALINE) Board Detection and Info Display (#3006)

This commit is contained in:
jLynx
2026-02-19 07:56:22 +00:00
committed by GitHub
parent 819b4d0fed
commit 77f747aab2
5 changed files with 70 additions and 12 deletions
+47
View File
@@ -31,6 +31,7 @@
#include "shell.hpp"
#include "chprintf.h"
#include "portapack.hpp"
#include "../flashsize.h"
extern "C" {
#include "platform_detect.h"
@@ -93,6 +94,22 @@ static const char* get_board_revision_string(board_rev_t rev) {
return "GSG HackRF R9";
case BOARD_REV_GSG_HACKRF1_R10:
return "GSG HackRF R10";
case BOARD_REV_PRALINE_R0_1:
case BOARD_REV_PRALINE_R0_2:
case BOARD_REV_PRALINE_R0_3:
return "HackRF Pro R0";
case BOARD_REV_PRALINE_R1_0:
case BOARD_REV_PRALINE_R1_1:
case BOARD_REV_PRALINE_R1_2:
return "HackRF Pro R1";
case BOARD_REV_GSG_PRALINE_R0_1:
case BOARD_REV_GSG_PRALINE_R0_2:
case BOARD_REV_GSG_PRALINE_R0_3:
return "GSG HackRF Pro R0";
case BOARD_REV_GSG_PRALINE_R1_0:
case BOARD_REV_GSG_PRALINE_R1_1:
case BOARD_REV_GSG_PRALINE_R1_2:
return "GSG HackRF Pro R1";
case BOARD_REV_UNRECOGNIZED:
return "Unrecognized";
case BOARD_REV_UNDETECTED:
@@ -134,6 +151,36 @@ static void cmd_info(BaseSequentialStream* chp, int argc, char* argv[]) {
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);
// Determine device type string
const char* device_str;
#ifdef PRALINE
device_str = "HackRF Pro";
#else
if (portapack::device_type == portapack::DEV_PORTARF) {
device_str = "PortaRF";
} else {
device_str = "HackRF One";
}
#endif
chprintf(chp, "Device: %s\r\n", device_str);
// Flash info: build-time allowed MB, runtime-detected limit, current firmware size
// Use explicit uint32_t cast: FLASH_SIZE_LIMIT_MB may be a float (e.g. 3.5 for HPro)
uint8_t flash_allowrun;
#ifdef PRALINE
flash_allowrun = 4; // HackRF Pro
#else
if (portapack::device_type == portapack::DeviceType::DEV_PORTAPACK) {
flash_allowrun = 1; // PortaPack classic
} else {
flash_allowrun = FLASH_SIZE_MB; // PortaRF
}
#endif
chprintf(chp, "Flash Allowed: %dMB\r\n", (uint32_t)FLASH_SIZE_MB);
chprintf(chp, "Flash Runtime: %dMB\r\n", (uint32_t)flash_allowrun);
chprintf(chp, "Flash Current: %dMB\r\n", (uint32_t)FLASH_SIZE_LIMIT_MB);
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__