From e27c2f504e4bf13b521b0988c3ef01aa03e0873c Mon Sep 17 00:00:00 2001 From: Sjef Verhoeven PE5PVB Date: Mon, 23 Dec 2024 16:10:33 +0100 Subject: [PATCH] Optimising --- TEF6686_ESP32.ino | 5 +---- src/Tuner_Interface.cpp | 4 +++- src/Tuner_Interface.h | 4 ++++ src/comms.cpp | 2 ++ src/comms.h | 1 + 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/TEF6686_ESP32.ino b/TEF6686_ESP32.ino index c525421..b86552f 100644 --- a/TEF6686_ESP32.ino +++ b/TEF6686_ESP32.ino @@ -6,7 +6,6 @@ #include #include #include -#include // https://github.com/fbiego/ESP32Time/archive/refs/heads/main.zip #include // https://github.com/ohmytime/TFT_eSPI_DynamicSpeed/archive/refs/heads/master.zip (please then edit the User_Setup.h as described in the Wiki) #include // https://github.com/bbx10/Hash_tng/archive/refs/heads/master.zip #include "src/WiFiConnect.h" @@ -5212,9 +5211,7 @@ void TuneFreq(int temp) { } void NumpadProcess(int num) { - static bool input_mode = false; - - if (scandxmode) { + if (scandxmode) { if (num == 127) cancelDXScan(); } else { if (num == 127) { diff --git a/src/Tuner_Interface.cpp b/src/Tuner_Interface.cpp index 7649950..424ef75 100644 --- a/src/Tuner_Interface.cpp +++ b/src/Tuner_Interface.cpp @@ -3,6 +3,8 @@ #include "Tuner_Patch_Lithio_V205_p512.h" #include +bool Data_Accelerator = false; + const unsigned char tuner_init_tab[] PROGMEM = { 7, 0x20, 0x0B, 0x01, 0x03, 0x98, 0x00, 0x00, 5, 0x20, 0x14, 0x01, 0x00, 0x00, @@ -72,7 +74,7 @@ bool Tuner_WriteBuffer(unsigned char *buf, uint16_t len) { Wire.beginTransmission(0x64); for (uint16_t i = 0; i < len; i++) Wire.write(buf[i]); uint8_t r = Wire.endTransmission(); - delayMicroseconds(100); + if (!Data_Accelerator) delay(2); return (r == 0) ? 1 : 0; } diff --git a/src/Tuner_Interface.h b/src/Tuner_Interface.h index a58b54f..5ee5ca5 100644 --- a/src/Tuner_Interface.h +++ b/src/Tuner_Interface.h @@ -1,3 +1,6 @@ +#ifndef TUNER_INTERFACE_H +#define TUNER_INTERFACE_H + void Tuner_I2C_Init(); void Tuner_Patch(byte TEF); void Tuner_Init(const unsigned char *table); @@ -5,3 +8,4 @@ bool Tuner_WriteBuffer(unsigned char *buf, uint16_t len); bool Tuner_ReadBuffer(unsigned char *buf, uint16_t len); bool Tuner_Table_Write(const unsigned char *tab); void Tuner_Reset(void); +#endif \ No newline at end of file diff --git a/src/comms.cpp b/src/comms.cpp index e073d41..28045dc 100644 --- a/src/comms.cpp +++ b/src/comms.cpp @@ -675,6 +675,7 @@ void XDRGTKRoutine() { if (scandxmode) cancelDXScan(); if (!XDRScan) BWsetRecall = BWset; XDRScan = true; + Data_Accelerator = true; switch (buff[1]) { case 'a': scanner_start = (atol(buff + 2) + 5) / 10; break; @@ -763,6 +764,7 @@ void XDRGTKRoutine() { } break; } + Data_Accelerator = false; break; case 'W': diff --git a/src/comms.h b/src/comms.h index 750826f..159164b 100644 --- a/src/comms.h +++ b/src/comms.h @@ -15,6 +15,7 @@ extern bool afscreen; extern bool aftest; extern bool autosquelch; extern bool BWreset; +extern bool Data_Accelerator; extern bool direction; extern bool externaltune; extern bool fullsearchrds;