busvoodoo: adjust voltage control
This commit is contained in:
parent
edf1a9e59c
commit
33a847b8e7
|
@ -208,11 +208,11 @@ float busvoodoo_vreg_set(uint8_t channel, float voltage)
|
|||
|
||||
float volt = NAN; // common variable for voltages
|
||||
if (BUSVOODOO_XV_CHANNEL==channel) { // set voltage on xV low drop-out voltage regulator
|
||||
if (voltage<=0.0) { // disable voltage regulator
|
||||
if (voltage<=0.3) { // disable voltage regulator
|
||||
gpio_clear(GPIO(BUSVOODOO_XVEN_PORT), GPIO(BUSVOODOO_XVEN_PIN)); // disable xV voltage regulator
|
||||
dac_disable(BUSVOODOO_XVCTL_CHANNEL); // disable xV control
|
||||
} else { // enable voltage regulator
|
||||
if (voltage>4.7) { // use the 5V directly
|
||||
if (voltage>4.85) { // use the 5V directly
|
||||
gpio_clear(GPIO(BUSVOODOO_5VPULLUP_PORT), GPIO(BUSVOODOO_5VPULLUP_PIN)); // put 5V on xV line
|
||||
} else { // use adjustable voltage regulator (5.0V rail minus LDO and diodes)
|
||||
gpio_set(GPIO(BUSVOODOO_5VPULLUP_PORT), GPIO(BUSVOODOO_5VPULLUP_PIN)); // disable 5V input
|
||||
|
@ -230,7 +230,7 @@ float busvoodoo_vreg_set(uint8_t channel, float voltage)
|
|||
sleep_ms(10); // let voltage settle
|
||||
volt = busvoodoo_vreg_get(BUSVOODOO_XV_CHANNEL); // get xV voltage to return
|
||||
} else if (BUSVOODOO_12V_CHANNEL==channel && busvoodoo_full) {// set voltage on 12V boost voltage regulator
|
||||
if (voltage<=3.3) { // disable voltage regulator
|
||||
if (voltage<3.29) { // disable voltage regulator
|
||||
gpio_set(GPIO(BUSVOODOO_12VEN_PORT), GPIO(BUSVOODOO_12VEN_PIN)); // disable 12V voltage regulator
|
||||
dac_disable(BUSVOODOO_12VCTL_CHANNEL); // disable 12V control
|
||||
} else {
|
||||
|
@ -247,7 +247,7 @@ float busvoodoo_vreg_set(uint8_t channel, float voltage)
|
|||
dac_enable(BUSVOODOO_12VCTL_CHANNEL); // enable DAC
|
||||
gpio_clear(GPIO(BUSVOODOO_12VEN_PORT), GPIO(BUSVOODOO_12VEN_PIN)); // enable 12V voltage regulator
|
||||
}
|
||||
sleep_ms(20); // let the voltage regulator start and voltage settle
|
||||
sleep_ms(100); // let the voltage regulator start and voltage settle
|
||||
volt = busvoodoo_vreg_get(BUSVOODOO_12V_CHANNEL); // get 12V voltage
|
||||
} else { // don't know about other voltage regulators
|
||||
volt = NAN;
|
||||
|
@ -313,7 +313,7 @@ static void busvoodoo_global_lv(void* argument) {
|
|||
}
|
||||
float voltage = busvoodoo_vreg_get(BUSVOODOO_XV_CHANNEL); // get xV voltage
|
||||
// print xV voltage
|
||||
if (voltage < 0.01) {
|
||||
if (voltage < 0.1) {
|
||||
printf(": 0.00V\n");
|
||||
} else {
|
||||
printf(": %.2fV\n", voltage);
|
||||
|
@ -327,7 +327,7 @@ static void busvoodoo_global_lv(void* argument) {
|
|||
}
|
||||
voltage = busvoodoo_vreg_set(BUSVOODOO_XV_CHANNEL, voltage); // set xV voltage
|
||||
// print xV voltage
|
||||
if (voltage < 0.01) {
|
||||
if (voltage < 0.1) {
|
||||
printf(": 0.00V\n");
|
||||
} else {
|
||||
printf(": %.2fV\n", voltage);
|
||||
|
@ -347,7 +347,7 @@ static void busvoodoo_global_hv(void* argument) {
|
|||
printf("high voltage regulator switched %s: ", gpio_get(GPIO(BUSVOODOO_12VEN_PORT), GPIO(BUSVOODOO_12VEN_PIN)) ? "off" : "on");
|
||||
float voltage = busvoodoo_vreg_get(BUSVOODOO_12V_CHANNEL); // get 12V voltage
|
||||
// print xV voltage
|
||||
if (voltage < 0.01) {
|
||||
if (voltage < 0.1) {
|
||||
printf(": 0.00V\n");
|
||||
} else {
|
||||
printf(": %.2fV\n", voltage);
|
||||
|
@ -362,7 +362,7 @@ static void busvoodoo_global_hv(void* argument) {
|
|||
}
|
||||
voltage = busvoodoo_vreg_set(BUSVOODOO_12V_CHANNEL, voltage); // set 12V voltage
|
||||
// print xV voltage
|
||||
if (voltage < 0.01) {
|
||||
if (voltage < 0.1) {
|
||||
printf(": 0.00V\n");
|
||||
} else {
|
||||
printf(": %.2fV\n", voltage);
|
||||
|
@ -383,7 +383,7 @@ const struct menu_command_t busvoodoo_global_commands[] = {
|
|||
{
|
||||
'l',
|
||||
"lV",
|
||||
"set voltage on low voltage power rail (0-5V)",
|
||||
"set voltage on low voltage power rail (0, 0.3-4.8, 5V)",
|
||||
MENU_ARGUMENT_FLOAT,
|
||||
"[voltage]",
|
||||
&busvoodoo_global_lv,
|
||||
|
|
Loading…
Reference in New Issue