Rev 1173 | Rev 1220 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1173 | Rev 1219 | ||
---|---|---|---|
Line 55... | Line 55... | ||
55 | } |
55 | } |
Line 56... | Line 56... | ||
56 | 56 | ||
57 | void SucheGyroOffset(void) |
57 | void SucheGyroOffset(void) |
58 | { |
58 | { |
- | 59 | unsigned char i, ready = 0; |
|
59 | unsigned char i, ready = 0; |
60 | int timeout; |
- | 61 | GyroDefektN = 0; GyroDefektR = 0; GyroDefektG = 0; |
|
60 | GyroDefektN = 0; GyroDefektR = 0; GyroDefektG = 0; |
62 | timeout = SetDelay(2000); |
61 | for(i=140; i != 0; i--) |
63 | for(i=140; i != 0; i--) |
62 | { |
64 | { |
63 | if(ready == 3 && i > 10) i = 9; |
65 | if(ready == 3 && i > 10) i = 9; |
64 | ready = 0; |
66 | ready = 0; |
Line 68... | Line 70... | ||
68 | twi_state = 8; |
70 | twi_state = 8; |
69 | i2c_start(); |
71 | i2c_start(); |
70 | if(AnalogOffsetNick < 10) { GyroDefektN = 1; AnalogOffsetNick = 10;}; if(AnalogOffsetNick > 245) { GyroDefektN = 1; AnalogOffsetNick = 245;}; |
72 | if(AnalogOffsetNick < 10) { GyroDefektN = 1; AnalogOffsetNick = 10;}; if(AnalogOffsetNick > 245) { GyroDefektN = 1; AnalogOffsetNick = 245;}; |
71 | if(AnalogOffsetRoll < 10) { GyroDefektR = 1; AnalogOffsetRoll = 10;}; if(AnalogOffsetRoll > 245) { GyroDefektR = 1; AnalogOffsetRoll = 245;}; |
73 | if(AnalogOffsetRoll < 10) { GyroDefektR = 1; AnalogOffsetRoll = 10;}; if(AnalogOffsetRoll > 245) { GyroDefektR = 1; AnalogOffsetRoll = 245;}; |
72 | if(AnalogOffsetGier < 10) { GyroDefektG = 1; AnalogOffsetGier = 10;}; if(AnalogOffsetGier > 245) { GyroDefektG = 1; AnalogOffsetGier = 245;}; |
74 | if(AnalogOffsetGier < 10) { GyroDefektG = 1; AnalogOffsetGier = 10;}; if(AnalogOffsetGier > 245) { GyroDefektG = 1; AnalogOffsetGier = 245;}; |
73 | while(twi_state); |
75 | while(twi_state) if(CheckDelay(timeout)) {printf("\n\r DAC or I2C ERROR! Check I2C, 3Vref, DAC and BL-Ctrl"); break;} |
74 | messanzahl_Druck = 0; |
76 | messanzahl_Druck = 0; |
75 | ANALOG_ON; |
77 | ANALOG_ON; |
76 | while(messanzahl_Druck == 0); |
78 | while(messanzahl_Druck == 0); |
77 | if(i<10) Delay_ms_Mess(10); |
79 | if(i<10) Delay_ms_Mess(10); |
78 | } |
80 | } |