Adding pages, moving values back and forth and displaying, fixed voltage display
This commit is contained in:
@ -35,7 +35,9 @@ float speed = 0;
|
||||
uint8_t sendTemperature = 0;
|
||||
uint8_t sendTemperatureDecimals = 0;
|
||||
uint8_t sendVoltage = 0;
|
||||
uint8_t sendSpeed = 0;
|
||||
uint8_t sendVoltageDecimals = 0;
|
||||
uint8_t sendRPMupper = 1;
|
||||
uint8_t sendRPMlower = 2;
|
||||
|
||||
//#define pairingMode
|
||||
#define CONNECTION_TIMEOUT 300
|
||||
@ -71,7 +73,8 @@ void OnDataRecv(const uint8_t *mac_addr, const uint8_t *data, int data_len) {
|
||||
Serial.print("Last Packet Recv Data: "); Serial.println(recData[0]); Serial.print(" "); Serial.print(recData[1]); Serial.print(" len:"); Serial.println(data_len);
|
||||
|
||||
// Answer with response
|
||||
const uint8_t respData[] = { sendTemperature, sendTemperatureDecimals, sendVoltage }; // sendSpeed
|
||||
|
||||
const uint8_t respData[] = { sendVoltage, sendVoltageDecimals, sendTemperature, sendTemperatureDecimals, sendRPMupper, sendRPMlower };
|
||||
Serial.print("Sending RESPONSE.... ");
|
||||
esp_err_t result = esp_now_send(mac_addr, respData, sizeof(data));
|
||||
if (result == ESP_OK) {
|
||||
@ -187,8 +190,8 @@ void checkTemperature() {
|
||||
Serial.println(temperature);
|
||||
if(temperature < 35) digitalWrite(fanRelais, LOW);
|
||||
if(temperature > 40) digitalWrite(fanRelais, HIGH);
|
||||
sendTemperature = (uint16_t) temperature;
|
||||
sendTemperatureDecimals = (uint16_t)(temperature - sendTemperature) *100;
|
||||
sendTemperature = abs(floor(temperature));
|
||||
sendTemperatureDecimals = (temperature - sendTemperature) * 100;
|
||||
}
|
||||
|
||||
void setup() {
|
||||
|
Reference in New Issue
Block a user