Skip to content

Commit

Permalink
Add mode 4 (force off) for the DMR OVCM flag.
Browse files Browse the repository at this point in the history
  • Loading branch information
g4klx committed Mar 7, 2021
1 parent 5537ebb commit 5d8d1a3
Show file tree
Hide file tree
Showing 10 changed files with 61 additions and 11 deletions.
5 changes: 4 additions & 1 deletion Conf.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2015-2020 by Jonathan Naylor G4KLX
* Copyright (C) 2015-2021 by Jonathan Naylor G4KLX
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -668,6 +668,9 @@ bool CConf::read()
case 3:
m_dmrOVCM = DMR_OVCM_ON;
break;
case 4:
m_dmrOVCM = DMR_OVCM_FORCE_OFF;
break;
default:
m_dmrOVCM = DMR_OVCM_OFF;
break;
Expand Down
8 changes: 7 additions & 1 deletion DMRCSBK.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2015,2016,2020 by Jonathan Naylor G4KLX
* Copyright (C) 2015,2016,2020,2021 by Jonathan Naylor G4KLX
* Copyright (C) 2019 by Patrick Maier DK5MP
*
* This program is free software; you can redistribute it and/or modify
Expand Down Expand Up @@ -189,6 +189,12 @@ void CDMRCSBK::setOVCM(bool ovcm)
}
}

void CDMRCSBK::clearOVCM()
{
if (getOVCM())
m_data[2U] ^= 0x04U;
}

bool CDMRCSBK::getGI() const
{
return m_GI;
Expand Down
3 changes: 2 additions & 1 deletion DMRCSBK.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2015,2016,2020 by Jonathan Naylor G4KLX
* Copyright (C) 2015,2016,2020,2021 by Jonathan Naylor G4KLX
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -50,6 +50,7 @@ class CDMRCSBK
// Set/Get the OVCM bit in the supported CSBKs
bool getOVCM() const;
void setOVCM(bool ovcm);
void clearOVCM();

// For BS Dwn Act
unsigned int getBSId() const;
Expand Down
8 changes: 7 additions & 1 deletion DMRLC.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2015,2016,2019 by Jonathan Naylor G4KLX
* Copyright (C) 2015,2016,2019,2021 by Jonathan Naylor G4KLX
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -195,6 +195,12 @@ void CDMRLC::setOVCM(bool ovcm)
m_options |= 0x04U;
}

void CDMRLC::clearOVCM()
{
if (getOVCM())
m_options ^= 0x04U;
}

unsigned int CDMRLC::getSrcId() const
{
return m_srcId;
Expand Down
3 changes: 2 additions & 1 deletion DMRLC.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2015,2016,2019 by Jonathan Naylor G4KLX
* Copyright (C) 2015,2016,2019,2021 by Jonathan Naylor G4KLX
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -41,6 +41,7 @@ class CDMRLC

bool getOVCM() const;
void setOVCM(bool ovcm);
void clearOVCM();

unsigned char getFID() const;
void setFID(unsigned char fid);
Expand Down
33 changes: 32 additions & 1 deletion DMRSlot.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2015-2020 Jonathan Naylor, G4KLX
* Copyright (C) 2015-2021 Jonathan Naylor, G4KLX
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -236,6 +236,11 @@ bool CDMRSlot::writeModem(unsigned char *data, unsigned int len)
lc->setOVCM(m_ovcm == DMR_OVCM_TX_ON || m_ovcm == DMR_OVCM_ON);
m_rfLC = lc;

if (m_ovcm == DMR_OVCM_FORCE_OFF) {
lc->clearOVCM();
m_rfLC = lc;
}

// The standby LC data
m_rfEmbeddedLC.setLC(*m_rfLC);
m_rfEmbeddedData[0U].setLC(*m_rfLC);
Expand Down Expand Up @@ -439,6 +444,9 @@ bool CDMRSlot::writeModem(unsigned char *data, unsigned int len)
// set the OVCM bit for the supported csbk
csbk.setOVCM(m_ovcm == DMR_OVCM_TX_ON || m_ovcm == DMR_OVCM_ON);

if (m_ovcm == DMR_OVCM_FORCE_OFF)
csbk.clearOVCM();

bool gi = csbk.getGI();
unsigned int srcId = csbk.getSrcId();
unsigned int dstId = csbk.getDstId();
Expand Down Expand Up @@ -797,6 +805,11 @@ bool CDMRSlot::writeModem(unsigned char *data, unsigned int len)
lc->setOVCM(m_ovcm == DMR_OVCM_TX_ON || m_ovcm == DMR_OVCM_ON);
m_rfLC = lc;

if (m_ovcm == DMR_OVCM_FORCE_OFF) {
lc->clearOVCM();
m_rfLC = lc;
}

// The standby LC data
m_rfEmbeddedLC.setLC(*m_rfLC);
m_rfEmbeddedData[0U].setLC(*m_rfLC);
Expand Down Expand Up @@ -1053,6 +1066,11 @@ void CDMRSlot::writeNetwork(const CDMRData& dmrData)
lc->setOVCM(m_ovcm == DMR_OVCM_RX_ON || m_ovcm == DMR_OVCM_ON);
m_netLC = lc;

if (m_ovcm == DMR_OVCM_FORCE_OFF) {
lc->clearOVCM();
m_netLC = lc;
}

// The standby LC data
m_netEmbeddedLC.setLC(*m_netLC);
m_netEmbeddedData[0U].setLC(*m_netLC);
Expand Down Expand Up @@ -1128,6 +1146,11 @@ void CDMRSlot::writeNetwork(const CDMRData& dmrData)
lc->setOVCM(m_ovcm == DMR_OVCM_RX_ON || m_ovcm == DMR_OVCM_ON);
m_netLC = lc;

if (m_ovcm == DMR_OVCM_FORCE_OFF) {
lc->clearOVCM();
m_netLC = lc;
}

m_lastFrameValid = false;

m_netTimeoutTimer.start();
Expand Down Expand Up @@ -1315,6 +1338,11 @@ void CDMRSlot::writeNetwork(const CDMRData& dmrData)
lc->setOVCM(m_ovcm == DMR_OVCM_RX_ON || m_ovcm == DMR_OVCM_ON);
m_netLC = lc;

if (m_ovcm == DMR_OVCM_FORCE_OFF) {
lc->clearOVCM();
m_netLC = lc;
}

// The standby LC data
m_netEmbeddedLC.setLC(*m_netLC);
m_netEmbeddedData[0U].setLC(*m_netLC);
Expand Down Expand Up @@ -1586,6 +1614,9 @@ void CDMRSlot::writeNetwork(const CDMRData& dmrData)
// set the OVCM bit for the supported csbk
csbk.setOVCM(m_ovcm == DMR_OVCM_RX_ON || m_ovcm == DMR_OVCM_ON);

if (m_ovcm == DMR_OVCM_FORCE_OFF)
csbk.clearOVCM();

bool gi = csbk.getGI();
unsigned int srcId = csbk.getSrcId();
unsigned int dstId = csbk.getDstId();
Expand Down
5 changes: 3 additions & 2 deletions Defines.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2015,2016,2017,2018 by Jonathan Naylor G4KLX
* Copyright (C) 2015,2016,2017,2018,2021 by Jonathan Naylor G4KLX
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -81,7 +81,8 @@ enum DMR_OVCM_TYPES {
DMR_OVCM_OFF,
DMR_OVCM_RX_ON,
DMR_OVCM_TX_ON,
DMR_OVCM_ON
DMR_OVCM_ON,
DMR_OVCM_FORCE_OFF
};

#endif
2 changes: 1 addition & 1 deletion MMDVM.ini
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ DumpTAData=1
CallHang=3
TXHang=4
# ModeHang=10
# OVCM Values, 0=off, 1=rx_on, 2=tx_on, 3=both_on
# OVCM Values, 0=off, 1=rx_on, 2=tx_on, 3=both_on, 4=force off
# OVCM=0

[System Fusion]
Expand Down
3 changes: 2 additions & 1 deletion MMDVMHost.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,8 @@ int CMMDVMHost::run()
LogInfo(" OVCM: on(tx only)");
else if (ovcm == DMR_OVCM_ON)
LogInfo(" OVCM: on");

else if (ovcm == DMR_OVCM_FORCE_OFF)
LogInfo(" OVCM: off (forced)");

switch (dmrBeacons) {
case DMR_BEACONS_NETWORK: {
Expand Down
2 changes: 1 addition & 1 deletion Version.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
#if !defined(VERSION_H)
#define VERSION_H

const char* VERSION = "20210101";
const char* VERSION = "20210307";

#endif

0 comments on commit 5d8d1a3

Please sign in to comment.