2016-03-14 22:58:09 +00:00
|
|
|
/*
|
2020-08-09 14:09:08 +00:00
|
|
|
* Copyright (C) 2016,2017,2018,2020 by Jonathan Naylor G4KLX & Tony Corbett G0WFV
|
2016-03-14 22:58:09 +00:00
|
|
|
*
|
|
|
|
* 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
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "HD44780.h"
|
|
|
|
#include "Log.h"
|
|
|
|
|
|
|
|
#include <wiringPi.h>
|
2016-05-01 15:59:43 +00:00
|
|
|
#include <softPwm.h>
|
2016-03-14 22:58:09 +00:00
|
|
|
#include <lcd.h>
|
2016-05-12 08:53:42 +00:00
|
|
|
#include <pthread.h>
|
2016-03-14 22:58:09 +00:00
|
|
|
|
|
|
|
#include <cstdio>
|
|
|
|
#include <cassert>
|
2016-04-16 19:59:31 +00:00
|
|
|
#include <cstring>
|
2016-03-14 22:58:09 +00:00
|
|
|
|
2016-04-14 20:52:03 +00:00
|
|
|
const char* LISTENING = "Listening ";
|
2016-05-12 08:53:42 +00:00
|
|
|
const char* DEADSPACE = " ";
|
2016-03-15 07:12:52 +00:00
|
|
|
|
2016-05-29 07:13:43 +00:00
|
|
|
char m_buffer1[128U];
|
|
|
|
char m_buffer2[128U];
|
2016-06-18 08:38:03 +00:00
|
|
|
char m_buffer3[128U];
|
|
|
|
char m_buffer4[128U];
|
2016-05-29 07:13:43 +00:00
|
|
|
|
2017-01-06 21:22:47 +00:00
|
|
|
const unsigned int DSTAR_RSSI_COUNT = 3U; // 3 * 420ms = 1260ms
|
|
|
|
const unsigned int DMR_RSSI_COUNT = 4U; // 4 * 360ms = 1440ms
|
2018-01-17 19:04:00 +00:00
|
|
|
const unsigned int YSF_RSSI_COUNT = 13U; // 13 * 100ms = 1300ms
|
2017-01-06 21:22:47 +00:00
|
|
|
const unsigned int P25_RSSI_COUNT = 7U; // 7 * 180ms = 1260ms
|
2018-01-17 19:04:00 +00:00
|
|
|
const unsigned int NXDN_RSSI_COUNT = 28U; // 28 * 40ms = 1120ms
|
2017-01-06 21:22:47 +00:00
|
|
|
|
2016-06-30 19:35:32 +00:00
|
|
|
CHD44780::CHD44780(unsigned int rows, unsigned int cols, const std::string& callsign, unsigned int dmrid, const std::vector<unsigned int>& pins, unsigned int i2cAddress, bool pwm, unsigned int pwmPin, unsigned int pwmBright, unsigned int pwmDim, bool displayClock, bool utc, bool duplex) :
|
2016-05-09 17:14:27 +00:00
|
|
|
CDisplay(),
|
2016-03-14 22:58:09 +00:00
|
|
|
m_rows(rows),
|
|
|
|
m_cols(cols),
|
2016-04-08 11:47:05 +00:00
|
|
|
m_callsign(callsign),
|
|
|
|
m_dmrid(dmrid),
|
2016-04-06 16:43:20 +00:00
|
|
|
m_rb(pins.at(0U)),
|
|
|
|
m_strb(pins.at(1U)),
|
|
|
|
m_d0(pins.at(2U)),
|
|
|
|
m_d1(pins.at(3U)),
|
|
|
|
m_d2(pins.at(4U)),
|
|
|
|
m_d3(pins.at(5U)),
|
2016-06-30 19:10:30 +00:00
|
|
|
m_i2cAddress(i2cAddress),
|
2016-05-03 16:59:21 +00:00
|
|
|
m_pwm(pwm),
|
|
|
|
m_pwmPin(pwmPin),
|
|
|
|
m_pwmBright(pwmBright),
|
|
|
|
m_pwmDim(pwmDim),
|
2016-05-28 20:29:30 +00:00
|
|
|
m_displayClock(displayClock),
|
|
|
|
m_utc(utc),
|
2016-05-12 11:32:19 +00:00
|
|
|
m_duplex(duplex),
|
2016-06-04 14:22:39 +00:00
|
|
|
//m_duplex(true), // uncomment to force duplex display for testing!
|
2016-04-11 11:21:46 +00:00
|
|
|
m_fd(-1),
|
2016-05-23 17:43:44 +00:00
|
|
|
m_dmr(false),
|
2017-01-06 21:22:47 +00:00
|
|
|
m_clockDisplayTimer(1000U, 0U, 250U), // Update the clock display every 250ms
|
|
|
|
m_rssiCount1(0U),
|
|
|
|
m_rssiCount2(0U)
|
2016-03-14 22:58:09 +00:00
|
|
|
{
|
2016-03-15 17:20:10 +00:00
|
|
|
assert(rows > 1U);
|
|
|
|
assert(cols > 15U);
|
2016-03-14 22:58:09 +00:00
|
|
|
}
|
|
|
|
|
2016-05-12 08:53:42 +00:00
|
|
|
// Text-based custom character for "from"
|
2016-05-11 06:58:05 +00:00
|
|
|
unsigned char fmChar[8] =
|
|
|
|
{
|
|
|
|
0b11100,
|
|
|
|
0b10000,
|
|
|
|
0b11000,
|
|
|
|
0b10000,
|
|
|
|
0b00101,
|
|
|
|
0b00111,
|
|
|
|
0b00101,
|
|
|
|
0b00101
|
|
|
|
};
|
|
|
|
|
2016-05-12 08:53:42 +00:00
|
|
|
// Text-based custom character for "to"
|
2016-05-11 06:58:05 +00:00
|
|
|
unsigned char toChar[8] =
|
|
|
|
{
|
|
|
|
0b11100,
|
|
|
|
0b01000,
|
|
|
|
0b01000,
|
|
|
|
0b01000,
|
|
|
|
0b00010,
|
|
|
|
0b00101,
|
|
|
|
0b00101,
|
|
|
|
0b00010
|
|
|
|
};
|
|
|
|
|
2016-05-11 12:22:28 +00:00
|
|
|
// Icon-based custom character for RF traffic
|
|
|
|
unsigned char rfChar[8] =
|
|
|
|
{
|
|
|
|
0b11111,
|
|
|
|
0b10101,
|
|
|
|
0b01110,
|
|
|
|
0b00100,
|
|
|
|
0b00100,
|
|
|
|
0b00100,
|
2016-05-12 08:53:42 +00:00
|
|
|
0b00100,
|
2016-05-11 12:22:28 +00:00
|
|
|
0b00000
|
2016-05-11 08:10:48 +00:00
|
|
|
};
|
|
|
|
|
2016-05-11 12:22:28 +00:00
|
|
|
// Icon-based custom character for network traffic
|
|
|
|
unsigned char ipChar[8] =
|
|
|
|
{
|
2016-05-12 08:53:42 +00:00
|
|
|
0b00000,
|
2016-05-11 12:22:28 +00:00
|
|
|
0b01110,
|
|
|
|
0b10001,
|
|
|
|
0b00100,
|
|
|
|
0b01010,
|
|
|
|
0b00000,
|
|
|
|
0b00100,
|
|
|
|
0b00000
|
2016-05-11 08:10:48 +00:00
|
|
|
};
|
|
|
|
|
2016-05-12 08:53:42 +00:00
|
|
|
// Icon-based custom character for call to talkgroup
|
2016-05-11 14:34:43 +00:00
|
|
|
unsigned char tgChar[8] =
|
|
|
|
{
|
|
|
|
0b01110,
|
|
|
|
0b10001,
|
|
|
|
0b10001,
|
|
|
|
0b10001,
|
2016-05-12 08:53:42 +00:00
|
|
|
0b01010,
|
|
|
|
0b01100,
|
|
|
|
0b10000,
|
2016-05-11 14:34:43 +00:00
|
|
|
0b00000
|
|
|
|
};
|
|
|
|
|
2016-05-12 08:53:42 +00:00
|
|
|
// Icon-based custom character for private call
|
2016-05-11 14:34:43 +00:00
|
|
|
unsigned char privChar[8] =
|
|
|
|
{
|
|
|
|
0b00100,
|
|
|
|
0b00000,
|
|
|
|
0b11111,
|
|
|
|
0b01110,
|
|
|
|
0b01110,
|
|
|
|
0b01010,
|
|
|
|
0b01010,
|
|
|
|
0b00000
|
2016-05-11 10:37:23 +00:00
|
|
|
};
|
|
|
|
|
2016-03-14 22:58:09 +00:00
|
|
|
CHD44780::~CHD44780()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
bool CHD44780::open()
|
|
|
|
{
|
2016-03-15 09:39:04 +00:00
|
|
|
::wiringPiSetup();
|
2016-03-15 09:38:15 +00:00
|
|
|
|
2016-05-03 16:59:21 +00:00
|
|
|
if (m_pwm) {
|
|
|
|
if (m_pwmPin != 1U) {
|
|
|
|
::softPwmCreate(m_pwmPin, 0, 100);
|
|
|
|
::softPwmWrite(m_pwmPin, m_pwmDim);
|
|
|
|
} else {
|
|
|
|
::pinMode(m_pwmPin, PWM_OUTPUT);
|
|
|
|
::pwmWrite(m_pwmPin, (m_pwmDim / 100) * 1024);
|
2016-05-01 15:59:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-04-17 11:11:05 +00:00
|
|
|
#ifdef ADAFRUIT_DISPLAY
|
2016-05-03 16:59:21 +00:00
|
|
|
adafruitLCDSetup();
|
2016-04-17 11:11:05 +00:00
|
|
|
#endif
|
|
|
|
|
2016-06-27 17:48:13 +00:00
|
|
|
#ifdef PCF8574_DISPLAY
|
|
|
|
pcf8574LCDSetup();
|
|
|
|
#endif
|
|
|
|
|
2016-04-06 16:43:20 +00:00
|
|
|
m_fd = ::lcdInit(m_rows, m_cols, 4, m_rb, m_strb, m_d0, m_d1, m_d2, m_d3, 0, 0, 0, 0);
|
2016-03-14 22:58:09 +00:00
|
|
|
if (m_fd == -1) {
|
|
|
|
LogError("Unable to open the HD44780");
|
|
|
|
return false;
|
|
|
|
}
|
2016-06-27 17:48:13 +00:00
|
|
|
|
2016-03-14 22:58:09 +00:00
|
|
|
::lcdDisplay(m_fd, 1);
|
|
|
|
::lcdCursor(m_fd, 0);
|
|
|
|
::lcdCursorBlink(m_fd, 0);
|
2016-05-11 06:58:05 +00:00
|
|
|
::lcdCharDef(m_fd, 0, fmChar);
|
|
|
|
::lcdCharDef(m_fd, 1, toChar);
|
2016-07-24 12:49:58 +00:00
|
|
|
::lcdCharDef(m_fd, 2, rfChar);
|
|
|
|
::lcdCharDef(m_fd, 3, ipChar);
|
|
|
|
::lcdCharDef(m_fd, 4, privChar);
|
|
|
|
::lcdCharDef(m_fd, 5, tgChar);
|
2016-03-14 22:58:09 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2016-04-17 11:11:05 +00:00
|
|
|
#ifdef ADAFRUIT_DISPLAY
|
|
|
|
void CHD44780::adafruitLCDSetup()
|
|
|
|
{
|
2016-05-03 16:59:21 +00:00
|
|
|
// The other control pins are initialised with lcdInit()
|
2016-07-13 20:07:37 +00:00
|
|
|
::mcp23017Setup(AF_BASE, m_i2cAddress);
|
2016-04-17 11:11:05 +00:00
|
|
|
|
2016-05-02 19:45:29 +00:00
|
|
|
// Backlight LEDs
|
2016-05-03 16:59:21 +00:00
|
|
|
::pinMode(AF_RED, OUTPUT);
|
|
|
|
::pinMode(AF_GREEN, OUTPUT);
|
|
|
|
::pinMode(AF_BLUE, OUTPUT);
|
2016-04-17 11:11:05 +00:00
|
|
|
|
|
|
|
// Control signals
|
2016-05-03 16:59:21 +00:00
|
|
|
::pinMode(AF_RW, OUTPUT);
|
|
|
|
::digitalWrite(AF_RW, LOW);
|
2016-06-28 17:21:04 +00:00
|
|
|
|
|
|
|
m_rb = AF_RS;
|
|
|
|
m_strb = AF_E;
|
|
|
|
m_d0 = AF_D0;
|
|
|
|
m_d1 = AF_D1;
|
|
|
|
m_d2 = AF_D2;
|
|
|
|
m_d3 = AF_D3;
|
2016-04-17 11:11:05 +00:00
|
|
|
}
|
2016-05-02 19:45:29 +00:00
|
|
|
|
2016-05-03 16:59:21 +00:00
|
|
|
void CHD44780::adafruitLCDColour(ADAFRUIT_COLOUR colour)
|
2016-05-02 19:45:29 +00:00
|
|
|
{
|
2016-05-03 16:59:21 +00:00
|
|
|
switch (colour) {
|
|
|
|
case AC_OFF:
|
2016-05-06 22:13:17 +00:00
|
|
|
::digitalWrite(AF_RED, AF_OFF);
|
|
|
|
::digitalWrite(AF_GREEN, AF_OFF);
|
|
|
|
::digitalWrite(AF_BLUE, AF_OFF);
|
2016-05-03 16:59:21 +00:00
|
|
|
break;
|
|
|
|
case AC_WHITE:
|
2016-05-06 22:13:17 +00:00
|
|
|
::digitalWrite(AF_RED, AF_ON);
|
|
|
|
::digitalWrite(AF_GREEN, AF_ON);
|
|
|
|
::digitalWrite(AF_BLUE, AF_ON);
|
2016-05-03 16:59:21 +00:00
|
|
|
break;
|
|
|
|
case AC_RED:
|
2016-05-06 22:13:17 +00:00
|
|
|
::digitalWrite(AF_RED, AF_ON);
|
|
|
|
::digitalWrite(AF_GREEN, AF_OFF);
|
|
|
|
::digitalWrite(AF_BLUE, AF_OFF);
|
2016-05-03 16:59:21 +00:00
|
|
|
break;
|
|
|
|
case AC_GREEN:
|
2016-05-06 22:13:17 +00:00
|
|
|
::digitalWrite(AF_RED, AF_OFF);
|
|
|
|
::digitalWrite(AF_GREEN, AF_ON);
|
|
|
|
::digitalWrite(AF_BLUE, AF_OFF);
|
2016-05-03 16:59:21 +00:00
|
|
|
break;
|
|
|
|
case AC_BLUE:
|
2016-05-06 22:13:17 +00:00
|
|
|
::digitalWrite(AF_RED, AF_OFF);
|
|
|
|
::digitalWrite(AF_GREEN, AF_OFF);
|
|
|
|
::digitalWrite(AF_BLUE, AF_ON);
|
2016-05-03 16:59:21 +00:00
|
|
|
break;
|
|
|
|
case AC_PURPLE:
|
2016-05-06 22:13:17 +00:00
|
|
|
::digitalWrite(AF_RED, AF_ON);
|
|
|
|
::digitalWrite(AF_GREEN, AF_OFF);
|
|
|
|
::digitalWrite(AF_BLUE, AF_ON);
|
2016-05-03 16:59:21 +00:00
|
|
|
break;
|
|
|
|
case AC_YELLOW:
|
2016-05-06 22:13:17 +00:00
|
|
|
::digitalWrite(AF_RED, AF_ON);
|
|
|
|
::digitalWrite(AF_GREEN, AF_ON);
|
|
|
|
::digitalWrite(AF_BLUE, AF_OFF);
|
2016-05-03 16:59:21 +00:00
|
|
|
break;
|
|
|
|
case AC_ICE:
|
2016-05-06 22:13:17 +00:00
|
|
|
::digitalWrite(AF_RED, AF_OFF);
|
|
|
|
::digitalWrite(AF_GREEN, AF_ON);
|
|
|
|
::digitalWrite(AF_BLUE, AF_ON);
|
2016-05-03 16:59:21 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2016-05-02 19:45:29 +00:00
|
|
|
}
|
2016-04-17 11:11:05 +00:00
|
|
|
#endif
|
|
|
|
|
2016-06-27 17:48:13 +00:00
|
|
|
#ifdef PCF8574_DISPLAY
|
|
|
|
void CHD44780::pcf8574LCDSetup()
|
|
|
|
{
|
|
|
|
// Initalize PFC8574
|
2016-06-30 19:10:30 +00:00
|
|
|
::pcf8574Setup(AF_BASE, m_i2cAddress);
|
2016-06-27 17:48:13 +00:00
|
|
|
|
|
|
|
// Turn on backlight
|
|
|
|
::pinMode (AF_BL, OUTPUT);
|
|
|
|
::digitalWrite (AF_BL, 1);
|
|
|
|
|
|
|
|
// Set LCD to write mode.
|
|
|
|
::pinMode (AF_RW, OUTPUT);
|
|
|
|
::digitalWrite (AF_RW, 0);
|
2016-06-27 18:18:17 +00:00
|
|
|
|
|
|
|
m_rb = AF_RS;
|
|
|
|
m_strb = AF_E;
|
2016-06-28 17:21:04 +00:00
|
|
|
m_d0 = AF_D0;
|
|
|
|
m_d1 = AF_D1;
|
|
|
|
m_d2 = AF_D2;
|
|
|
|
m_d3 = AF_D3;
|
2016-06-27 17:48:13 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2016-05-09 17:14:27 +00:00
|
|
|
void CHD44780::setIdleInt()
|
2016-03-14 22:58:09 +00:00
|
|
|
{
|
2016-06-04 14:22:39 +00:00
|
|
|
m_clockDisplayTimer.start(); // Start the clock display in IDLE only
|
2016-03-14 22:58:09 +00:00
|
|
|
::lcdClear(m_fd);
|
2016-05-02 21:08:08 +00:00
|
|
|
|
|
|
|
#ifdef ADAFRUIT_DISPLAY
|
2016-05-06 21:31:10 +00:00
|
|
|
adafruitLCDColour(AC_WHITE);
|
2016-05-02 21:08:08 +00:00
|
|
|
#endif
|
2016-05-03 16:59:21 +00:00
|
|
|
|
|
|
|
if (m_pwm) {
|
|
|
|
if (m_pwmPin != 1U)
|
|
|
|
::softPwmWrite(m_pwmPin, m_pwmDim);
|
|
|
|
else
|
|
|
|
::pwmWrite(m_pwmPin, (m_pwmDim / 100) * 1024);
|
2016-05-01 15:59:43 +00:00
|
|
|
}
|
|
|
|
|
2016-05-29 07:13:43 +00:00
|
|
|
// Print callsign and ID at on top row for all screen sizes
|
2016-03-14 22:58:09 +00:00
|
|
|
::lcdPosition(m_fd, 0, 0);
|
2016-05-28 20:29:30 +00:00
|
|
|
::lcdPrintf(m_fd, "%-6s", m_callsign.c_str());
|
|
|
|
::lcdPosition(m_fd, m_cols - 7, 0);
|
|
|
|
::lcdPrintf(m_fd, "%7u", m_dmrid);
|
2016-03-14 22:58:09 +00:00
|
|
|
|
2016-05-29 07:13:43 +00:00
|
|
|
// Print MMDVM and Idle on bottom row for all screen sizes
|
|
|
|
::lcdPosition(m_fd, 0, m_rows - 1);
|
2016-07-24 12:49:58 +00:00
|
|
|
::lcdPuts(m_fd, "MMDVM");
|
2016-05-29 07:13:43 +00:00
|
|
|
::lcdPosition(m_fd, m_cols - 4, m_rows - 1);
|
2016-06-04 14:22:39 +00:00
|
|
|
::lcdPuts(m_fd, "Idle"); // Gets overwritten by clock on 2 line screen
|
2016-04-11 11:21:46 +00:00
|
|
|
|
|
|
|
m_dmr = false;
|
2016-03-14 22:58:09 +00:00
|
|
|
}
|
|
|
|
|
2016-05-09 17:14:27 +00:00
|
|
|
void CHD44780::setErrorInt(const char* text)
|
2016-03-21 22:47:58 +00:00
|
|
|
{
|
2016-05-03 16:59:21 +00:00
|
|
|
assert(text != NULL);
|
|
|
|
|
2016-05-02 21:08:08 +00:00
|
|
|
#ifdef ADAFRUIT_DISPLAY
|
2016-05-03 16:59:21 +00:00
|
|
|
adafruitLCDColour(AC_RED);
|
2016-05-02 21:08:08 +00:00
|
|
|
#endif
|
2016-03-21 22:47:58 +00:00
|
|
|
|
2016-06-04 14:22:39 +00:00
|
|
|
m_clockDisplayTimer.stop(); // Stop the clock display
|
2016-03-21 22:47:58 +00:00
|
|
|
::lcdClear(m_fd);
|
|
|
|
|
2016-05-03 16:59:21 +00:00
|
|
|
if (m_pwm) {
|
|
|
|
if (m_pwmPin != 1U)
|
|
|
|
::softPwmWrite(m_pwmPin, m_pwmBright);
|
|
|
|
else
|
|
|
|
::pwmWrite(m_pwmPin, (m_pwmBright / 100) * 1024);
|
2016-05-01 15:59:43 +00:00
|
|
|
}
|
|
|
|
|
2016-03-21 22:47:58 +00:00
|
|
|
::lcdPosition(m_fd, 0, 0);
|
2016-07-24 12:49:58 +00:00
|
|
|
::lcdPuts(m_fd, "MMDVM");
|
2016-03-21 22:47:58 +00:00
|
|
|
|
|
|
|
::lcdPosition(m_fd, 0, 1);
|
|
|
|
::lcdPrintf(m_fd, "%s ERROR", text);
|
2016-04-11 11:21:46 +00:00
|
|
|
|
|
|
|
m_dmr = false;
|
2016-03-21 22:47:58 +00:00
|
|
|
}
|
|
|
|
|
2016-05-09 17:14:27 +00:00
|
|
|
void CHD44780::setLockoutInt()
|
2016-03-14 22:58:09 +00:00
|
|
|
{
|
2016-05-02 21:08:08 +00:00
|
|
|
#ifdef ADAFRUIT_DISPLAY
|
2016-05-03 16:59:21 +00:00
|
|
|
adafruitLCDColour(AC_RED);
|
2016-05-02 21:08:08 +00:00
|
|
|
#endif
|
2016-05-03 16:59:21 +00:00
|
|
|
|
2016-06-04 14:22:39 +00:00
|
|
|
m_clockDisplayTimer.stop(); // Stop the clock display
|
2016-03-14 22:58:09 +00:00
|
|
|
::lcdClear(m_fd);
|
|
|
|
|
2016-05-03 16:59:21 +00:00
|
|
|
if (m_pwm) {
|
|
|
|
if (m_pwmPin != 1U)
|
|
|
|
::softPwmWrite(m_pwmPin, m_pwmBright);
|
|
|
|
else
|
|
|
|
::pwmWrite(m_pwmPin, (m_pwmBright / 100) * 1024);
|
2016-05-01 15:59:43 +00:00
|
|
|
}
|
|
|
|
|
2016-03-14 22:58:09 +00:00
|
|
|
::lcdPosition(m_fd, 0, 0);
|
2016-07-24 12:49:58 +00:00
|
|
|
::lcdPuts(m_fd, "MMDVM");
|
2016-03-14 22:58:09 +00:00
|
|
|
|
|
|
|
::lcdPosition(m_fd, 0, 1);
|
|
|
|
::lcdPuts(m_fd, "Lockout");
|
|
|
|
|
2016-04-11 11:21:46 +00:00
|
|
|
m_dmr = false;
|
2016-03-14 22:58:09 +00:00
|
|
|
}
|
|
|
|
|
2018-08-15 16:17:42 +00:00
|
|
|
void CHD44780::setQuitInt()
|
|
|
|
{
|
|
|
|
#ifdef ADAFRUIT_DISPLAY
|
|
|
|
adafruitLCDColour(AC_RED);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
m_clockDisplayTimer.stop(); // Stop the clock display
|
|
|
|
::lcdClear(m_fd);
|
|
|
|
|
|
|
|
if (m_pwm) {
|
|
|
|
if (m_pwmPin != 1U)
|
|
|
|
::softPwmWrite(m_pwmPin, m_pwmBright);
|
|
|
|
else
|
|
|
|
::pwmWrite(m_pwmPin, (m_pwmBright / 100) * 1024);
|
|
|
|
}
|
|
|
|
|
|
|
|
::lcdPosition(m_fd, 0, 0);
|
|
|
|
::lcdPuts(m_fd, "MMDVM");
|
|
|
|
|
|
|
|
::lcdPosition(m_fd, 0, 1);
|
|
|
|
::lcdPuts(m_fd, "STOPPED");
|
|
|
|
|
|
|
|
m_dmr = false;
|
|
|
|
}
|
|
|
|
|
2020-05-03 17:33:22 +00:00
|
|
|
void CHD44780::setFMInt()
|
2020-04-11 19:42:05 +00:00
|
|
|
{
|
|
|
|
m_clockDisplayTimer.stop();
|
|
|
|
::lcdClear(m_fd);
|
|
|
|
|
|
|
|
#ifdef ADAFRUIT_DISPLAY
|
|
|
|
adafruitLCDColour(AC_WHITE);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (m_pwm) {
|
|
|
|
if (m_pwmPin != 1U)
|
|
|
|
::softPwmWrite(m_pwmPin, m_pwmDim);
|
|
|
|
else
|
|
|
|
::pwmWrite(m_pwmPin, (m_pwmDim / 100) * 1024);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Print callsign and ID at on top row for all screen sizes
|
|
|
|
::lcdPosition(m_fd, 0, 0);
|
|
|
|
::lcdPrintf(m_fd, "%-6s", m_callsign.c_str());
|
|
|
|
::lcdPosition(m_fd, m_cols - 7, 0);
|
|
|
|
::lcdPrintf(m_fd, "%7u", m_dmrid);
|
|
|
|
|
|
|
|
// Print MMDVM and Idle on bottom row for all screen sizes
|
|
|
|
::lcdPosition(m_fd, 0, m_rows - 1);
|
|
|
|
::lcdPuts(m_fd, "MMDVM");
|
|
|
|
::lcdPosition(m_fd, m_cols - 4, m_rows - 1);
|
|
|
|
::lcdPuts(m_fd, "FM"); // Gets overwritten by clock on 2 line screen
|
|
|
|
|
|
|
|
m_dmr = false;
|
|
|
|
}
|
|
|
|
|
2016-05-09 17:14:27 +00:00
|
|
|
void CHD44780::writeDStarInt(const char* my1, const char* my2, const char* your, const char* type, const char* reflector)
|
2016-03-14 22:58:09 +00:00
|
|
|
{
|
2016-03-15 17:20:10 +00:00
|
|
|
assert(my1 != NULL);
|
|
|
|
assert(my2 != NULL);
|
|
|
|
assert(your != NULL);
|
2016-04-12 16:46:48 +00:00
|
|
|
assert(type != NULL);
|
2016-04-16 19:45:49 +00:00
|
|
|
assert(reflector != NULL);
|
2016-03-15 17:20:10 +00:00
|
|
|
|
2016-05-03 16:59:21 +00:00
|
|
|
#ifdef ADAFRUIT_DISPLAY
|
|
|
|
adafruitLCDColour(AC_RED);
|
|
|
|
#endif
|
|
|
|
|
2016-06-04 14:22:39 +00:00
|
|
|
m_clockDisplayTimer.stop(); // Stop the clock display
|
2016-04-11 11:21:46 +00:00
|
|
|
::lcdClear(m_fd);
|
|
|
|
|
2016-05-03 16:59:21 +00:00
|
|
|
if (m_pwm) {
|
|
|
|
if (m_pwmPin != 1U)
|
|
|
|
::softPwmWrite(m_pwmPin, m_pwmBright);
|
|
|
|
else
|
|
|
|
::pwmWrite(m_pwmPin, (m_pwmBright / 100) * 1024);
|
2016-05-01 15:59:43 +00:00
|
|
|
}
|
|
|
|
|
2016-06-15 20:49:38 +00:00
|
|
|
if (m_rows > 2U) {
|
|
|
|
::lcdPosition(m_fd, 0, (m_rows / 2) - 2);
|
|
|
|
::sprintf(m_buffer1, "%s%s", "D-Star", DEADSPACE);
|
2016-05-29 07:13:43 +00:00
|
|
|
::lcdPrintf(m_fd, "%.*s", m_cols, m_buffer1);
|
2016-06-15 20:49:38 +00:00
|
|
|
}
|
2016-04-18 06:43:17 +00:00
|
|
|
|
2016-06-15 20:49:38 +00:00
|
|
|
::lcdPosition(m_fd, 0, (m_rows / 2) - 1);
|
2016-09-29 18:44:13 +00:00
|
|
|
::lcdPutchar(m_fd, 0);
|
|
|
|
::lcdPrintf(m_fd, " %.8s/%.4s", my1, my2);
|
2016-06-15 20:49:38 +00:00
|
|
|
::lcdPosition(m_fd, m_cols - 1, (m_rows / 2) - 1);
|
2016-07-24 12:49:58 +00:00
|
|
|
|
|
|
|
if (strcmp(type, "R") == 0) {
|
|
|
|
::lcdPutchar(m_fd, 2);
|
|
|
|
} else {
|
|
|
|
::lcdPutchar(m_fd, 3);
|
|
|
|
}
|
2016-05-03 16:59:21 +00:00
|
|
|
|
2016-06-17 21:28:39 +00:00
|
|
|
::sprintf(m_buffer1, "%.8s", your);
|
|
|
|
|
|
|
|
char *p = m_buffer1;
|
|
|
|
for (; *p; ++p) {
|
2016-06-17 22:04:10 +00:00
|
|
|
if (*p == ' ')
|
|
|
|
*p = '_';
|
2016-06-17 21:28:39 +00:00
|
|
|
}
|
2016-05-03 16:59:21 +00:00
|
|
|
|
2016-06-15 20:49:38 +00:00
|
|
|
if (strcmp(reflector, " ") != 0) {
|
2016-09-29 18:44:13 +00:00
|
|
|
if (m_rows == 2 && m_cols == 40) {
|
|
|
|
::sprintf(m_buffer3, " via %.8s", reflector);
|
|
|
|
strcat(m_buffer1, m_buffer3);
|
|
|
|
} else if (m_rows > 2) {
|
|
|
|
::sprintf(m_buffer3, "via %.8s", reflector);
|
|
|
|
::lcdPosition(m_fd, 0, (m_rows / 2) + 1);
|
|
|
|
::lcdPrintf(m_fd, "%.*s", m_cols, m_buffer3);
|
|
|
|
}
|
2016-06-17 21:28:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
::lcdPosition(m_fd, 0, (m_rows / 2));
|
2016-09-29 18:44:13 +00:00
|
|
|
::lcdPutchar(m_fd, 1);
|
|
|
|
::lcdPrintf(m_fd, " %.*s", m_cols, m_buffer1);
|
2016-06-17 21:28:39 +00:00
|
|
|
|
2016-04-11 11:21:46 +00:00
|
|
|
m_dmr = false;
|
2017-01-06 21:22:47 +00:00
|
|
|
m_rssiCount1 = 0U;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CHD44780::writeDStarRSSIInt(unsigned char rssi)
|
|
|
|
{
|
|
|
|
if (m_rssiCount1 == 0U && m_rows > 2) {
|
2017-01-07 09:11:23 +00:00
|
|
|
::lcdPosition(m_fd, 0, 3);
|
2017-01-08 09:37:17 +00:00
|
|
|
::lcdPrintf(m_fd, "-%3udBm", rssi);
|
2017-01-06 21:22:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
m_rssiCount1++;
|
|
|
|
if (m_rssiCount1 >= DSTAR_RSSI_COUNT)
|
|
|
|
m_rssiCount1 = 0U;
|
2016-03-14 22:58:09 +00:00
|
|
|
}
|
|
|
|
|
2016-05-09 17:14:27 +00:00
|
|
|
void CHD44780::clearDStarInt()
|
2016-03-14 22:58:09 +00:00
|
|
|
{
|
2016-05-03 16:59:21 +00:00
|
|
|
#ifdef ADAFRUIT_DISPLAY
|
2016-05-11 17:17:23 +00:00
|
|
|
adafruitLCDColour(AC_PURPLE);
|
2016-05-03 16:59:21 +00:00
|
|
|
#endif
|
2016-05-02 19:45:29 +00:00
|
|
|
|
2016-06-04 14:22:39 +00:00
|
|
|
m_clockDisplayTimer.stop(); // Stop the clock display
|
2016-06-15 20:49:38 +00:00
|
|
|
::lcdClear(m_fd);
|
2016-05-28 20:29:30 +00:00
|
|
|
|
2016-06-15 20:49:38 +00:00
|
|
|
::lcdPosition(m_fd, 0, (m_rows / 2) - 1);
|
|
|
|
::sprintf(m_buffer2, "%s%s", "D-Star", DEADSPACE);
|
|
|
|
::lcdPrintf(m_fd, "%.*s", m_cols, m_buffer2);
|
|
|
|
::lcdPosition(m_fd, 0, (m_rows / 2));
|
|
|
|
::lcdPrintf(m_fd, "%.*s", m_cols, LISTENING);
|
2016-03-14 22:58:09 +00:00
|
|
|
}
|
|
|
|
|
2016-05-09 17:14:27 +00:00
|
|
|
void CHD44780::writeDMRInt(unsigned int slotNo, const std::string& src, bool group, const std::string& dst, const char* type)
|
2016-03-14 22:58:09 +00:00
|
|
|
{
|
2016-04-11 11:21:46 +00:00
|
|
|
assert(type != NULL);
|
|
|
|
|
2016-04-12 16:46:48 +00:00
|
|
|
if (!m_dmr) {
|
2016-06-04 14:22:39 +00:00
|
|
|
m_clockDisplayTimer.stop(); // Stop the clock display
|
2016-06-19 16:15:42 +00:00
|
|
|
::lcdClear(m_fd);
|
2016-03-14 22:58:09 +00:00
|
|
|
|
2016-05-02 21:08:08 +00:00
|
|
|
#ifdef ADAFRUIT_DISPLAY
|
2016-05-03 16:59:21 +00:00
|
|
|
adafruitLCDColour(AC_GREEN);
|
2016-05-02 21:08:08 +00:00
|
|
|
#endif
|
2016-05-03 16:59:21 +00:00
|
|
|
|
|
|
|
if (m_pwm) {
|
|
|
|
if (m_pwmPin != 1U)
|
|
|
|
::softPwmWrite(m_pwmPin, m_pwmBright);
|
|
|
|
else
|
|
|
|
::pwmWrite(m_pwmPin, (m_pwmBright / 100) * 1024);
|
2016-05-01 15:59:43 +00:00
|
|
|
}
|
|
|
|
|
2016-05-11 21:30:06 +00:00
|
|
|
if (m_duplex) {
|
2016-05-12 08:53:42 +00:00
|
|
|
if (m_rows > 2U) {
|
|
|
|
::lcdPosition(m_fd, 0, (m_rows / 2) - 2);
|
2016-05-29 07:13:43 +00:00
|
|
|
::sprintf(m_buffer1, "%s%s", "DMR", DEADSPACE);
|
|
|
|
::lcdPrintf(m_fd, "%.*s", m_cols, m_buffer1);
|
2016-05-12 08:53:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (slotNo == 1U) {
|
2016-10-02 10:38:54 +00:00
|
|
|
//m_dmrScrollTimer2.stop();
|
2016-05-12 08:53:42 +00:00
|
|
|
::lcdPosition(m_fd, 0, (m_rows / 2));
|
|
|
|
::lcdPrintf(m_fd, "2 %.*s", m_cols - 2U, LISTENING);
|
|
|
|
} else {
|
2016-10-02 10:38:54 +00:00
|
|
|
//m_dmrScrollTimer1.stop();
|
2016-05-12 08:53:42 +00:00
|
|
|
::lcdPosition(m_fd, 0, (m_rows / 2) - 1);
|
|
|
|
::lcdPrintf(m_fd, "1 %.*s", m_cols - 2U, LISTENING);
|
|
|
|
}
|
2016-05-11 21:30:06 +00:00
|
|
|
} else {
|
2016-10-02 10:38:54 +00:00
|
|
|
//m_dmrScrollTimer2.stop();
|
2016-07-24 19:14:07 +00:00
|
|
|
|
|
|
|
if (m_rows > 2U) {
|
|
|
|
::lcdPosition(m_fd, 0, (m_rows / 2) - 2);
|
|
|
|
::sprintf(m_buffer1, "%s", DEADSPACE);
|
|
|
|
::lcdPrintf(m_fd, "%.*s", m_cols, m_buffer1);
|
|
|
|
}
|
|
|
|
|
2016-05-12 08:53:42 +00:00
|
|
|
::lcdPosition(m_fd, 0, (m_rows / 2) - 1);
|
2016-05-29 07:13:43 +00:00
|
|
|
::sprintf(m_buffer1, "%s%s", "DMR", DEADSPACE);
|
|
|
|
::lcdPrintf(m_fd, "%.*s", m_cols, m_buffer1);
|
2016-05-12 08:53:42 +00:00
|
|
|
::lcdPosition(m_fd, 0, (m_rows / 2));
|
|
|
|
::lcdPrintf(m_fd, "%.*s", m_cols, LISTENING);
|
2016-04-11 11:21:46 +00:00
|
|
|
}
|
|
|
|
}
|
2016-03-15 17:20:10 +00:00
|
|
|
|
2016-05-02 21:08:08 +00:00
|
|
|
#ifdef ADAFRUIT_DISPLAY
|
2016-05-11 21:30:06 +00:00
|
|
|
adafruitLCDColour(AC_RED);
|
2016-05-02 21:08:08 +00:00
|
|
|
#endif
|
2016-05-02 19:45:29 +00:00
|
|
|
|
2016-05-11 20:14:17 +00:00
|
|
|
if (m_duplex) {
|
2016-07-24 19:14:07 +00:00
|
|
|
if (m_rows > 2U) {
|
|
|
|
::lcdPosition(m_fd, 0, (m_rows / 2) - 2);
|
|
|
|
::sprintf(m_buffer1, "%s%s", "DMR", DEADSPACE);
|
|
|
|
::lcdPrintf(m_fd, "%.*s", m_cols, m_buffer1);
|
|
|
|
}
|
|
|
|
|
2016-05-12 08:53:42 +00:00
|
|
|
if (slotNo == 1U) {
|
|
|
|
::lcdPosition(m_fd, 0, (m_rows / 2) - 1);
|
2016-05-12 15:32:27 +00:00
|
|
|
::lcdPuts(m_fd, "1 ");
|
2016-10-02 10:38:54 +00:00
|
|
|
if (m_cols > 16 )
|
|
|
|
::sprintf(m_buffer1, "%s > %s%s%s", src.c_str(), group ? "TG" : "", dst.c_str(), DEADSPACE);
|
|
|
|
else
|
|
|
|
::sprintf(m_buffer1, "%s>%s%s", src.c_str(), dst.c_str(), DEADSPACE);
|
2016-05-29 07:13:43 +00:00
|
|
|
::lcdPrintf(m_fd, "%.*s", m_cols - 2U, m_buffer1);
|
2016-05-12 15:32:27 +00:00
|
|
|
|
2016-06-04 14:22:39 +00:00
|
|
|
::lcdPosition(m_fd, m_cols - 3U, (m_rows / 2) - 1);
|
|
|
|
::lcdPuts(m_fd, " ");
|
2016-07-24 12:49:58 +00:00
|
|
|
|
|
|
|
if (group) {
|
|
|
|
::lcdPutchar(m_fd, 5);
|
|
|
|
} else {
|
|
|
|
::lcdPutchar(m_fd, 4);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (strcmp(type, "R") == 0) {
|
|
|
|
::lcdPutchar(m_fd, 2);
|
|
|
|
} else {
|
|
|
|
::lcdPutchar(m_fd, 3);
|
|
|
|
}
|
2016-05-12 08:53:42 +00:00
|
|
|
} else {
|
|
|
|
::lcdPosition(m_fd, 0, (m_rows / 2));
|
2016-05-12 15:32:27 +00:00
|
|
|
::lcdPuts(m_fd, "2 ");
|
2016-10-02 10:38:54 +00:00
|
|
|
if (m_cols > 16 )
|
|
|
|
::sprintf(m_buffer2, "%s > %s%s%s", src.c_str(), group ? "TG" : "", dst.c_str(), DEADSPACE);
|
|
|
|
else
|
|
|
|
::sprintf(m_buffer2, "%s>%s%s", src.c_str(), dst.c_str(), DEADSPACE);
|
2016-05-29 07:13:43 +00:00
|
|
|
::lcdPrintf(m_fd, "%.*s", m_cols - 2U, m_buffer2);
|
2016-05-12 15:32:27 +00:00
|
|
|
|
2016-06-04 14:22:39 +00:00
|
|
|
::lcdPosition(m_fd, m_cols - 3U, (m_rows / 2));
|
|
|
|
::lcdPuts(m_fd, " ");
|
2016-07-24 12:49:58 +00:00
|
|
|
|
|
|
|
if (group) {
|
|
|
|
::lcdPutchar(m_fd, 5);
|
|
|
|
} else {
|
|
|
|
::lcdPutchar(m_fd, 4);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (strcmp(type, "R") == 0) {
|
|
|
|
::lcdPutchar(m_fd, 2);
|
|
|
|
} else {
|
|
|
|
::lcdPutchar(m_fd, 3);
|
|
|
|
}
|
2016-04-14 21:31:57 +00:00
|
|
|
}
|
2016-05-11 20:14:17 +00:00
|
|
|
} else {
|
2016-07-24 19:14:07 +00:00
|
|
|
if (m_rows > 2U) {
|
|
|
|
::lcdPosition(m_fd, 0, (m_rows / 2) - 2);
|
|
|
|
::sprintf(m_buffer1, "%s%s", "DMR", DEADSPACE);
|
|
|
|
::lcdPrintf(m_fd, "%.*s", m_cols, m_buffer1);
|
|
|
|
}
|
|
|
|
|
2016-05-12 08:53:42 +00:00
|
|
|
::lcdPosition(m_fd, 0, (m_rows / 2) - 1);
|
2016-05-11 20:14:17 +00:00
|
|
|
::lcdPutchar(m_fd, 0);
|
2016-05-29 07:13:43 +00:00
|
|
|
::sprintf(m_buffer2, " %s%s", src.c_str(), DEADSPACE);
|
|
|
|
::lcdPrintf(m_fd, "%.*s", m_cols - 4U, m_buffer2);
|
2016-05-12 08:53:42 +00:00
|
|
|
::lcdPosition(m_fd, m_cols - 1U, (m_rows / 2) - 1);
|
2016-07-24 12:49:58 +00:00
|
|
|
|
|
|
|
if (strcmp(type, "R") == 0) {
|
|
|
|
::lcdPutchar(m_fd, 2);
|
|
|
|
} else {
|
|
|
|
::lcdPutchar(m_fd, 3);
|
|
|
|
}
|
2016-05-11 20:14:17 +00:00
|
|
|
|
2016-05-12 08:53:42 +00:00
|
|
|
::lcdPosition(m_fd, 0, (m_rows / 2));
|
2016-05-11 20:14:17 +00:00
|
|
|
::lcdPutchar(m_fd, 1);
|
2016-06-18 08:38:03 +00:00
|
|
|
::sprintf(m_buffer2, " %s%s%s", group ? "TG" : "", dst.c_str(), DEADSPACE);
|
2016-05-29 07:13:43 +00:00
|
|
|
::lcdPrintf(m_fd, "%.*s", m_cols - 4U, m_buffer2);
|
2016-05-12 08:53:42 +00:00
|
|
|
::lcdPosition(m_fd, m_cols - 1U, (m_rows / 2));
|
2016-07-24 12:49:58 +00:00
|
|
|
|
|
|
|
if (group) {
|
|
|
|
::lcdPutchar(m_fd, 5);
|
|
|
|
} else {
|
|
|
|
::lcdPutchar(m_fd, 4);
|
|
|
|
}
|
2016-03-14 22:58:09 +00:00
|
|
|
}
|
2016-04-11 11:21:46 +00:00
|
|
|
m_dmr = true;
|
2017-01-06 21:22:47 +00:00
|
|
|
m_rssiCount1 = 0U;
|
|
|
|
m_rssiCount2 = 0U;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CHD44780::writeDMRRSSIInt(unsigned int slotNo, unsigned char rssi)
|
|
|
|
{
|
2017-01-07 11:42:42 +00:00
|
|
|
if (m_rows > 2) {
|
2017-01-06 21:22:47 +00:00
|
|
|
if (slotNo == 1U) {
|
|
|
|
if (m_rssiCount1 == 0U) {
|
|
|
|
::lcdPosition(m_fd, 0, 3);
|
2017-01-07 14:06:05 +00:00
|
|
|
::lcdPrintf(m_fd, "-%3udBm", rssi);
|
2017-01-06 21:22:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
m_rssiCount1++;
|
|
|
|
if (m_rssiCount1 >= DMR_RSSI_COUNT)
|
|
|
|
m_rssiCount1 = 0U;
|
|
|
|
} else {
|
|
|
|
if (m_rssiCount2 == 0U) {
|
|
|
|
::lcdPosition(m_fd, (m_cols / 2), 3);
|
2017-01-07 14:06:05 +00:00
|
|
|
::lcdPrintf(m_fd, "-%3udBm", rssi);
|
2017-01-06 21:22:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
m_rssiCount2++;
|
|
|
|
if (m_rssiCount2 >= DMR_RSSI_COUNT)
|
|
|
|
m_rssiCount2 = 0U;
|
|
|
|
}
|
|
|
|
}
|
2016-03-14 22:58:09 +00:00
|
|
|
}
|
|
|
|
|
2016-05-09 17:14:27 +00:00
|
|
|
void CHD44780::clearDMRInt(unsigned int slotNo)
|
2016-03-14 22:58:09 +00:00
|
|
|
{
|
2016-05-02 21:08:08 +00:00
|
|
|
#ifdef ADAFRUIT_DISPLAY
|
2016-05-11 17:17:23 +00:00
|
|
|
adafruitLCDColour(AC_PURPLE);
|
2016-05-02 21:08:08 +00:00
|
|
|
#endif
|
2016-05-02 19:45:29 +00:00
|
|
|
|
2016-06-04 14:22:39 +00:00
|
|
|
m_clockDisplayTimer.stop(); // Stop the clock display
|
|
|
|
|
2016-05-12 08:53:42 +00:00
|
|
|
if (m_duplex) {
|
2016-04-14 21:09:00 +00:00
|
|
|
if (slotNo == 1U) {
|
2016-07-24 18:36:55 +00:00
|
|
|
::lcdPosition(m_fd, 0, (m_rows / 2) - 1);
|
2016-04-14 21:09:00 +00:00
|
|
|
::lcdPrintf(m_fd, "1 %.*s", m_cols - 2U, LISTENING);
|
2017-01-07 11:40:26 +00:00
|
|
|
|
|
|
|
if (m_rows > 2) { // clear slot 1 RSSI
|
|
|
|
::lcdPosition(m_fd, 0, 3);
|
2017-01-07 14:06:05 +00:00
|
|
|
::lcdPrintf(m_fd, "%.*s", m_cols / 2, DEADSPACE);
|
2017-01-07 11:40:26 +00:00
|
|
|
}
|
2016-04-14 21:09:00 +00:00
|
|
|
} else {
|
2016-07-24 18:36:55 +00:00
|
|
|
::lcdPosition(m_fd, 0, (m_rows / 2));
|
2016-04-14 21:09:00 +00:00
|
|
|
::lcdPrintf(m_fd, "2 %.*s", m_cols - 2U, LISTENING);
|
2017-01-07 11:40:26 +00:00
|
|
|
|
|
|
|
if (m_rows > 2) { // cleat slot 2 RSSI
|
|
|
|
::lcdPosition(m_fd, m_cols / 2, 3);
|
2017-01-07 14:06:05 +00:00
|
|
|
::lcdPrintf(m_fd, "%.*s", m_cols / 2, DEADSPACE);
|
2017-01-07 11:40:26 +00:00
|
|
|
}
|
2016-04-14 21:09:00 +00:00
|
|
|
}
|
2016-05-12 08:53:42 +00:00
|
|
|
} else {
|
2016-07-24 19:14:07 +00:00
|
|
|
|
|
|
|
if (m_rows > 2U) {
|
|
|
|
::lcdPosition(m_fd, 0, (m_rows / 2) - 2);
|
|
|
|
::sprintf(m_buffer1, "%s", DEADSPACE);
|
|
|
|
::lcdPrintf(m_fd, "%.*s", m_cols, m_buffer1);
|
|
|
|
}
|
|
|
|
|
2016-06-05 18:06:04 +00:00
|
|
|
::lcdPosition(m_fd, 0, (m_rows / 2) - 1);
|
|
|
|
::sprintf(m_buffer2, "%s%s", "DMR", DEADSPACE);
|
|
|
|
::lcdPrintf(m_fd, "%.*s", m_cols, m_buffer2);
|
|
|
|
::lcdPosition(m_fd, 0, (m_rows / 2));
|
|
|
|
::lcdPrintf(m_fd, "%.*s", m_cols, LISTENING);
|
2016-03-14 22:58:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-09 14:09:08 +00:00
|
|
|
void CHD44780::writeFusionInt(const char* source, const char* dest, unsigned char dgid, const char* type, const char* origin)
|
2016-03-14 22:58:09 +00:00
|
|
|
{
|
2016-04-11 11:21:46 +00:00
|
|
|
assert(source != NULL);
|
|
|
|
assert(dest != NULL);
|
2016-05-16 20:57:32 +00:00
|
|
|
assert(type != NULL);
|
2016-05-19 18:08:48 +00:00
|
|
|
assert(origin != NULL);
|
2016-04-11 11:21:46 +00:00
|
|
|
|
2016-05-03 16:59:21 +00:00
|
|
|
#ifdef ADAFRUIT_DISPLAY
|
|
|
|
adafruitLCDColour(AC_RED);
|
|
|
|
#endif
|
|
|
|
|
2016-06-04 14:22:39 +00:00
|
|
|
m_clockDisplayTimer.stop(); // Stop the clock display
|
2016-03-14 22:58:09 +00:00
|
|
|
::lcdClear(m_fd);
|
|
|
|
|
2016-05-03 16:59:21 +00:00
|
|
|
if (m_pwm) {
|
|
|
|
if (m_pwmPin != 1U)
|
|
|
|
::softPwmWrite(m_pwmPin, m_pwmBright);
|
|
|
|
else
|
|
|
|
::pwmWrite(m_pwmPin, (m_pwmBright / 100) * 1024);
|
2016-05-01 15:59:43 +00:00
|
|
|
}
|
|
|
|
|
2016-03-14 22:58:09 +00:00
|
|
|
::lcdPosition(m_fd, 0, 0);
|
|
|
|
::lcdPuts(m_fd, "System Fusion");
|
|
|
|
|
2016-04-14 21:01:04 +00:00
|
|
|
if (m_rows == 2U && m_cols == 16U) {
|
2016-05-29 07:13:43 +00:00
|
|
|
char m_buffer1[16U];
|
|
|
|
::sprintf(m_buffer1, "%.10s >", source);
|
2016-04-14 21:01:04 +00:00
|
|
|
::lcdPosition(m_fd, 0, 1);
|
2016-05-29 07:13:43 +00:00
|
|
|
::lcdPrintf(m_fd, "%.*s", m_cols, m_buffer1);
|
2016-04-18 06:43:17 +00:00
|
|
|
} else if (m_rows == 4U && m_cols == 16U) {
|
2016-05-29 07:13:43 +00:00
|
|
|
char m_buffer1[16U];
|
|
|
|
::sprintf(m_buffer1, "%.10s >", source);
|
2016-04-18 06:43:17 +00:00
|
|
|
::lcdPosition(m_fd, 0, 1);
|
2016-05-29 07:13:43 +00:00
|
|
|
::lcdPrintf(m_fd, "%.*s", m_cols, m_buffer1);
|
2016-04-18 06:43:17 +00:00
|
|
|
|
2020-08-09 18:23:18 +00:00
|
|
|
::sprintf(m_buffer1, "DG-ID %u", dgid);
|
2016-04-18 06:43:17 +00:00
|
|
|
::lcdPosition(m_fd, 0, 2);
|
2016-05-29 07:13:43 +00:00
|
|
|
::lcdPrintf(m_fd, "%.*s", m_cols, m_buffer1);
|
2016-04-14 21:01:04 +00:00
|
|
|
} else if (m_rows == 4U && m_cols == 20U) {
|
2016-05-29 07:13:43 +00:00
|
|
|
char m_buffer1[20U];
|
|
|
|
::sprintf(m_buffer1, "%.10s >", source);
|
2016-03-15 11:42:36 +00:00
|
|
|
::lcdPosition(m_fd, 0, 1);
|
2016-05-29 07:13:43 +00:00
|
|
|
::lcdPrintf(m_fd, "%.*s", m_cols, m_buffer1);
|
2016-03-15 11:42:36 +00:00
|
|
|
|
2020-08-09 18:23:18 +00:00
|
|
|
::sprintf(m_buffer1, "DG-ID %u", dgid);
|
2016-03-15 11:42:36 +00:00
|
|
|
::lcdPosition(m_fd, 0, 2);
|
2016-05-29 07:13:43 +00:00
|
|
|
::lcdPrintf(m_fd, "%.*s", m_cols, m_buffer1);
|
2016-04-14 21:01:04 +00:00
|
|
|
} else if (m_rows == 2 && m_cols == 40U) {
|
2016-05-29 07:13:43 +00:00
|
|
|
char m_buffer1[40U];
|
2020-08-09 18:23:18 +00:00
|
|
|
::sprintf(m_buffer1, "%.10s > DG-ID %u", source, dgid);
|
2016-03-15 11:42:36 +00:00
|
|
|
|
|
|
|
::lcdPosition(m_fd, 0, 1);
|
2016-05-29 07:13:43 +00:00
|
|
|
::lcdPrintf(m_fd, "%.*s", m_cols, m_buffer1);
|
2016-03-15 11:42:36 +00:00
|
|
|
}
|
2016-04-11 11:21:46 +00:00
|
|
|
|
|
|
|
m_dmr = false;
|
2020-08-09 18:23:18 +00:00
|
|
|
m_rssiCount1 = 0U;
|
2017-01-06 21:22:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CHD44780::writeFusionRSSIInt(unsigned char rssi)
|
|
|
|
{
|
2020-08-09 18:23:18 +00:00
|
|
|
if (m_rssiCount1 == 0U && m_rows > 2) {
|
2017-01-06 21:22:47 +00:00
|
|
|
::lcdPosition(m_fd, 0, 3);
|
2017-01-08 09:37:17 +00:00
|
|
|
::lcdPrintf(m_fd, "-%3udBm", rssi);
|
2020-08-09 18:23:18 +00:00
|
|
|
}
|
2017-01-06 21:22:47 +00:00
|
|
|
|
2020-08-09 18:23:18 +00:00
|
|
|
m_rssiCount1++;
|
|
|
|
if (m_rssiCount1 >= YSF_RSSI_COUNT)
|
|
|
|
m_rssiCount1 = 0U;
|
2016-03-14 22:58:09 +00:00
|
|
|
}
|
|
|
|
|
2016-05-09 17:14:27 +00:00
|
|
|
void CHD44780::clearFusionInt()
|
2016-03-14 22:58:09 +00:00
|
|
|
{
|
2016-09-12 17:12:32 +00:00
|
|
|
#ifdef ADAFRUIT_DISPLAY
|
|
|
|
adafruitLCDColour(AC_PURPLE);
|
|
|
|
#endif
|
|
|
|
m_clockDisplayTimer.stop(); // Stop the clock display
|
|
|
|
|
|
|
|
if (m_rows == 2U && m_cols == 16U) {
|
|
|
|
::lcdPosition(m_fd, 0, 1);
|
|
|
|
::lcdPrintf(m_fd, "%.*s", m_cols, LISTENING);
|
|
|
|
} else if (m_rows == 4U && m_cols == 16U) {
|
|
|
|
::lcdPosition(m_fd, 0, 1);
|
|
|
|
::lcdPrintf(m_fd, "%.*s", m_cols, LISTENING);
|
|
|
|
|
|
|
|
::lcdPosition(m_fd, 0, 2);
|
|
|
|
::lcdPrintf(m_fd, "%.*s", m_cols, " ");
|
2017-01-06 21:22:47 +00:00
|
|
|
|
|
|
|
::lcdPosition(m_fd, 0, 3);
|
|
|
|
::lcdPrintf(m_fd, "%.*s", m_cols, " ");
|
2016-09-12 17:12:32 +00:00
|
|
|
} else if (m_rows == 4U && m_cols == 20U) {
|
|
|
|
::lcdPosition(m_fd, 0, 1);
|
|
|
|
::lcdPrintf(m_fd, "%.*s", m_cols, LISTENING);
|
|
|
|
|
|
|
|
::lcdPosition(m_fd, 0, 2);
|
|
|
|
::lcdPrintf(m_fd, "%.*s", m_cols, " ");
|
2017-01-06 21:22:47 +00:00
|
|
|
|
|
|
|
::lcdPosition(m_fd, 0, 3);
|
|
|
|
::lcdPrintf(m_fd, "%.*s", m_cols, " ");
|
2016-09-12 17:12:32 +00:00
|
|
|
} else if (m_rows == 2 && m_cols == 40U) {
|
|
|
|
::lcdPosition(m_fd, 0, 1);
|
|
|
|
::lcdPrintf(m_fd, "%.*s", m_cols, LISTENING);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-09-12 19:23:50 +00:00
|
|
|
void CHD44780::writeP25Int(const char* source, bool group, unsigned int dest, const char* type)
|
2016-09-12 17:12:32 +00:00
|
|
|
{
|
|
|
|
assert(source != NULL);
|
|
|
|
assert(type != NULL);
|
|
|
|
|
|
|
|
#ifdef ADAFRUIT_DISPLAY
|
|
|
|
adafruitLCDColour(AC_RED);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
m_clockDisplayTimer.stop(); // Stop the clock display
|
|
|
|
::lcdClear(m_fd);
|
|
|
|
|
|
|
|
if (m_pwm) {
|
|
|
|
if (m_pwmPin != 1U)
|
|
|
|
::softPwmWrite(m_pwmPin, m_pwmBright);
|
|
|
|
else
|
|
|
|
::pwmWrite(m_pwmPin, (m_pwmBright / 100) * 1024);
|
|
|
|
}
|
|
|
|
|
|
|
|
::lcdPosition(m_fd, 0, 0);
|
|
|
|
::lcdPuts(m_fd, "P25");
|
|
|
|
|
|
|
|
if (m_rows == 2U && m_cols == 16U) {
|
|
|
|
char m_buffer1[16U];
|
|
|
|
::sprintf(m_buffer1, "%.10s >", source);
|
|
|
|
::lcdPosition(m_fd, 0, 1);
|
|
|
|
::lcdPrintf(m_fd, "%.*s", m_cols, m_buffer1);
|
|
|
|
} else if (m_rows == 4U && m_cols == 16U) {
|
|
|
|
char m_buffer1[16U];
|
|
|
|
::sprintf(m_buffer1, "%.10s >", source);
|
|
|
|
::lcdPosition(m_fd, 0, 1);
|
|
|
|
::lcdPrintf(m_fd, "%.*s", m_cols, m_buffer1);
|
|
|
|
|
2016-09-12 19:23:50 +00:00
|
|
|
::sprintf(m_buffer1, "%s%u", group ? "TG" : "", dest);
|
2016-09-12 17:12:32 +00:00
|
|
|
::lcdPosition(m_fd, 0, 2);
|
|
|
|
::lcdPrintf(m_fd, "%.*s", m_cols, m_buffer1);
|
|
|
|
} else if (m_rows == 4U && m_cols == 20U) {
|
|
|
|
char m_buffer1[20U];
|
|
|
|
::sprintf(m_buffer1, "%.10s >", source);
|
|
|
|
::lcdPosition(m_fd, 0, 1);
|
|
|
|
::lcdPrintf(m_fd, "%.*s", m_cols, m_buffer1);
|
|
|
|
|
2016-09-12 19:23:50 +00:00
|
|
|
::sprintf(m_buffer1, "%s%u", group ? "TG" : "", dest);
|
2016-09-12 17:12:32 +00:00
|
|
|
::lcdPosition(m_fd, 0, 2);
|
|
|
|
::lcdPrintf(m_fd, "%.*s", m_cols, m_buffer1);
|
|
|
|
} else if (m_rows == 2 && m_cols == 40U) {
|
|
|
|
char m_buffer1[40U];
|
2016-09-12 19:23:50 +00:00
|
|
|
::sprintf(m_buffer1, "%.10s > %s%u", source, group ? "TG" : "", dest);
|
2016-09-12 17:12:32 +00:00
|
|
|
|
|
|
|
::lcdPosition(m_fd, 0, 1);
|
|
|
|
::lcdPrintf(m_fd, "%.*s", m_cols, m_buffer1);
|
|
|
|
}
|
|
|
|
|
|
|
|
m_dmr = false;
|
2017-01-06 21:22:47 +00:00
|
|
|
m_rssiCount1 = 0U;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CHD44780::writeP25RSSIInt(unsigned char rssi)
|
|
|
|
{
|
|
|
|
if (m_rssiCount1 == 0U && m_rows > 2) {
|
|
|
|
::lcdPosition(m_fd, 0, 3);
|
2017-01-08 09:37:17 +00:00
|
|
|
::lcdPrintf(m_fd, "-%3udBm", rssi);
|
2017-01-06 21:22:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
m_rssiCount1++;
|
|
|
|
if (m_rssiCount1 >= P25_RSSI_COUNT)
|
|
|
|
m_rssiCount1 = 0U;
|
2016-09-12 17:12:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CHD44780::clearP25Int()
|
|
|
|
{
|
2016-05-03 16:59:21 +00:00
|
|
|
#ifdef ADAFRUIT_DISPLAY
|
2016-05-11 17:17:23 +00:00
|
|
|
adafruitLCDColour(AC_PURPLE);
|
2016-05-03 16:59:21 +00:00
|
|
|
#endif
|
|
|
|
|
2016-06-04 14:22:39 +00:00
|
|
|
m_clockDisplayTimer.stop(); // Stop the clock display
|
2016-05-28 20:29:30 +00:00
|
|
|
|
2016-04-14 20:57:23 +00:00
|
|
|
if (m_rows == 2U && m_cols == 16U) {
|
|
|
|
::lcdPosition(m_fd, 0, 1);
|
2018-01-17 19:04:00 +00:00
|
|
|
::lcdPrintf(m_fd, "%.*s", m_cols, LISTENING);
|
|
|
|
} else if (m_rows == 4U && m_cols == 16U) {
|
|
|
|
::lcdPosition(m_fd, 0, 1);
|
|
|
|
::lcdPrintf(m_fd, "%.*s", m_cols, LISTENING);
|
|
|
|
|
|
|
|
::lcdPosition(m_fd, 0, 2);
|
|
|
|
::lcdPrintf(m_fd, "%.*s", m_cols, " ");
|
|
|
|
|
|
|
|
::lcdPosition(m_fd, 0, 3);
|
|
|
|
::lcdPrintf(m_fd, "%.*s", m_cols, " ");
|
|
|
|
} else if (m_rows == 4U && m_cols == 20U) {
|
|
|
|
::lcdPosition(m_fd, 0, 1);
|
|
|
|
::lcdPrintf(m_fd, "%.*s", m_cols, LISTENING);
|
|
|
|
|
|
|
|
::lcdPosition(m_fd, 0, 2);
|
|
|
|
::lcdPrintf(m_fd, "%.*s", m_cols, " ");
|
|
|
|
|
|
|
|
::lcdPosition(m_fd, 0, 3);
|
|
|
|
::lcdPrintf(m_fd, "%.*s", m_cols, " ");
|
|
|
|
} else if (m_rows == 2 && m_cols == 40U) {
|
|
|
|
::lcdPosition(m_fd, 0, 1);
|
|
|
|
::lcdPrintf(m_fd, "%.*s", m_cols, LISTENING);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CHD44780::writeNXDNInt(const char* source, bool group, unsigned int dest, const char* type)
|
|
|
|
{
|
|
|
|
assert(source != NULL);
|
|
|
|
assert(type != NULL);
|
|
|
|
|
|
|
|
#ifdef ADAFRUIT_DISPLAY
|
|
|
|
adafruitLCDColour(AC_RED);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
m_clockDisplayTimer.stop(); // Stop the clock display
|
|
|
|
::lcdClear(m_fd);
|
|
|
|
|
|
|
|
if (m_pwm) {
|
|
|
|
if (m_pwmPin != 1U)
|
|
|
|
::softPwmWrite(m_pwmPin, m_pwmBright);
|
|
|
|
else
|
|
|
|
::pwmWrite(m_pwmPin, (m_pwmBright / 100) * 1024);
|
|
|
|
}
|
|
|
|
|
|
|
|
::lcdPosition(m_fd, 0, 0);
|
|
|
|
::lcdPuts(m_fd, "NXDN");
|
|
|
|
|
|
|
|
if (m_rows == 2U && m_cols == 16U) {
|
|
|
|
char m_buffer1[16U];
|
|
|
|
::sprintf(m_buffer1, "%.10s >", source);
|
|
|
|
::lcdPosition(m_fd, 0, 1);
|
|
|
|
::lcdPrintf(m_fd, "%.*s", m_cols, m_buffer1);
|
|
|
|
} else if (m_rows == 4U && m_cols == 16U) {
|
|
|
|
char m_buffer1[16U];
|
|
|
|
::sprintf(m_buffer1, "%.10s >", source);
|
|
|
|
::lcdPosition(m_fd, 0, 1);
|
|
|
|
::lcdPrintf(m_fd, "%.*s", m_cols, m_buffer1);
|
|
|
|
|
|
|
|
::sprintf(m_buffer1, "%s%u", group ? "TG" : "", dest);
|
|
|
|
::lcdPosition(m_fd, 0, 2);
|
|
|
|
::lcdPrintf(m_fd, "%.*s", m_cols, m_buffer1);
|
|
|
|
} else if (m_rows == 4U && m_cols == 20U) {
|
|
|
|
char m_buffer1[20U];
|
|
|
|
::sprintf(m_buffer1, "%.10s >", source);
|
|
|
|
::lcdPosition(m_fd, 0, 1);
|
|
|
|
::lcdPrintf(m_fd, "%.*s", m_cols, m_buffer1);
|
|
|
|
|
|
|
|
::sprintf(m_buffer1, "%s%u", group ? "TG" : "", dest);
|
|
|
|
::lcdPosition(m_fd, 0, 2);
|
|
|
|
::lcdPrintf(m_fd, "%.*s", m_cols, m_buffer1);
|
|
|
|
} else if (m_rows == 2 && m_cols == 40U) {
|
|
|
|
char m_buffer1[40U];
|
|
|
|
::sprintf(m_buffer1, "%.10s > %s%u", source, group ? "TG" : "", dest);
|
|
|
|
|
|
|
|
::lcdPosition(m_fd, 0, 1);
|
|
|
|
::lcdPrintf(m_fd, "%.*s", m_cols, m_buffer1);
|
|
|
|
}
|
|
|
|
|
|
|
|
m_dmr = false;
|
|
|
|
m_rssiCount1 = 0U;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CHD44780::writeNXDNRSSIInt(unsigned char rssi)
|
|
|
|
{
|
|
|
|
if (m_rssiCount1 == 0U && m_rows > 2) {
|
|
|
|
::lcdPosition(m_fd, 0, 3);
|
|
|
|
::lcdPrintf(m_fd, "-%3udBm", rssi);
|
|
|
|
}
|
|
|
|
|
|
|
|
m_rssiCount1++;
|
|
|
|
if (m_rssiCount1 >= NXDN_RSSI_COUNT)
|
|
|
|
m_rssiCount1 = 0U;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CHD44780::clearNXDNInt()
|
|
|
|
{
|
|
|
|
#ifdef ADAFRUIT_DISPLAY
|
|
|
|
adafruitLCDColour(AC_PURPLE);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
m_clockDisplayTimer.stop(); // Stop the clock display
|
|
|
|
|
|
|
|
if (m_rows == 2U && m_cols == 16U) {
|
|
|
|
::lcdPosition(m_fd, 0, 1);
|
2016-04-14 20:57:23 +00:00
|
|
|
::lcdPrintf(m_fd, "%.*s", m_cols, LISTENING);
|
2016-04-18 06:43:17 +00:00
|
|
|
} else if (m_rows == 4U && m_cols == 16U) {
|
|
|
|
::lcdPosition(m_fd, 0, 1);
|
|
|
|
::lcdPrintf(m_fd, "%.*s", m_cols, LISTENING);
|
|
|
|
|
|
|
|
::lcdPosition(m_fd, 0, 2);
|
|
|
|
::lcdPrintf(m_fd, "%.*s", m_cols, " ");
|
2017-01-06 21:22:47 +00:00
|
|
|
|
|
|
|
::lcdPosition(m_fd, 0, 3);
|
|
|
|
::lcdPrintf(m_fd, "%.*s", m_cols, " ");
|
2016-04-14 20:57:23 +00:00
|
|
|
} else if (m_rows == 4U && m_cols == 20U) {
|
2016-03-15 11:42:36 +00:00
|
|
|
::lcdPosition(m_fd, 0, 1);
|
|
|
|
::lcdPrintf(m_fd, "%.*s", m_cols, LISTENING);
|
|
|
|
|
|
|
|
::lcdPosition(m_fd, 0, 2);
|
2016-04-14 20:57:23 +00:00
|
|
|
::lcdPrintf(m_fd, "%.*s", m_cols, " ");
|
2017-01-06 21:22:47 +00:00
|
|
|
|
|
|
|
::lcdPosition(m_fd, 0, 3);
|
|
|
|
::lcdPrintf(m_fd, "%.*s", m_cols, " ");
|
2016-04-14 20:57:23 +00:00
|
|
|
} else if (m_rows == 2 && m_cols == 40U) {
|
2016-03-15 11:42:36 +00:00
|
|
|
::lcdPosition(m_fd, 0, 1);
|
|
|
|
::lcdPrintf(m_fd, "%.*s", m_cols, LISTENING);
|
|
|
|
}
|
2016-03-14 22:58:09 +00:00
|
|
|
}
|
|
|
|
|
2018-06-11 20:30:49 +00:00
|
|
|
void CHD44780::writePOCSAGInt(uint32_t ric, const std::string& message)
|
|
|
|
{
|
|
|
|
::lcdPosition(m_fd, m_cols - 5, m_rows - 1);
|
|
|
|
::lcdPuts(m_fd, "POCSAG TX");
|
|
|
|
}
|
|
|
|
|
|
|
|
void CHD44780::clearPOCSAGInt()
|
|
|
|
{
|
|
|
|
::lcdPosition(m_fd, m_cols - 5, m_rows - 1);
|
|
|
|
::lcdPuts(m_fd, " Idle");
|
|
|
|
}
|
|
|
|
|
2016-09-15 21:03:48 +00:00
|
|
|
void CHD44780::writeCWInt()
|
|
|
|
{
|
|
|
|
::lcdPosition(m_fd, m_cols - 5, m_rows - 1);
|
|
|
|
::lcdPuts(m_fd, "CW TX");
|
|
|
|
}
|
|
|
|
|
|
|
|
void CHD44780::clearCWInt()
|
|
|
|
{
|
|
|
|
::lcdPosition(m_fd, m_cols - 5, m_rows - 1);
|
|
|
|
::lcdPuts(m_fd, " Idle");
|
|
|
|
}
|
|
|
|
|
2016-05-21 11:28:09 +00:00
|
|
|
void CHD44780::clockInt(unsigned int ms)
|
|
|
|
{
|
2016-05-28 20:29:30 +00:00
|
|
|
m_clockDisplayTimer.clock(ms);
|
2016-06-04 14:22:39 +00:00
|
|
|
|
|
|
|
// Idle clock display
|
2016-05-28 20:29:30 +00:00
|
|
|
if (m_displayClock && m_clockDisplayTimer.isRunning() && m_clockDisplayTimer.hasExpired()) {
|
|
|
|
time_t currentTime;
|
|
|
|
struct tm *Time;
|
2016-06-04 14:22:39 +00:00
|
|
|
time(¤tTime);
|
2016-05-28 20:29:30 +00:00
|
|
|
|
2016-06-04 14:22:39 +00:00
|
|
|
if (m_utc) {
|
2016-05-28 20:29:30 +00:00
|
|
|
Time = gmtime(¤tTime);
|
|
|
|
} else {
|
|
|
|
Time = localtime(¤tTime);
|
|
|
|
}
|
|
|
|
|
2016-07-02 22:48:00 +00:00
|
|
|
setlocale(LC_TIME,"");
|
2016-06-24 15:08:28 +00:00
|
|
|
strftime(m_buffer1, 128, "%X", Time); // Time
|
|
|
|
strftime(m_buffer2, 128, "%x", Time); // Date
|
|
|
|
|
2016-05-29 07:13:43 +00:00
|
|
|
if (m_cols == 16U && m_rows == 2U) {
|
2016-06-24 15:08:28 +00:00
|
|
|
::lcdPosition(m_fd, m_cols - 10, 1);
|
|
|
|
::lcdPrintf(m_fd, "%s%.*s", strlen(m_buffer1) > 8 ? "" : " ", 10, m_buffer1);
|
2016-05-29 07:13:43 +00:00
|
|
|
} else {
|
2016-06-24 16:14:48 +00:00
|
|
|
::lcdPosition(m_fd, (m_cols - (strlen(m_buffer1) == 8 ? 8 : 10)) / 2, m_rows == 2 ? 1 : 2);
|
2016-06-24 15:58:01 +00:00
|
|
|
::lcdPrintf(m_fd, "%.*s", strlen(m_buffer1) == 8 ? 8 : 10, m_buffer1);
|
2016-06-24 15:08:28 +00:00
|
|
|
::lcdPosition(m_fd, (m_cols - strlen(m_buffer2)) / 2, m_rows == 2 ? 0 : 1);
|
|
|
|
::lcdPrintf(m_fd, "%s", m_buffer2);
|
2016-05-29 07:13:43 +00:00
|
|
|
}
|
2016-07-06 18:46:52 +00:00
|
|
|
|
2016-06-04 14:22:39 +00:00
|
|
|
m_clockDisplayTimer.start();
|
|
|
|
}
|
2016-05-21 11:28:09 +00:00
|
|
|
}
|
|
|
|
|
2016-03-14 22:58:09 +00:00
|
|
|
void CHD44780::close()
|
|
|
|
{
|
|
|
|
}
|