Merge master into text-justification

This commit is contained in:
Reed Nightingale 2020-01-28 20:34:23 -08:00
commit 0ad20caa4b
7 changed files with 49 additions and 30 deletions

View File

@ -101,7 +101,12 @@ const uint8_t FreeSansBold9pt7bBitmaps[] PROGMEM = {
0x78, 0x1E, 0x03, 0x00, 0xC0, 0x70, 0x38, 0x0E, 0x00, 0xFE, 0xFE, 0x0E,
0x1C, 0x38, 0x38, 0x70, 0xE0, 0xFF, 0xFF, 0x37, 0x66, 0x66, 0x6E, 0xE6,
0x66, 0x66, 0x67, 0x30, 0xFF, 0xFF, 0x80, 0xCE, 0x66, 0x66, 0x67, 0x76,
0x66, 0x66, 0x6E, 0xC0, 0x71, 0x8E };
0x66, 0x66, 0x6E, 0xC0, 0x71, 0x8E, 0x0C, 0x00, 0xF0, 0x00, 0x8F, 0x10,
0x1C, 0xF3, 0x83, 0xFF, 0xFC, 0x7F, 0xFF, 0xE3, 0xF0, 0xFE, 0x1E, 0x07,
0xC1, 0xC0, 0x38, 0xF8, 0x01, 0xFF, 0x80, 0x1F, 0xF8, 0x01, 0xFF, 0x80,
0x1F, 0x1C, 0x03, 0x81, 0xE0, 0x78, 0x3F, 0x0F, 0xC7, 0xFF, 0xFE, 0x3F,
0xFF, 0xC3, 0xCF, 0x38, 0x08, 0xF1, 0x00, 0x0F, 0x00
};
const GFXglyph FreeSansBold9pt7bGlyphs[] PROGMEM = {
{ 0, 0, 0, 5, 0, 1 }, // 0x20 ' '
@ -198,11 +203,16 @@ const GFXglyph FreeSansBold9pt7bGlyphs[] PROGMEM = {
{ 1207, 4, 17, 7, 1, -12 }, // 0x7B '{'
{ 1216, 1, 17, 5, 2, -12 }, // 0x7C '|'
{ 1219, 4, 17, 7, 2, -12 }, // 0x7D '}'
{ 1228, 8, 2, 9, 0, -4 } }; // 0x7E '~'
{ 1228, 8, 2, 9, 0, -4 }, // 0x7E '~'
{ 1231, 20, 20, 22, 1, -12 }, // 0x7F gear icon
{ 1231, 0, 0, 10, 0, 1 }, // 0x80 10px space to match numbers
{ 1231, 0, 0, 4, 0, 1 }, // 0x81 4px space to match period
};
const GFXfont FreeSansBold9pt7b PROGMEM = {
(uint8_t *)FreeSansBold9pt7bBitmaps,
(GFXglyph *)FreeSansBold9pt7bGlyphs,
0x20, 0x7E, 22 };
// Approx. 1902 bytes
0x20, //first character
0x81, //last character
22 //yAdvance (newline)
};

View File

@ -38,8 +38,6 @@ static const unsigned int cwAdcDotTo = 600;
static const unsigned int cwAdcDashFrom = cwAdcDotTo + 1;
static const unsigned int cwAdcDashTo = 800;
static const unsigned int delayBeforeCWStartTime = 50;
/**
* Starts transmitting the carrier with the sidetone
* It assumes that we have called cwTxStart and not called cwTxStop
@ -93,7 +91,7 @@ char update_PaddleLatch(bool isUpdateKeyState) {
else{
if (KeyerMode_e::KEYER_STRAIGHT != globalSettings.keyerMode)
tmpKeyerControl = 0 ;
else if (paddle <= cwAdcSTTo)
else if (paddle <= cwAdcDashTo)
tmpKeyerControl = DIT_L ;
else
tmpKeyerControl = 0 ;
@ -156,8 +154,6 @@ void cwKeyer(void){
case KEYED_PREP:
//modified KD8CEC
if (!globalSettings.txActive){
//DelayTime Option
active_delay(delayBeforeCWStartTime * 2);
globalSettings.cwExpirationTimeMs = millis() + globalSettings.cwActiveTimeoutMs;
startTx(TuningMode_e::TUNE_CW);
}
@ -205,11 +201,7 @@ void cwKeyer(void){
// if we are here, it is only because the key is pressed
if (!globalSettings.txActive){
startTx(TuningMode_e::TUNE_CW);
//DelayTime Option
active_delay(delayBeforeCWStartTime * 2);
globalSettings.cwExpirationTimeMs = millis() + globalSettings.cwDitDurationMs;
globalSettings.cwExpirationTimeMs = millis() + globalSettings.cwActiveTimeoutMs;
}
cwKeydown();

View File

@ -11,7 +11,8 @@ struct Point ts_point;
/*
* This formats the frequency given in f
*/
void formatFreq(uint32_t freq, char* buff, uint16_t buff_size) {
void formatFreq(uint32_t freq, char* buff, uint16_t buff_size, uint8_t fixed_width)
{
memset(buff, 0, buff_size);
ultoa(freq, buff, DEC);
@ -20,10 +21,20 @@ void formatFreq(uint32_t freq, char* buff, uint16_t buff_size) {
const uint8_t num_leading_digits_raw = num_digits % 3;
const uint8_t num_leading_digits = (0 == num_leading_digits_raw) ? 3 : num_leading_digits_raw;
if(0 == num_spacers){
return;
if(0 < fixed_width){
while(0 < fixed_width - num_digits - num_spacers){
if(0 == fixed_width % 4){
buff[0] = '\x81';//separator size
}
else{
buff[0] = '\x80';//digit size
}
--fixed_width;
++buff;
}
}
ultoa(freq, buff, DEC);
buff += num_leading_digits;
num_digits -= num_leading_digits;
for(int i = num_digits-1; i >= 0; --i){
@ -214,13 +225,6 @@ void displayChar(int16_t x, int16_t y, unsigned char c, uint16_t color, uint16_t
tft.drawCharGFX(x,y,c,color,bg,1);
}
void displayRawText(char *text, int x1, int y1, int color, int background){
tft.setTextColor(color,background);
tft.setCursor(x1,y1);
tft.setBound(0,320);
tft.print(text);
}
void displayRawText(char *text, int x1, int y1, int w, int color, int background){
tft.setTextColor(color,background);
tft.setCursor(x1,y1);

View File

@ -22,10 +22,9 @@ void displayVline(unsigned int x, unsigned int y, unsigned int l, unsigned int c
void displayRect(unsigned int x,unsigned int y,unsigned int w,unsigned int h,unsigned int c);
void displayFillrect(unsigned int x,unsigned int y,unsigned int w,unsigned int h,unsigned int c);
void displayChar(int16_t x, int16_t y, unsigned char c, uint16_t color, uint16_t bg);
void displayRawText(char *text, int x1, int y1, int color, int background);
void displayText(char *text, int x1, int y1, int w, int h, int color, int background, int border, TextJustification_e justification = TextJustification_e::Center);
void formatFreq(uint32_t freq, char* buff, uint16_t buff_size);
void formatFreq(uint32_t freq, char* buff, uint16_t buff_size, uint8_t fixed_width = 0);
/* touch functions */
boolean readTouch();

View File

@ -105,7 +105,7 @@ constexpr Button btn_set[BUTTON_TOTAL] PROGMEM = {
{LAYOUT_BUTTON_X + 0*LAYOUT_BUTTON_PITCH_X, LAYOUT_BUTTON_Y + 2*LAYOUT_BUTTON_PITCH_Y, LAYOUT_BUTTON_WIDTH, LAYOUT_BUTTON_HEIGHT, BUTTON_15 , "15", '5'},
{LAYOUT_BUTTON_X + 1*LAYOUT_BUTTON_PITCH_X, LAYOUT_BUTTON_Y + 2*LAYOUT_BUTTON_PITCH_Y, LAYOUT_BUTTON_WIDTH, LAYOUT_BUTTON_HEIGHT, BUTTON_10 , "10", '1'},
{LAYOUT_BUTTON_X + 2*LAYOUT_BUTTON_PITCH_X, LAYOUT_BUTTON_Y + 2*LAYOUT_BUTTON_PITCH_Y, LAYOUT_BUTTON_WIDTH, LAYOUT_BUTTON_HEIGHT, BUTTON_BLANK_1, "", '\0'},
{LAYOUT_BUTTON_X + 3*LAYOUT_BUTTON_PITCH_X, LAYOUT_BUTTON_Y + 2*LAYOUT_BUTTON_PITCH_Y, LAYOUT_BUTTON_WIDTH, LAYOUT_BUTTON_HEIGHT, BUTTON_MNU, "MNU", 'M'},
{LAYOUT_BUTTON_X + 3*LAYOUT_BUTTON_PITCH_X, LAYOUT_BUTTON_Y + 2*LAYOUT_BUTTON_PITCH_Y, LAYOUT_BUTTON_WIDTH, LAYOUT_BUTTON_HEIGHT, BUTTON_MNU, "\x7F", 'M'},
{LAYOUT_BUTTON_X + 4*LAYOUT_BUTTON_PITCH_X, LAYOUT_BUTTON_Y + 2*LAYOUT_BUTTON_PITCH_Y, LAYOUT_BUTTON_WIDTH, LAYOUT_BUTTON_HEIGHT, BUTTON_FRQ, "FRQ", 'F'},
};
@ -226,11 +226,12 @@ void displayVFO(Vfo_e vfo){
}
}
c[1] = ':';
c[2] = ' ';
if (VFO_A == vfo){
getButton(BUTTON_VFOA, &button);
formatFreq(globalSettings.vfoA.frequency, c+2, sizeof(c)-2);
formatFreq(globalSettings.vfoA.frequency, c+3, sizeof(c)-3, 10);
if (VFO_A == globalSettings.activeVfo){
displayColor = COLOR_ACTIVE_VFO_TEXT;
@ -245,7 +246,7 @@ void displayVFO(Vfo_e vfo){
if (VFO_B == vfo){
getButton(BUTTON_VFOB, &button);
formatFreq(globalSettings.vfoB.frequency, c+2, sizeof(c)-2);
formatFreq(globalSettings.vfoB.frequency, c+3, sizeof(c)-3, 10);
if (VFO_B == globalSettings.activeVfo){
displayColor = COLOR_ACTIVE_VFO_TEXT;

4
version.cpp Normal file
View File

@ -0,0 +1,4 @@
#include "version.h"
const char VERSION_STRING_PRIVATE [] PROGMEM = "R1.1.1";
const char* const VERSION_STRING = VERSION_STRING_PRIVATE;

9
version.h Normal file
View File

@ -0,0 +1,9 @@
#pragma once
#include <avr/pgmspace.h>
/*
* VERSION_STRING is a PROGMEM string, so extract it before use, e.g.
* strncpy_P(char_buffer_out,VERSION_STRING,size_of_char_buffer_out);
*/
extern const char* const VERSION_STRING;