Subversion Repositories FlightCtrl

Rev

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

Rev 683 Rev 685
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 "timer0.h"
-
 
54
#include "timer2.h"
-
 
55
#include "uart.h"
-
 
56
#include "uart1.h"
-
 
57
#include "menu.h"
-
 
58
#include "fc.h"
-
 
59
#include "rc.h"
-
 
60
#include "analog.h"
-
 
61
#include "printf_P.h"
-
 
62
#include "spi.h"
-
 
63
#include "twimaster.h"
-
 
64
#include "eeprom.h"
-
 
65
#include "_Settings.h"
Line -... Line 66...
-
 
66
 
53
 
67
 
54
unsigned char EEPromArray[E2END+1] EEMEM;
68
uint8_t EEPromArray[E2END+1] EEMEM;
Line 55... Line 69...
55
unsigned char PlatinenVersion = 10;
69
uint8_t BoardRelease = 10;
56
 
70
 
57
// -- Parametersatz aus EEPROM lesen ---
71
// -- Parametersatz aus EEPROM lesen ---
58
// number [0..5]
72
// number [0..5]
Line 70... Line 84...
70
   if(number > 5) number = 5;
84
   if(number > 5) number = 5;
71
   eeprom_write_block(buffer, &EEPromArray[EEPROM_ADR_PARAM_BEGIN + length * number], length);
85
   eeprom_write_block(buffer, &EEPromArray[EEPROM_ADR_PARAM_BEGIN + length * number], length);
72
   eeprom_write_byte(&EEPromArray[EEPROM_ADR_ACTIVE_SET], number);                              // diesen Parametersatz als aktuell merken
86
   eeprom_write_byte(&EEPromArray[EEPROM_ADR_ACTIVE_SET], number);                              // diesen Parametersatz als aktuell merken
73
}
87
}
Line -... Line 88...
-
 
88
 
-
 
89
/***************************************************/
-
 
90
/*       Get number of active parameter set        */
74
 
91
/***************************************************/
75
unsigned char GetActiveParamSetNumber(void)
92
uint8_t GetActiveParamSetNumber(void)
76
{
93
{
77
 unsigned char set;
94
        uint8_t set;
78
 set = eeprom_read_byte(&EEPromArray[EEPROM_ADR_ACTIVE_SET]);
95
        set = eeprom_read_byte(&EEPromArray[EEPROM_ADR_ACTIVE_SET]);
79
 if(set > 5)
96
        if(set > 5)
80
  {
97
        {
81
   set = 2;
98
        set = 2;
82
   eeprom_write_byte(&EEPromArray[EEPROM_ADR_ACTIVE_SET], set);                                 // diesen Parametersatz als aktuell merken
99
        eeprom_write_byte(&EEPromArray[EEPROM_ADR_ACTIVE_SET], set);                            // diesen Parametersatz als aktuell merken
83
  }
100
        }
84
 return(set);
101
        return(set);
Line 85... Line 102...
85
}
102
}
86
 
103
 
87
//############################################################################
104
//############################################################################
Line 95... Line 112...
95
        cli();
112
        cli();
Line 96... Line 113...
96
 
113
 
97
    DDRB  = 0x00;
114
    DDRB  = 0x00;
98
    PORTB = 0x00;
115
    PORTB = 0x00;
-
 
116
    for(timer = 0; timer < 1000; timer++); // make delay
-
 
117
 
99
    for(timer = 0; timer < 1000; timer++); // make delay
118
 
-
 
119
    if(PINB & 0x01) BoardRelease = 11;
-
 
120
    else BoardRelease = 10;
100
    if(PINB & 0x01) PlatinenVersion = 11; else PlatinenVersion = 10;
121
 
101
    DDRC  = 0x81; // SCL & Speaker
122
    DDRC  = 0x81; // SCL & Speaker
102
    PORTC = 0xff; // Pullup SDA
123
    PORTC = 0xff; // Pullup SDA
103
    DDRB  = 0x1B; // LEDs und Druckoffset
124
    DDRB  = 0x1B; // LEDs und Druckoffset
104
    PORTB = 0x01; // LED_Rot
125
    PORTB = 0x01; // LED_Rot
Line 135... Line 156...
135
 
156
 
136
    VersionInfo.Hauptversion = VERSION_HAUPTVERSION;
157
    VersionInfo.Hauptversion = VERSION_HAUPTVERSION;
137
    VersionInfo.Nebenversion = VERSION_NEBENVERSION;
158
    VersionInfo.Nebenversion = VERSION_NEBENVERSION;
Line 138... Line 159...
138
    VersionInfo.PCKompatibel = VERSION_KOMPATIBEL;
159
    VersionInfo.PCKompatibel = VERSION_KOMPATIBEL;
139
 
160
 
140
        printf("\n\rFlightControl\n\rHardware:%d.%d\n\rSoftware:V%d.%d%c ",PlatinenVersion/10,PlatinenVersion%10, VERSION_HAUPTVERSION, VERSION_NEBENVERSION,VERSION_INDEX + 'a');
161
        printf("\n\rFlightControl\n\rHardware:%d.%d\n\rSoftware:V%d.%d%c ",BoardRelease/10,BoardRelease%10, VERSION_HAUPTVERSION, VERSION_NEBENVERSION,VERSION_INDEX + 'a');
Line 141... Line 162...
141
        printf("\n\r==============================");
162
        printf("\n\r==============================");
142
        GRN_ON;
163
        GRN_ON;
Line 187... Line 208...
187
        if (EE_Parameter.GlobalConfig & CFG_HEADING_HOLD) printf("HeadingHold");
208
        if (EE_Parameter.GlobalConfig & CFG_HEADING_HOLD) printf("HeadingHold");
188
        else printf("Neutral");
209
        else printf("Neutral");
Line 189... Line 210...
189
 
210
 
Line 190... Line 211...
190
        printf("\n\n\r");
211
        printf("\n\n\r");
191
 
212
 
192
    LcdClear();
213
    LCD_Clear();
193
    I2CTimeout = 5000;
214
    I2CTimeout = 5000;
194
        while (1)
215
        while (1)
195
        {
216
        {