Merge branch 'main' into cud
This commit is contained in:
commit
94bf181692
|
@ -24,7 +24,7 @@
|
|||
#include <WebServer.h>
|
||||
#include <Update.h>
|
||||
#endif
|
||||
#include "lcd.hpp"
|
||||
#include "espmega_iot_lcd.hpp"
|
||||
|
||||
#ifdef ENABLE_CLIMATE_MODULE
|
||||
#include "ir_codes.hpp"
|
||||
|
|
|
@ -0,0 +1,73 @@
|
|||
#include <user_code.hpp>
|
||||
#include <espmega_iot_lcd.hpp>
|
||||
|
||||
void lcd_send_stop_bit()
|
||||
{
|
||||
#ifdef ENABLE_INTERNAL_LCD
|
||||
Serial.write(0xFF);
|
||||
Serial.write(0xFF);
|
||||
Serial.write(0xFF);
|
||||
#endif
|
||||
}
|
||||
|
||||
void lcd_send_command(String command)
|
||||
{
|
||||
#ifdef ENABLE_INTERNAL_LCD
|
||||
lcd_send_stop_bit();
|
||||
Serial.print(command);
|
||||
lcd_send_stop_bit();
|
||||
#endif
|
||||
}
|
||||
|
||||
void lcd_reset()
|
||||
{
|
||||
#ifdef ENABLE_INTERNAL_LCD
|
||||
lcd_send_stop_bit();
|
||||
lcd_send_command("rest");
|
||||
lcd_send_stop_bit();
|
||||
#endif
|
||||
}
|
||||
|
||||
void lcd_init()
|
||||
{
|
||||
#ifdef ENABLE_INTERNAL_LCD
|
||||
lcd_reset();
|
||||
delay(750);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool lcd_upload_start(size_t size)
|
||||
{
|
||||
Serial.begin(115200);
|
||||
lcd_send_stop_bit();
|
||||
Serial.print("rest");
|
||||
lcd_send_stop_bit();
|
||||
Serial.print("connect");
|
||||
lcd_send_stop_bit();
|
||||
delay(1000);
|
||||
Serial.print("whmi-wri 1024,115200,res0");
|
||||
lcd_send_stop_bit();
|
||||
lcd_wait_ack();
|
||||
}
|
||||
bool lcd_upload_write(uint8_t *data, size_t size)
|
||||
{
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
Serial.write(data[i]);
|
||||
}
|
||||
}
|
||||
|
||||
bool lcd_wait_ack()
|
||||
{
|
||||
bool data_ok = false;
|
||||
for (int i; i < 50; i++)
|
||||
{
|
||||
if (Serial.read() == 0x05)
|
||||
{
|
||||
data_ok = true;
|
||||
break;
|
||||
}
|
||||
delay(100);
|
||||
}
|
||||
return data_ok;
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
#pragma once
|
||||
|
||||
#include <ESPMegaPRO.h>
|
||||
|
||||
|
||||
void lcd_send_stop_bit();
|
||||
void lcd_send_command(String command);
|
||||
String lcd_wait_response();
|
||||
void lcd_reset();
|
||||
void lcd_init();
|
||||
|
||||
bool lcd_upload_start(size_t size);
|
||||
bool lcd_upload_write(uint8_t* data, size_t size);
|
||||
bool lcd_wait_ack();
|
37
src/lcd.cpp
37
src/lcd.cpp
|
@ -1,37 +0,0 @@
|
|||
#include <user_code.hpp>
|
||||
#include <lcd.hpp>
|
||||
|
||||
void lcd_send_stop_bit()
|
||||
{
|
||||
#ifdef ENABLE_INTERNAL_LCD
|
||||
Serial.write(0xFF);
|
||||
Serial.write(0xFF);
|
||||
Serial.write(0xFF);
|
||||
#endif
|
||||
}
|
||||
|
||||
void lcd_send_command(String command)
|
||||
{
|
||||
#ifdef ENABLE_INTERNAL_LCD
|
||||
lcd_send_stop_bit();
|
||||
Serial.print(command);
|
||||
lcd_send_stop_bit();
|
||||
#endif
|
||||
}
|
||||
|
||||
void lcd_reset()
|
||||
{
|
||||
#ifdef ENABLE_INTERNAL_LCD
|
||||
lcd_send_stop_bit();
|
||||
lcd_send_command("rest");
|
||||
lcd_send_stop_bit();
|
||||
#endif
|
||||
}
|
||||
|
||||
void lcd_init()
|
||||
{
|
||||
#ifdef ENABLE_INTERNAL_LCD
|
||||
lcd_reset();
|
||||
delay(750);
|
||||
#endif
|
||||
}
|
11
src/lcd.hpp
11
src/lcd.hpp
|
@ -1,11 +0,0 @@
|
|||
#ifndef EMG_LCD_ENABLED
|
||||
#include <Arduino.h>
|
||||
|
||||
#define EMG_LCD_ENABLED
|
||||
|
||||
void lcd_send_stop_bit();
|
||||
void lcd_send_command(String command);
|
||||
String lcd_wait_response();
|
||||
void lcd_reset();
|
||||
void lcd_init();
|
||||
#endif
|
Loading…
Reference in New Issue