/*
* #################################### define parameters to fixed values
*/
-#define FIRMWARE_VERSION 0x002
+#define FIRMWARE_VERSION 0x003
#define ISMYADDR() (rxbuf[1] == '0' && rxbuf[2] == '0')
LED_CH3_ON();
}
}
- setVoltages();
}
void setDCDC(uint8_t group, uint8_t chan, uint8_t val) {
getdata(buf);
} else {
// usb_serial_putchar(buf);
- }
+ }
}
ISR(USART1_UDRE_vect) {
// set DCDC ON/OFF
case 0:
- if (hex_to_int(rxbuf[3]) < 4) {
- switchDCDC(hex_to_int(rxbuf[3]), hex_to_int(rxbuf[9]));
- eeprom_update_byte((uint8_t *)0x21, shift_register);
- eeprom_update_byte((uint8_t *)0x22, shift_register >> 8);
- eeprom_update_byte((uint8_t *)0x23, shift_register >> 16);
- eeprom_update_byte((uint8_t *)0x24, shift_register >> 24);
+ if (hex_to_int(rxbuf[3]) <= 4) {
+ if (rxbuf[3]=='4') {
+ switchDCDC(0,hex_to_int(rxbuf[9]));
+ switchDCDC(1,hex_to_int(rxbuf[9]));
+ switchDCDC(2,hex_to_int(rxbuf[9]));
+ switchDCDC(3,hex_to_int(rxbuf[9]));
+ }
+ else {
+ switchDCDC(hex_to_int(rxbuf[3]), hex_to_int(rxbuf[9]));
+ }
+ setVoltages();
+ if(rxbuf[6] != '8') {
+ eeprom_update_byte((uint8_t *)0x21, shift_register);
+ eeprom_update_byte((uint8_t *)0x22, shift_register >> 8);
+ eeprom_update_byte((uint8_t *)0x23, shift_register >> 16);
+ eeprom_update_byte((uint8_t *)0x24, shift_register >> 24);
+ }
}
send_answer_hex(&rxbuf[0], 0x00d1);
break;
case 1:
if (hex_to_int(rxbuf[3]) < 4) {
setDCDC(hex_to_int(rxbuf[3]), hex_to_int(rxbuf[4]), hex_to_int(rxbuf[9]));
- eeprom_update_byte((uint8_t *)0x21, shift_register);
- eeprom_update_byte((uint8_t *)0x22, shift_register >> 8);
- eeprom_update_byte((uint8_t *)0x23, shift_register >> 16);
- eeprom_update_byte((uint8_t *)0x24, shift_register >> 24);
+ if(rxbuf[6] != '8') {
+ eeprom_update_byte((uint8_t *)0x21, shift_register);
+ eeprom_update_byte((uint8_t *)0x22, shift_register >> 8);
+ eeprom_update_byte((uint8_t *)0x23, shift_register >> 16);
+ eeprom_update_byte((uint8_t *)0x24, shift_register >> 24);
+ }
}
send_answer_hex(&rxbuf[0], 0x00d1);
break;
send_answer_hex(&rxbuf[0], V_out);
}
}
- /*
- // get current C_out
- if (hex_to_int(rxbuf[5]) == 8) {
- //LDO CH1
- if (hex_to_int(rxbuf[4]) == 1) {
- C_out = adc[13];
- }
- //LDO CH0
- if (hex_to_int(rxbuf[4]) == 0) {
- C_out = adc[3];
- }
- send_answer_hex(&rxbuf[0],C_out);
- }
- */
-
// get GND
if (hex_to_int(rxbuf[5]) == 9) {
GND = (5 * adc[1]) / 2;