1
0
mirror of https://github.com/kalymos/PsNee.git synced 2026-04-18 00:47:20 +00:00

serial debug cleaning

This commit is contained in:
kalymos
2025-09-08 21:22:27 +02:00
parent 2bb458c5e3
commit bc9e75b5b1
3 changed files with 22 additions and 20 deletions

View File

@@ -428,7 +428,7 @@
#define PIN_WFCK_OUTPUT DDRB |= (1 << DDB1) // |= updates the DDRB register with the OR operator and the mask, DDRB bxxxxxxxx OR mask b00000001 = bxxxxxxx1
// Define pull-ups and set high at the main pin
#define PIN_DATA_SET PORTB |= (1 << PB0) // Create a mask (1<<0) with the first bit at 1 b00000001, \
#define PIN_DATA_SET PORTB |= (1 << PB0) // Create a mask (1<<0) with the first bit at 1 b00000001,
// |= updates the PORTB register with the OR operator and the mask, PORTB bxxxxxxxx OR mask b00000001 = bxxxxxxx1
// Define pull-ups set down at the main pin

View File

@@ -6,9 +6,9 @@
// MCU // Arduino
//------------------------------------------------------------------------------------------------
//#define ATmega328_168 // Nano, Pro Mini, Uno
//#define ATmega32U4_16U4 // Micro, Pro Micro
//#define ATtiny85_45_25 // ATtiny
//#define ATmega328_168 // Nano, Pro Mini, Uno
//#define ATmega32U4_16U4 // Micro, Pro Micro
//#define ATtiny85_45_25 // ATtiny
//------------------------------------------------------------------------------------------------
// Console selection
@@ -341,6 +341,16 @@ void Init() {
SET_TIMER_TCCROB;
#endif
#if defined(ATmega328_168)
// Power saving
// Disable the ADC by setting the ADEN bit (bit 7) of the ADCSRA register to zero.
ADCSRA = ADCSRA & B01111111;
// Disable the analog comparator by setting the ACD bit (bit 7) of the ACSR register to one.
ACSR = B10000000;
// Disable digital input buffers on all analog input pins by setting bits 0-5 of the DIDR0 register to one.
DIDR0 = DIDR0 | B00111111;
#endif
#if defined(PATCH_SWITCH) && defined(BIOS_PATCH)
PIN_SWITCH_INPUT;
PIN_SWITCH_SET;
@@ -363,8 +373,6 @@ void Init() {
mySerial.begin(115200); // 13,82 bytes in 12ms, max for softwareserial. (expected data: ~13 bytes / 12ms) // update: this is actually quicker
#elif defined(PSNEE_DEBUG_SERIAL_MONITOR) && !defined(ATtiny85_45_25)
Serial.begin(500000); // 60 bytes in 12ms (expected data: ~26 bytes / 12ms) // update: this is actually quicker
// DEBUG_PRINT("MCU frequency: "); DEBUG_PRINT(F_CPU); DEBUG_PRINTLN(" Hz");
// DEBUG_PRINTLN("Waiting for SQCK..");
#endif
}
@@ -507,7 +515,7 @@ int main() {
else if (hysteresis > 0) {
hysteresis--;
}
Serial.println(hysteresis);
// hysteresis value "optimized" using very worn but working drive on ATmega328 @ 16Mhz
// should be fine on other MCUs and speeds, as the PSX dictates SUBQ rate
if (hysteresis >= HYSTERESIS_MAX) {

View File

@@ -136,19 +136,13 @@ const char region[3] = {'a', 'e', 'i'};
void Debug_Log (int Lows, int Wfck_mode){
#if defined(ATtiny85_45_25)
mySerial.print("m "); mySerial.println(Wfck_mode);
mySerial.print("m "); mySerial.println(Wfck_mode);
#elif !defined(ATtiny85_45_25)
//DEBUG_PRINT("highs: "); DEBUG_PRINT(highs);
Serial.print(" lows: "); Serial.println(Lows);
Serial.print(" wfck_mode: "); Serial.println(Wfck_mode);
Serial.print(" region: "); Serial.print(region[0]); Serial.print(region[1]); Serial.println(region[2]);
// Power saving
// Disable the ADC by setting the ADEN bit (bit 7) of the ADCSRA register to zero.
ADCSRA = ADCSRA & B01111111;
// Disable the analog comparator by setting the ACD bit (bit 7) of the ACSR register to one.
ACSR = B10000000;
// Disable digital input buffers on all analog input pins by setting bits 0-5 of the DIDR0 register to one.
DIDR0 = DIDR0 | B00111111;
Serial.print(" MCU frequency: "); Serial.print(F_CPU); Serial.println(" Hz");
//Serial.println("Waiting for SQCK..");
Serial.print(" lows: "); Serial.println(Lows);
Serial.print(" wfck_mode: "); Serial.println(Wfck_mode);
Serial.print(" region: "); Serial.print(region[0]); Serial.print(region[1]); Serial.println(region[2]);
#endif
}
@@ -173,7 +167,7 @@ void Debug_Scbuf (uint8_t *Scbuf){
Serial.print(Scbuf[i], HEX);
Serial.print(" ");
}
Serial.println("");
Serial.print("");
}
#endif
}