Subversion Repositories FlightCtrl

Rev

Rev 1134 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1134 Rev 1139
Line 48... Line 48...
48
// +  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
48
// +  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
49
// +  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
49
// +  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
50
// +  POSSIBILITY OF SUCH DAMAGE.
50
// +  POSSIBILITY OF SUCH DAMAGE.
51
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
51
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
52
#include "main.h"
52
#include "main.h"
-
 
53
#include "altcon.h"
-
 
54
#include "pitch.h"
-
 
55
#include "led.h"
Line 53... Line 56...
53
 
56
 
54
unsigned char EEPromArray[E2END + 1] EEMEM;
57
unsigned char EEPromArray[E2END + 1] EEMEM;
55
unsigned char PlatinenVersion = 10;
58
unsigned char PlatinenVersion = 10;
56
unsigned char SendVersionToNavi = 1;
59
unsigned char SendVersionToNavi = 1;
57
// -- Parametersatz aus EEPROM lesen ---
60
// -- Parametersatz aus EEPROM lesen ---
Line -... Line 61...
-
 
61
// number [1..5]
-
 
62
 
-
 
63
 
-
 
64
void init( void ) {
-
 
65
        LED_Init();
-
 
66
        altcon_init();
-
 
67
        pitch_init();
-
 
68
}
58
// number [1..5]
69
 
59
 
70
 
60
void ReadParameterSet(unsigned char number, unsigned char *buffer, unsigned char length) {
71
void ReadParameterSet(unsigned char number, unsigned char *buffer, unsigned char length) {
61
    if ((number > 5) || (number < 1)) number = 3;
-
 
62
    eeprom_read_block(buffer, &EEPromArray[EEPROM_ADR_PARAM_BEGIN + length * (number - 1)], length);
72
    if ((number > 5) || (number < 1)) number = 3;
Line 63... Line 73...
63
    LED_Init();
73
    eeprom_read_block(buffer, &EEPromArray[EEPROM_ADR_PARAM_BEGIN + length * (number - 1)], length);
64
}
74
}
Line 65... Line 75...
65
 
75
 
66
// -- Parametersatz ins EEPROM schreiben ---
76
// -- Parametersatz ins EEPROM schreiben ---
67
// number [1..5]
77
// number [1..5]
68
 
78
 
69
void WriteParameterSet(unsigned char number, unsigned char *buffer, unsigned char length) {
79
void WriteParameterSet(unsigned char number, unsigned char *buffer, unsigned char length) {
70
    if (number > 5) number = 5;
-
 
71
    if (number < 1) return;
80
    if (number > 5) number = 5;
Line 72... Line 81...
72
    eeprom_write_block(buffer, &EEPromArray[EEPROM_ADR_PARAM_BEGIN + length * (number - 1)], length);
81
    if (number < 1) return;
73
    SetActiveParamSetNumber(number);
82
    eeprom_write_block(buffer, &EEPromArray[EEPROM_ADR_PARAM_BEGIN + length * (number - 1)], length);
74
    LED_Init();
83
    SetActiveParamSetNumber(number);
Line 86... Line 95...
86
 
95
 
87
void SetActiveParamSetNumber(unsigned char number) {
96
void SetActiveParamSetNumber(unsigned char number) {
88
    if (number > 5) number = 5;
97
    if (number > 5) number = 5;
89
    if (number < 1) return;
98
    if (number < 1) return;
-
 
99
    eeprom_write_byte(&EEPromArray[EEPROM_ADR_ACTIVE_SET], number); // diesen Parametersatz als aktuell merken
90
    eeprom_write_byte(&EEPromArray[EEPROM_ADR_ACTIVE_SET], number); // diesen Parametersatz als aktuell merken
100
    init();
Line 91... Line 101...
91
}
101
}
92
 
102
 
Line 103... Line 113...
103
        } else Piep(WinkelOut.CalcState);
113
        } else Piep(WinkelOut.CalcState);
104
    }
114
    }
105
    DebugOut.Analog[19] = WinkelOut.CalcState;
115
    DebugOut.Analog[19] = WinkelOut.CalcState;
106
}
116
}
Line -... Line 117...
-
 
117
 
107
 
118
 
108
//############################################################################
119
//############################################################################
Line 109... Line 120...
109
//Hauptprogramm
120
//Hauptprogramm
110
 
121
 
Line 146... Line 157...
146
    StickRoll = 0;
157
    StickRoll = 0;
147
    StickNick = 0;
158
    StickNick = 0;
Line 148... Line 159...
148
 
159
 
Line -... Line 160...
-
 
160
    ROT_OFF;
149
    ROT_OFF;
161
 
150
 
162
    LED_Init();
151
    Timer_Init();
163
    Timer_Init();
152
    UART_Init();
164
    UART_Init();
153
    rc_sum_init();
165
    rc_sum_init();
Line 211... Line 223...
211
    if (EE_Parameter.GlobalConfig & CFG_HEADING_HOLD) printf("HeadingHold");
223
    if (EE_Parameter.GlobalConfig & CFG_HEADING_HOLD) printf("HeadingHold");
212
    else printf("Neutral");
224
    else printf("Neutral");
Line 213... Line 225...
213
 
225
 
Line -... Line 226...
-
 
226
    printf("\n\n\r");
-
 
227
 
-
 
228
    // Initialisierung muß nach Einlesen der Konfiguration erfolgen
214
    printf("\n\n\r");
229
    init();
215
 
230
       
216
    LcdClear();
231
    LcdClear();
217
    I2CTimeout = 5000;
232
    I2CTimeout = 5000;