fix pocsag tx char limit (#2303)

* fix pocsag tx display

* set max to 40, and add 2nd line

* up to 80 chars

* max pocsag to 80 via serial too

* fix amp override
This commit is contained in:
Totoo 2024-10-15 20:38:18 +02:00 committed by GitHub
parent 8d1fb7cb66
commit 1b3359b050
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 25 additions and 11 deletions

View File

@ -33,6 +33,8 @@ using namespace pocsag;
namespace ui {
#define MAX_POCSAG_LENGTH 80
void POCSAGTXView::focus() {
field_address.focus();
}
@ -57,6 +59,7 @@ void POCSAGTXView::on_remote(const PocsagTosendMessage data) {
options_phase.set_selected_index(data.phase == 'P' ? 0 : 1);
field_address.set_value(data.addr);
message = (char*)data.msg;
buffer = message;
text_message.set(message);
options_bitrate.dirty();
options_type.dirty();
@ -105,9 +108,9 @@ bool POCSAGTXView::start_tx() {
progressbar.set_max(total_frames);
transmitter_model.set_rf_amp(true);
transmitter_model.set_tx_gain(40);
// We left exactly same TX LPF settings as previous fw 1.7.4, TX LPF= 1M75 (min). It is fine even in max FM dev. 150khz and 2400 bauds.
// transmitter_model.set_rf_amp(true);
// transmitter_model.set_tx_gain(40);
// We left exactly same TX LPF settings as previous fw 1.7.4, TX LPF= 1M75 (min). It is fine even in max FM dev. 150khz and 2400 bauds.
transmitter_model.set_baseband_bandwidth(1'750'000); // Min TX LPF . Pocsag is NBFM , using BW channel 25khz or 12khz
transmitter_model.enable();
@ -139,11 +142,18 @@ bool POCSAGTXView::start_tx() {
void POCSAGTXView::paint(Painter&) {
message = buffer;
text_message.set(message);
text_message.set(message); // the whole message, but it may not fit.
if (message.length() > 30 && message.length() <= 60) {
text_message_l2.set(message.substr(29)); // remaining to 2nd line
} else if (message.length() > 60) {
text_message_l2.set(message.substr(29, 27) + "...");
} else {
text_message_l2.set("");
}
}
void POCSAGTXView::on_set_text(NavigationView& nav) {
text_prompt(nav, buffer, 30);
text_prompt(nav, buffer, MAX_POCSAG_LENGTH);
}
POCSAGTXView::POCSAGTXView(
@ -158,6 +168,7 @@ POCSAGTXView::POCSAGTXView(
&options_function,
&options_phase,
&text_message,
&text_message_l2,
&button_message,
&progressbar,
&tx_view});

View File

@ -122,15 +122,18 @@ class POCSAGTXView : public View {
}};
Text text_message{
{0 * 8, 16 * 8, 16 * 8, 16},
{0 * 8, 16 * 8, 30 * 8, 16},
""};
Text text_message_l2{
{0 * 8, 18 * 8, 30 * 8, 16},
""};
Button button_message{
{0 * 8, 18 * 8, 14 * 8, 32},
{0 * 8, 20 * 8, 14 * 8, 32},
"Set message"};
ProgressBar progressbar{
{16, 200, 208, 16}};
{16, 210, 208, 16}};
TransmitterView tx_view{
16 * 16,

View File

@ -1079,8 +1079,8 @@ static void cmd_sendpocsag(BaseSequentialStream* chp, int argc, char* argv[]) {
}
uint64_t addr = atol(argv[0]);
int msglen = atoi(argv[1]); // without minimum limit, since addr only don't send anything
if (msglen > 30 || msglen < 0) {
chprintf(chp, "error, msglen max is 30\r\n");
if (msglen > 80 || msglen < 0) {
chprintf(chp, "error, msglen max is 80\r\n");
return;
}
@ -1120,7 +1120,7 @@ static void cmd_sendpocsag(BaseSequentialStream* chp, int argc, char* argv[]) {
}
}
uint8_t msg[31] = {0};
uint8_t msg[81] = {0};
if (msglen > 0) {
chprintf(chp, "send %d bytes\r\n", msglen);
do {