Giter VIP home page Giter VIP logo

Comments (12)

tomaskovacik avatar tomaskovacik commented on August 12, 2024

these?

#define Do_PLAY 0x03 // mix button held down (RCD300 head unit only)

from vwcdavr.

istals avatar istals commented on August 12, 2024

Yes

case Do_UP:
case Do_UP_MK3:
if (playing == TRUE) // skip track lead-in if not in play mode
{
SetStateTrackLeadIn();
}
ResetTime();
#ifndef DISC_TRACK_NUMBER_FROM_MPD
track++;
decimal_adjust_u8 = track & 0x0F; // skip past hexidecimal codes
if (decimal_adjust_u8 == 0x0A) // are with at xA?
{
track += 6; // yes, add 6 and we'll be at x0 instead
}
if (track == 0xA0) // have we gone beyond Track 99?
{ // yes, rollover to Track 01 so that jog wheels
track = 1; // can continue rolling (Audi Concert II)
}
#endif
EnqueueString(sNEXT);
break;
case Do_DOWN:
case Do_DOWN_MK3:
if (playing == TRUE) // skip track lead-in if not in play mode
{
SetStateTrackLeadIn();
}
ResetTime();
#ifndef DISC_TRACK_NUMBER_FROM_MPD
decimal_adjust_u8 = track & 0x0F; // skip past hexidecimal codes
if (decimal_adjust_u8 == 0) // are we at x0?
{
track -= 6; // yes, subtract 6 and we'll be at x9 instead
}
track--;
if (track == 0) // have we gone below Track 1?
{ // yes, rollover to Track 99 so that jog wheels
track = 0x99; // can continue rolling (Audi Concert II)
}
#endif
EnqueueString(sPREVIOUS);

But also I needed to add SetStateIdleThenPlay(); after init Init_VWCDC(); to get radio playing, I feel that I'm missing something

from vwcdavr.

tomaskovacik avatar tomaskovacik commented on August 12, 2024

what exactly do you need to do with them? if you press button on MFSW or on radio then emulator will change track

from vwcdavr.

istals avatar istals commented on August 12, 2024

Ok, then that is not happening, I'm using Arduino Uno (AVR_ATmega328P)
defs and things I changed in code

// #define DUMPMODE
// #define DUMPMODE2
//#define DISC_TRACK_NUMBER_FROM_MPD
// #define BLUETOOTH

#define RADIO_COMMAND      PB0 //ICP
#define RADIO_COMMAND_DDR  DDRB
#define RADIO_COMMAND_PORT  PORTB
#define RADIO_COMMAND_PIN PINB
//standard pinout 8,11,13
#define RADIO_CLOCK       PB5
#define RADIO_CLOCK_DDR    DDRB
#define RADIO_CLOCK_PORT  PORTB
#if defined(__AVR_ATmega328PB__) //cannot use pb3 with serial1
#define RADIO_DATA        PB2
#else
#define RADIO_DATA        PB3
#endif
#define RADIO_DATA_DDR    DDRB
#define RADIO_DATA_PORT  PORTB
//my pinout, 8,6,A0
//#define RADIO_CLOCK        PD4
//#define RADIO_CLOCK_DDR    DDRD
//#define RADIO_CLOCK_PORT  PORTD
//#define RADIO_DATA         PC3
//#define RADIO_DATA_DDR     DDRC
//#define RADIO_DATA_PORT  PORTC
//#define RADIO_ACC 3 // PD3 = INT1

int main()
{
  Serial.begin(9600);
  
  pinMode(D_CTRL_PREV_PIN, OUTPUT);
  pinMode(D_CTRL_NEXT_PIN, OUTPUT);
  pinMode(D_CTRL_LED_PIN, OUTPUT);
  digitalWrite(D_CTRL_PREV_PIN, LOW);
  digitalWrite(D_CTRL_NEXT_PIN, LOW);
  digitalWrite(D_CTRL_LED_PIN, LOW);
#ifdef BLUETOOTH
#if defined(__AVR_ATmega324__) || defined(__AVR_ATmega324A__) || defined(__AVR_ATmega324P__) || defined(__AVR_ATmega324PA__) || defined(__AVR_ATmega324PB__) || defined(__AVR_ATmega324PB__) || defined(__AVR_ATmega328PB__)
  Serial1.begin(9600);
#else
  Serial.begin(9600);
//
#endif
#endif

#ifdef DISC_TRACK_NUMBER_FROM_MPD
#if defined(__AVR_ATmega324__) || defined(__AVR_ATmega324A__) || defined(__AVR_ATmega324P__) || defined(__AVR_ATmega324PA__) || defined(__AVR_ATmega324PB__) || defined(__AVR_ATmega324PB__)
  Serial1.begin(115200);
#else
  Serial.begin(115200);
#endif
#endif
  //Serial.println("COM+SNAME+VWCDPIC1");

  unsigned long delay_time = 0;
  int next_high = 0;
  int prev_high = 0;

  Init_VWCDC();
  // starts playing Bluetooth stream
  // SetStateIdleThenPlay();
//#if defined(__AVR_ATmega328P__)
//  Serial.println("__AVR_ATmega328P__ board");
//#endif

// my board __AVR_ATmega328P__
#ifdef DISC_TRACK_NUMBER_FROM_MPD
  //start in idle mode
  SetStateIdle();
#endif
  //Serial.println("COM+TONEOFF");
  while (1)
  {
    CDC_Protocol();

    if (D_CTRL_LED_STATE == 1) {
      digitalWrite(D_CTRL_LED_PIN, HIGH);
    } else {
      digitalWrite(D_CTRL_LED_PIN, LOW);
    }

    if (D_CTRL_NEXT > 0) {
      Serial.println("D_CTRL_NEXT press");
      if (delay_time == 0) {
        delay_time = millis();
        digitalWrite(D_CTRL_NEXT_PIN, HIGH);
        next_high = 1;
      } else if (delay_time + 200 <= millis()) {
        digitalWrite(D_CTRL_NEXT_PIN, LOW);
        next_high = 0;
        delay_time = 0;
        D_CTRL_NEXT = 0;
      }
    } else if (next_high == 1) {
      digitalWrite(D_CTRL_NEXT_PIN, LOW);
      next_high = 0;
    }

    if (D_CTRL_PREV > 0) {
      Serial.println("D_CTRL_PREV press");
      int delay_plus = 150;
      if(D_CTRL_PREV == 1) delay_plus = 250;

      if (delay_time == 0) {
        delay_time = millis();
        digitalWrite(D_CTRL_PREV_PIN, HIGH);
        prev_high = 1;
      } else if (delay_time + delay_plus <= millis()) {
        digitalWrite(D_CTRL_PREV_PIN, LOW);
        prev_high = 0;
        delay_time = 0;
        if (D_CTRL_PREV == 2) {
          D_CTRL_PREV = 0;
        } else {
          D_CTRL_PREV = 2;
        }
      }
    } else if (prev_high == 1) {
      digitalWrite(D_CTRL_NEXT_PIN, LOW);
      prev_high = 0;
    }
  }
}

from vwcdavr.

tomaskovacik avatar tomaskovacik commented on August 12, 2024

is it working without your changes ?

from vwcdavr.

istals avatar istals commented on August 12, 2024

Regarding this, how could I test that these buttons are working and I'm receiving those bytes?
DUMPMODE and DUMPMODE2 must be enabled?

from vwcdavr.

istals avatar istals commented on August 12, 2024

No, not working no data from head unit

from vwcdavr.

tomaskovacik avatar tomaskovacik commented on August 12, 2024

arduino pin 8 is connected to dataout on the radio?

RADIO PIN -> arduino pin
DataOut -> digital 8 (ICP1)
DataIn -> digital 11(PB3) (10 for atmega328PB)
Clock -> digital 13(PB5)

from vwcdavr.

istals avatar istals commented on August 12, 2024

Yes, Double checked

from vwcdavr.

tomaskovacik avatar tomaskovacik commented on August 12, 2024

you should see some commands on serial at startup of radio, mainly disable and enable, depends on state in which radio started

from vwcdavr.

istals avatar istals commented on August 12, 2024

Looks like my head unit is not providing any data, closing

from vwcdavr.

tomaskovacik avatar tomaskovacik commented on August 12, 2024

radio must be coded to have cdc enabled, try it

http://wiki.ross-tech.com/wiki/index.php/Audi_Radio_Generation_I#Coding

from vwcdavr.

Related Issues (17)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.