Skip to content
This repository has been archived by the owner on Oct 20, 2023. It is now read-only.

Commit

Permalink
added comments, cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
NoobishSVK committed Dec 30, 2022
1 parent afbfbf2 commit 08eedcd
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions TEF6686_ESP32-v115.ino
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,7 @@ char programServicePrevious[9];
char programTypePrevious[17];
char radioIdPrevious[4];
char radioTextPrevious[65];
float BatteryVoltage;
int BatteryPercentage;
int AGC;
int BatteryLevel;
int BWOld;
int ConverterSet;
int DeEmphasis;
Expand Down Expand Up @@ -185,6 +182,8 @@ int VolSet;
int volume;
int XDRBWset;
int XDRBWsetold;

// Theme Engine Colors
int PrimaryColor;
int SecondaryColor;
int FrameColor;
Expand All @@ -194,9 +193,12 @@ int BackgroundColor;
int ActiveColor;
int OptimizerColor;
int CurrentTheme;

// Scrolling RT settings
int xPos = 6;
int yPos = 2;
int charWidth = tft.textWidth("AA");

uint16_t BW;
uint16_t MStatus;
int16_t OStatus;
Expand Down Expand Up @@ -228,6 +230,7 @@ String VolString;
String XDRGTKShutdownString;
String WiFiSwitchString;

// Wi-Fi setup
const char* PARAM_INPUT_1 = "ssid";
const char* PARAM_INPUT_2 = "pass";
const char* PARAM_INPUT_3 = "ip";
Expand Down Expand Up @@ -266,10 +269,10 @@ unsigned long BWCLOCK = 0;
unsigned long RTCLOCK = 0;
unsigned long TPCLOCK = 0;

// Battery calculation
const int MAX_ANALOG_VAL = 4095;
const float MIN_BATTERY_VOLTAGE = 3.15;
const float MAX_BATTERY_VOLTAGE = 4.05;

int rawValue = analogRead(BATTERYPIN);
float voltageLevel = (rawValue / 4095.0) * 2 * 1.1 * 3.3 - 0.2; // calculate voltage level
float batteryFraction = (voltageLevel - MIN_BATTERY_VOLTAGE) / (MIN_BATTERY_VOLTAGE / MAX_BATTERY_VOLTAGE);
Expand All @@ -289,7 +292,6 @@ void initSPIFFS() {
if (!SPIFFS.begin(true)) {
Serial.println("An error has occurred while mounting SPIFFS");
}
Serial.println("SPIFFS mounted successfully");
}

// Read File from SPIFFS
Expand Down Expand Up @@ -423,7 +425,7 @@ void setup() {

rawValue = analogRead(BATTERYPIN);
if(voltageLevel < 1.5) {
voltageLevel = voltageLevel * 3.45;
voltageLevel = voltageLevel * 3.6;
}
delay(50);

Expand Down Expand Up @@ -670,13 +672,6 @@ void setup() {
}

void loop() {
/* BatteryLevel = analogRead(16); // GPIO13
BatteryPercentage = map(BatteryLevel, 0, 649, 0, 100); //665 full usb, 649 full battery
if (BatteryLevel >= 649) {
BatteryPercentage = 100;
}
*/
if (digitalRead(PWRBUTTON) == LOW && USBstatus == false) {
PWRButtonPress();
}
Expand Down

0 comments on commit 08eedcd

Please sign in to comment.