Subversion Repositories Projects

Rev

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

Rev 1801 Rev 1802
Line 129... Line 129...
129
    usart1_DisableTXD();
129
    usart1_DisableTXD();
130
#endif
130
#endif
Line 131... Line 131...
131
 
131
 
Line 132... Line 132...
132
paramset_serial setting;
132
paramset_serial setting;
133
 
133
 
134
//#define NOFCOMMUNICATION
-
 
135
#ifndef NOFCOMMUNICATION
-
 
136
    usart1_request_blocking('Q', PSTR(REQUEST_CURRENT_SETTING));
-
 
137
        memcpy((char*)(&setting), (char*)pRxData, sizeof(paramset_serial));
-
 
138
    //setting = *((paramset_serial*)pRxData);
-
 
139
#else 
-
 
140
        // manual stuff?        
-
 
141
        memcpy((char*)setting.param.Name, "NO FC COMMUN", 12);
-
 
142
        setting.param.UnterspannungsWarnung = 94;
-
 
143
#endif // #ifndef NOFCOMMUNICATION
-
 
Line 144... Line -...
144
    //write_ascii_char(4 + 12 * 30, rxd_buffer[2]);
-
 
145
 
-
 
146
   
-
 
147
 
-
 
148
    write_ndigit_number_u(10, 7, setting.SettingsIndex, 1, 1);
-
 
149
    write_ascii_string_len(13, 7, setting.param.Name, 12);
-
 
150
 
-
 
151
    uint8_t cells = 0;
-
 
152
    if (CELL_NUM == -1) {
-
 
153
#define MAX_CELL_VOLTAGE 43 // max cell volatage for LiPO
-
 
154
 
-
 
155
        if (setting.param.UnterspannungsWarnung < 50) {
-
 
156
            // up to 6s LiPo, less than 2s is technical impossible
-
 
157
            for (cells = 2; cells < 7; cells++) {
-
 
158
                if (UBat < cells * MAX_CELL_VOLTAGE) break;
-
 
159
            }
-
 
160
 
-
 
161
            min_voltage = cells * setting.param.UnterspannungsWarnung;
-
 
162
        } else {
-
 
163
            min_voltage = setting.param.UnterspannungsWarnung;
-
 
164
            cells = min_voltage / CELL_VOLT_MIN;
-
 
165
        }
-
 
166
        //write_ndigit_number_u(10, 13, setting.param.UnterspannungsWarnung, 3, 1);
-
 
167
    } else {
-
 
168
        cells = CELL_NUM;
-
 
169
        min_voltage = cells * CELL_VOLT_MIN;
-
 
170
    }
-
 
171
 
-
 
172
    max_voltage = cells * CELL_VOLT_MAX;
-
 
173
 
-
 
174
    write_ndigit_number_u(11, 8, cells, 1, 0);
-
 
Line 175... Line 134...
175
    write_ndigit_number_s_10th(8, 9, min_voltage, 3, 0);
134
#define NOFCOMMUNICATION
176
    write_ndigit_number_s_10th(20, 9, max_voltage, 3, 0);
135
#ifndef NOFCOMMUNICATION
177
 
136
   
178
 
137