~hmatuschek/+junk/qdmr-package

« back to all changes in this revision

Viewing changes to lib/rd5r_codeplug.cc

  • Committer: Hannes Matuschek
  • Date: 2020-07-07 14:49:41 UTC
  • mfrom: (1.1.4)
  • Revision ID: hmatuschek@gmail.com-20200707144941-niwxz5phhmi0kt1w
* Finalized implementation of MD5R.
* Fixed RD-5R upload.

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
  memset(name, 0xff, 16);
43
43
  _unused25              = 0;
44
44
  _unused30              = 0x50;
 
45
  ctcss_dcs_receive      = 0xffff;
 
46
  ctcss_dcs_transmit     = 0xffff;
45
47
  _unused36              = 0;
46
48
  tx_signaling_syst      = 0;
47
49
  _unused38              = 0;
48
50
  rx_signaling_syst      = 0;
49
51
  _unused40              = 0x16;
50
 
  privacy_group          = 0;
 
52
  privacy_group          = PRIVGR_NONE;
51
53
  emergency_system_index = 0;
 
54
  contact_name_index     = 0;
52
55
  _unused48_0            = 0;
53
56
  emergency_alarm_ack    = 0;
54
57
  data_call_conf         = 0;
59
62
  _unused49_7            = 0;
60
63
  dcdm                   = 0;
61
64
  _unused50_1            = 0;
 
65
  non_ste_frequency      = 0;
62
66
  _unused50_6            = 0;
63
67
  _unused51_0            = 0;
64
68
  talkaround             = 0;
443
447
void
444
448
RD5RCodeplug::grouplist_t::fromRXGroupListObj(const RXGroupList *lst, const Config *conf) {
445
449
  setName(lst->name());
446
 
  for (int i=0; i<16; i++) {
 
450
  for (int i=0; i<15; i++) {
447
451
    if (lst->count() > i) {
448
452
      member[i] = conf->contacts()->indexOfDigital(lst->contact(i))+1;
449
453
    } else {
547
551
  call_alert_dur       = 24; // 0x18
548
552
  lone_worker_response = 1;
549
553
  lone_worker_reminder = 10; //0x0a
550
 
  talkaround_grp_hang  = 6;
551
 
  talkaround_priv_hang = 6;
 
554
  grp_hang  = 6;
 
555
  priv_hang = 6;
552
556
 
553
557
  // default value 0x40
554
558
  downch_mode_vfo      = 0;
738
742
  addImage("Radioddity RD5R Codeplug");
739
743
  image(0).addElement(0x00080, 0x07b80);
740
744
  image(0).addElement(0x08000, 0x16300);
 
745
}
741
746
 
 
747
void
 
748
RD5RCodeplug::clear()
 
749
{
742
750
  // Clear codeplug and set to default values
 
751
  memset(data(0x00080), 0xff, 0x07b80);
 
752
  memset(data(0x08000), 0xff, 0x16300);
 
753
 
743
754
  // clear timestamp
744
755
  timestamp_t *ts = (timestamp_t *)data(OFFSET_TIMESTMP);
745
756
  ts->setNow();
 
757
 
746
758
  // Clear basic config and set to default values
747
759
  general_settings_t *gs = (general_settings_t*) data(OFFSET_SETTINGS);
748
760
  gs->clear();
749
761
  gs->initDefault();
 
762
 
750
763
  // Clear default button settings
751
764
  button_settings_t *bs = (button_settings_t *)data(OFFSET_BUTTONS);
752
765
  bs->initDefault();
 
766
 
753
767
  // Clear intro text.
754
768
  intro_text_t *it = (intro_text_t*) data(OFFSET_INTRO);
755
769
  it->clear();
 
770
 
756
771
  // Clear channels
757
772
  for (int i=0; i<NCHAN; i++) {
758
773
    // First, get bank
766
781
    // Disable channel
767
782
    b->bitmap[(i % 128) / 8] &= ~(1 << (i & 7));
768
783
  }
 
784
 
769
785
  // Clear Zones
770
786
  for (int i=0; i<NZONES; i++) {
771
787
    zonetab_t *zt = (zonetab_t*) data(OFFSET_ZONETAB);
774
790
    zt->bitmap[i / 8] &= ~(1 << (i & 7));
775
791
    z->clear();
776
792
  }
 
793
 
777
794
  // Clear Scanlists
778
795
  for (int i=0; i<NSCANL; i++) {
779
796
    scantab_t *st = (scantab_t*) data(OFFSET_SCANTAB);
782
799
    st->valid[i] = 0;
783
800
    sl->clear();
784
801
  }
 
802
 
785
803
  // Clear contacts
786
804
  for (int i=0; i<NCONTACTS; i++) {
787
805
    contact_t *ct = (contact_t*) data(OFFSET_CONTACTS + (i)*sizeof(contact_t));
788
806
    ct->clear();
789
807
  }
 
808
 
790
809
  // Clear DTMF contacts
791
810
  for (int i=0; i<NDTMF; i++) {
792
811
    dtmf_contact_t *ct = (dtmf_contact_t*) data(OFFSET_DTMF + (i)*sizeof(dtmf_contact_t));
793
812
    ct->clear();
794
813
  }
 
814
 
795
815
  // Clear Grouplists:
796
816
  for (int i=0; i<NGLISTS; i++) {
797
817
    grouptab_t *gt = (grouptab_t*) data(OFFSET_GROUPTAB);
1051
1071
    }
1052
1072
 
1053
1073
    // Construct from Channel object
 
1074
    ch->clear();
1054
1075
    ch->fromChannelObj(config->channelList()->channel(i), config);
1055
1076
 
1056
1077
    // Set valid bit.
1128
1149
  for (int i=0; i<NGLISTS; i++) {
1129
1150
    grouptab_t *gt = (grouptab_t*) data(OFFSET_GROUPTAB);
1130
1151
    grouplist_t *gl = &gt->grouplist[i];
1131
 
 
1132
1152
    if (i >= config->rxGroupLists()->count()) {
1133
1153
      gt->nitems1[i] = 0;
1134
1154
      continue;
1135
1155
    }
1136
 
 
1137
1156
    // Enable group list
1138
 
    gt->nitems1[i] = 1;
1139
 
 
1140
 
    // RD-5R firmware up to v2.1.6 has a bug:
1141
 
    // when all 16 entries in RX group list are occupied,
1142
 
    // it stops functioning and no audio is received.
1143
 
    // As a workaround, we must use only 15 entries here.
1144
 
    for (int j=0; j<std::min(15,config->rxGroupLists()->list(i)->count()); j++)
1145
 
      gl->member[j] = config->contacts()->indexOf(config->rxGroupLists()->list(i)->contact(j))+1;
1146
1157
    gt->nitems1[i] = std::min(15,config->rxGroupLists()->list(i)->count()) + 1;
 
1158
    gl->fromRXGroupListObj(config->rxGroupLists()->list(i), config);
1147
1159
  }
1148
1160
 
1149
1161
  return true;