mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-27 12:46:34 +00:00
commit
eecfbd990a
@ -20,6 +20,11 @@
|
|||||||
|
|
||||||
// if using software spi this optimizes the code
|
// if using software spi this optimizes the code
|
||||||
|
|
||||||
|
#ifdef ESP32
|
||||||
|
#define ILI9488_DIMMER
|
||||||
|
#undef ESP32_PWM_CHANNEL
|
||||||
|
#define ESP32_PWM_CHANNEL 1
|
||||||
|
#endif
|
||||||
|
|
||||||
#define ILI9488_START start();
|
#define ILI9488_START start();
|
||||||
#define ILI9488_STOP stop();
|
#define ILI9488_STOP stop();
|
||||||
@ -322,8 +327,13 @@ void ILI9488::DisplayInit(int8_t p,int8_t size,int8_t rot,int8_t font) {
|
|||||||
void ILI9488::DisplayOnff(int8_t on) {
|
void ILI9488::DisplayOnff(int8_t on) {
|
||||||
if (on) {
|
if (on) {
|
||||||
writecommand(ILI9488_DISPON); //Display on
|
writecommand(ILI9488_DISPON); //Display on
|
||||||
|
|
||||||
if (_bp>=0) {
|
if (_bp>=0) {
|
||||||
|
#ifdef ILI9488_DIMMER
|
||||||
|
ledcWrite(ESP32_PWM_CHANNEL,dimmer);
|
||||||
|
#else
|
||||||
digitalWrite(_bp,HIGH);
|
digitalWrite(_bp,HIGH);
|
||||||
|
#endif
|
||||||
/*
|
/*
|
||||||
writecommand(ILI9488_WRCTRLD);
|
writecommand(ILI9488_WRCTRLD);
|
||||||
writedata(0x0c);
|
writedata(0x0c);
|
||||||
@ -332,15 +342,30 @@ void ILI9488::DisplayOnff(int8_t on) {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
writecommand(ILI9488_DISPOFF);
|
writecommand(ILI9488_DISPOFF);
|
||||||
|
|
||||||
if (_bp>=0) {
|
if (_bp>=0) {
|
||||||
|
#ifdef ILI9488_DIMMER
|
||||||
|
ledcWrite(ESP32_PWM_CHANNEL,0);
|
||||||
|
#else
|
||||||
digitalWrite(_bp,LOW);
|
digitalWrite(_bp,LOW);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
//writecommand(ILI9488_WRCTRLD);
|
//writecommand(ILI9488_WRCTRLD);
|
||||||
//writedata(0x04);
|
//writedata(0x04);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
ILI9488_STOP
|
ILI9488_STOP
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// dimmer 0-100
|
||||||
|
void ILI9488::dim(uint8_t dim) {
|
||||||
|
dimmer = dim;
|
||||||
|
if (dimmer>15) dimmer=15;
|
||||||
|
dimmer=((float)dimmer/15.0)*255.0;
|
||||||
|
#ifdef ESP32
|
||||||
|
ledcWrite(ESP32_PWM_CHANNEL,dimmer);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void ILI9488::begin(void) {
|
void ILI9488::begin(void) {
|
||||||
pinMode(_cs, OUTPUT);
|
pinMode(_cs, OUTPUT);
|
||||||
@ -348,8 +373,14 @@ void ILI9488::begin(void) {
|
|||||||
pinMode(_sclk, OUTPUT);
|
pinMode(_sclk, OUTPUT);
|
||||||
pinMode(_mosi, OUTPUT);
|
pinMode(_mosi, OUTPUT);
|
||||||
if (_bp>=0) {
|
if (_bp>=0) {
|
||||||
pinMode(_bp, OUTPUT);
|
#ifdef ILI9488_DIMMER
|
||||||
digitalWrite(_bp,HIGH);
|
ledcSetup(ESP32_PWM_CHANNEL,4000,8);
|
||||||
|
ledcAttachPin(_bp,ESP32_PWM_CHANNEL);
|
||||||
|
ledcWrite(ESP32_PWM_CHANNEL,128);
|
||||||
|
#else
|
||||||
|
pinMode(_bp, OUTPUT);
|
||||||
|
digitalWrite(_bp,HIGH);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef ESP32
|
#ifndef ESP32
|
||||||
|
@ -157,10 +157,11 @@ class ILI9488 : public Renderer {
|
|||||||
void write16BitColor(uint16_t color);
|
void write16BitColor(uint16_t color);
|
||||||
void commandList(uint8_t *addr);
|
void commandList(uint8_t *addr);
|
||||||
void hw_spi_init();
|
void hw_spi_init();
|
||||||
|
void dim(uint8_t contrast);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint8_t tabcolor;
|
uint8_t tabcolor;
|
||||||
|
uint8_t dimmer;
|
||||||
void fastSPIwrite(uint8_t d,uint8_t dc);
|
void fastSPIwrite(uint8_t d,uint8_t dc);
|
||||||
void spi_lcd_mode_init(void);
|
void spi_lcd_mode_init(void);
|
||||||
void start(void);
|
void start(void);
|
||||||
|
@ -402,10 +402,15 @@ void xsend_message_txt(char *msg) {
|
|||||||
g_client->print(F("\r\n--frontier\r\n"));
|
g_client->print(F("\r\n--frontier\r\n"));
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
g_client->print(F("--frontier\r\n"));
|
if (*msg=='&') {
|
||||||
g_client->print(F("Content-Type: text/plain\r\n\r\n"));
|
msg++;
|
||||||
g_client->println(msg);
|
attach_Array(msg);
|
||||||
g_client->print(F("\r\n--frontier\r\n"));
|
} else {
|
||||||
|
g_client->print(F("--frontier\r\n"));
|
||||||
|
g_client->print(F("Content-Type: text/plain\r\n\r\n"));
|
||||||
|
g_client->println(msg);
|
||||||
|
g_client->print(F("\r\n--frontier\r\n"));
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -439,6 +444,8 @@ void attach_File(char *path) {
|
|||||||
g_client->print(F("\r\n--frontier\r\n"));
|
g_client->print(F("\r\n--frontier\r\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // defined(USE_SCRIPT_FATFS) && defined(USE_SCRIPT)
|
||||||
|
|
||||||
float *get_array_by_name(char *name, uint16_t *alen);
|
float *get_array_by_name(char *name, uint16_t *alen);
|
||||||
void flt2char(float num, char *nbuff);
|
void flt2char(float num, char *nbuff);
|
||||||
|
|
||||||
@ -473,8 +480,6 @@ void attach_Array(char *aname) {
|
|||||||
g_client->print(F("\r\n--frontier\r\n"));
|
g_client->print(F("\r\n--frontier\r\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // defined(USE_SCRIPT_FATFS) && defined(USE_SCRIPT)
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
|
||||||
|
@ -3708,6 +3708,7 @@ void esp32_beep(int32_t freq ,uint32_t len) {
|
|||||||
#define IF_NEST 8
|
#define IF_NEST 8
|
||||||
// execute section of scripter
|
// execute section of scripter
|
||||||
int16_t Run_Scripter(const char *type, int8_t tlen, char *js) {
|
int16_t Run_Scripter(const char *type, int8_t tlen, char *js) {
|
||||||
|
int16_t retval;
|
||||||
|
|
||||||
if (!glob_script_mem.scriptptr) {
|
if (!glob_script_mem.scriptptr) {
|
||||||
return -99;
|
return -99;
|
||||||
@ -3717,12 +3718,15 @@ int16_t Run_Scripter(const char *type, int8_t tlen, char *js) {
|
|||||||
|
|
||||||
JsonParserObject jo;
|
JsonParserObject jo;
|
||||||
if (js) {
|
if (js) {
|
||||||
String jss = js; // copy the string to a new buffer, not sure we can change the original buffer
|
//String jss = js; // copy the string to a new buffer, not sure we can change the original buffer
|
||||||
JsonParser parser((char*)jss.c_str());
|
//JsonParser parser((char*)jss.c_str());
|
||||||
|
JsonParser parser(js);
|
||||||
jo = parser.getRootObject();
|
jo = parser.getRootObject();
|
||||||
|
retval = Run_script_sub(type, tlen, &jo);
|
||||||
|
} else {
|
||||||
|
retval = Run_script_sub(type, tlen, 0);
|
||||||
}
|
}
|
||||||
|
return retval;
|
||||||
return Run_script_sub(type, tlen, &jo);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t Run_script_sub(const char *type, int8_t tlen, JsonParserObject *jo) {
|
int16_t Run_script_sub(const char *type, int8_t tlen, JsonParserObject *jo) {
|
||||||
|
@ -54,6 +54,8 @@ AudioFileSourceID3 *id3;
|
|||||||
AudioGeneratorMP3 *decoder = NULL;
|
AudioGeneratorMP3 *decoder = NULL;
|
||||||
void *mp3ram = NULL;
|
void *mp3ram = NULL;
|
||||||
|
|
||||||
|
#define I2SAUDIO_TASK_STACK_SIZE 8192
|
||||||
|
|
||||||
|
|
||||||
#ifdef ESP8266
|
#ifdef ESP8266
|
||||||
const int preallocateBufferSize = 5*1024;
|
const int preallocateBufferSize = 5*1024;
|
||||||
@ -189,6 +191,7 @@ void sayTime(int hour, int minutes, AudioGeneratorTalkie *talkie) {
|
|||||||
} else {
|
} else {
|
||||||
talkie->say(spA_M_, sizeof(spA_M_));
|
talkie->say(spA_M_, sizeof(spA_M_));
|
||||||
}
|
}
|
||||||
|
out->stop();
|
||||||
delete talkie;
|
delete talkie;
|
||||||
TTGO_PWR_OFF
|
TTGO_PWR_OFF
|
||||||
}
|
}
|
||||||
@ -293,7 +296,7 @@ void Webradio(const char *url) {
|
|||||||
retryms = millis() + 2000;
|
retryms = millis() + 2000;
|
||||||
}
|
}
|
||||||
|
|
||||||
xTaskCreatePinnedToCore(mp3_task2, "MP3-2", 8192, NULL, 3, &mp3_task_h, 1);
|
xTaskCreatePinnedToCore(mp3_task2, "MP3-2", I2SAUDIO_TASK_STACK_SIZE, NULL, 3, &mp3_task_h, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void mp3_task2(void *arg){
|
void mp3_task2(void *arg){
|
||||||
@ -373,25 +376,27 @@ void Play_mp3(const char *path) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
file = new AudioFileSourceFS(*fsp,path);
|
file = new AudioFileSourceFS(*fsp,path);
|
||||||
id3 = new AudioFileSourceID3(file);
|
if (file->isOpen()) {
|
||||||
|
id3 = new AudioFileSourceID3(file);
|
||||||
|
|
||||||
if (mp3ram) {
|
if (mp3ram) {
|
||||||
mp3 = new AudioGeneratorMP3(mp3ram, preallocateCodecSize);
|
mp3 = new AudioGeneratorMP3(mp3ram, preallocateCodecSize);
|
||||||
} else {
|
} else {
|
||||||
mp3 = new AudioGeneratorMP3();
|
mp3 = new AudioGeneratorMP3();
|
||||||
}
|
}
|
||||||
mp3->begin(id3, out);
|
mp3->begin(id3, out);
|
||||||
|
|
||||||
if (I2S_Task) {
|
if (I2S_Task) {
|
||||||
xTaskCreatePinnedToCore(mp3_task, "MP3", 8192, NULL, 3, &mp3_task_h, 1);
|
xTaskCreatePinnedToCore(mp3_task, "MP3", I2SAUDIO_TASK_STACK_SIZE, NULL, 3, &mp3_task_h, 1);
|
||||||
} else {
|
} else {
|
||||||
while (mp3->isRunning()) {
|
while (mp3->isRunning()) {
|
||||||
if (!mp3->loop()) {
|
if (!mp3->loop()) {
|
||||||
mp3->stop();
|
mp3->stop();
|
||||||
mp3_delete();
|
mp3_delete();
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
OsWatchLoop();
|
||||||
}
|
}
|
||||||
OsWatchLoop();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user