Merge pull request #213 from euquiq/Fix-APRS-TX-app

Fix aprs tx app
This commit is contained in:
Erwin Ried 2020-10-27 21:57:50 +01:00 committed by GitHub
commit 911f0c8881
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 28 additions and 18 deletions

View File

@ -82,6 +82,7 @@ private:
6, 6,
SymField::SYMFIELD_ALPHANUM SymField::SYMFIELD_ALPHANUM
}; };
NumberField num_ssid_dest { NumberField num_ssid_dest {
{ 19 * 8, 2 * 16 }, { 19 * 8, 2 * 16 },
2, 2,

View File

@ -38,9 +38,13 @@ void make_aprs_frame(const char * src_address, const uint32_t src_ssid,
char address[14] = { 0 }; char address[14] = { 0 };
memcpy(&address[0], dest_address, 6); memcpy(&address[0], dest_address, 6);
address[6] = (dest_ssid & 15) << 1;
memcpy(&address[7], src_address, 6); memcpy(&address[7], src_address, 6);
address[13] = (src_ssid & 15) << 1; //euquiq: According to ax.25 doc section 2.2.13.x.x and 2.4.1.2
// SSID need bits 5.6 set, so later when shifted it will end up being 011xxxx0 (xxxx = SSID number)
// Notice that if need to signal usage of AX.25 V2.0, (dest_ssid | 112); (MSb will need to be set at the end)
address[6] = (dest_ssid | 48);
address[13] = (src_ssid | 48);
frame.make_ui_frame(address, 0x03, protocol_id_t::NO_LAYER3, payload); frame.make_ui_frame(address, 0x03, protocol_id_t::NO_LAYER3, payload);
} }

View File

@ -51,32 +51,37 @@ void AX25Frame::NRZI_add_bit(const uint32_t bit) {
} }
} }
void AX25Frame::add_byte(uint8_t byte, bool is_flag, bool is_data) { void AX25Frame::add_byte(uint8_t byte, bool is_flag, bool is_data)
uint32_t bit; {
bool bit;
if (is_data) if (is_data)
crc_ccitt.process_byte(byte); crc_ccitt.process_byte(byte);
for (uint32_t i = 0; i < 8; i++) { for (uint32_t i = 0; i < 8; i++)
{
bit = (byte >> i) & 1; bit = (byte >> i) & 1;
if (bit) NRZI_add_bit(bit);
ones_counter++;
else
ones_counter = 0;
if ((ones_counter == 6) && (!is_flag)) { if (bit)
{
ones_counter++;
if ((ones_counter == 5) && (!is_flag))
{
NRZI_add_bit(0); NRZI_add_bit(0);
ones_counter = 0; ones_counter = 0;
} }
}
NRZI_add_bit(bit); else
ones_counter = 0;
} }
} }
void AX25Frame::flush() { void AX25Frame::flush()
{
if (bit_counter) if (bit_counter)
*bb_data_ptr = current_byte << (7 - bit_counter); *bb_data_ptr = current_byte << (8 - bit_counter); //euquiq: This was 7 but there are 8 bits
}; };
void AX25Frame::add_flag() { void AX25Frame::add_flag() {

View File

@ -485,7 +485,7 @@ TransmittersMenuView::TransmittersMenuView(NavigationView& nav) {
add_items({ add_items({
//{ "..", ui::Color::light_grey(),&bitmap_icon_previous, [&nav](){ nav.pop(); } }, //{ "..", ui::Color::light_grey(),&bitmap_icon_previous, [&nav](){ nav.pop(); } },
{ "ADS-B [S]", ui::Color::yellow(), &bitmap_icon_adsb, [&nav](){ nav.push<ADSBTxView>(); } }, { "ADS-B [S]", ui::Color::yellow(), &bitmap_icon_adsb, [&nav](){ nav.push<ADSBTxView>(); } },
{ "APRS", ui::Color::orange(), &bitmap_icon_aprs, [&nav](){ nav.push<APRSTXView>(); } }, { "APRS", ui::Color::green(), &bitmap_icon_aprs, [&nav](){ nav.push<APRSTXView>(); } },
{ "BHT Xy/EP", ui::Color::green(), &bitmap_icon_bht, [&nav](){ nav.push<BHTView>(); } }, { "BHT Xy/EP", ui::Color::green(), &bitmap_icon_bht, [&nav](){ nav.push<BHTView>(); } },
{ "GPS Sim", ui::Color::yellow(), &bitmap_icon_gps_sim, [&nav](){ nav.push<GpsSimAppView>(); } }, { "GPS Sim", ui::Color::yellow(), &bitmap_icon_gps_sim, [&nav](){ nav.push<GpsSimAppView>(); } },
{ "Jammer", ui::Color::yellow(), &bitmap_icon_jammer, [&nav](){ nav.push<JammerView>(); } }, { "Jammer", ui::Color::yellow(), &bitmap_icon_jammer, [&nav](){ nav.push<JammerView>(); } },