fixing serial input not taking effect immediately #bugfix
Not a complete fix, still needs work
This commit is contained in:
parent
d30c60639c
commit
4076423e1b
2 changed files with 17 additions and 1 deletions
|
|
@ -1,3 +1,5 @@
|
|||
//#pragma once
|
||||
//#include "pP_function.h"
|
||||
#include "pP_config.h"
|
||||
#include <EEPROM.h>
|
||||
|
||||
|
|
@ -76,7 +78,7 @@ void restoreConfig() {
|
|||
|
||||
EEPROM.get(LOGIC_ADDRESS, temp);
|
||||
if (temp < 0 || temp > 1) {
|
||||
reset = true;
|
||||
erase = true;
|
||||
} else {
|
||||
LOGIC = temp;
|
||||
}
|
||||
|
|
@ -92,6 +94,9 @@ void restoreConfig() {
|
|||
if (erase) {
|
||||
eraseEEPROM();
|
||||
}
|
||||
|
||||
adjustFollow();
|
||||
adjustComp();
|
||||
}
|
||||
|
||||
void setDefaultConfig() {
|
||||
|
|
@ -103,4 +108,6 @@ void setDefaultConfig() {
|
|||
Hyst = HYST_DEFAULT;
|
||||
LOGIC = LOGIC_DEFAULT;
|
||||
voltMeterConstant = VM_CONST_DEFAULT;
|
||||
adjustFollow();
|
||||
adjustComp();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,9 @@
|
|||
Created by Alan "pyr0ball" Weinstock 6/26/2019
|
||||
*/
|
||||
|
||||
//#pragma once
|
||||
//#include "pP_function.h"
|
||||
|
||||
void digitalWriteFast(uint8_t pin, uint8_t x) {
|
||||
if (pin / 8) { // pin >= 8
|
||||
PORTB ^= (-x ^ PORTB) & (1 << (pin % 8));
|
||||
|
|
@ -95,6 +98,9 @@ update the voltMeterConstant variable in pP_config.h with the correct value
|
|||
/* Compares diffs of threshold vs read value
|
||||
if positive, adjusts the follower to within
|
||||
the range set above*/
|
||||
followerLong = followerThrs * 1023L;
|
||||
followerInt = (long long) followerLong / Vin;
|
||||
followerInt = (int) followerInt;
|
||||
ADJ_FOLLOW = (followerInt / 4);
|
||||
|
||||
// Analog output (PWM) of duty cycle
|
||||
|
|
@ -104,6 +110,9 @@ update the voltMeterConstant variable in pP_config.h with the correct value
|
|||
/*------------------------------------------------*/
|
||||
|
||||
void adjustComp() {
|
||||
compLong = compThrs * 1023L;
|
||||
compInt = (long long) compLong / Vin;
|
||||
compInt = (int) compInt;
|
||||
OCR1A = compInt;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue