Merge branch 'master' into M17_AX25_FM

This commit is contained in:
Jonathan Naylor 2021-03-12 19:56:57 +00:00
commit f1de23e568
6 changed files with 15 additions and 14 deletions

View file

@ -31,6 +31,8 @@ const unsigned int HOMEBREW_DATA_PACKET_LENGTH = 55U;
CDMRDirectNetwork::CDMRDirectNetwork(const std::string& address, unsigned int port, unsigned int local, unsigned int id, const std::string& password, bool duplex, const char* version, bool slot1, bool slot2, HW_TYPE hwType, bool debug) : CDMRDirectNetwork::CDMRDirectNetwork(const std::string& address, unsigned int port, unsigned int local, unsigned int id, const std::string& password, bool duplex, const char* version, bool slot1, bool slot2, HW_TYPE hwType, bool debug) :
m_address(address),
m_port(port),
m_addr(), m_addr(),
m_addrLen(0U), m_addrLen(0U),
m_id(NULL), m_id(NULL),
@ -70,9 +72,6 @@ m_beacon(false)
assert(id > 1000U); assert(id > 1000U);
assert(!password.empty()); assert(!password.empty());
if (CUDPSocket::lookup(address, port, m_addr, m_addrLen) != 0)
m_addrLen = 0U;
m_buffer = new unsigned char[BUFFER_LENGTH]; m_buffer = new unsigned char[BUFFER_LENGTH];
m_salt = new unsigned char[sizeof(uint32_t)]; m_salt = new unsigned char[sizeof(uint32_t)];
m_id = new uint8_t[4U]; m_id = new uint8_t[4U];
@ -122,7 +121,7 @@ void CDMRDirectNetwork::setConfig(const std::string& callsign, unsigned int rxFr
bool CDMRDirectNetwork::open() bool CDMRDirectNetwork::open()
{ {
if (m_addrLen == 0U) { if (CUDPSocket::lookup(m_address, m_port, m_addr, m_addrLen) != 0) {
LogError("DMR, Could not lookup the address of the DMR Network"); LogError("DMR, Could not lookup the address of the DMR Network");
return false; return false;
} }

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2015,2016,2017,2018,2020 by Jonathan Naylor G4KLX * Copyright (C) 2015,2016,2017,2018,2020,2021 by Jonathan Naylor G4KLX
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -58,6 +58,8 @@ public:
virtual void close(); virtual void close();
private: private:
std::string m_address;
unsigned int m_port;
sockaddr_storage m_addr; sockaddr_storage m_addr;
unsigned int m_addrLen; unsigned int m_addrLen;
uint8_t* m_id; uint8_t* m_id;

View file

@ -677,7 +677,7 @@ CDisplay* CDisplay::createDisplay(const CConf& conf, CModem* modem)
bool rotate = conf.getOLEDRotate(); bool rotate = conf.getOLEDRotate();
bool logosaver = conf.getOLEDLogoScreensaver(); bool logosaver = conf.getOLEDLogoScreensaver();
display = new COLED(type, brightness, invert, scroll, rotate, logosaver, conf.getDMRNetworkSlot1(), conf.getDMRNetworkSlot2()); display = new COLED(type, brightness, invert, scroll, rotate, logosaver, conf.getDuplex());
#endif #endif
} else if (type == "CAST") { } else if (type == "CAST") {
display = new CCASTInfo(modem); display = new CCASTInfo(modem);

View file

@ -191,15 +191,15 @@ const unsigned char logo_POCSAG_bmp [] =
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
}; };
COLED::COLED(unsigned char displayType, unsigned char displayBrightness, bool displayInvert, bool displayScroll, bool displayRotate, bool displayLogoScreensaver, bool slot1Enabled, bool slot2Enabled) : COLED::COLED(unsigned char displayType, unsigned char displayBrightness, bool displayInvert, bool displayScroll, bool displayRotate, bool displayLogoScreensaver, bool duplex) :
m_displayType(displayType), m_displayType(displayType),
m_displayBrightness(displayBrightness), m_displayBrightness(displayBrightness),
m_displayInvert(displayInvert), m_displayInvert(displayInvert),
m_displayScroll(displayScroll), m_displayScroll(displayScroll),
m_displayRotate(displayRotate), m_displayRotate(displayRotate),
m_displayLogoScreensaver(displayLogoScreensaver), m_displayLogoScreensaver(displayLogoScreensaver),
m_slot1Enabled(slot1Enabled), m_duplex(duplex),
m_slot2Enabled(slot2Enabled), //m_duplex(true), // uncomment to force duplex display for testing!
m_ipaddress(), m_ipaddress(),
m_display() m_display()
{ {
@ -403,7 +403,7 @@ int COLED::writeDMRIntEx(unsigned int slotNo, const class CUserDBentry& src, boo
} }
// if both slots, use lines 2-3 for slot 1, lines 4-5 for slot 2 // if both slots, use lines 2-3 for slot 1, lines 4-5 for slot 2
// if single slot, use lines 2-3 // if single slot, use lines 2-3
if ( m_slot1Enabled && m_slot2Enabled ) { if ( m_duplex ) {
if (slotNo == 1U) { if (slotNo == 1U) {
m_display.fillRect(0,OLED_LINE2,m_display.width(),40,BLACK); m_display.fillRect(0,OLED_LINE2,m_display.width(),40,BLACK);
@ -451,7 +451,7 @@ void COLED::clearDMRInt(unsigned int slotNo)
{ {
// if both slots, use lines 2-3 for slot 1, lines 4-5 for slot 2 // if both slots, use lines 2-3 for slot 1, lines 4-5 for slot 2
// if single slot, use lines 2-3 // if single slot, use lines 2-3
if ( m_slot1Enabled && m_slot2Enabled ){ if ( m_duplex ){
if (slotNo == 1U) { if (slotNo == 1U) {
m_display.fillRect(0, OLED_LINE3, m_display.width(), 40, BLACK); m_display.fillRect(0, OLED_LINE3, m_display.width(), 40, BLACK);
m_display.setCursor(0,OLED_LINE3); m_display.setCursor(0,OLED_LINE3);

4
OLED.h
View file

@ -41,7 +41,7 @@
class COLED : public CDisplay class COLED : public CDisplay
{ {
public: public:
COLED(unsigned char displayType, unsigned char displayBrighness, bool displayInvert, bool displayScroll, bool displayRotate, bool displayLogoScreensaver, bool slot1Enabled, bool slot2Enabled); COLED(unsigned char displayType, unsigned char displayBrighness, bool displayInvert, bool displayScroll, bool displayRotate, bool displayLogoScreensaver, bool duplex);
virtual ~COLED(); virtual ~COLED();
virtual bool open(); virtual bool open();
@ -94,7 +94,7 @@ private:
bool m_displayScroll; bool m_displayScroll;
bool m_displayRotate; bool m_displayRotate;
bool m_displayLogoScreensaver; bool m_displayLogoScreensaver;
bool m_slot1Enabled; bool m_duplex;
bool m_slot2Enabled; bool m_slot2Enabled;
std::string m_ipaddress; std::string m_ipaddress;
ArduiPi_OLED m_display; ArduiPi_OLED m_display;

View file

@ -19,6 +19,6 @@
#if !defined(VERSION_H) #if !defined(VERSION_H)
#define VERSION_H #define VERSION_H
const char* VERSION = "20210309"; const char* VERSION = "20210312";
#endif #endif