mirror of https://github.com/g4klx/MMDVMHost
Refresh the display handlers.
This commit is contained in:
parent
3df5c6041c
commit
45821b1881
|
|
@ -60,8 +60,6 @@ void CCASTInfo::setIdleInt()
|
||||||
networkInfoInitialized = true;
|
networkInfoInitialized = true;
|
||||||
passCounter = 0;
|
passCounter = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCASTInfo::setErrorInt(const char* text)
|
void CCASTInfo::setErrorInt(const char* text)
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ public:
|
||||||
void clearDStar();
|
void clearDStar();
|
||||||
|
|
||||||
void writeDMR(unsigned int slotNo, const std::string& src, bool group, const std::string& dst, const char* type);
|
void writeDMR(unsigned int slotNo, const std::string& src, bool group, const std::string& dst, const char* type);
|
||||||
void writeDMR(unsigned int slotNo, const class CUserDBentry& src, bool group, const std::string& dst, const char* type);
|
void writeDMR(unsigned int slotNo, const CUserDBentry& src, bool group, const std::string& dst, const char* type);
|
||||||
void writeDMRRSSI(unsigned int slotNo, unsigned char rssi);
|
void writeDMRRSSI(unsigned int slotNo, unsigned char rssi);
|
||||||
void writeDMRBER(unsigned int slotNo, float ber);
|
void writeDMRBER(unsigned int slotNo, float ber);
|
||||||
void writeDMRTA(unsigned int slotNo, const unsigned char* talkerAlias, const char* type);
|
void writeDMRTA(unsigned int slotNo, const unsigned char* talkerAlias, const char* type);
|
||||||
|
|
@ -67,7 +67,7 @@ public:
|
||||||
void clearP25();
|
void clearP25();
|
||||||
|
|
||||||
void writeNXDN(const char* source, bool group, unsigned int dest, const char* type);
|
void writeNXDN(const char* source, bool group, unsigned int dest, const char* type);
|
||||||
void writeNXDN(const class CUserDBentry& source, bool group, unsigned int dest, const char* type);
|
void writeNXDN(const CUserDBentry& source, bool group, unsigned int dest, const char* type);
|
||||||
void writeNXDNRSSI(unsigned char rssi);
|
void writeNXDNRSSI(unsigned char rssi);
|
||||||
void writeNXDNBER(float ber);
|
void writeNXDNBER(float ber);
|
||||||
void clearNXDN();
|
void clearNXDN();
|
||||||
|
|
@ -101,7 +101,7 @@ protected:
|
||||||
virtual void clearDStarInt() = 0;
|
virtual void clearDStarInt() = 0;
|
||||||
|
|
||||||
virtual void writeDMRInt(unsigned int slotNo, const std::string& src, bool group, const std::string& dst, const char* type) = 0;
|
virtual void writeDMRInt(unsigned int slotNo, const std::string& src, bool group, const std::string& dst, const char* type) = 0;
|
||||||
virtual int writeDMRIntEx(unsigned int slotNo, const class CUserDBentry& src, bool group, const std::string& dst, const char* type);
|
virtual int writeDMRIntEx(unsigned int slotNo, const CUserDBentry& src, bool group, const std::string& dst, const char* type);
|
||||||
virtual void writeDMRRSSIInt(unsigned int slotNo, unsigned char rssi);
|
virtual void writeDMRRSSIInt(unsigned int slotNo, unsigned char rssi);
|
||||||
virtual void writeDMRTAInt(unsigned int slotNo, const unsigned char* talkerAlias, const char* type);
|
virtual void writeDMRTAInt(unsigned int slotNo, const unsigned char* talkerAlias, const char* type);
|
||||||
virtual void writeDMRBERInt(unsigned int slotNo, float ber);
|
virtual void writeDMRBERInt(unsigned int slotNo, float ber);
|
||||||
|
|
@ -118,7 +118,7 @@ protected:
|
||||||
virtual void clearP25Int() = 0;
|
virtual void clearP25Int() = 0;
|
||||||
|
|
||||||
virtual void writeNXDNInt(const char* source, bool group, unsigned int dest, const char* type) = 0;
|
virtual void writeNXDNInt(const char* source, bool group, unsigned int dest, const char* type) = 0;
|
||||||
virtual int writeNXDNIntEx(const class CUserDBentry& source, bool group, unsigned int dest, const char* type);
|
virtual int writeNXDNIntEx(const CUserDBentry& source, bool group, unsigned int dest, const char* type);
|
||||||
virtual void writeNXDNRSSIInt(unsigned char rssi);
|
virtual void writeNXDNRSSIInt(unsigned char rssi);
|
||||||
virtual void writeNXDNBERInt(float ber);
|
virtual void writeNXDNBERInt(float ber);
|
||||||
virtual void clearNXDNInt() = 0;
|
virtual void clearNXDNInt() = 0;
|
||||||
|
|
|
||||||
27
Nextion.cpp
27
Nextion.cpp
|
|
@ -137,7 +137,7 @@ void CNextion::setIdleInt()
|
||||||
sendCommand("page MMDVM");
|
sendCommand("page MMDVM");
|
||||||
sendCommandAction(1U);
|
sendCommandAction(1U);
|
||||||
|
|
||||||
if (m_brightness>0) {
|
if (m_brightness > 0U) {
|
||||||
::sprintf(command, "dim=%u", m_idleBrightness);
|
::sprintf(command, "dim=%u", m_idleBrightness);
|
||||||
sendCommand(command);
|
sendCommand(command);
|
||||||
}
|
}
|
||||||
|
|
@ -203,7 +203,7 @@ void CNextion::setErrorInt(const char* text)
|
||||||
sendCommandAction(1U);
|
sendCommandAction(1U);
|
||||||
|
|
||||||
char command[20];
|
char command[20];
|
||||||
if (m_brightness>0) {
|
if (m_brightness > 0U) {
|
||||||
::sprintf(command, "dim=%u", m_brightness);
|
::sprintf(command, "dim=%u", m_brightness);
|
||||||
sendCommand(command);
|
sendCommand(command);
|
||||||
}
|
}
|
||||||
|
|
@ -226,7 +226,7 @@ void CNextion::setLockoutInt()
|
||||||
sendCommandAction(1U);
|
sendCommandAction(1U);
|
||||||
|
|
||||||
char command[20];
|
char command[20];
|
||||||
if (m_brightness>0) {
|
if (m_brightness > 0U) {
|
||||||
::sprintf(command, "dim=%u", m_brightness);
|
::sprintf(command, "dim=%u", m_brightness);
|
||||||
sendCommand(command);
|
sendCommand(command);
|
||||||
}
|
}
|
||||||
|
|
@ -245,7 +245,7 @@ void CNextion::setQuitInt()
|
||||||
sendCommandAction(1U);
|
sendCommandAction(1U);
|
||||||
|
|
||||||
char command[100];
|
char command[100];
|
||||||
if (m_brightness>0) {
|
if (m_brightness > 0U) {
|
||||||
::sprintf(command, "dim=%u", m_idleBrightness);
|
::sprintf(command, "dim=%u", m_idleBrightness);
|
||||||
sendCommand(command);
|
sendCommand(command);
|
||||||
}
|
}
|
||||||
|
|
@ -268,7 +268,7 @@ void CNextion::setFMInt()
|
||||||
sendCommandAction(1U);
|
sendCommandAction(1U);
|
||||||
|
|
||||||
char command[20];
|
char command[20];
|
||||||
if (m_brightness > 0) {
|
if (m_brightness > 0U) {
|
||||||
::sprintf(command, "dim=%u", m_brightness);
|
::sprintf(command, "dim=%u", m_brightness);
|
||||||
sendCommand(command);
|
sendCommand(command);
|
||||||
}
|
}
|
||||||
|
|
@ -295,7 +295,7 @@ void CNextion::writeDStarInt(const char* my1, const char* my2, const char* your,
|
||||||
}
|
}
|
||||||
|
|
||||||
char text[50U];
|
char text[50U];
|
||||||
if (m_brightness>0) {
|
if (m_brightness > 0U) {
|
||||||
::sprintf(text, "dim=%u", m_brightness);
|
::sprintf(text, "dim=%u", m_brightness);
|
||||||
sendCommand(text);
|
sendCommand(text);
|
||||||
}
|
}
|
||||||
|
|
@ -396,7 +396,7 @@ void CNextion::writeDMRInt(unsigned int slotNo, const std::string& src, bool gro
|
||||||
}
|
}
|
||||||
|
|
||||||
char text[50U];
|
char text[50U];
|
||||||
if (m_brightness>0) {
|
if (m_brightness > 0U) {
|
||||||
::sprintf(text, "dim=%u", m_brightness);
|
::sprintf(text, "dim=%u", m_brightness);
|
||||||
sendCommand(text);
|
sendCommand(text);
|
||||||
}
|
}
|
||||||
|
|
@ -614,7 +614,7 @@ void CNextion::writeFusionInt(const char* source, const char* dest, unsigned cha
|
||||||
|
|
||||||
|
|
||||||
char text[30U];
|
char text[30U];
|
||||||
if (m_brightness>0) {
|
if (m_brightness > 0U) {
|
||||||
::sprintf(text, "dim=%u", m_brightness);
|
::sprintf(text, "dim=%u", m_brightness);
|
||||||
sendCommand(text);
|
sendCommand(text);
|
||||||
}
|
}
|
||||||
|
|
@ -693,7 +693,7 @@ void CNextion::writeP25Int(const char* source, bool group, unsigned int dest, co
|
||||||
}
|
}
|
||||||
|
|
||||||
char text[30U];
|
char text[30U];
|
||||||
if (m_brightness>0) {
|
if (m_brightness > 0U) {
|
||||||
::sprintf(text, "dim=%u", m_brightness);
|
::sprintf(text, "dim=%u", m_brightness);
|
||||||
sendCommand(text);
|
sendCommand(text);
|
||||||
}
|
}
|
||||||
|
|
@ -765,7 +765,7 @@ void CNextion::writeNXDNInt(const char* source, bool group, unsigned int dest, c
|
||||||
}
|
}
|
||||||
|
|
||||||
char text[30U];
|
char text[30U];
|
||||||
if (m_brightness>0) {
|
if (m_brightness > 0U) {
|
||||||
::sprintf(text, "dim=%u", m_brightness);
|
::sprintf(text, "dim=%u", m_brightness);
|
||||||
sendCommand(text);
|
sendCommand(text);
|
||||||
}
|
}
|
||||||
|
|
@ -838,7 +838,7 @@ void CNextion::writeM17Int(const char* source, const char* dest, const char* typ
|
||||||
}
|
}
|
||||||
|
|
||||||
char text[30U];
|
char text[30U];
|
||||||
if (m_brightness > 0) {
|
if (m_brightness > 0U) {
|
||||||
::sprintf(text, "dim=%u", m_brightness);
|
::sprintf(text, "dim=%u", m_brightness);
|
||||||
sendCommand(text);
|
sendCommand(text);
|
||||||
}
|
}
|
||||||
|
|
@ -907,7 +907,7 @@ void CNextion::writePOCSAGInt(uint32_t ric, const std::string& message)
|
||||||
}
|
}
|
||||||
|
|
||||||
char text[200U];
|
char text[200U];
|
||||||
if (m_brightness>0) {
|
if (m_brightness > 0U) {
|
||||||
::sprintf(text, "dim=%u", m_brightness);
|
::sprintf(text, "dim=%u", m_brightness);
|
||||||
sendCommand(text);
|
sendCommand(text);
|
||||||
}
|
}
|
||||||
|
|
@ -984,6 +984,7 @@ void CNextion::sendCommandAction(unsigned int status)
|
||||||
char text[30U];
|
char text[30U];
|
||||||
::sprintf(text, "MMDVM.status.val=%d", status);
|
::sprintf(text, "MMDVM.status.val=%d", status);
|
||||||
sendCommand(text);
|
sendCommand(text);
|
||||||
|
|
||||||
sendCommand("click S0,1");
|
sendCommand("click S0,1");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -993,8 +994,10 @@ void CNextion::sendCommand(const char* command)
|
||||||
|
|
||||||
m_serial->write((unsigned char*)command, (unsigned int)::strlen(command));
|
m_serial->write((unsigned char*)command, (unsigned int)::strlen(command));
|
||||||
m_serial->write((unsigned char*)"\xFF\xFF\xFF", 3U);
|
m_serial->write((unsigned char*)"\xFF\xFF\xFF", 3U);
|
||||||
|
|
||||||
// Since we just firing commands at the display, and not listening for the response,
|
// Since we just firing commands at the display, and not listening for the response,
|
||||||
// we must add a bit of a delay to allow the display to process the commands, else some are getting mangled.
|
// we must add a bit of a delay to allow the display to process the commands, else some are getting mangled.
|
||||||
// 10 ms is just a guess, but seems to be sufficient.
|
// 10 ms is just a guess, but seems to be sufficient.
|
||||||
CThread::sleep(10U);
|
CThread::sleep(10U);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
75
OLED.cpp
75
OLED.cpp
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2016,2017,2018,2020 by Jonathan Naylor G4KLX
|
* Copyright (C) 2016,2017,2018,2020,2023 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
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
#include "Log.h"
|
#include "Log.h"
|
||||||
|
|
||||||
static bool networkInfoInitialized = false;
|
static bool networkInfoInitialized = false;
|
||||||
static unsigned char passCounter = 0;
|
static unsigned char passCounter = 0U;
|
||||||
|
|
||||||
//Logo MMDVM for Idle Screen
|
//Logo MMDVM for Idle Screen
|
||||||
static unsigned char logo_glcd_bmp[] =
|
static unsigned char logo_glcd_bmp[] =
|
||||||
|
|
@ -191,6 +191,7 @@ const unsigned char logo_POCSAG_bmp [] =
|
||||||
};
|
};
|
||||||
|
|
||||||
COLED::COLED(unsigned char displayType, unsigned char displayBrightness, bool displayInvert, bool displayScroll, bool displayRotate, bool displayLogoScreensaver, bool duplex) :
|
COLED::COLED(unsigned char displayType, unsigned char displayBrightness, bool displayInvert, bool displayScroll, bool displayRotate, bool displayLogoScreensaver, bool duplex) :
|
||||||
|
CDisplay(),
|
||||||
m_displayType(displayType),
|
m_displayType(displayType),
|
||||||
m_displayBrightness(displayBrightness),
|
m_displayBrightness(displayBrightness),
|
||||||
m_displayInvert(displayInvert),
|
m_displayInvert(displayInvert),
|
||||||
|
|
@ -198,7 +199,6 @@ m_displayScroll(displayScroll),
|
||||||
m_displayRotate(displayRotate),
|
m_displayRotate(displayRotate),
|
||||||
m_displayLogoScreensaver(displayLogoScreensaver),
|
m_displayLogoScreensaver(displayLogoScreensaver),
|
||||||
m_duplex(duplex),
|
m_duplex(duplex),
|
||||||
//m_duplex(true), // uncomment to force duplex display for testing!
|
|
||||||
m_ipaddress(),
|
m_ipaddress(),
|
||||||
m_display()
|
m_display()
|
||||||
{
|
{
|
||||||
|
|
@ -210,22 +210,17 @@ COLED::~COLED()
|
||||||
|
|
||||||
bool COLED::open()
|
bool COLED::open()
|
||||||
{
|
{
|
||||||
|
|
||||||
// SPI
|
// SPI
|
||||||
if (m_display.oled_is_spi_proto(m_displayType))
|
if (m_display.oled_is_spi_proto(m_displayType)) {
|
||||||
{
|
|
||||||
// SPI change parameters to fit to your LCD
|
// SPI change parameters to fit to your LCD
|
||||||
if (!m_display.init(OLED_SPI_DC, OLED_SPI_RESET, OLED_SPI_CS, m_displayType))
|
if (!m_display.init(OLED_SPI_DC, OLED_SPI_RESET, OLED_SPI_CS, m_displayType))
|
||||||
return false;
|
return false;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
// I2C change parameters to fit to your LCD
|
// I2C change parameters to fit to your LCD
|
||||||
if (!m_display.init(OLED_I2C_RESET, m_displayType))
|
if (!m_display.init(OLED_I2C_RESET, m_displayType))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
m_display.begin();
|
m_display.begin();
|
||||||
|
|
||||||
m_display.invertDisplay(m_displayInvert ? 1 : 0);
|
m_display.invertDisplay(m_displayInvert ? 1 : 0);
|
||||||
|
|
@ -237,12 +232,13 @@ bool COLED::open()
|
||||||
m_display.sendCommand(0xA0);
|
m_display.sendCommand(0xA0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// init done
|
// Init done
|
||||||
m_display.setTextWrap(false); // disable text wrap as default
|
m_display.setTextWrap(false); // disable text wrap as default
|
||||||
m_display.clearDisplay(); // clears the screen buffer
|
m_display.clearDisplay(); // clears the screen buffer
|
||||||
m_display.display(); // display it (clear display)
|
m_display.display(); // display it (clear display)
|
||||||
|
|
||||||
OLED_statusbar();
|
OLED_statusbar();
|
||||||
|
|
||||||
m_display.setCursor(0, OLED_LINE4);
|
m_display.setCursor(0, OLED_LINE4);
|
||||||
m_display.setTextSize(1);
|
m_display.setTextSize(1);
|
||||||
m_display.print(" -Initializing-");
|
m_display.print(" -Initializing-");
|
||||||
|
|
@ -272,6 +268,7 @@ void COLED::setIdleInt()
|
||||||
m_mode = MODE_IDLE;
|
m_mode = MODE_IDLE;
|
||||||
|
|
||||||
m_display.clearDisplay();
|
m_display.clearDisplay();
|
||||||
|
|
||||||
OLED_statusbar();
|
OLED_statusbar();
|
||||||
|
|
||||||
if (m_displayScroll && m_displayLogoScreensaver)
|
if (m_displayScroll && m_displayLogoScreensaver)
|
||||||
|
|
@ -293,15 +290,15 @@ void COLED::setIdleInt()
|
||||||
delete m_network;
|
delete m_network;
|
||||||
|
|
||||||
networkInfoInitialized = true;
|
networkInfoInitialized = true;
|
||||||
passCounter = 0;
|
passCounter = 0U;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Let's let the users know if they are in Auto-AP mode...
|
// Let's let the users know if they are in Auto-AP mode...
|
||||||
if (m_ipaddress.find("wlan0_ap") != std::string::npos) {
|
if (m_ipaddress.find("wlan0_ap") != std::string::npos) {
|
||||||
size_t pos = m_ipaddress.find("wlan0_ap");
|
size_t pos = m_ipaddress.find("wlan0_ap");
|
||||||
if (pos != std::string::npos) {
|
if (pos != std::string::npos)
|
||||||
m_ipaddress.erase(pos, 9); // remove redundant/superfluous "wlan0_ap" from string
|
m_ipaddress.erase(pos, 9); // remove redundant/superfluous "wlan0_ap" from string
|
||||||
}
|
|
||||||
// Read ssid value from /etc/hostapd.conf if it exists...
|
// Read ssid value from /etc/hostapd.conf if it exists...
|
||||||
std::string ssid;
|
std::string ssid;
|
||||||
std::ifstream configFile("/etc/hostapd/hostapd.conf");
|
std::ifstream configFile("/etc/hostapd/hostapd.conf");
|
||||||
|
|
@ -317,6 +314,7 @@ void COLED::setIdleInt()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
configFile.close();
|
configFile.close();
|
||||||
} else {
|
} else {
|
||||||
ssid = "Unknown"; // `/etc/hostapd.conf` does not exist...
|
ssid = "Unknown"; // `/etc/hostapd.conf` does not exist...
|
||||||
|
|
@ -352,8 +350,8 @@ void COLED::setIdleInt()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_display.display();
|
|
||||||
|
|
||||||
|
m_display.display();
|
||||||
}
|
}
|
||||||
|
|
||||||
void COLED::setErrorInt(const char* text)
|
void COLED::setErrorInt(const char* text)
|
||||||
|
|
@ -437,6 +435,7 @@ void COLED::writeDStarInt(const char* my1, const char* my2, const char* your, co
|
||||||
m_display.printf("%s", m_ipaddress.c_str());
|
m_display.printf("%s", m_ipaddress.c_str());
|
||||||
|
|
||||||
OLED_statusbar();
|
OLED_statusbar();
|
||||||
|
|
||||||
m_display.display();
|
m_display.display();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -458,50 +457,46 @@ void COLED::writeDMRInt(unsigned int slotNo,const std::string& src,bool group,co
|
||||||
CUserDB entry tmp;
|
CUserDB entry tmp;
|
||||||
|
|
||||||
tmp.set(keyCALLSIGN, src);
|
tmp.set(keyCALLSIGN, src);
|
||||||
|
|
||||||
writeDMRIntEx(slotNo, tmp, group, dst, type);
|
writeDMRIntEx(slotNo, tmp, group, dst, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define CALLandNAME(u) ((u).get(keyCALLSIGN) + " " + (u).get(keyFIRST_NAME))
|
#define CALLandNAME(u) ((u).get(keyCALLSIGN) + " " + (u).get(keyFIRST_NAME))
|
||||||
|
|
||||||
int COLED::writeDMRIntEx(unsigned int slotNo, const class CUserDBentry& src, bool group, const std::string& dst, const char* type)
|
int COLED::writeDMRIntEx(unsigned int slotNo, const CUserDBentry& src, bool group, const std::string& dst, const char* type)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (m_mode != MODE_DMR) {
|
if (m_mode != MODE_DMR) {
|
||||||
m_display.clearDisplay();
|
m_display.clearDisplay();
|
||||||
m_mode = MODE_DMR;
|
m_mode = MODE_DMR;
|
||||||
clearDMRInt(slotNo);
|
clearDMRInt(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_duplex) {
|
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);
|
||||||
m_display.setCursor(0, OLED_LINE2);
|
m_display.setCursor(0, OLED_LINE2);
|
||||||
m_display.printf("%s", CALLandNAME(src).c_str());
|
m_display.printf("%s", CALLandNAME(src).c_str());
|
||||||
m_display.setCursor(0, OLED_LINE3);
|
m_display.setCursor(0, OLED_LINE3);
|
||||||
m_display.printf("Slot: %i %s %s%s",slotNo,type,group ? "TG: " : "",dst.c_str());
|
m_display.printf("Slot: %i %s %s%s", slotNo, type.c_str(), group ? "TG: " : "", dst.c_str());
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
m_display.fillRect(0, OLED_LINE4, m_display.width(), 40, BLACK);
|
m_display.fillRect(0, OLED_LINE4, m_display.width(), 40, BLACK);
|
||||||
m_display.setCursor(0, OLED_LINE4);
|
m_display.setCursor(0, OLED_LINE4);
|
||||||
m_display.printf("%s", CALLandNAME(src).c_str());
|
m_display.printf("%s", CALLandNAME(src).c_str());
|
||||||
m_display.setCursor(0, OLED_LINE5);
|
m_display.setCursor(0, OLED_LINE5);
|
||||||
m_display.printf("Slot: %i %s %s%s",slotNo,type,group ? "TG: " : "",dst.c_str());
|
m_display.printf("Slot: %i %s %s%s", slotNo, type.c_str(), group ? "TG: " : "", dst.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
m_display.fillRect(0, OLED_LINE6, m_display.width(), 20, BLACK);
|
m_display.fillRect(0, OLED_LINE6, m_display.width(), 20, BLACK);
|
||||||
m_display.setCursor(0, OLED_LINE6);
|
m_display.setCursor(0, OLED_LINE6);
|
||||||
m_display.printf("%s", m_ipaddress.c_str());
|
m_display.printf("%s", m_ipaddress.c_str());
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
m_display.fillRect(0, OLED_LINE2, m_display.width(), m_display.height(), BLACK);
|
m_display.fillRect(0, OLED_LINE2, m_display.width(), m_display.height(), BLACK);
|
||||||
m_display.setCursor(0, OLED_LINE2);
|
m_display.setCursor(0, OLED_LINE2);
|
||||||
m_display.printf("%s", CALLandNAME(src).c_str());
|
m_display.printf("%s", CALLandNAME(src).c_str());
|
||||||
m_display.setCursor(0, OLED_LINE3);
|
m_display.setCursor(0, OLED_LINE3);
|
||||||
m_display.printf("Slot: %i %s %s%s",slotNo,type,group ? "TG: " : "",dst.c_str());
|
m_display.printf("Slot: %i %s %s%s", slotNo, type.c_str(), group ? "TG: " : "", dst.c_str());
|
||||||
m_display.setCursor(0, OLED_LINE4);
|
m_display.setCursor(0, OLED_LINE4);
|
||||||
m_display.printf("%s", src.get(keyCITY).c_str());
|
m_display.printf("%s", src.get(keyCITY).c_str());
|
||||||
m_display.setCursor(0, OLED_LINE5);
|
m_display.setCursor(0, OLED_LINE5);
|
||||||
|
|
@ -511,6 +506,7 @@ int COLED::writeDMRIntEx(unsigned int slotNo, const class CUserDBentry& src, boo
|
||||||
}
|
}
|
||||||
|
|
||||||
OLED_statusbar();
|
OLED_statusbar();
|
||||||
|
|
||||||
m_display.display();
|
m_display.display();
|
||||||
|
|
||||||
// must be 0, to avoid calling writeDMRInt() from CDisplay::writeDMR()
|
// must be 0, to avoid calling writeDMRInt() from CDisplay::writeDMR()
|
||||||
|
|
@ -526,14 +522,12 @@ void COLED::clearDMRInt(unsigned int slotNo)
|
||||||
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);
|
||||||
m_display.print("Slot: 1 Standby");
|
m_display.print("Slot: 1 Standby");
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
m_display.fillRect(0, OLED_LINE5, m_display.width(), 40, BLACK);
|
m_display.fillRect(0, OLED_LINE5, m_display.width(), 40, BLACK);
|
||||||
m_display.setCursor(0, OLED_LINE5);
|
m_display.setCursor(0, OLED_LINE5);
|
||||||
m_display.print("Slot: 2 Standby");
|
m_display.print("Slot: 2 Standby");
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
m_display.fillRect(0, OLED_LINE2, m_display.width(), m_display.height(), BLACK);
|
m_display.fillRect(0, OLED_LINE2, m_display.width(), m_display.height(), BLACK);
|
||||||
m_display.setCursor(0, OLED_LINE3);
|
m_display.setCursor(0, OLED_LINE3);
|
||||||
m_display.printf("Slot: %i Standby", slotNo);
|
m_display.printf("Slot: %i Standby", slotNo);
|
||||||
|
|
@ -542,6 +536,7 @@ void COLED::clearDMRInt(unsigned int slotNo)
|
||||||
m_display.fillRect(0, OLED_LINE6, m_display.width(), 20, BLACK);
|
m_display.fillRect(0, OLED_LINE6, m_display.width(), 20, BLACK);
|
||||||
m_display.setCursor(0, OLED_LINE6);
|
m_display.setCursor(0, OLED_LINE6);
|
||||||
m_display.printf("%s", m_ipaddress.c_str());
|
m_display.printf("%s", m_ipaddress.c_str());
|
||||||
|
|
||||||
m_display.display();
|
m_display.display();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -590,6 +585,7 @@ void COLED::writeP25Int(const char* source, bool group, unsigned int dest, const
|
||||||
m_display.printf(" %s%u", group ? "TG" : "", dest);
|
m_display.printf(" %s%u", group ? "TG" : "", dest);
|
||||||
|
|
||||||
OLED_statusbar();
|
OLED_statusbar();
|
||||||
|
|
||||||
m_display.display();
|
m_display.display();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -611,10 +607,11 @@ void COLED::writeNXDNInt(const char* source, bool group, unsigned int dest, cons
|
||||||
CUserDBentry tmp;
|
CUserDBentry tmp;
|
||||||
|
|
||||||
tmp.set(keyCALLSIGN, source);
|
tmp.set(keyCALLSIGN, source);
|
||||||
|
|
||||||
writeNXDNIntEx(tmp, group, dest, type);
|
writeNXDNIntEx(tmp, group, dest, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
int COLED::writeNXDNIntEx(const class CUserDBentry& source, bool group, unsigned int dest, const char* type)
|
int COLED::writeNXDNIntEx(const CUserDBentry& source, bool group, unsigned int dest, const char* type)
|
||||||
{
|
{
|
||||||
m_mode = MODE_NXDN;
|
m_mode = MODE_NXDN;
|
||||||
|
|
||||||
|
|
@ -637,6 +634,7 @@ int COLED::writeNXDNIntEx(const class CUserDBentry& source, bool group, unsigned
|
||||||
m_display.printf("%s", source.get(keyCOUNTRY).c_str());
|
m_display.printf("%s", source.get(keyCOUNTRY).c_str());
|
||||||
|
|
||||||
OLED_statusbar();
|
OLED_statusbar();
|
||||||
|
|
||||||
m_display.display();
|
m_display.display();
|
||||||
|
|
||||||
// must be 0, to avoid calling writeNXDNInt() from CDisplay::writeNXDN()
|
// must be 0, to avoid calling writeNXDNInt() from CDisplay::writeNXDN()
|
||||||
|
|
@ -672,8 +670,8 @@ void COLED::writeM17Int(const char* source, const char* dest, const char* type)
|
||||||
m_display.setCursor(0, OLED_LINE6);
|
m_display.setCursor(0, OLED_LINE6);
|
||||||
m_display.printf("%s", m_ipaddress.c_str());
|
m_display.printf("%s", m_ipaddress.c_str());
|
||||||
|
|
||||||
|
|
||||||
OLED_statusbar();
|
OLED_statusbar();
|
||||||
|
|
||||||
m_display.display();
|
m_display.display();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -729,9 +727,8 @@ void COLED::writePOCSAGInt(uint32_t ric, const std::string& message)
|
||||||
|
|
||||||
m_display.setCursor(0, OLED_LINE2);
|
m_display.setCursor(0, OLED_LINE2);
|
||||||
m_display.printf("RIC: %u", ric);
|
m_display.printf("RIC: %u", ric);
|
||||||
if (!rublic.empty()) {
|
if (!rublic.empty())
|
||||||
m_display.printf(" / %s", rublic.c_str());
|
m_display.printf(" / %s", rublic.c_str());
|
||||||
}
|
|
||||||
|
|
||||||
m_display.setTextWrap(true); // text wrap temorally enable
|
m_display.setTextWrap(true); // text wrap temorally enable
|
||||||
m_display.setCursor(0, OLED_LINE3);
|
m_display.setCursor(0, OLED_LINE3);
|
||||||
|
|
@ -749,6 +746,7 @@ void COLED::writePOCSAGInt(uint32_t ric, const std::string& message)
|
||||||
m_display.setTextWrap(false);
|
m_display.setTextWrap(false);
|
||||||
|
|
||||||
OLED_statusbar();
|
OLED_statusbar();
|
||||||
|
|
||||||
m_display.display();
|
m_display.display();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -775,6 +773,7 @@ void COLED::writeCWInt()
|
||||||
|
|
||||||
m_display.setTextSize(1);
|
m_display.setTextSize(1);
|
||||||
m_display.display();
|
m_display.display();
|
||||||
|
|
||||||
if (m_displayScroll)
|
if (m_displayScroll)
|
||||||
m_display.startscrollleft(0x02, 0x0f);
|
m_display.startscrollleft(0x02, 0x0f);
|
||||||
}
|
}
|
||||||
|
|
@ -802,17 +801,18 @@ void COLED::clearCWInt()
|
||||||
|
|
||||||
if (m_displayScroll)
|
if (m_displayScroll)
|
||||||
m_display.startscrolldiagleft(0x00, 0x0f);
|
m_display.startscrolldiagleft(0x00, 0x0f);
|
||||||
|
|
||||||
m_display.display();
|
m_display.display();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void COLED::close()
|
void COLED::close()
|
||||||
{
|
{
|
||||||
m_display.clearDisplay();
|
m_display.clearDisplay();
|
||||||
m_display.fillRect(0, 0, m_display.width(), 16, BLACK);
|
m_display.fillRect(0, 0, m_display.width(), 16, BLACK);
|
||||||
|
|
||||||
if (m_displayScroll)
|
if (m_displayScroll)
|
||||||
m_display.startscrollleft(0x00, 0x01);
|
m_display.startscrollleft(0x00, 0x01);
|
||||||
|
|
||||||
m_display.setCursor(0, OLED_LINE3);
|
m_display.setCursor(0, OLED_LINE3);
|
||||||
m_display.setTextSize(2);
|
m_display.setTextSize(2);
|
||||||
m_display.print(" -OFFLINE-");
|
m_display.print(" -OFFLINE-");
|
||||||
|
|
@ -848,3 +848,4 @@ void COLED::OLED_statusbar()
|
||||||
if (m_displayScroll)
|
if (m_displayScroll)
|
||||||
m_display.startscrollleft(0x00, 0x01);
|
m_display.startscrollleft(0x00, 0x01);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
17
OLED.h
17
OLED.h
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2016,2017,2018,2020 by Jonathan Naylor G4KLX
|
* Copyright (C) 2016,2017,2018,2020,2023 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
|
||||||
|
|
@ -45,13 +45,15 @@
|
||||||
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 duplex);
|
COLED(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();
|
||||||
|
|
||||||
virtual void setIdleInt();
|
virtual void close();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void setIdleInt();
|
||||||
virtual void setErrorInt(const char* text);
|
virtual void setErrorInt(const char* text);
|
||||||
virtual void setLockoutInt();
|
virtual void setLockoutInt();
|
||||||
virtual void setQuitInt();
|
virtual void setQuitInt();
|
||||||
|
|
@ -61,7 +63,7 @@ public:
|
||||||
virtual void clearDStarInt();
|
virtual void clearDStarInt();
|
||||||
|
|
||||||
virtual void writeDMRInt(unsigned int slotNo, const std::string& src, bool group, const std::string& dst, const char* type);
|
virtual void writeDMRInt(unsigned int slotNo, const std::string& src, bool group, const std::string& dst, const char* type);
|
||||||
virtual int writeDMRIntEx(unsigned int slotNo, const class CUserDBentry& src, bool group, const std::string& dst, const char* type);
|
virtual int writeDMRIntEx(unsigned int slotNo, const CUserDBentry& src, bool group, const std::string& dst, const char* type);
|
||||||
virtual void clearDMRInt(unsigned int slotNo);
|
virtual void clearDMRInt(unsigned int slotNo);
|
||||||
|
|
||||||
virtual void writeFusionInt(const char* source, const char* dest, unsigned char dgid, const char* type, const char* origin);
|
virtual void writeFusionInt(const char* source, const char* dest, unsigned char dgid, const char* type, const char* origin);
|
||||||
|
|
@ -71,7 +73,7 @@ public:
|
||||||
virtual void clearP25Int();
|
virtual void clearP25Int();
|
||||||
|
|
||||||
virtual void writeNXDNInt(const char* source, bool group, unsigned int dest, const char* type);
|
virtual void writeNXDNInt(const char* source, bool group, unsigned int dest, const char* type);
|
||||||
virtual int writeNXDNIntEx(const class CUserDBentry& source, bool group, unsigned int dest, const char* type);
|
virtual int writeNXDNIntEx(const CUserDBentry& source, bool group, unsigned int dest, const char* type);
|
||||||
virtual void clearNXDNInt();
|
virtual void clearNXDNInt();
|
||||||
|
|
||||||
virtual void writeM17Int(const char* source, const char* dest, const char* type);
|
virtual void writeM17Int(const char* source, const char* dest, const char* type);
|
||||||
|
|
@ -83,8 +85,6 @@ public:
|
||||||
virtual void writeCWInt();
|
virtual void writeCWInt();
|
||||||
virtual void clearCWInt();
|
virtual void clearCWInt();
|
||||||
|
|
||||||
virtual void close();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const char* m_slot1_state;
|
const char* m_slot1_state;
|
||||||
const char* m_slot2_state;
|
const char* m_slot2_state;
|
||||||
|
|
@ -99,9 +99,10 @@ private:
|
||||||
std::string m_ipaddress;
|
std::string m_ipaddress;
|
||||||
ArduiPi_OLED m_display;
|
ArduiPi_OLED m_display;
|
||||||
|
|
||||||
float readTemperature(const std::string& filePath);
|
float readTemperature(const char* filePath);
|
||||||
|
|
||||||
void OLED_statusbar();
|
void OLED_statusbar();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -235,7 +235,7 @@ void CTFTSurenoo::writeDMRInt(unsigned int slotNo, const std::string& src, bool
|
||||||
m_mode = MODE_DMR;
|
m_mode = MODE_DMR;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CTFTSurenoo::writeDMRIntEx(unsigned int slotNo, const class CUserDBentry& src, bool group, const std::string& dst, const char* type)
|
int CTFTSurenoo::writeDMRIntEx(unsigned int slotNo, const CUserDBentry& src, bool group, const std::string& dst, const char* type)
|
||||||
{
|
{
|
||||||
assert(type != NULL);
|
assert(type != NULL);
|
||||||
|
|
||||||
|
|
@ -335,7 +335,7 @@ void CTFTSurenoo::writeNXDNInt(const char* source, bool group, unsigned int dest
|
||||||
m_mode = MODE_NXDN;
|
m_mode = MODE_NXDN;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CTFTSurenoo::writeNXDNIntEx(const class CUserDBentry& source, bool group, unsigned int dest, const char* type)
|
int CTFTSurenoo::writeNXDNIntEx(const CUserDBentry& source, bool group, unsigned int dest, const char* type)
|
||||||
{
|
{
|
||||||
assert(type != NULL);
|
assert(type != NULL);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ protected:
|
||||||
virtual void clearDStarInt();
|
virtual void clearDStarInt();
|
||||||
|
|
||||||
virtual void writeDMRInt(unsigned int slotNo, const std::string& src, bool group, const std::string& dst, const char* type);
|
virtual void writeDMRInt(unsigned int slotNo, const std::string& src, bool group, const std::string& dst, const char* type);
|
||||||
virtual int writeDMRIntEx(unsigned int slotNo, const class CUserDBentry& src, bool group, const std::string& dst, const char* type);
|
virtual int writeDMRIntEx(unsigned int slotNo, const CUserDBentry& src, bool group, const std::string& dst, const char* type);
|
||||||
virtual void clearDMRInt(unsigned int slotNo);
|
virtual void clearDMRInt(unsigned int slotNo);
|
||||||
|
|
||||||
virtual void writeFusionInt(const char* source, const char* dest, unsigned char dgid, const char* type, const char* origin);
|
virtual void writeFusionInt(const char* source, const char* dest, unsigned char dgid, const char* type, const char* origin);
|
||||||
|
|
@ -58,7 +58,7 @@ protected:
|
||||||
virtual void clearP25Int();
|
virtual void clearP25Int();
|
||||||
|
|
||||||
virtual void writeNXDNInt(const char* source, bool group, unsigned int dest, const char* type);
|
virtual void writeNXDNInt(const char* source, bool group, unsigned int dest, const char* type);
|
||||||
virtual int writeNXDNIntEx(const class CUserDBentry& source, bool group, unsigned int dest, const char* type);
|
virtual int writeNXDNIntEx(const CUserDBentry& source, bool group, unsigned int dest, const char* type);
|
||||||
virtual void clearNXDNInt();
|
virtual void clearNXDNInt();
|
||||||
|
|
||||||
virtual void writeM17Int(const char* source, const char* dest, const char* type);
|
virtual void writeM17Int(const char* source, const char* dest, const char* type);
|
||||||
|
|
@ -87,9 +87,9 @@ private:
|
||||||
void setLineBuffer(char *buf, const char *text, int maxchar);
|
void setLineBuffer(char *buf, const char *text, int maxchar);
|
||||||
void setModeLine(const char *text);
|
void setModeLine(const char *text);
|
||||||
void setStatusLine(unsigned int line, const char *text);
|
void setStatusLine(unsigned int line, const char *text);
|
||||||
void refreshDisplay(void);
|
void refreshDisplay();
|
||||||
|
|
||||||
void lcdReset(void);
|
void lcdReset();
|
||||||
void clearScreen(unsigned char colour);
|
void clearScreen(unsigned char colour);
|
||||||
void setBackground(unsigned char colour);
|
void setBackground(unsigned char colour);
|
||||||
void setRotation(unsigned char rotation);
|
void setRotation(unsigned char rotation);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue