Chri O. Posted November 19, 2023 Share Posted November 19, 2023 (edited) Extra info: Goonies ATR size 720sectors * 128 18s. per track, Track25 (sector 452) starts to load Goonies main screen and ends on Track27 (sector 492). Edited November 19, 2023 by Chri O. Quote Link to comment Share on other sites More sharing options...
Chri O. Posted November 22, 2023 Share Posted November 22, 2023 VER 06 New for v06 / 1050 Tandon Drive Goonies fix Additional fixes for 1050 Tandon Drive (about 90% ok see line 713) Quote /********************************************************************* MIT License Copyright (c) [2023] [Chris O.] Atari 1050 - Track Display, ver 06. For 1050 Tandon Drive/World Drive. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *********************************************************************/ const byte VER = 06; // Note: // New for v05 // Custom font DSEG7_Classic_Mini_Bold_32 // Screen Saver In OLED_CONTRAST(): (avoid screen burn) // Drive firmware select: 1050 Tandon Drive <-> 1050 World Drive // SetLib Adafruit_SSD1306 <-> Adafruit_SH1106 // Display Drive ID# ,Detecting the Drive ID by wiring into the drive select switch. // I love flashing LEDs ): 1st debug LED on UNO-NANO pin D13 - 2nd debug LED on pin D12 (USE 360ohm resistor) // // New for v06 / 1050 Tandon Drive Goonies fix // Additional fixes for 1050 Tandon Drive (about 90% ok see line 713) // // -------------------------------------------------------------------------------------------------------------- // -- Adjust as needed here ------------------------------------------------------------------------------------- // -#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# // // ---------------------------------------- #define DEBUG 0 // Serial(115200) SET TO 0 REMOVE DEBUG, 1 DEBUG ON // ---------------------------------------- // // ---------------------------------------- #define DRIVE_FIRMWARE 1 // Drive firmware select: 1 true = 1050 Tandon Drive <-> 0 false = 1050 World Drive // ---------------------------------------- // // ---------------------------------------- #define SetLib 0 // ---> 1 Adafruit_SSD1306, ---> 0 Adafruit_SH1106. // ---------------------------------------- // // ---------------------------------------- #define SCREEN_WIDTH 128 // OLED display width, in pixels #define SCREEN_HEIGHT 64 // OLED display height, in pixels, NOTE: adjust setTextSize(2) to 0 or 1 for OLED 128X32 #define OLED_RESET -1 // Reset pin # (or -1 if sharing Arduino reset pin) #define SCREEN_ADDRESS 0x3C //<- Use i2c_scanner sketch scans the I2C-bus for devices. // ----------------------------- https://playground.arduino.cc/Main/I2cScanner/ // Or see datasheet for Address; 0x3D for 128x64, 0x3C for 128x32, // 1.31" 128x64 SH1106 addr 0x3C. // 0.96" 128x64 SH1106 addr 0x3C // ---------------------------------------- // // ---------------------------------------- #define SHOW_ID 1 // Display Drive ID#, 0 = NO <-> 1 YES // Detecting the Drive ID by wiring into the drive select switch. Arduino pin D7(BK SW) & D8(WT SW) // Note: Use 47k resistors between Drive Select switch and Arduino!!! // Note: Drive ID will show as ID:3 if not properly connected!!! // ---------------------------------------- // // ---------------------------------------- // OLED Auto-dimming unsigned long interval = 10000; // 10sec // 0x7F MAX 127 see datasheet https://cdn-shop.adafruit.com/datasheets/SSD1306.pdf const byte ContrastValueMAX = 0xFA; // MAX 250 On 0.96 inch OLED. // -#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# #pragma message("Tandon Drive or World Drive ARDUINO UNO-NANO only, ATmega328 AVR Pin Change Interrupt in use") unsigned long preMillis = 0; byte ContrastValue = ContrastValueMAX; volatile byte curContrastValue = ContrastValueMAX; // Screen Saver (avoid OLED screen burn) byte AutoDimCounter = 0; // Move things on screen around based on AutoDimCounter // I love flashing LEDs ): #define Debug_LED1 LED_BUILTIN // 1st debug LED on UNO-NANO pin D13 #define Debug_LED2 12 // 2nd debug LED on pin D12 // NOTE: It is a good idea to connect OUTPUT-INPUT pins to other devices with // 470ohm to 1k resistors for Short circuit current-limiting. // I USE 1K // ARDUINO UNO-NANO const byte interruptPin_NS01 = 4; // NS01 @ U2 ic pin 2, NOT USED FOR interrupt. const byte interruptPin_NS02 = 2; // NS02 @ U2 ic pin 7 Hardware interrupt. const byte interruptPin_NS03 = 5; // NS03 @ U3 ic pin 2 For PCINT interrupt. PCINT21 -- ATmega328 const byte interruptPin_NS04 = 3; // NS04 @ U3 ic pin 7 Hardware interrupt. const byte N_TRACK00_Pin = 6; // Look for Q5 and C47,C50 on 1050 motherboard // connect closer to the C47,C50 side @ R#59 Track 00 sensor. // // MCU GND to 1050 TP15 GND (test point 15). // TP13 (test point 13) or TP14 (test point 14). for +5v or +12v. (double check ok!!!) // TODO use 12v and diode Cathode(-) to vin on ARDUINO NANO !!! // #if SHOW_ID // Detecting the Drive ID by wiring into the drive select switch. byte D_ID = '?'; // Current Drive ID#, see setup() // Note: use 47k resistors between Drive Select switch and Arduino!!! byte D_IDsw1_Pin7 = 7; // BLACK SW pin 7 byte D_IDsw2_Pin8 = 8; // WHITE SW pin 8 #endif #if DRIVE_FIRMWARE // 1 = 1050 Tandon Drive // ATmega328, PCINT bool D4_state = false; // only for 1050 Tandon Drive bool D5_state = false; #endif volatile byte Tcount = 0; volatile unsigned long timeNS01 = 0; // PCINT pin change interrupt volatile unsigned long timeNS02 = 0; volatile unsigned long timeNS03 = 0; // PCINT pin change interrupt volatile unsigned long timeNS04 = 0; byte NewTcount = Tcount; byte OldTcount = Tcount; // https://github.com/wonho-maker/Adafruit_SH1106 /********************************************************************* Change the adafruit SSD1306 to SH1106 SH1106 driver don't provide several functions such as scroll commands. *********************************************************************/ // Teensy SH1106 driver fix https://forum.pjrc.com/threads/68174-OLED-problems #include <SPI.h> #include <Wire.h> #include <Adafruit_GFX.h> #if SetLib // SSD1306 driver #include <Adafruit_SSD1306.h> // 0.91 Inch I2C OLED Display. Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET); #else // SH1106 driver #include <Adafruit_SH1106.h> // OLED 1.30" @ I2C addr. 0x3C or 0.96" OLED Module I2C Adafruit_SH1106 display(OLED_RESET); #endif // How to Create and use custom fonts for Adafruit_GFX libraries // https://www.youtube.com/watch?app=desktop&v=L8MmTISmwZ8 // // OLED Font Converter https://oleddisplay.squix.ch/ // //#include <Fonts/FreeMono24pt7b.h> //#include <Fonts/FreeMonoBold24pt7b.h> //#include <Fonts/DSEG7_Modern_Regular_50.h> //#include <Fonts/DSEG14_Modern_Bold_Italic_54.h> //#include <Fonts/DSEG7_Classic_Mini_Bold_Italic_60.h> //#include <Fonts/DSEG7_Classic_Mini_Bold_Italic_55.h> //#include <Fonts/DSEG7_Classic_Mini_Bold_Italic_28.h> // 28Bitmaps //#include <Fonts/DSEG7_Classic_Mini_Bold_Italic_24.h> // 24Bitmaps //#include <Fonts/DSEG7_Classic_Mini_Bold_24.h> // 24Bitmaps //#include <Fonts/DSEG7_Classic_Mini_Bold_28.h> // 28Bitmaps #include <Fonts/DSEG7_Classic_Mini_Bold_32.h> // 32Bitmaps /* // save ram #define LOGO16_GLCD_HEIGHT 16 #define LOGO16_GLCD_WIDTH 16 static const unsigned char PROGMEM logo16_glcd_bmp[] = { B00000000, B11000000, B00000001, B11000000, B00000001, B11000000, B00000011, B11100000, B11110011, B11100000, B11111110, B11111000, B01111110, B11111111, B00110011, B10011111, B00011111, B11111100, B00001101, B01110000, B00011011, B10100000, B00111111, B11100000, B00111111, B11110000, B01111100, B11110000, B01110000, B01110000, B00000000, B00110000 }; */ // ---setup()----------------------------------------------------------------------------------------------------------------------- void setup() { // put your setup code here, to run once: Serial.begin(115200); while (!Serial && millis() < 350 ); // ---------------------------------------- #if DRIVE_FIRMWARE // 1 = 1050 Tandon Drive // ---------------------------------------- Serial.print(F("Basic ARDUINO 1050 Tandon Drive Test: v.0")); // ---------------------------------------- #else // 0 = 1050 World Drive // ---------------------------------------- Serial.print(F("Basic ARDUINO 1050 World Drive Test: v.0")); // ---------------------------------------- #endif // END - Drive firmware select // ---------------------------------------- Serial.println(VER); // ---------------------------------------- // Detecting the Drive ID by wiring into the drive select switch. pin D7 & D8 // Note: Use 20k to 47k resistors between Drive Select switch and Arduino!!! #if SHOW_ID pinMode(D_IDsw1_Pin7, INPUT); // BLACK SW pin 7 pinMode(D_IDsw2_Pin8, INPUT); // WHITE SW pin 8 uint8_t SW = 0; if (digitalRead(D_IDsw1_Pin7) == HIGH) { //BLACK OPEN pin 7 (RIOT 6532 ic pull-up +5v) Serial.print(F("BLACK OPEN HIGH SW ")), Serial.println(SW, BIN); } else { bitSet(SW, 0); // 1st bit Serial.print(F("BLACK CLOSED LOW SW ")), Serial.println(SW, BIN); } if (digitalRead(D_IDsw2_Pin8) == HIGH) { //WHITE OPEN pin 8 (RIOT 6532 ic pull-up +5v) Serial.print(F("WHITE OPEN HIGH SW ")), Serial.println(SW, BIN); } else { bitSet(SW, 1); // 2nd bit Serial.print(F("WHITE CLOSED LOW SW ")), Serial.println(SW, BIN); } switch (SW) { case 0: // 1st bit D_ID = 1; // 0 bit 0000 < BLACK OPEN HIGH & < WHITE OPEN HIGH break; case 1: D_ID = 2; // 1 bit 0001 > BLACK CLOSED LOW & < WHITE OPEN HIGH break; case 2: // 2nd bit D_ID = 4; // 2 bit 0010 < BLACK OPEN HIGH & > WHITE CLOSED LOW break; case 3: D_ID = 3; // 3 bit 0011 > BLACK CLOSED LOW & > WHITE CLOSED LOW break; default: D_ID = '?'; // break; } Serial.print(F("Drive ID")), Serial.println(D_ID); #endif // ---------------------------------------- // ---------------------------------------- #if SetLib // SSD1306 driver // ---------------------------------------- if (!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) { Serial.println(F("SSD1306 allocation failed")); for (;;); // Don't proceed, loop forever } display.ssd1306_command(0X81); // SETCONTRAST display.ssd1306_command(ContrastValueMAX); // Show image buffer on the display hardware. // Since the buffer is intialized with an Adafruit splashscreen // internally, this will display the splashscreen. display.display(); delay(1000); // Clear the buffer. display.clearDisplay(); // Show the display buffer on the hardware. // NOTE: You _must_ call display after making any drawing commands // to make them visible on the display hardware! display.display(); if (SCREEN_HEIGHT < 64) { display.setTextSize(1); // TODO test 0 or 1 ? } else { display.setTextSize(2); } // display.setTextColor(WHITE); display.setTextColor(BLACK, WHITE); // 'inverted' text display.setCursor(0, 5); display.println(F("Atari 1050")); // display.setTextSize(1); display.setTextColor(WHITE); display.setCursor(8, 25); display.println(F("Track Display Test")); // if (SCREEN_HEIGHT < 64) { display.setTextSize(1); // test 0 or 1 ? } else { display.setTextSize(2); } display.setCursor(10, 40); display.print("V.0"); display.println(VER); display.display(); delay(2000); // display setup for loop() display.clearDisplay(); display.setTextSize(9); // for 0.96" OLED 128X64 no custom font display.setCursor(10, 4); if (NewTcount < 10) { display.print("0"); } display.print(NewTcount); #if SHOW_ID ID(0, 50); // x, y 1050 Drive_ID #endif display.display(); // ---------------------------------------- #else // SH1106 driver // ---------------------------------------- display.begin(SH1106_SWITCHCAPVCC, SCREEN_ADDRESS); // initialize I2C addr 0x3D (for the 128x64), SH1106 addr 0x3C. display.SH1106_command(0X81); // SETCONTRAST display.SH1106_command(ContrastValueMAX); // Show image buffer on the display hardware. // Since the buffer is intialized with an Adafruit splashscreen // internally, this will display the splashscreen. display.display(); delay(1000); // Clear the buffer. display.clearDisplay(); display.display(); if (SCREEN_HEIGHT < 64) { display.setTextSize(1); // test 0 or 1 ? } else { display.setTextSize(2); } // display.setTextColor(WHITE); display.setTextColor(BLACK, WHITE); // 'inverted' text display.setCursor(0, 5); display.println(F("Atari 1050")); // display.setTextSize(1); display.setTextColor(WHITE); display.setCursor(8, 25); display.println(F("Track Display Test")); // if (SCREEN_HEIGHT < 64) { display.setTextSize(1); // test 0 or 1 ? } else { display.setTextSize(2); } display.setCursor(10, 40); display.print("V.0"); display.println(VER); display.display(); delay(2000); // display setup for loop() display.clearDisplay(); //display.setTextSize(9); // for 0.96" OLED 128X64 no custom font //display.setCursor(10, 4); if (SCREEN_HEIGHT < 64) { // OLED 128X32 ? display.setTextSize(1); // TODO test 0 or 1 ? } else { display.setTextSize(2);// for 0.96" OLED 128X64, 32Bitmaps custom font } display.setCursor(10, 58); // bug 58 ? why not 64 ? // display.setFont(&DSEG7_Modern_Regular_50); // DSEG7_Modern_Regular_50 // display.setFont(&DSEG7_Classic_Mini_Bold_Italic_60); // DSEG7_Classic_Mini_Bold_Italic_60 // display.setFont(&DSEG7_Classic_Mini_Bold_Italic_55); // DSEG7_Classic_Mini_Bold_Italic_55 // display.setFont(&DSEG7_Classic_Mini_Bold_Italic_28); // DSEG7_Classic_Mini_Bold_Italic_28 // display.setFont(&DSEG7_Classic_Mini_Bold_24); // 24Bitmaps // display.setFont(&DSEG7_Classic_Mini_Bold_28); // 28Bitmaps display.setFont(&DSEG7_Classic_Mini_Bold_32); // 32Bitmaps if (NewTcount < 10) { display.print("0"); } display.print(NewTcount); #if SHOW_ID ID(0, 50); // x, y 1050 Drive_ID #endif display.display(); // ---------------------------------------- #endif // END - SetLib // ---------------------------------------- pinMode(Debug_LED1, OUTPUT); // 1st debug Led on UNO pin 13 (LED_BUILTIN) pinMode(Debug_LED2, OUTPUT); // 2nd debug Led on pin 12 pinMode(N_TRACK00_Pin, INPUT); pinMode(interruptPin_NS01, INPUT); pinMode(interruptPin_NS02, INPUT); pinMode(interruptPin_NS03, INPUT); pinMode(interruptPin_NS04, INPUT); // For ATmega328 AVR ONLY, PCINT Pin Change Interrupt PCICR |= B00000100; //Bit2 = 1 -> "PCIE2" enabeled (PCINT16 to PCINT23) // ---------------------------------------- #if DRIVE_FIRMWARE // 1 true = 1050 Tandon Drive // ---------------------------------------- // edge-triggered interrupt on FALLING edge (high to low). attachInterrupt(digitalPinToInterrupt(interruptPin_NS02), IRQ_NS02, FALLING); // FALLING // edge-triggered interrupt on RISING edge (low to high). attachInterrupt(digitalPinToInterrupt(interruptPin_NS04), IRQ_NS04, RISING); // RISING PCMSK2 |= B00110000; //Bit5 = 1 -> "PCINT21" enabeled, Bit4 = 1 -> "PCINT20" enabeled // ---------------------------------------- #else // 0 false = 1050 World Drive // ---------------------------------------- // triggered interrupt on CHANGE. attachInterrupt(digitalPinToInterrupt(interruptPin_NS02), IRQ_NS02, CHANGE); // CHANGE // triggered interrupt on CHANGE. attachInterrupt(digitalPinToInterrupt(interruptPin_NS04), IRQ_NS04, CHANGE); // CHANGE PCMSK2 |= B00110000; //Bit5 = 1 -> "PCINT21" enabeled, Bit4 = 1 -> "PCINT20" enabeled // ---------------------------------------- #endif // END - Drive firmware select // ---------------------------------------- } // ----loop()----------------------------------------------------------------------------------------------------------------------- void loop() { // put your main code here, to run repeatedly: noInterrupts(); NewTcount = Tcount; interrupts(); OLED_CONTRAST(); // Oled Auto-dimming // ---------------------------------------- #if DRIVE_FIRMWARE // 1 true = 1050 Tandon Drive // ---------------------------------------- // Moved to PCINT2_vect for 1050 Tandon Drive // ---------------------------------------- #else // 0 false = 1050 World Drive // ---------------------------------------- if (digitalRead(N_TRACK00_Pin) == HIGH) { // if Track 0 sensor @5volts then set TRACK count to 0 NewTcount = 0; noInterrupts(); Tcount = 0; interrupts(); } // ---------------------------------------- #endif // END - Drive firmware select // ---------------------------------------- if (OldTcount != NewTcount) { if (NewTcount > 250) { Serial.println(F("BUG1")); #if DRIVE_FIRMWARE // 1 = 1050 Tandon Drive Tcount = 0;//Tcount = 0; // TODO TEST #else // 0 = 1050 World Drive Tcount = 1; #endif NewTcount = 0; // } if (NewTcount > 39) { Serial.println(F("BUG2")); Tcount = 39;; NewTcount = 39; // reset 1050 has no more then 40t } OldTcount = NewTcount; display.clearDisplay(); #if SHOW_ID ID(0, 50); // 1050 Drive_ID #endif display.setFont(&DSEG7_Classic_Mini_Bold_32); // 32Bitmaps display.setTextSize(2); // for 0.96" OLED 128X64, 32Bitmaps custom font //display.setCursor(10, 4); display.setCursor(10, 64); // for Fonts if (NewTcount < 10) { display.print("0"); //Serial.print("0"); } display.print(NewTcount); display.display(); Serial.print(F(" TK:")); Serial.println(NewTcount); unsigned long curMillis = millis(); preMillis = curMillis; //for OLED Auto-dimming AutoDimCounter = 0; } } #if SHOW_ID // ------ 1050 Drive_ID -------------------------------------------------------------------------------------------------------- void ID(byte x, byte y) { display.setFont(); // display.setTextSize(2); // 2 for 0.96" OLED 128X64, 32Bitmaps custom font. SET 0 OR 1 FOR OLED 128X32 display.setCursor(x, y); // x y 0, 54 display.print(D_ID); //Drive_ID display.setFont(&DSEG7_Classic_Mini_Bold_32); // 32Bitmaps display.setTextSize(2); // for 0.96" OLED 128X64, 32Bitmaps custom font } #endif // ------ OLED Auto-dimming ---------------------------------------------------------------------------------------------------- void OLED_CONTRAST() { unsigned long curMillis = millis(); if (curMillis - preMillis >= interval) { preMillis = curMillis; ContrastValue = 0; // MIN contrast. curContrastValue = 0; #if SetLib // SSD1306 driver display.ssd1306_command(0X81); // SETCONTRAST display.ssd1306_command(ContrastValue); #else // // SH1106 driver display.SH1106_command(0X81); display.SH1106_command(ContrastValue); #endif Serial.print(" OLED Auto-dimming "); // -------- OLED Screen Saver (avoid screen burn) Serial.println(AutoDimCounter); display.clearDisplay(); // Move things on screen around based on AutoDimCounter AutoDimCounter = AutoDimCounter + 1; // start 1 if (AutoDimCounter > 5) { AutoDimCounter = 0; } switch (AutoDimCounter) { case 0: display.setCursor(5, 64); // for Fonts if (NewTcount < 10) { display.print("0"); } display.print(NewTcount); #if SHOW_ID ID(110, 50); // 1050 Drive_ID #endif break; case 1: // start from 1 display.setCursor(10, 64); // for Fonts if (NewTcount < 10) { display.print("0"); } display.print(NewTcount); #if SHOW_ID ID(0, 50); // 1050 Drive_ID #endif break; case 2: display.setCursor(15, 64); // for Fonts if (NewTcount < 10) { display.print("0"); } display.print(NewTcount); #if SHOW_ID ID(0, 0); // 1050 Drive_ID #endif break; case 3: display.setCursor(10, 64); // for Fonts if (NewTcount < 10) { display.print("0"); } display.print(NewTcount); #if SHOW_ID ID(0, 50); // 1050 Drive_ID #endif break; case 4: display.setCursor(5, 64); // for Fonts if (NewTcount < 10) { display.print("0"); } display.print(NewTcount); #if SHOW_ID ID(110, 50); // 1050 Drive_ID #endif break; case 5: display.setCursor(0, 64); // for Fonts if (NewTcount < 10) { display.print("0"); } display.print(NewTcount); #if SHOW_ID ID(110, 0); // 1050 Drive_ID #endif break; default: display.setCursor(10, 64); // for Fonts if (NewTcount < 10) { display.print("0"); } display.print(NewTcount); #if SHOW_ID ID(0, 50); // 1050 Drive_ID #endif } display.display(); // -------- Screen Saver ----------------------- } if (ContrastValue != curContrastValue) { ContrastValue = curContrastValue; #if SetLib // SSD1306 driver display.ssd1306_command(0X81); // SETCONTRAST display.ssd1306_command(curContrastValue); #else // SH1106 driver display.SH1106_command(0X81); display.SH1106_command(curContrastValue); #endif } } // ------------------------------------------------------------------------------------------------------------------------------- #if DRIVE_FIRMWARE // 1 = 1050 Tandon Drive // ---------------------------------------- // For ATmega328 UNO & NANO ISR (PCINT2_vect) { byte D = PIND; // AVR Fast read port D byte bit4 = bitRead(D, 4); // PIN 4 // NS01 byte bit5 = bitRead(D, 5); // PIN 5 // NS03 byte bit6 = bitRead(D, 6); // PIN 6 // T_00 if (bit6 == 1) { Tcount = 0; NewTcount = 0; } // NS01 if (bit4 == 1) { // HIGH //timeNS01 = micros(); D4_state = true; } else if (bit4 == 0) { // LOW timeNS01 = micros(); D4_state = false; } // NS03 if (bit5 == 1) { // HIGH D5_state = true; } else if (bit5 == 0) { // LOW timeNS03 = micros(); D5_state = false; #if DEBUG Serial.print(F("3-ns4 ")); Serial.println(timeNS03 - timeNS04); #endif if (((timeNS03 - timeNS04) < 1800) && ((timeNS04 - timeNS01) < 550000)) { if ((timeNS03 - timeNS01) < 25000) { Tcount --; Serial.println(F("d5> --")); } } } #if DEBUG Serial.print(F("D4:")); Serial.print(bit4); Serial.print(F(" D5:")); Serial.println(bit5); Serial.print(F("Tc:")); Serial.println(Tcount); #endif } void IRQ_NS02() { timeNS02 = micros(); #if DEBUG Serial.print(timeNS02 - timeNS01); Serial.println(F(" N2f")); #endif if ((D4_state == true) && (D5_state == false)) { Tcount --; #if DEBUG Serial.println(F("> --N2f")); #endif } if (D4_state == false) { // D4 BEFORE if ((timeNS02 - timeNS01) < 18000) { Tcount ++; #if DEBUG Serial.println(F("> ++N2f")); #endif } } digitalWrite(Debug_LED1, LOW); // 1st led digitalWrite(Debug_LED2, HIGH); // 2nd led curContrastValue = ContrastValueMAX; } void IRQ_NS04() { timeNS04 = micros(); #if DEBUG //Serial.print(F("1-ns3 ")); //Serial.print(timeNS01 - timeNS03); //Serial.print(F(" 1-ns2 ")); //Serial.print(timeNS01 - timeNS02); Serial.print(F(" 4-ns1 ")); Serial.println(timeNS04 - timeNS01); #endif if (D5_state == true) { // DO WE NEED THIS HERE? if (timeNS04 < (timeNS03 + 25000)) //D5 == NS03 { Tcount ++; #if DEBUG Serial.println(F("> ++")); #endif } else if ((timeNS04 - timeNS03) < 39000) { if ((timeNS01 - timeNS02) < 25000) { Tcount --; #if DEBUG Serial.println(F("> --")); #endif } } else if (((timeNS04 - timeNS01) > 350000) && ((timeNS04 - timeNS01) < 520000)) { //D4 == NS01 Tcount --; #if DEBUG Serial.println(F("ls> --")); // TODO fix this some more (Long start) // else if (((timeNS04 - timeNS01) > 350000) &&, OK for goonies game // else if (((timeNS04 - timeNS01) > 100000) &&, OK for DOS Format #endif } } digitalWrite(Debug_LED1, HIGH); // 1st led digitalWrite(Debug_LED2, LOW); // 2nd led curContrastValue = ContrastValueMAX; } // ---------------------------------------- #else // 0 = 1050 World Drive // ---------------------------------------- // For ATmega328 UNO & NANO ISR (PCINT2_vect) { if (digitalRead(4) == LOW) { // NS01 = 4; // NS01 @ U2 ic pin 2, PCINT to d4 timeNS01 = micros(); if (timeNS01 < timeNS02 + 500) { //31000 #if DEBUG Serial.print (F(" --N1sL ")); Serial.print(timeNS01); Serial.print(F(" N2ch:")); Serial.print(timeNS02); #endif Tcount --; } else if (timeNS01 > timeNS02 ) { #if DEBUG Serial.print (F(" ++N1sL ")); Serial.print(timeNS01); Serial.print(F(" N2ch:")); Serial.print(timeNS02); #endif Tcount ++; } } if (digitalRead(5) == LOW) { timeNS03 = micros(); if (timeNS03 < timeNS04 + 500) { //31000 #if DEBUG Serial.print (F(" --N3sL ")); Serial.print(timeNS03); Serial.print(F(" N4ch:")); Serial.print(timeNS04); #endif Tcount --; } else if (timeNS03 > timeNS04 ) { #if DEBUG Serial.print (F(" ++N3sL ")); Serial.print(timeNS03); Serial.print(F(" N4ch:")); Serial.print(timeNS04); #endif Tcount ++; } } } void IRQ_NS02() { // RISING digitalWrite(Debug_LED1, LOW); // 1st led digitalWrite(Debug_LED2, HIGH); // 2nd led timeNS02 = micros(); // only need this for timing. curContrastValue = ContrastValueMAX; } void IRQ_NS04() { // FALLING digitalWrite(Debug_LED1, HIGH); // 1st led digitalWrite(Debug_LED2, LOW); // 2nd led timeNS04 = micros(); // only need this for timing. curContrastValue = ContrastValueMAX; } #endif // END - Drive firmware select 1 Quote Link to comment Share on other sites More sharing options...
xrbrevin Posted November 22, 2023 Share Posted November 22, 2023 much appreciated - i'll upload it this evening and try it out 😎 in case it helps, here are the track numbers according to my Rana1000 drive: 27 title (loads from 25-27) 28 house 30 plumbing 32 cave 33 rolling ball 34 skull 35 organ 36 octopus 38 ship Quote Link to comment Share on other sites More sharing options...
macsonny Posted November 27, 2023 Author Share Posted November 27, 2023 On 11/22/2023 at 4:27 PM, Chri O. said: VER 06 New for v06 / 1050 Tandon Drive Goonies fix Additional fixes for 1050 Tandon Drive (about 90% ok see line 713) So I've updated my unit with this newer load and I'm going to say it works heaps better with my World Drive with Happy upgrade. Previously it was a bit random if the drive would jump to track zero and then sometimes jumps directly to tract 3 or 4 even though the drive was still only at track 1 or 2. Now it works perfectly! I love the large display too - looks really nice. Great work. Thanks for your efforts!!! 2 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.