1.13.19
korekta VoltBar Kosmetyka wyswietlacza zmiana czasu przy wybudzaniu
This commit is contained in:
@@ -7,7 +7,7 @@
|
|||||||
#include <Adafruit_GFX.h>
|
#include <Adafruit_GFX.h>
|
||||||
#include <Adafruit_SSD1306.h>
|
#include <Adafruit_SSD1306.h>
|
||||||
|
|
||||||
#define Version "1.13.17"
|
#define Version "1.13.19"
|
||||||
////2DO:
|
////2DO:
|
||||||
//pomiar napięcia na baterii
|
//pomiar napięcia na baterii
|
||||||
// menu do zmiany zakresu predkosci biegów
|
// menu do zmiany zakresu predkosci biegów
|
||||||
@@ -100,8 +100,8 @@ float voltageDividerRatio = 3.0;
|
|||||||
int adcBattVoltValue = 0;
|
int adcBattVoltValue = 0;
|
||||||
float inputVoltage = 0.0;
|
float inputVoltage = 0.0;
|
||||||
float measuredVoltage = 0.0;
|
float measuredVoltage = 0.0;
|
||||||
|
int voltBarHeight = 0;
|
||||||
|
int voltBarPosition = 0;
|
||||||
void setup() {
|
void setup() {
|
||||||
//SERVO
|
//SERVO
|
||||||
digitalWrite(ServoSwitch, HIGH);
|
digitalWrite(ServoSwitch, HIGH);
|
||||||
@@ -169,7 +169,8 @@ void setup() {
|
|||||||
totalDist = totalDistReaded;
|
totalDist = totalDistReaded;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//########################################### LOOP ############################################################
|
||||||
|
//########################################### LOOP ############################################################
|
||||||
void loop() {
|
void loop() {
|
||||||
|
|
||||||
loopTime = millis();
|
loopTime = millis();
|
||||||
@@ -212,7 +213,7 @@ void loop() {
|
|||||||
|
|
||||||
//duzy font
|
//duzy font
|
||||||
//GEAR
|
//GEAR
|
||||||
display.setCursor(0, 0);
|
display.setCursor(3, 0);
|
||||||
display.println("G:");
|
display.println("G:");
|
||||||
display.setCursor(35, 0);
|
display.setCursor(35, 0);
|
||||||
display.print(currentGear);
|
display.print(currentGear);
|
||||||
@@ -228,8 +229,8 @@ void loop() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//SPEED
|
//SPEED
|
||||||
display.setCursor(0, 40);
|
display.setCursor(3, 40);
|
||||||
display.println("S");
|
display.println("S:");
|
||||||
display.setCursor(35, 40);
|
display.setCursor(35, 40);
|
||||||
display.println(speed, 1);
|
display.println(speed, 1);
|
||||||
//GearBar
|
//GearBar
|
||||||
@@ -251,7 +252,10 @@ void loop() {
|
|||||||
adcBattVoltValue = analogRead(VoltInptPin);
|
adcBattVoltValue = analogRead(VoltInptPin);
|
||||||
measuredVoltage = (adcBattVoltValue * referenceVoltage) / maxADCValue;
|
measuredVoltage = (adcBattVoltValue * referenceVoltage) / maxADCValue;
|
||||||
inputVoltage = measuredVoltage * voltageDividerRatio;
|
inputVoltage = measuredVoltage * voltageDividerRatio;
|
||||||
display.fillRect(0, 63, ((inputVoltage-9)/3.6)*124, 1 , SSD1306_WHITE);
|
|
||||||
|
voltBarHeight = int(((inputVoltage-9)/3.6)*64);
|
||||||
|
voltBarPosition = 64 - voltBarHeight;
|
||||||
|
display.fillRect(0, voltBarPosition, 1, voltBarHeight, SSD1306_WHITE);
|
||||||
//########################################## ZAPIS DO WYŚWIETLACZA ######################################################
|
//########################################## ZAPIS DO WYŚWIETLACZA ######################################################
|
||||||
display.display();
|
display.display();
|
||||||
loopTime = millis();
|
loopTime = millis();
|
||||||
@@ -283,7 +287,8 @@ void loop() {
|
|||||||
loop_cnt = 0;
|
loop_cnt = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//########################################### LOOP ############################################################
|
||||||
|
//########################################### LOOP ############################################################
|
||||||
void calcSpeed() {
|
void calcSpeed() {
|
||||||
lastLastMillisSpd = lastMillisSpd;
|
lastLastMillisSpd = lastMillisSpd;
|
||||||
lastMillisSpd = millissSpd;
|
lastMillisSpd = millissSpd;
|
||||||
@@ -430,7 +435,7 @@ void prepareTurnOff() {
|
|||||||
totalDistWrited = totalDist;
|
totalDistWrited = totalDist;
|
||||||
loop_cnt = 0;
|
loop_cnt = 0;
|
||||||
|
|
||||||
for (; 500 < (millis() - lastMillisSpd);) { // zmiana z 1000 na 500 w 1.13.X
|
for (; 1500 < (millis() - lastMillisSpd);) { // zmiana z 1000 na 1500 w 1.13.X
|
||||||
digitalWrite(ServoSwitch, LOW);
|
digitalWrite(ServoSwitch, LOW);
|
||||||
digitalWrite(ServoPin, LOW);
|
digitalWrite(ServoPin, LOW);
|
||||||
//INFO
|
//INFO
|
||||||
|
|||||||
Reference in New Issue
Block a user