Merge pull request #9285 from gemu2015/scripter-update

Scripter update
This commit is contained in:
Theo Arends 2020-09-11 16:13:53 +02:00 committed by GitHub
commit e9ee4e8689
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 2097 additions and 2069 deletions

File diff suppressed because it is too large Load Diff

View File

@ -506,7 +506,7 @@ void DisplayText(void)
}
}
break;
#endif
#endif // USE_SCRIPT_FATFS
case 'h':
// hor line to
var = atoiv(cp, &temp);
@ -696,7 +696,7 @@ void DisplayText(void)
Restore_graph(temp,bbuff);
break;
}
#endif
#endif // USE_SCRIPT_FATFS
{ int16_t num,gxp,gyp,gxs,gys,dec,icol;
float ymin,ymax;
var=atoiv(cp,&num);
@ -744,7 +744,7 @@ void DisplayText(void)
AddValue(num,temp);
}
break;
#endif
#endif // USE_GRAPH
#ifdef USE_AWATCH
case 'w':
@ -752,7 +752,7 @@ void DisplayText(void)
cp += var;
DrawAClock(temp);
break;
#endif
#endif // USE_AWATCH
#ifdef USE_TOUCH_BUTTONS
case 'b':
@ -834,12 +834,13 @@ void DisplayText(void)
buttons[num]->vpower.is_pushbutton=0;
}
if (dflg) buttons[num]->xdrawButton(buttons[num]->vpower.on_off);
buttons[num]->vpower.disable=!dflg;
}
}
}
}
break;
#endif
#endif // USE_TOUCH_BUTTONS
default:
// unknown escape
Response_P(PSTR("Unknown Escape"));
@ -1530,8 +1531,8 @@ void CmndDisplayRows(void)
bool jpg2rgb888(const uint8_t *src, size_t src_len, uint8_t * out, jpg_scale_t scale);
char get_jpeg_size(unsigned char* data, unsigned int data_size, unsigned short *width, unsigned short *height);
void rgb888_to_565(uint8_t *in, uint16_t *out, uint32_t len);
#endif
#endif
#endif // JPEG_PICTS
#endif // ESP32
#if defined(USE_SCRIPT_FATFS) && defined(USE_SCRIPT)
extern FS *fsp;
@ -1626,7 +1627,7 @@ void Draw_RGB_Bitmap(char *file,uint16_t xp, uint16_t yp) {
#endif // ESP32
}
}
#endif
#endif // USE_SCRIPT_FATFS
#ifdef USE_AWATCH
#define MINUTE_REDUCT 4
@ -1663,7 +1664,7 @@ void DrawAClock(uint16_t rad) {
temp=((float)RtcTime.minute*(pi/30.0)-(pi/2.0));
renderer->writeLine(disp_xpos, disp_ypos,disp_xpos+(frad-MINUTE_REDUCT)*cosf(temp),disp_ypos+(frad-MINUTE_REDUCT)*sinf(temp), fg_color);
}
#endif
#endif // USE_AWATCH
#ifdef USE_GRAPH
@ -1938,7 +1939,7 @@ void Restore_graph(uint8_t num, char *path) {
fp.close();
RedrawGraph(num,1);
}
#endif
#endif // USE_SCRIPT_FATFS
void RedrawGraph(uint8_t num, uint8_t flags) {
uint16_t index=num%NUM_GRAPHS;
@ -2050,16 +2051,13 @@ void AddValue(uint8_t num,float fval) {
#ifdef USE_FT5206
#include <FT5206.h>
// touch panel controller
#undef FT5206_address
#define FT5206_address 0x38
#include <FT5206.h>
FT5206_Class *touchp;
TP_Point pLoc;
extern VButton *buttons[];
bool FT5206_found;
bool Touch_Init(TwoWire &i2c) {
@ -2088,6 +2086,7 @@ uint32_t Touch_Status(uint32_t sel) {
}
}
#ifdef USE_TOUCH_BUTTONS
void Touch_MQTT(uint8_t index, const char *cp) {
ResponseTime_P(PSTR(",\"FT5206\":{\"%s%d\":\"%d\"}}"), cp, index+1, buttons[index]->vpower.on_off);
@ -2184,6 +2183,7 @@ uint8_t vbutt=0;
pLoc.y = 0;
}
}
#endif // USE_TOUCH_BUTTONS
#endif // USE_FT5206

View File

@ -52,7 +52,7 @@ AudioFileSourceFS *file;
AudioOutputI2S *out;
AudioFileSourceID3 *id3;
AudioGeneratorMP3 *decoder = NULL;
void *mp3ram = NULL;
#ifdef USE_WEBRADIO
AudioFileSourceICYStream *ifile = NULL;
@ -210,6 +210,12 @@ void I2S_Init(void) {
is2_volume=10;
out->SetGain(((float)is2_volume/100.0)*4.0);
out->stop();
mp3ram = nullptr;
#ifdef ESP32
if (psramFound()) {
mp3ram = heap_caps_malloc(preallocateCodecSize, MALLOC_CAP_SPIRAM | MALLOC_CAP_8BIT);
}
#ifdef USE_WEBRADIO
if (psramFound()) {
@ -223,6 +229,7 @@ void I2S_Init(void) {
//Serial.printf_P(PSTR("FATAL ERROR: Unable to preallocate %d bytes for app\n"), preallocateBufferSize+preallocateCodecSize);
}
#endif // USE_WEBRADIO
#endif // ESP32
}
#ifdef ESP32
@ -285,7 +292,7 @@ void Webradio(const char *url) {
retryms = millis() + 2000;
}
xTaskCreatePinnedToCore(mp3_task2, "MP3", 8192, NULL, 3, &mp3_task_h, 1);
xTaskCreatePinnedToCore(mp3_task2, "MP3-2", 8192, NULL, 3, &mp3_task_h, 1);
}
void mp3_task2(void *arg){
@ -366,7 +373,12 @@ void Play_mp3(const char *path) {
file = new AudioFileSourceFS(*fsp,path);
id3 = new AudioFileSourceID3(file);
mp3 = new AudioGeneratorMP3();
if (mp3ram) {
mp3 = new AudioGeneratorMP3(mp3ram, preallocateCodecSize);
} else {
mp3 = new AudioGeneratorMP3();
}
mp3->begin(id3, out);
if (I2S_Task) {