Coder Social home page Coder Social logo

Comments (7)

tomaskovacik avatar tomaskovacik commented on September 17, 2024

gala is square wave duty 50%
based on testings:

GALA=1

for GALA set to 1 (start radio with TP button switched)
going from ~20Hz up I get these changes in volume/loudness

freq(Hz) volume loudness
up
start 4E B
105 4C,4A
135 A
167 48,46
196 9
217 44,42
250 8
286 40,3E
308 7
down
286 8
256 42
220 9
197 46
178 A
149 4A
119 B
93 4E

GALA=2

freq(Hz) volume loudness
up
start 4E B
85 4C,4A
114 A
143 48,46
169 9
206 44,42
232 8
263 40,3E
312 7
down
256 8
222 42
204 9
178 46
154 A
126 4A
98 B
71 4E

GALA=3

freq(Hz) volume loudness
up
start 4E B
68 4C,4A
96 A
126 48,46
154 9
189 44,42
217 8
244 40,3E
278 7
down
238 8
217 42
185 9
164 46
137 A
110 4A
82 B
55 4E

GALA=4

freq(Hz) volume loudness
up
start 4A B
78 A
107 48,46
137 9
169 44,42
196 8
222 40,3E
down
192 42
174 9
149 46
116 A
92 4A
65 B

GALA=5

freq(Hz) volume loudness
up
start 52 C
39 50,4E
68 B
92 4C,4A
126 A
156 48,46
189 9
222 44,42
250 8
down
213 9
185 46
161 A
137 4A
110 B
82 4E
54 C

from audi_concert1_chorus1_volume_fix.

tomaskovacik avatar tomaskovacik commented on September 17, 2024
velocity goes up:                  
gala V=4A L=A V=46 L=9 V=42 L=8 V=3E L=7  
1 105 135 167 196 217 250 286 308  
2 85 114 143 169 206 232 263 312  
3 68 96 126 154 189 217 244 278  
4   78 107 137 169 196 222    
5 39 68 92 126 156 189 222 250  
                   
velocity goes down:                  
gala L=8 V=42 L=9 V=46 L=A V=4A L=B V=4E L=C
1 286 256 220 197 178 149 119 93  
2 256 222 204 178 154 126 98 71  
3 238 217 185 164 137 110 82 55  
4   192 174 149 116 92 65    
5     213 185 161 137 110 82 54

this will be implemented: the increment will be 30km/h up and down, the value of GALA(0-5) will affect starting speed at which automatic increment happens the first time

velocity goes up:                  
gala V=4A L=A V=46 L=9 V=42 L=8 V=3E L=7  
1 100 130 160 190 220 250 280 310  
2 80 110 140 170 200 230 260 290  
3 70 100 130 160 190 220 250 280  
4 50 80 110 140 170 200 230 260  
5 40 70 100 130 160 190 220 250  
                   
velocity goes down:                  
gala L=8 V=42 L=9 V=46 L=A V=4A L=B V=4E L=C
1 280 250 220 190 160 130 100 70 40
2 260 230 200 170 140 110 80 50 20
3 250 220 190 160 130 100 70 40 10
4 230 200 170 140 110 80 50 20  
5 220 190 160 130 100 70 40 10  

the default setting will be:
start volume = 3 (4E)
gala=3 (starting speed 70km/h)

this could be changed by starting radio in config mode (pressed and held TP button while powering on the radio), then cycling over the config using TP button, SW will automatically set start volume and gala value based on what will be displayed)

from audi_concert1_chorus1_volume_fix.

tomaskovacik avatar tomaskovacik commented on September 17, 2024

start speed calculation (I made up):
120-(0xF*GALA):

GALA START
1 104
2 88
3 72
4 56
5 40
GALA 1                
  speed volume loudnes            
start 104 78 11            
HEX:   4E B            
                   
ID 0 1 2 3 4 5 6 7 8
speed 104 134 164 194 224 254 284 314 344
V -4 0 -4 0 -4 0 -4 0 -4
L 0 -1 0 -1 0 -1 0 -1 0
                   
[V] 74 74 70 70 66 66 62 62 58
[L] 11 10 10 9 9 8 8 7 7
                   
[V(hex)] 4A 4A 46 46 42 42 3E 3E 3A
[L (hex)] B A A 9 9 8 8 7 7

from audi_concert1_chorus1_volume_fix.

tomaskovacik avatar tomaskovacik commented on September 17, 2024

speed emulation is made using atmega328 and this Arduino code, it is basic square wave emulator. Frequency can be changed over the serial port.

https://github.com/tomaskovacik/arduino/tree/master/wavegen

from audi_concert1_chorus1_volume_fix.

tomaskovacik avatar tomaskovacik commented on September 17, 2024

config menu is sent to display as standard TEXT:

    //TEXT: VOL  1->...->5
    //TEXT: SENS LO
    //TEXT: RM   ON 
    //TEXT: NAV  1->...->5 
    //TEXT: TEL  L 
    //TEXT: TA   1->...->5 
    //TEXT: GALA OFF->1-...->5

from audi_concert1_chorus1_volume_fix.

tomaskovacik avatar tomaskovacik commented on September 17, 2024

measuring width of pulse on stm32 works on pin PA0 like this:

#define GALA PA0
volatile uint16_t captime; // timer count of low pulse (temp)

void TIMER2_ISR()
{
  if ( Timer2.getInputCaptureFlag(TIMER_CH2) && !captime ) // period end
  {
    captime = Timer2.getCompare(TIMER_CH2);//ICR1; // save a copy of current TMR1 count

   }
 }

void setup(){
pinMode(GALA,INPUT_PULLUP);
 Timer2.pause(); // pause timer 2
 //timer2 for GALA:
 Timer2.setPrescaleFactor(72); // 1 microsecond resolution
 // setup timer 2 channel 1 capture on rising edge
 Timer2.setInputCaptureMode(TIMER_CH1, TIMER_IC_INPUT_DEFAULT); // use default input TI1
 // setup timer 2 channel 2 capture on falling edge
 Timer2.setInputCaptureMode(TIMER_CH2, TIMER_IC_INPUT_SWITCH); // use switched input TI1
 Timer2.setPolarity(TIMER_CH2, 1); // trigger on falling edge
 // counter setup as slave triggered by TI1 in reset mode
 Timer2.setSlaveFlags( TIMER_SMCR_TS_TI1FP1 | TIMER_SMCR_SMS_RESET );
 Timer2.refresh();
 Timer2.getCompare(TIMER_CH1); // clear capture flag
 Timer2.getCompare(TIMER_CH2); // clear capture flag
 Timer2.attachInterrupt(TIMER_CH2, TIMER2_ISR); //ch1 is rising edge, it's after low pulse, which we need to process while high pulse ocure...
  Timer2.resume(); // let timer 2 run
}

void loop(){
 if (!captime) {
   Serial.print("Speed=");
   Serial.print((float)1000000 / (2 * captime));
   Serial.println("km/h");
   captime = 0;
 }
}

but this will not work for V1, so I change it to standard interrupt:

//use PA14 for V1 board
#define GALA PA14 //SWDCLK pin, exposed on version one boards
//PA0 for V2
//#define GALA PA0
volatile uint16_t captime; // timer count of low pulse (temp)

void gala_up(void) {
    Timer2.resume(); // let timer 2 run
    //detachInterrupt(digitalPinToInterrupt(GALA));
    attachInterrupt(digitalPinToInterrupt(GALA), gala_down, FALLING); //
}

void gala_down(void) {
  Timer2.pause();
  //detachInterrupt(digitalPinToInterrupt(GALA));
  captime = Timer2.getCount();
}

void setup(){
pinMode(GALA, INPUT_PULLUP);
  Timer2.setPrescaleFactor(72); // 1 microsecond resolution
  Timer2.refresh();
  Timer2.setCount(0);
  attachInterrupt(digitalPinToInterrupt(GALA), gala_up, RISING);
}

void setup(){
  if (captime>0) {
    Serial.print("Speed=");
    Serial.print((float)1000000 / (2 * captime));
    Serial.println("km/h");
    Timer2.setCount(0);
    captime=0;
    attachInterrupt(digitalPinToInterrupt(GALA), gala_up, RISING); //
  }
}

from audi_concert1_chorus1_volume_fix.

tomaskovacik avatar tomaskovacik commented on September 17, 2024

hopefully 4e7bda1 fix this, but it needs to be tested in the car!

for version 1.0 of HW, 1k resistor needs to be put between the CLK pin of the ST-LINK connector and the gala signal in radio, resistor R2304 as showed in picture

gala_on_V1

from audi_concert1_chorus1_volume_fix.

Related Issues (15)

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.