mirror of
https://github.com/sanni/cartreader.git
synced 2024-11-26 14:34:15 +01:00
Fix Clock Gen Calibration Menu
Function didn't display negative calibration factors correctly. Also added option to use the calibration factor without enabling the calibration menu to save some space.
This commit is contained in:
parent
0b42d5d1f2
commit
2e72842bb1
@ -4,7 +4,7 @@
|
||||
This project represents a community-driven effort to provide
|
||||
an easy to build and easy to modify cartridge dumper.
|
||||
|
||||
Date: 2023-09-22
|
||||
Date: 2023-10-17
|
||||
Version: 12.9
|
||||
|
||||
SD lib: https://github.com/greiman/SdFat
|
||||
@ -1774,7 +1774,7 @@ void RTCStart() {
|
||||
abort();
|
||||
}
|
||||
|
||||
// RTC_DS1307 does not have lostPower()
|
||||
// RTC_DS1307 does not have lostPower()
|
||||
#if defined(DS3231)
|
||||
// Set RTC Date/Time of Sketch Build if it lost battery power
|
||||
// After initial setup it would have lost battery power ;)
|
||||
@ -1831,11 +1831,10 @@ void clkcal() {
|
||||
// last number is the clock correction factor which is custom for each clock generator
|
||||
cal_factor = readClockOffset();
|
||||
|
||||
display.clearDisplay();
|
||||
display.setCursor(0, 0);
|
||||
display.print("Read correction: ");
|
||||
display.println(cal_factor);
|
||||
display.updateDisplay();
|
||||
display_Clear();
|
||||
print_Msg(F("Read correction: "));
|
||||
println_Msg(String(cal_factor));
|
||||
display_Update();
|
||||
delay(500);
|
||||
|
||||
if (cal_factor > INT32_MIN) {
|
||||
@ -1868,11 +1867,7 @@ void clkcal() {
|
||||
while (1) {
|
||||
if (old_cal != cal_factor) {
|
||||
display_Clear();
|
||||
println_Msg(F(""));
|
||||
println_Msg(F(""));
|
||||
println_Msg(F(""));
|
||||
println_Msg(F(""));
|
||||
println_Msg(F(" Adjusting"));
|
||||
println_Msg(F("Adjusting..."));
|
||||
display_Update();
|
||||
clockgen.set_correction(cal_factor, SI5351_PLL_INPUT_XO);
|
||||
clockgen.set_pll(SI5351_PLL_FIXED, SI5351_PLLA);
|
||||
@ -1893,21 +1888,23 @@ void clkcal() {
|
||||
float count = FreqCount.read();
|
||||
display_Clear();
|
||||
println_Msg(F("Clock Calibration"));
|
||||
println_Msg(F(""));
|
||||
print_Msg(F("Freq: "));
|
||||
print_Msg(count);
|
||||
println_Msg(F("Hz"));
|
||||
print_Msg(F("Correction:"));
|
||||
print_right(cal_factor);
|
||||
print_Msg(F("Adjustment:"));
|
||||
println_Msg(String(cal_factor));
|
||||
print_Msg(F("Step:"));
|
||||
print_right(cal_offset);
|
||||
println_Msg(F(""));
|
||||
#ifdef enable_Button2
|
||||
println_Msg(F("(Hold button to save)"));
|
||||
println_Msg(F(""));
|
||||
println_Msg(F("Decrease Increase"));
|
||||
#else
|
||||
#ifdef enable_rotary
|
||||
println_Msg(F("Rotate to adjust"));
|
||||
println_Msg(F("Rotate to adjust Frequency"));
|
||||
println_Msg(F("Press to change step width"));
|
||||
println_Msg(F("Hold to save"));
|
||||
#else
|
||||
println_Msg(F("Click/dbl to adjust"));
|
||||
#endif
|
||||
@ -1998,7 +1995,7 @@ void print_right(int32_t number) {
|
||||
void savetofile() {
|
||||
display_Clear();
|
||||
println_Msg(F("Saving..."));
|
||||
println_Msg(cal_factor);
|
||||
println_Msg(String(cal_factor));
|
||||
display_Update();
|
||||
delay(2000);
|
||||
|
||||
@ -2017,7 +2014,7 @@ void savetofile() {
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef clockgen_calibration
|
||||
#if defined(clockgen_calibration) || defined(use_clockgen_calibration)
|
||||
int32_t atoi32_signed(const char* input_string) {
|
||||
if (input_string == NULL) {
|
||||
return 0;
|
||||
@ -2093,7 +2090,7 @@ int32_t readClockOffset() {
|
||||
#endif
|
||||
|
||||
int32_t initializeClockOffset() {
|
||||
#ifdef clockgen_calibration
|
||||
#ifdef use_clockgen_calibration
|
||||
FsFile clock_file;
|
||||
const char zero_char_arr[] = { '0' };
|
||||
int32_t clock_offset = readClockOffset();
|
||||
@ -2164,7 +2161,7 @@ void setup() {
|
||||
pixels.setPixelColor(2, pixels.Color(0, 0, 100));
|
||||
pixels.show();
|
||||
|
||||
// Set TX0 LED Pin(PE1) to Output for status indication during flashing for HW4
|
||||
// Set TX0 LED Pin(PE1) to Output for status indication during flashing for HW4
|
||||
#if !(defined(enable_serial) || defined(HW5))
|
||||
DDRE |= (1 << 1);
|
||||
#endif
|
||||
|
@ -335,10 +335,11 @@
|
||||
/****/
|
||||
|
||||
/* [ SNES Core/CLOCKGEN: Read Clock Generator Calibration Data ---- ]
|
||||
Toggle to use calibration data from snes_clk.txt
|
||||
Toggle clock calibration menu and whether or not to use calibration data from snes_clk.txt
|
||||
*/
|
||||
|
||||
//#define clockgen_calibration
|
||||
//#define use_clockgen_calibration
|
||||
|
||||
/****/
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user