Modif by Xavier F4IYT

This commit is contained in:
alternatifs 2026-07-25 20:37:32 +02:00
parent e1fd3bec3e
commit 8abad38d51
13 changed files with 176 additions and 170 deletions

Binary file not shown.

View File

@ -1,7 +1,7 @@
/*
/*
* File: Afficheur.cpp
* Author: F4GOH
*
*
*/
#include "Afficheur.h"
@ -11,6 +11,7 @@
Afficheur::Afficheur()
{
tft = new Adafruit_ST7789(TFT_CS, TFT_DC, TFT_RST);
}
Afficheur::~Afficheur() {
@ -19,6 +20,18 @@ Afficheur::~Afficheur() {
void Afficheur::begin() {
// Initialisation I2C avec adresse 0x3C
Wire.begin();
if(!oled.begin(SSD1306_SWITCHCAPVCC, 0x3C))
{
Serial.println("OLED non detecte");
}
else
{
Serial.println("OLED OK");
}
// Initialisation rétroéclairage TFT
pinMode(TFT_BL, OUTPUT);
digitalWrite(TFT_BL, HIGH);
@ -28,8 +41,8 @@ void Afficheur::begin() {
tft->setRotation(1);
tft->setAddrWindow(34, 0, 172, 320);
tft->fillScreen(ST77XX_BLACK);
tft->setTextWrap(false);
tft->setTextWrap(false);
oled.clearDisplay();
}
const uint16_t Afficheur::lineColors[8] = {
@ -56,6 +69,8 @@ void Afficheur::timeDisplay(char* txt) {
// Petit padding
tft->setCursor(46, 0);
tft->print(txt);
oledPrint(txt,0,35,1);
}
void Afficheur::modeDisplay(const char* txt) {
@ -82,16 +97,28 @@ void Afficheur::modeDisplay(const char* txt) {
tft->setCursor(cx, cy);
tft->print(txt);
// Calcul de la largeur approximative
int16_t x1, y1;
oled.getTextBounds(txt, 10, 0, &x1, &y1, &w, &h);
// centrage horizontal et vertical
int x0= (128 - w) / 2;
int y0= (64 - h) / 2;
oledPrint(txt,40,10,2);
}
void Afficheur::modeEfface() {
const int width = 172;
// Zone centrale approximative (même logique que modeDisplay)
tft->fillRect(0, 120, width, 80, ST77XX_BLACK);
}
void Afficheur::clearDisplay() {
tft->fillScreen(ST77XX_BLACK);
oled.fillRect(0, 0, 128, 64, SSD1306_BLACK);
}
void Afficheur::configDisplay(config& cfg) {
@ -114,6 +141,8 @@ void Afficheur::configDisplay(config& cfg) {
tft->setCursor(x, y);
tft->print(line);
y += lineHeight;
snprintf(line, sizeof(line), "f=%lu %ld %s", cfg.freq, cfg.offset,bandStr[cfg.band]);
oledPrint(line,0,0,1);
// Ligne 2
tft->setTextColor(lineColors[1], ST77XX_BLACK);
@ -121,6 +150,7 @@ void Afficheur::configDisplay(config& cfg) {
tft->setCursor(x, y);
tft->print(line);
y += lineHeight;
oledPrint(line,0,8,1);
// Ligne 3
tft->setTextColor(lineColors[2], ST77XX_BLACK);
@ -128,22 +158,26 @@ void Afficheur::configDisplay(config& cfg) {
tft->setCursor(x, y);
tft->print(line);
y += lineHeight;
snprintf(line, sizeof(line), "gps baud %lu wpm %u", cfg.baud,cfg.wpm);
oledPrint(line,0,16,1);
// Ligne 4
tft->setTextColor(lineColors[3], ST77XX_BLACK);
snprintf(line, sizeof(line), "loc %.4s Enigma %s", cfg.locator,cfg.enigma ? "on" : "off");
snprintf(line, sizeof(line), "loc %.4s", cfg.locator);
tft->setCursor(x, y);
tft->print(line);
y += lineHeight;
oledPrint(line,0,24,1);
// Ligne 5
const char* modeStr[] = { "WSPR", "RTTY", "FT8", "HELL", "CW","IAMBIC" };
const char* modeStr[] = { "WSPR", "RTTY", "FT8", "HELL", "CW", "IAMBIC", "ALL" };
tft->setTextColor(lineColors[4], ST77XX_BLACK);
snprintf(line, sizeof(line), "mode %s %s", modeStr[cfg.mode], cfg.call);
tft->setCursor(x, y);
tft->print(line);
y += lineHeight;
// Ligne 6
tft->setTextColor(lineColors[5], ST77XX_BLACK);
snprintf(line, sizeof(line), "wpm %u nmea %s",
@ -152,7 +186,11 @@ void Afficheur::configDisplay(config& cfg) {
tft->setCursor(x, y);
tft->print(line);
y += lineHeight;
snprintf(line, sizeof(line), "nmea %s follow %s",
cfg.nmeaEnabled ? "on" : "off",
cfg.follow ? "on" : "off");
oledPrint(line,0,48,1);
// Ligne 7
tft->setTextColor(lineColors[6], ST77XX_BLACK);
snprintf(line, sizeof(line), "Iambic type %c follow %s",
@ -160,7 +198,9 @@ void Afficheur::configDisplay(config& cfg) {
cfg.follow ? "on" : "off");
tft->setCursor(x, y);
tft->print(line);
snprintf(line, sizeof(line), "Iambic type %c",
cfg.bicmd);
oledPrint(line,0,56,1);
}
void Afficheur::printCharCW(char car) {
@ -174,7 +214,7 @@ void Afficheur::printCharCW(char car) {
CHAR_HEIGHT * (MAX_LINES - 1), // hauteur des lignes 1 à 4
ST77XX_BLACK
);
tft->setTextSize(TEXT_SIZE);
tft->setTextWrap(false);
@ -192,7 +232,7 @@ void Afficheur::printCharCW(char car) {
// écran plein
if (currentLine >= MAX_LINES) {
//tft->fillScreen(ST77XX_BLACK);
tft->fillRect(
0,
CHAR_HEIGHT * 1, // début à la ligne 1
@ -200,7 +240,7 @@ void Afficheur::printCharCW(char car) {
CHAR_HEIGHT * (MAX_LINES - 1), // hauteur des lignes 1 à 4
ST77XX_BLACK
);
currentLine = 1;
}
@ -235,4 +275,23 @@ void Afficheur::printFrequency(uint32_t freq) {
tft->setCursor(x, y);
tft->print(buf);
}
oledPrint(buf,10,0,1);
}
void Afficheur::oledPrint(String txt, int x , int y , int Size)
{
//oled.clearDisplay();
// Calculer la largeur et la hauteur du texte précédent
int textWidth = txt.length() * 6 * Size; // Largeur approximative (6 pixels par caractère)
int textHeight = 8 * Size; // Hauteur approximative (8 pixels par taille)
oled.fillRect(x, y, textWidth, textHeight, SSD1306_BLACK);
oled.setTextSize(Size); // taille du texte
oled.setTextColor(SSD1306_WHITE); // Couleur du texte (blanc pour OLED)
oled.setCursor(x, y);
oled.println(txt);
oled.display();
// Effacer l'écran
//oled.clearDisplay();
}

View File

@ -11,6 +11,9 @@
#include <Arduino.h>
#include <Adafruit_GFX.h>
#include <Adafruit_ST7789.h>
#include <Adafruit_SSD1306.h>
#include <Wire.h>
//#include <U8g2lib.h>
#include <SPI.h>
#include "Menu.h"
@ -39,6 +42,8 @@
#define MAX_COLS 13
#define MAX_LINES 5
#define SCREENOLED_WIDTH 128
#define SCREENOLED_HEIGHT 64
class Afficheur {
public:
@ -53,12 +58,17 @@ public:
void clearDisplay();
void printCharCW(char car);
void printFrequency(uint32_t freq);
void oledPrint(String txt, int x , int y , int Size);
private:
//Adafruit_SSD1306 display;
//U8G2_SSD1306_128X64_NONAME_F_HW_I2C display; //gfx
Adafruit_ST7789 *tft;
Adafruit_SSD1306 oled = Adafruit_SSD1306(
SCREENOLED_WIDTH,
SCREENOLED_HEIGHT,
&Wire,
-1
);
//U8G2_SSD1306_128X64_NONAME_F_HW_I2C display; //gfx
Adafruit_ST7789 *tft;
int cursorX = 0;
int cursorY = 0;

View File

@ -4,16 +4,11 @@
// Constructeur
Iambic::Iambic(Modulation* m, Afficheur* a,int wpm,char _mode,bool _enigma)
Iambic::Iambic(Modulation* m, Afficheur* a,int wpm,char _mode)
: mod(m), afficheur(a) {
Keyboard.begin();
enigmaEn=_enigma;
wpmSpeed=wpm;
enigma.init();
pinMode(LED_PIN, OUTPUT);
pinMode(PIEZO_SPKR_PIN, OUTPUT);
pinMode(TX_SWITCH_PIN, OUTPUT);
@ -39,7 +34,7 @@ Iambic::Iambic(Modulation* m, Afficheur* a,int wpm,char _mode,bool _enigma)
g_dit_paddle = LEFT_PADDLE_PIN; // Dits on right hand thumb
g_dah_paddle = RIGHT_PADDLE_PIN; // Dahs on right hand index finger
g_sidetone_muted = false; // Default to no sidetone
g_sidetone_muted = true; // Default to no sidetone
//vband
// Etat des touches
@ -59,16 +54,7 @@ Iambic::~Iambic() {
void Iambic::scan() {
static long ktimer;
if (enigmaEn) {
if (digitalRead(PUSH_PIN) == 0) {
char *buf;
buf = enigma.getChiffre();
Serial.println(buf);
mod->sendCw(buf, wpmSpeed);
enigma.init();
}
}
// This state machine translates paddle input into DITS and DAHs and keys the transmitter.
switch (g_keyerState) {
case IDLE:
@ -150,10 +136,7 @@ void Iambic::scan() {
} else { // Check for intercharacter space
if (millis() > ktimer) { // We have a character
//Serial.println(g_current_morse_character);
char car;
car=morse_char_decode(g_current_morse_character);
afficheur->printCharCW(car);
enigma.encode(car);
afficheur->printCharCW(morse_char_decode(g_current_morse_character));
//Serial.print(morse_char_decode(g_current_morse_character));
g_keyerState = IDLE; // go idle
}
@ -182,13 +165,12 @@ void Iambic::update_PaddleLatch() {
// Key the Transmitter
///////////////////////////////////////////////////////////////////////////////
void Iambic::tx_key_down() {
if (!enigmaEn) {
digitalWrite(LED_PIN, HIGH); // turn the LED on
digitalWrite(TX_SWITCH_PIN, HIGH); // Turn the transmitter on
mod->sendCarriage(true);
}
digitalWrite(LED_PIN, HIGH); // turn the LED on
digitalWrite(TX_SWITCH_PIN, HIGH); // Turn the transmitter on
mod->sendCarriage(true);
if (!g_sidetone_muted) {
tone(PIEZO_SPKR_PIN, SIDETONE_FREQ_HZ); // Sidetone on if not muted
tone(PIEZO_SPKR_PIN, SIDETONE_FREQ_HZ); // Sidetone on if not muted
}
}
@ -196,15 +178,14 @@ void Iambic::tx_key_down() {
///////////////////////////////////////////////////////////////////////////////
// Un-key the transmitter
///////////////////////////////////////////////////////////////////////////////
void Iambic::tx_key_up() {
if (!enigmaEn) {
digitalWrite(LED_PIN, LOW); // turn the LED off
digitalWrite(TX_SWITCH_PIN, LOW); // Turn the transmitter off
mod->sendCarriage(false);
}
digitalWrite(LED_PIN, LOW); // turn the LED off
digitalWrite(TX_SWITCH_PIN, LOW); // Turn the transmitter off
mod->sendCarriage(false);
if (!g_sidetone_muted) {
noTone(PIEZO_SPKR_PIN);
noTone(PIEZO_SPKR_PIN);
}
}

View File

@ -17,7 +17,6 @@
#include <Modulation.h>
#include "Afficheur.h"
#include <Keyboard.h>
#include "Enigma.h"
#define VBAND_LEFT '['
@ -25,7 +24,7 @@
// Keyer define
#define SIDETONE_FREQ_HZ 700 // Frequency for the keyer sidetone
#define SIDETONE_FREQ_HZ 600 // Frequency for the keyer sidetone
#define DEFAULT_SPEED_WPM 10 // 15 WPM default keyer speed
#define KEYER_MODE_IS_IAMBIC_A // Remove the '//' at the beginning of the line if you prefer Iambic A, otherwise the code will use Iambic B. If you don't use squeeze keying it doesn't matter.
@ -41,8 +40,6 @@
#define IAMBIC_B 0x10 // 0x00 for Iambic A, 0x10 for Iambic B (Binary 0001 0000)
#define IAMBIC_A 0
#define PUSH_PIN 27
// Keyer State machine type - states for sending of Morse elements based on paddle input
enum KSTYPE {
IDLE,
@ -70,7 +67,6 @@ class Iambic {
private:
Modulation* mod;
Afficheur* afficheur;
Enigma enigma;
uint32_t g_ditTime; // Number of milliseconds per dit
uint8_t g_keyerControl; // 0x1 Dit latch, 0x2 Dah latch, 0x04 Dit being processed, 0x10 for Iambic A or 1 for B
@ -96,8 +92,7 @@ private:
unsigned long left_time;
unsigned long right_time;
bool enigmaEn;
int wpmSpeed;
char morse_char_decode(uint8_t code);
void update_PaddleLatch();
@ -106,7 +101,7 @@ private:
public:
// Constructeur
Iambic(Modulation* m, Afficheur* a,int wpm,char _mode,bool _enigma);
Iambic(Modulation* m, Afficheur* a,int wpm,char _mode);
// Destructeur
~Iambic();

View File

@ -6,7 +6,7 @@
#include "Menu.h"
const char* Menu::modeStr[6] = {"WSPR", "RTTY", "FT8", "HELL", "CW", "IAMBIC"};
const char* Menu::modeStr[7] = {"WSPR", "RTTY", "FT8", "HELL", "CW", "IAMBIC", "ALL"};
const char* Menu::bandStr[7] = {"160m", "80m", "60m", "40m", "30m", "20m", "free frequency"};
@ -67,8 +67,7 @@ void Menu::setup() {
con->onCmd("nmea", _nmea_);
con->onCmd("wpm", _wpm_);
con->onCmd("follow", _follow_);
con->onCmd("enigma", _enigma_);
con->onUnknown(_unknown);
con->start();
this->run();
@ -81,28 +80,27 @@ void Menu::_exit_(ArgList& L, Stream& S) {
void Menu::_help_(ArgList& L, Stream& S) {
S.println(F("Available commands"));
S.println(F("Set transmission frequency : freq 7040100"));
S.println(F("Set offset value : offset -200"));
S.println(F("Set callsign : call F4XYZ"));
S.println(F("Set locator : loc JN07"));
S.println(F("Set mode wspr rtty ft8 hell cw iaùmbic : mode wspr"));
S.println(F("Set band 160,80m,60m,40m,30m,20m,freq : band 40m"));
S.println(F("Set modulo in minutes : minute 10"));
S.println(F("Set follow mode : follow 1"));
S.println(F("Set cw words per minute : wpm 15"));
S.println(F("Set iambic mode : iambic B"));
S.println(F("Set enigma mode 0 or 1 : enigma 1"));
S.println(F("Set transmission power (dBm) : dbm 10"));
S.println(F("Set email address : mail f4xyz at example.com"));
S.println(F("Set gps baud rate : gpsbaud 9600"));
S.println(F("Scan I2C bus : scan"));
S.println(F("Show nmea frame 0 or 1 : nmea 1"));
S.println(F("Save current configuration to EEPROM : save"));
S.println(F("Display current configuration : show"));
S.println(F("Reset all parameters to default : raz"));
S.println(F("Restart RPI pico : restart"));
S.println(F("Show this help message : help"));
S.println(F("Exit menu : exit"));
S.println(F("Set transmission frequency : freq 7040100"));
S.println(F("Set offset value : offset -200"));
S.println(F("Set callsign : call F4XYZ"));
S.println(F("Set locator : loc JN07"));
S.println(F("Set mode wspr rtty ft8 hell cw all : mode wspr"));
S.println(F("Set band 160,80m,60m,40m,30m,20m,freq : band 40m"));
S.println(F("Set modulo in minutes : minute 10"));
S.println(F("Set follow mode : follow 1"));
S.println(F("Set cw words per minute : wpm 15"));
S.println(F("Set iambic mode : iambic B"));
S.println(F("Set transmission power (dBm) : dbm 10"));
S.println(F("Set email address : mail f4xyz at example.com"));
S.println(F("Set gps baud rate : gpsbaud 9600"));
S.println(F("Scan I2C bus : scan"));
S.println(F("Show nmea frame : nmea 1"));
S.println(F("Save current configuration to EEPROM : save"));
S.println(F("Display current configuration : show"));
S.println(F("Reset all parameters to default : raz"));
S.println(F("Restart RPI pico : restart"));
S.println(F("Show this help message : help"));
S.println(F("Exit menu : exit"));
}
@ -174,6 +172,8 @@ void Menu::_mode_(ArgList& L, Stream& S) {
anchor->cfg.mode = CW;
} else if (p == "iambic") {
anchor->cfg.mode = IAMBIC;
} else if (p == "all") {
anchor->cfg.mode = ALL;
} else {
S.println(F("Invalid mode syntax. Example: mode wspr"));
return;
@ -396,23 +396,6 @@ void Menu::_follow_(ArgList& L, Stream& S) {
}
}
void Menu::_enigma_(ArgList& L, Stream& S) {
String p;
bool ret;
p = L.getNextArg();
ret = anchor->acceptCmd(p, 1, 1);
if (ret == true) {
int val = p.toInt(); // Conversion en entier
if (val == 0 || val == 1) {
anchor->cfg.enigma = (val == 1); // Affectation booléenne
S.printf("Enigma is %s\n\r", anchor->cfg.enigma ? "enabled" : "disabled");
} else {
S.println(F("Invalid value. Use 0 to disable or 1 to enable enigma mode."));
}
}
}
void Menu::_show_(ArgList& L, Stream& S) {
S.println("Current configuration :");
S.printf(" freq : %lu Hz\n\r", anchor->cfg.freq);
@ -423,8 +406,7 @@ void Menu::_show_(ArgList& L, Stream& S) {
S.printf(" mode : %s\n\r", modeStr[anchor->cfg.mode]);
S.printf(" band : %s\n\r", bandStr[anchor->cfg.band]);
S.printf(" wpm : %u\n\r", anchor->cfg.wpm);
S.printf(" iambic mode : %c\n\r", anchor->cfg.bicmd);
S.printf(" Enigma is : %s\n\r", anchor->cfg.enigma ? "ON" : "OFF");
S.printf(" iambic mode : %c\n\r", anchor->cfg.bicmd);
S.printf(" mail : %s\n\r", anchor->cfg.mail);
S.printf(" minute : %u min\n\r", anchor->cfg.minute);
S.printf(" Gps baud rate : %u\n\r", anchor->cfg.baud);
@ -451,9 +433,7 @@ void Menu::_raz_(ArgList& L, Stream& S) {
anchor->cfg.mode=WSPR;
anchor->cfg.nmeaEnabled=false;
anchor->cfg.wpm=12;
anchor->cfg.bicmd='A';
anchor->cfg.follow=0;
anchor->cfg.enigma=0;
anchor->cfg.band = FREQ;
Serial.println("Configuration has been reset to default values.");
}
@ -489,5 +469,6 @@ void Menu::scanI2C() {
}
Menu* Menu::anchor = NULL;

View File

@ -16,7 +16,7 @@
#define MENU_PIN 6
typedef enum{
WSPR,RTTY,FT8,HELL,CW,IAMBIC,NOTX
WSPR,RTTY,FT8,HELL,CW,IAMBIC,ALL,NOTX
}txModes;
typedef enum{
@ -44,7 +44,6 @@ typedef struct {
bool follow;
char bicmd;
bands band;
bool enigma;
} config;
@ -83,7 +82,6 @@ public:
static void _nmea_(ArgList& L, Stream& S);
static void _wpm_(ArgList& L, Stream& S);
static void _follow_(ArgList& L, Stream& S);
static void _enigma_(ArgList& L, Stream& S);
//void displayRtc();
bool exitFlag;
@ -92,7 +90,7 @@ public:
static Menu* anchor;
bool acceptCmd(String cmd, int longMin, int longMax);
void scanI2C();
static const char* modeStr[6];
static const char* modeStr[7];
static const char* bandStr[7];
freqbands tabfreq[6];

View File

@ -306,14 +306,11 @@ void Modulation::sendCw(char * stringCw, int cwWpm) {
byte nb_bits, val;
int d;
int c = *stringCw++;
startTimerIRQ(tempo*1000);
waitIrq();
while (c != '\0') {
c = toupper(c); // Uppercase
if (c == 32) { // Space character between words in string
periods = 200 << 24; //dds off 7 dot length spacing
//delay(tempo * 7); // between words
for (int t=0;t<7;t++) waitIrq();
delay(tempo * 7); // between words
} else if (c > 32 && c < 91) {
c = c - 32;
d = int(pgm_read_word(&morseVaricode[0][c])); // Get CW varicode
@ -322,29 +319,19 @@ void Modulation::sendCw(char * stringCw, int cwWpm) {
for (int b = 7; b > 7 - nb_bits; b--) { // Send CW character, each bit represents a symbol (0 for dot, 1 for dash) MSB first
val = bitRead(d, b); //look varicode
periods = cwfr;
//delay(tempo + 2 * tempo * val); // A dot length or a dash length (3 times the dot)
waitIrq();
if (val == 1) {
waitIrq();
waitIrq();
}
periods = cwfr;
delay(tempo + 2 * tempo * val); // A dot length or a dash length (3 times the dot)
periods = 200 << 24; //dds off 1 dot length spacing
//delay(tempo); // between symbols in a character
waitIrq();
delay(tempo); // between symbols in a character
}
}
periods = 200 << 24; //dds off 3 dots length spacing
//delay(tempo * 3); // between characters in a word
waitIrq();
waitIrq();
waitIrq();
delay(tempo * 3); // between characters in a word
}
c = *stringCw++; // Next caracter in string
}
periods = 200 << 24; //dds off
stopTimerIRQ();
periods = 200 << 24; //dds off
}
void Modulation::sendCarriage(bool state) {
if (state) {

View File

@ -3,10 +3,6 @@
<logicalFolder name="root" displayName="root" projectFiles="true" kind="ROOT">
<df root="." name="0">
<df name="lib">
<df name="Enigma">
<in>Enigma.cpp</in>
<in>Enigma.h</in>
</df>
<df name="Iambic">
<in>Iambic.cpp</in>
<in>Iambic.h</in>
@ -594,10 +590,6 @@
<preBuildCommand></preBuildCommand>
</preBuild>
</makefileType>
<item path="lib/Enigma/Enigma.cpp" ex="false" tool="1" flavor2="0">
</item>
<item path="lib/Enigma/Enigma.h" ex="false" tool="3" flavor2="0">
</item>
<item path="lib/Iambic/Iambic.cpp" ex="false" tool="1" flavor2="0">
</item>
<item path="lib/Iambic/Iambic.h" ex="false" tool="3" flavor2="0">

View File

@ -19,10 +19,6 @@
<in>Encodeur.h</in>
<in>quadrature.pio.h</in>
</df>
<df name="Enigma">
<in>Enigma.cpp</in>
<in>Enigma.h</in>
</df>
<df name="Iambic">
<in>Iambic.cpp</in>
<in>Iambic.h</in>

View File

@ -23,8 +23,6 @@
<file>file:/home/ale/NetBeansProjects/pico/wsprPico2/lib/Modulation/Modulation.cpp</file>
<file>file:/home/ale/NetBeansProjects/pico/wsprPico2/lib/Menu/Menu.h</file>
<file>file:/home/ale/NetBeansProjects/pico/wsprPico2/lib/Menu/Menu.cpp</file>
<file>file:/home/ale/NetBeansProjects/pico/wsprPico2/lib/Enigma/Enigma.cpp</file>
<file>file:/home/ale/NetBeansProjects/pico/wsprPico2/lib/Enigma/Enigma.h</file>
</group>
</open-files>
</project-private>

View File

@ -13,6 +13,9 @@ platform = https://github.com/maxgerhardt/platform-raspberrypi.git
board = rpipico2
framework = arduino
board_build.core = earlephilhower
build_flags =
;-I/home/xavier/.platformio/packages/framework-arduinopico/libraries/tusb-hid/src
-IC:\Users\Xavier.debert\.platformio\packages\framework-arduinopico\libraries\tusb-hid\src
lib_deps =
https://github.com/etherkit/JTEncode
@ -23,3 +26,7 @@ lib_deps =
adafruit/Adafruit NeoPixel@^1.15.1
https://github.com/adafruit/Adafruit-ST7735-Library
https://github.com/adafruit/Adafruit-gfx-library
https://github.com/adafruit/Adafruit_SSD1306.git
olikraus/U8g2
Keyboard

View File

@ -43,7 +43,6 @@ Afficheur *afficheur;
Iambic *iambic;
Locator loc;
void checkGps();
void computeLocator(int nbChar);
void initTimeTable(void);
@ -94,13 +93,6 @@ void setup(void) {
set_sys_clock_khz(CLK_KHZ, true);
Serial.begin(115200);
Wire.setSDA(4);
Wire.setSCL(5);
Wire.begin();
pinMode(PTT_PIN,OUTPUT);
digitalWrite(PTT_PIN,LOW);
pinMode(LED_TX_PIN,OUTPUT);
@ -110,9 +102,10 @@ void setup(void) {
afficheur->begin();
if (digitalRead(MENU_PIN) == 0) {
afficheur->modeDisplay("MENU");
afficheur->modeDisplay("MENU");
}
leMenu = new Menu(); // Menu de configuration
leMenu->setup();
@ -133,33 +126,35 @@ void setup(void) {
if (cfg.mode == IAMBIC) {
iambic = new Iambic(mod, afficheur, cfg.wpm, cfg.bicmd,cfg.enigma);
iambic = new Iambic(mod, afficheur, cfg.wpm, cfg.bicmd);
}
Wire.setClock(400000);
initTimeTable();
afficheur->clearDisplay();
//led no gps sync to lcd
afficheur->configDisplay(cfg);
afficheur->configDisplay(cfg); //c'est la que ca plante
//delay(10000);
enc.begin();
}
void loop() {
/*
char car;
enc.updateButton();
if (enc.wasPressed()) {
Serial.print(" | CLICK");
//if (enc.wasPressed()) {
//Serial.print(" | CLICK");
if (digitalRead(PUSH_PIN) == 0) { //peut etre une tramsission à faire si btn encodeur
if (!firstTxStart) {
//afficheur->clearDisplay();
//firstTxStart = true;
}
txing(cfg.mode);
}
//}
}
if (Serial.available() > 0) {
}
*/
if (cfg.mode == IAMBIC) {
//Serial.println("scan");
iambic->scan();
@ -172,6 +167,7 @@ void loop() {
} else {
checkGps();
}
//wspr();
}
@ -225,7 +221,7 @@ void checkGps() {
}
}
} else {
//Serial.println("Heure GPS non disponible.");
//Serial.println("Heure GPS non disponible.");
}
}
//returne un bool et change de couleur
@ -256,6 +252,12 @@ void txing(txModes md) {
break;
case CW: cw();
break;
case ALL: wspr();
rtty();
ft8();
hell();
cw();
break;
}
}
@ -323,7 +325,7 @@ void cw() {
sprintf(buffer, " %s %s BEACON %s \n\r", cfg.call,cfg.call, position.locator);
Serial.println(buffer);
afficheur->modeDisplay(" CW");
digitalWrite(PTT_PIN,HIGH);
digitalWrite(PTT_PIN,HIGH);
mod->sendCw(buffer,cfg.wpm);
digitalWrite(PTT_PIN,LOW);
afficheur->modeEfface();