Skip to content

Commit

Permalink
Cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
hmatuschek committed Jul 21, 2024
1 parent 42e8610 commit 8cb2681
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 4 deletions.
13 changes: 10 additions & 3 deletions lib/dr1801uv_codeplug.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3269,9 +3269,16 @@ DR1801UVCodeplug::index(Config *config, Context &ctx, const ErrorStack &err) con

// All indices as 0-based. That is, the first channel gets index 0 etc.

// There can only be one DMR radio ID
if (! config->settings()->defaultIdRef()->isNull())
ctx.add(config->settings()->defaultId(), 0);
// There must be a default DMR radio ID.
if (nullptr == ctx.config()->settings()->defaultId()) {
errMsg(err) << "No default DMR radio ID specified.";
errMsg(err) << "Cannot index codplug for encoding for the BTECH DR-1801UV.";
return false;
}

// Map radio IDs
for (int i=0; i<ctx.config()->radioIDs()->count(); i++)
ctx.add(ctx.config()->radioIDs()->getId(i), i);

// Map digital and DTMF contacts
for (int i=0, d=0; i<config->contacts()->count(); i++) {
Expand Down
1 change: 1 addition & 0 deletions src/application.cc
Original file line number Diff line number Diff line change
Expand Up @@ -709,6 +709,7 @@ void
Application::onCodeplugDownloaded(Radio *radio, Codeplug *codeplug) {
_config->clear();
_mainWindow->setWindowModified(false);

ErrorStack err;
if (codeplug->decode(_config, err)) {
_mainWindow->statusBar()->showMessage(tr("Read complete"));
Expand Down
2 changes: 1 addition & 1 deletion test/configtest.hh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ private slots:

void testMelodyLilypond();
void testMelodyEncoding();
void testMelodyDecoding();
void testMelodyDecoding();

protected:
QTextStream _stderr;
Expand Down
12 changes: 12 additions & 0 deletions test/dr1801_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,18 @@ DR1801Test::testBasicConfigReencoding() {
}
}


void
DR1801Test::testProstProcessingOfEmptyCodeplug() {
Config config;
DR1801UVCodeplug codeplug;
ErrorStack err;

config.clear();
QVERIFY(codeplug.postprocess(&config, err));
}


QTEST_GUILESS_MAIN(DR1801Test)


1 change: 1 addition & 0 deletions test/dr1801_test.hh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ private slots:
void testBasicConfigEncoding();
void testBasicConfigDecoding();
void testBasicConfigReencoding();
void testProstProcessingOfEmptyCodeplug();
};

#endif // DR1801TEST_HH

0 comments on commit 8cb2681

Please sign in to comment.