18,6 → 18,7 |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
****************************************************************************/ |
|
#include "main.h" |
#include <avr/io.h> |
#include <avr/eeprom.h> |
#include <avr/pgmspace.h> |
25,7 → 26,6 |
#include <util/delay.h> |
#include "max7456_software_spi.h" |
#include "config.h" |
#include "main.h" |
#include "buttons.h" |
#include "usart1.h" |
|
62,7 → 62,6 |
} |
} |
|
|
/** |
* save data to eeprom |
*/ |
87,49 → 86,49 |
#else |
write_ascii_string_pgm(2, 3, PSTR("NaviCtrl Mode")); |
|
usart1_EnableTXD(); |
usart1_puts_pgm(PSTR(REQUEST_UART_TO_FC)); |
usart1_DisableTXD(); |
usart1_EnableTXD(); |
usart1_puts_pgm(PSTR(REQUEST_UART_TO_FC)); |
usart1_DisableTXD(); |
#endif |
|
|
usart1_request_blocking('Q', PSTR(REQUEST_CURRENT_SETTING)); |
usart1_request_blocking('Q', PSTR(REQUEST_CURRENT_SETTING)); |
|
//write_ascii_char(4 + 12 * 30, rxd_buffer[2]); |
//write_ascii_char(4 + 12 * 30, rxd_buffer[2]); |
|
paramset_serial setting; |
setting = *((paramset_serial*)pRxData); |
|
write_ascii_string_pgm(2, 6, PSTR("Setting: ")); |
write_ndigit_number_u(11, 6, setting.SettingsIndex, 1, 1); |
write_ascii_string_len(13, 6, setting.param.Name, 12); |
write_ascii_string_pgm(2, 6, PSTR("Setting: ")); |
write_ndigit_number_u(11, 6, setting.SettingsIndex, 1, 1); |
write_ascii_string_len(13, 6, setting.param.Name, 12); |
|
uint8_t cells = 0; |
write_ascii_string_pgm(2, 8, PSTR("Battery:")); // Guessing Number of Cells |
if (CELL_NUM == -1) { |
#define MAX_CELL_VOLTAGE 43 // max cell volatage for LiPO |
|
if (setting.param.UnterspannungsWarnung < 50) { |
// up to 6s LiPo, less than 2s is technical impossible |
for(cells = 2; cells < 7; cells++) { |
if(UBat < cells * MAX_CELL_VOLTAGE) break; |
} |
uint8_t cells = 0; |
write_ascii_string_pgm(2, 8, PSTR("Battery:")); // Guessing Number of Cells |
if (CELL_NUM == -1) { |
#define MAX_CELL_VOLTAGE 43 // max cell volatage for LiPO |
|
min_voltage = cells * setting.param.UnterspannungsWarnung; |
} else { |
min_voltage = setting.param.UnterspannungsWarnung; |
cells = min_voltage / CELL_VOLT_MIN; |
} |
//write_ndigit_number_u(10, 13, setting.param.UnterspannungsWarnung, 3, 1); |
if (setting.param.UnterspannungsWarnung < 50) { |
// up to 6s LiPo, less than 2s is technical impossible |
for (cells = 2; cells < 7; cells++) { |
if (UBat < cells * MAX_CELL_VOLTAGE) break; |
} |
|
min_voltage = cells * setting.param.UnterspannungsWarnung; |
} else { |
min_voltage = setting.param.UnterspannungsWarnung; |
cells = min_voltage / CELL_VOLT_MIN; |
} |
//write_ndigit_number_u(10, 13, setting.param.UnterspannungsWarnung, 3, 1); |
} else { |
cells = CELL_NUM; |
min_voltage = cells * CELL_VOLT_MIN; |
min_voltage = cells * CELL_VOLT_MIN; |
} |
|
max_voltage = cells * CELL_VOLT_MAX; |
|
max_voltage = cells * CELL_VOLT_MAX; |
|
write_ndigit_number_u(11, 8, cells, 1, 0); |
write_ascii_string_pgm(13, 8, PSTR("Cells")); // Number of Cells |
write_ascii_string_pgm(13, 8, PSTR("Cells")); // Number of Cells |
write_ascii_string_pgm(2, 9, PSTR("Warn:")); // Warn Voltage |
write_ndigit_number_s_10th(8, 9, min_voltage, 3, 0); |
write_ascii_string_pgm(14, 9, PSTR("Max:")); // Max Voltage |
148,12 → 147,12 |
#if FCONLY |
//usart1_request_mk_data(0, 'v', 0); |
write_ascii_string_pgm(2, 11, PSTR("FC VERSION: ........")); |
usart1_request_blocking('V', PSTR(REQUEST_FC_VERSION)); |
usart1_request_blocking('V', PSTR(REQUEST_FC_VERSION)); |
#else |
usart1_request_nc_uart(); |
usart1_request_nc_uart(); |
//usart1_request_mk_data(1, 'v', 0); |
write_ascii_string_pgm(2, 11, PSTR("NC VERSION: ........")); |
usart1_request_blocking('V', PSTR(REQUEST_NC_VERSION)); |
usart1_request_blocking('V', PSTR(REQUEST_NC_VERSION)); |
#endif |
str_VersionInfo VersionInfo; |
VersionInfo = *((str_VersionInfo*)pRxData); |