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

@ -11,6 +11,7 @@
Afficheur::Afficheur() Afficheur::Afficheur()
{ {
tft = new Adafruit_ST7789(TFT_CS, TFT_DC, TFT_RST); tft = new Adafruit_ST7789(TFT_CS, TFT_DC, TFT_RST);
} }
Afficheur::~Afficheur() { Afficheur::~Afficheur() {
@ -19,6 +20,18 @@ Afficheur::~Afficheur() {
void Afficheur::begin() { void Afficheur::begin() {
// Initialisation I2C avec adresse 0x3C // 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); pinMode(TFT_BL, OUTPUT);
digitalWrite(TFT_BL, HIGH); digitalWrite(TFT_BL, HIGH);
@ -28,8 +41,8 @@ void Afficheur::begin() {
tft->setRotation(1); tft->setRotation(1);
tft->setAddrWindow(34, 0, 172, 320); tft->setAddrWindow(34, 0, 172, 320);
tft->fillScreen(ST77XX_BLACK); tft->fillScreen(ST77XX_BLACK);
tft->setTextWrap(false); tft->setTextWrap(false);
oled.clearDisplay();
} }
const uint16_t Afficheur::lineColors[8] = { const uint16_t Afficheur::lineColors[8] = {
@ -56,6 +69,8 @@ void Afficheur::timeDisplay(char* txt) {
// Petit padding // Petit padding
tft->setCursor(46, 0); tft->setCursor(46, 0);
tft->print(txt); tft->print(txt);
oledPrint(txt,0,35,1);
} }
void Afficheur::modeDisplay(const char* txt) { void Afficheur::modeDisplay(const char* txt) {
@ -82,16 +97,28 @@ void Afficheur::modeDisplay(const char* txt) {
tft->setCursor(cx, cy); tft->setCursor(cx, cy);
tft->print(txt); 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() { void Afficheur::modeEfface() {
const int width = 172; const int width = 172;
// Zone centrale approximative (même logique que modeDisplay) // Zone centrale approximative (même logique que modeDisplay)
tft->fillRect(0, 120, width, 80, ST77XX_BLACK); tft->fillRect(0, 120, width, 80, ST77XX_BLACK);
} }
void Afficheur::clearDisplay() { void Afficheur::clearDisplay() {
tft->fillScreen(ST77XX_BLACK); tft->fillScreen(ST77XX_BLACK);
oled.fillRect(0, 0, 128, 64, SSD1306_BLACK);
} }
void Afficheur::configDisplay(config& cfg) { void Afficheur::configDisplay(config& cfg) {
@ -114,6 +141,8 @@ void Afficheur::configDisplay(config& cfg) {
tft->setCursor(x, y); tft->setCursor(x, y);
tft->print(line); tft->print(line);
y += lineHeight; y += lineHeight;
snprintf(line, sizeof(line), "f=%lu %ld %s", cfg.freq, cfg.offset,bandStr[cfg.band]);
oledPrint(line,0,0,1);
// Ligne 2 // Ligne 2
tft->setTextColor(lineColors[1], ST77XX_BLACK); tft->setTextColor(lineColors[1], ST77XX_BLACK);
@ -121,6 +150,7 @@ void Afficheur::configDisplay(config& cfg) {
tft->setCursor(x, y); tft->setCursor(x, y);
tft->print(line); tft->print(line);
y += lineHeight; y += lineHeight;
oledPrint(line,0,8,1);
// Ligne 3 // Ligne 3
tft->setTextColor(lineColors[2], ST77XX_BLACK); tft->setTextColor(lineColors[2], ST77XX_BLACK);
@ -128,22 +158,26 @@ void Afficheur::configDisplay(config& cfg) {
tft->setCursor(x, y); tft->setCursor(x, y);
tft->print(line); tft->print(line);
y += lineHeight; y += lineHeight;
snprintf(line, sizeof(line), "gps baud %lu wpm %u", cfg.baud,cfg.wpm);
oledPrint(line,0,16,1);
// Ligne 4 // Ligne 4
tft->setTextColor(lineColors[3], ST77XX_BLACK); 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->setCursor(x, y);
tft->print(line); tft->print(line);
y += lineHeight; y += lineHeight;
oledPrint(line,0,24,1);
// Ligne 5 // 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); tft->setTextColor(lineColors[4], ST77XX_BLACK);
snprintf(line, sizeof(line), "mode %s %s", modeStr[cfg.mode], cfg.call); snprintf(line, sizeof(line), "mode %s %s", modeStr[cfg.mode], cfg.call);
tft->setCursor(x, y); tft->setCursor(x, y);
tft->print(line); tft->print(line);
y += lineHeight; y += lineHeight;
// Ligne 6 // Ligne 6
tft->setTextColor(lineColors[5], ST77XX_BLACK); tft->setTextColor(lineColors[5], ST77XX_BLACK);
snprintf(line, sizeof(line), "wpm %u nmea %s", snprintf(line, sizeof(line), "wpm %u nmea %s",
@ -152,6 +186,10 @@ void Afficheur::configDisplay(config& cfg) {
tft->setCursor(x, y); tft->setCursor(x, y);
tft->print(line); tft->print(line);
y += lineHeight; 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 // Ligne 7
tft->setTextColor(lineColors[6], ST77XX_BLACK); tft->setTextColor(lineColors[6], ST77XX_BLACK);
@ -160,7 +198,9 @@ void Afficheur::configDisplay(config& cfg) {
cfg.follow ? "on" : "off"); cfg.follow ? "on" : "off");
tft->setCursor(x, y); tft->setCursor(x, y);
tft->print(line); tft->print(line);
snprintf(line, sizeof(line), "Iambic type %c",
cfg.bicmd);
oledPrint(line,0,56,1);
} }
void Afficheur::printCharCW(char car) { void Afficheur::printCharCW(char car) {
@ -235,4 +275,23 @@ void Afficheur::printFrequency(uint32_t freq) {
tft->setCursor(x, y); tft->setCursor(x, y);
tft->print(buf); 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 <Arduino.h>
#include <Adafruit_GFX.h> #include <Adafruit_GFX.h>
#include <Adafruit_ST7789.h> #include <Adafruit_ST7789.h>
#include <Adafruit_SSD1306.h>
#include <Wire.h>
//#include <U8g2lib.h>
#include <SPI.h> #include <SPI.h>
#include "Menu.h" #include "Menu.h"
@ -39,6 +42,8 @@
#define MAX_COLS 13 #define MAX_COLS 13
#define MAX_LINES 5 #define MAX_LINES 5
#define SCREENOLED_WIDTH 128
#define SCREENOLED_HEIGHT 64
class Afficheur { class Afficheur {
public: public:
@ -53,12 +58,17 @@ public:
void clearDisplay(); void clearDisplay();
void printCharCW(char car); void printCharCW(char car);
void printFrequency(uint32_t freq); void printFrequency(uint32_t freq);
void oledPrint(String txt, int x , int y , int Size);
private: private:
//Adafruit_SSD1306 display; Adafruit_SSD1306 oled = Adafruit_SSD1306(
//U8G2_SSD1306_128X64_NONAME_F_HW_I2C display; //gfx SCREENOLED_WIDTH,
Adafruit_ST7789 *tft; SCREENOLED_HEIGHT,
&Wire,
-1
);
//U8G2_SSD1306_128X64_NONAME_F_HW_I2C display; //gfx
Adafruit_ST7789 *tft;
int cursorX = 0; int cursorX = 0;
int cursorY = 0; int cursorY = 0;

View File

@ -4,16 +4,11 @@
// Constructeur // 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) { : mod(m), afficheur(a) {
Keyboard.begin(); Keyboard.begin();
enigmaEn=_enigma;
wpmSpeed=wpm;
enigma.init();
pinMode(LED_PIN, OUTPUT); pinMode(LED_PIN, OUTPUT);
pinMode(PIEZO_SPKR_PIN, OUTPUT); pinMode(PIEZO_SPKR_PIN, OUTPUT);
pinMode(TX_SWITCH_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_dit_paddle = LEFT_PADDLE_PIN; // Dits on right hand thumb
g_dah_paddle = RIGHT_PADDLE_PIN; // Dahs on right hand index finger 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 //vband
// Etat des touches // Etat des touches
@ -59,15 +54,6 @@ Iambic::~Iambic() {
void Iambic::scan() { void Iambic::scan() {
static long ktimer; 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. // This state machine translates paddle input into DITS and DAHs and keys the transmitter.
switch (g_keyerState) { switch (g_keyerState) {
@ -150,10 +136,7 @@ void Iambic::scan() {
} else { // Check for intercharacter space } else { // Check for intercharacter space
if (millis() > ktimer) { // We have a character if (millis() > ktimer) { // We have a character
//Serial.println(g_current_morse_character); //Serial.println(g_current_morse_character);
char car; afficheur->printCharCW(morse_char_decode(g_current_morse_character));
car=morse_char_decode(g_current_morse_character);
afficheur->printCharCW(car);
enigma.encode(car);
//Serial.print(morse_char_decode(g_current_morse_character)); //Serial.print(morse_char_decode(g_current_morse_character));
g_keyerState = IDLE; // go idle g_keyerState = IDLE; // go idle
} }
@ -182,13 +165,12 @@ void Iambic::update_PaddleLatch() {
// Key the Transmitter // Key the Transmitter
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
void Iambic::tx_key_down() { void Iambic::tx_key_down() {
if (!enigmaEn) {
digitalWrite(LED_PIN, HIGH); // turn the LED on digitalWrite(LED_PIN, HIGH); // turn the LED on
digitalWrite(TX_SWITCH_PIN, HIGH); // Turn the transmitter on digitalWrite(TX_SWITCH_PIN, HIGH); // Turn the transmitter on
mod->sendCarriage(true); mod->sendCarriage(true);
}
if (!g_sidetone_muted) { 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 // Un-key the transmitter
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
void Iambic::tx_key_up() { void Iambic::tx_key_up() {
if (!enigmaEn) {
digitalWrite(LED_PIN, LOW); // turn the LED off digitalWrite(LED_PIN, LOW); // turn the LED off
digitalWrite(TX_SWITCH_PIN, LOW); // Turn the transmitter off
mod->sendCarriage(false); digitalWrite(TX_SWITCH_PIN, LOW); // Turn the transmitter off
} mod->sendCarriage(false);
if (!g_sidetone_muted) { if (!g_sidetone_muted) {
noTone(PIEZO_SPKR_PIN); noTone(PIEZO_SPKR_PIN);
} }
} }

View File

@ -17,7 +17,6 @@
#include <Modulation.h> #include <Modulation.h>
#include "Afficheur.h" #include "Afficheur.h"
#include <Keyboard.h> #include <Keyboard.h>
#include "Enigma.h"
#define VBAND_LEFT '[' #define VBAND_LEFT '['
@ -25,7 +24,7 @@
// Keyer define // 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 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. #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_B 0x10 // 0x00 for Iambic A, 0x10 for Iambic B (Binary 0001 0000)
#define IAMBIC_A 0 #define IAMBIC_A 0
#define PUSH_PIN 27
// Keyer State machine type - states for sending of Morse elements based on paddle input // Keyer State machine type - states for sending of Morse elements based on paddle input
enum KSTYPE { enum KSTYPE {
IDLE, IDLE,
@ -70,7 +67,6 @@ class Iambic {
private: private:
Modulation* mod; Modulation* mod;
Afficheur* afficheur; Afficheur* afficheur;
Enigma enigma;
uint32_t g_ditTime; // Number of milliseconds per dit 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 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 left_time;
unsigned long right_time; unsigned long right_time;
bool enigmaEn;
int wpmSpeed;
char morse_char_decode(uint8_t code); char morse_char_decode(uint8_t code);
void update_PaddleLatch(); void update_PaddleLatch();
@ -106,7 +101,7 @@ private:
public: public:
// Constructeur // Constructeur
Iambic(Modulation* m, Afficheur* a,int wpm,char _mode,bool _enigma); Iambic(Modulation* m, Afficheur* a,int wpm,char _mode);
// Destructeur // Destructeur
~Iambic(); ~Iambic();

View File

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

View File

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

View File

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

View File

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

View File

@ -19,10 +19,6 @@
<in>Encodeur.h</in> <in>Encodeur.h</in>
<in>quadrature.pio.h</in> <in>quadrature.pio.h</in>
</df> </df>
<df name="Enigma">
<in>Enigma.cpp</in>
<in>Enigma.h</in>
</df>
<df name="Iambic"> <df name="Iambic">
<in>Iambic.cpp</in> <in>Iambic.cpp</in>
<in>Iambic.h</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/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.h</file>
<file>file:/home/ale/NetBeansProjects/pico/wsprPico2/lib/Menu/Menu.cpp</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> </group>
</open-files> </open-files>
</project-private> </project-private>

View File

@ -13,6 +13,9 @@ platform = https://github.com/maxgerhardt/platform-raspberrypi.git
board = rpipico2 board = rpipico2
framework = arduino framework = arduino
board_build.core = earlephilhower 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 = lib_deps =
https://github.com/etherkit/JTEncode https://github.com/etherkit/JTEncode
@ -23,3 +26,7 @@ lib_deps =
adafruit/Adafruit NeoPixel@^1.15.1 adafruit/Adafruit NeoPixel@^1.15.1
https://github.com/adafruit/Adafruit-ST7735-Library https://github.com/adafruit/Adafruit-ST7735-Library
https://github.com/adafruit/Adafruit-gfx-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; Iambic *iambic;
Locator loc; Locator loc;
void checkGps(); void checkGps();
void computeLocator(int nbChar); void computeLocator(int nbChar);
void initTimeTable(void); void initTimeTable(void);
@ -94,13 +93,6 @@ void setup(void) {
set_sys_clock_khz(CLK_KHZ, true); set_sys_clock_khz(CLK_KHZ, true);
Serial.begin(115200); Serial.begin(115200);
Wire.setSDA(4);
Wire.setSCL(5);
Wire.begin();
pinMode(PTT_PIN,OUTPUT); pinMode(PTT_PIN,OUTPUT);
digitalWrite(PTT_PIN,LOW); digitalWrite(PTT_PIN,LOW);
pinMode(LED_TX_PIN,OUTPUT); pinMode(LED_TX_PIN,OUTPUT);
@ -110,9 +102,10 @@ void setup(void) {
afficheur->begin(); afficheur->begin();
if (digitalRead(MENU_PIN) == 0) { if (digitalRead(MENU_PIN) == 0) {
afficheur->modeDisplay("MENU"); afficheur->modeDisplay("MENU");
} }
leMenu = new Menu(); // Menu de configuration leMenu = new Menu(); // Menu de configuration
leMenu->setup(); leMenu->setup();
@ -133,13 +126,15 @@ void setup(void) {
if (cfg.mode == IAMBIC) { 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); Wire.setClock(400000);
initTimeTable(); initTimeTable();
afficheur->clearDisplay();
//led no gps sync to lcd //led no gps sync to lcd
afficheur->configDisplay(cfg); afficheur->configDisplay(cfg); //c'est la que ca plante
//delay(10000); //delay(10000);
enc.begin(); enc.begin();
@ -147,18 +142,18 @@ void setup(void) {
} }
void loop() { 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) { if (cfg.mode == IAMBIC) {
//Serial.println("scan"); //Serial.println("scan");
@ -172,6 +167,7 @@ void loop() {
} else { } else {
checkGps(); checkGps();
} }
//wspr();
} }
@ -256,6 +252,12 @@ void txing(txModes md) {
break; break;
case CW: cw(); case CW: cw();
break; 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); sprintf(buffer, " %s %s BEACON %s \n\r", cfg.call,cfg.call, position.locator);
Serial.println(buffer); Serial.println(buffer);
afficheur->modeDisplay(" CW"); afficheur->modeDisplay(" CW");
digitalWrite(PTT_PIN,HIGH); digitalWrite(PTT_PIN,HIGH);
mod->sendCw(buffer,cfg.wpm); mod->sendCw(buffer,cfg.wpm);
digitalWrite(PTT_PIN,LOW); digitalWrite(PTT_PIN,LOW);
afficheur->modeEfface(); afficheur->modeEfface();