1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-15 20:35:17 +03:00

Bsongis/lua interpreter added on x7d (#3999)

* [X7D] Lua option added (only standalone scripts)

* [X7D] Compilation fix

* [X7D] Compilation fix

* [X7D] Compilation fix

* [X7D] Compilation fix
This commit is contained in:
Bertrand Songis 2016-11-10 21:41:16 +01:00 committed by GitHub
parent 35571ad4d1
commit d58244ebde
23 changed files with 174 additions and 120 deletions

View file

@ -401,6 +401,7 @@ int cliSet(const char ** argv)
serialPrint("%s: Invalid arguments \"%s\" \"%s\"", argv[0], argv[1], argv[2]);
}
}
#if !defined(SOFTWARE_VOLUME)
else if (!strcmp(argv[1], "volume")) {
int level = 0;
if (toInt(argv, 2, &level) > 0) {
@ -411,6 +412,7 @@ int cliSet(const char ** argv)
}
return 0;
}
#endif
return 0;
}
@ -589,9 +591,11 @@ int cliDisplay(const char ** argv)
gettime(&utm);
serialPrint("rtc = %4d-%02d-%02d %02d:%02d:%02d.%02d0", utm.tm_year+TM_YEAR_BASE, utm.tm_mon+1, utm.tm_mday, utm.tm_hour, utm.tm_min, utm.tm_sec, g_ms100);
}
#if !defined(SOFTWARE_VOLUME)
else if (!strcmp(argv[1], "volume")) {
serialPrint("volume = %d", getVolume());
}
#endif
#if defined(STM32)
else if (!strcmp(argv[1], "uid")) {
char str[LEN_CPU_UID+1];

View file

@ -404,6 +404,15 @@ void drawStatusLine();
#define EDIT_MODE_INIT -1
#endif
#if defined(VIRTUAL_INPUTS)
uint8_t getExposCount();
void insertExpo(uint8_t idx);
void deleteExpo(uint8_t idx);
uint8_t getMixesCount();
void insertMix(uint8_t idx);
void deleteMix(uint8_t idx);
#endif
typedef int (*FnFuncP) (int x);
void drawFunction(FnFuncP fn, uint8_t offset=0);

View file

@ -608,7 +608,7 @@ void lcdDrawNumber(coord_t x, coord_t y, lcdint_t val, LcdFlags flags, uint8_t l
}
else {
// TODO needed on CPUAVR? y &= ~0x07;
lcdDrawFilledRect(xn, y+2*FH-3, ln, 2);
lcdDrawSolidFilledRect(xn, y+2*FH-3, ln, 2);
}
}
if (neg) lcdDrawChar(x, y, '-', flags);
@ -665,6 +665,40 @@ void lcdDrawLine(coord_t x1, coord_t y1, coord_t x2, coord_t y2, uint8_t pat, Lc
}
#endif
#if defined(CPUM64)
void lcdDrawVerticalLine(coord_t x, int8_t y, int8_t h, uint8_t pat)
{
if (x >= LCD_W) return;
if (h<0) { y+=h; h=-h; }
if (y<0) { h+=y; y=0; }
if (y+h > LCD_H) { h = LCD_H - y; }
if (pat==DOTTED && !(y%2))
pat = ~pat;
uint8_t *p = &displayBuf[ y / 8 * LCD_W + x ];
y = (y & 0x07);
if (y) {
ASSERT_IN_DISPLAY(p);
*p ^= ~(BITMASK(y)-1) & pat;
p += LCD_W;
h -= 8-y;
}
while (h>0) {
ASSERT_IN_DISPLAY(p);
*p ^= pat;
p += LCD_W;
h -= 8;
}
if (h < 0) h += 8;
if (h) {
p -= LCD_W;
ASSERT_IN_DISPLAY(p);
*p ^= ~(BITMASK(h)-1) & pat;
}
}
void lcdDrawSolidVerticalLine(coord_t x, scoord_t y, scoord_t h)
{
lcdDrawVerticalLine(x, y, h, SOLID);
@ -678,6 +712,59 @@ void lcdDrawRect(coord_t x, coord_t y, coord_t w, coord_t h, uint8_t pat, LcdFla
lcdDrawHorizontalLine(x, y+h-1, w, pat);
lcdDrawHorizontalLine(x, y, w, pat);
}
#else
void lcdDrawVerticalLine(coord_t x, scoord_t y, scoord_t h, uint8_t pat, LcdFlags att)
{
if (x >= LCD_W) return;
#if defined(CPUARM)
// should never happen on 9X
if (y >= LCD_H) return;
#endif
if (h<0) { y+=h; h=-h; }
if (y<0) { h+=y; y=0; }
if (y+h > LCD_H) { h = LCD_H - y; }
if (pat==DOTTED && !(y%2))
pat = ~pat;
uint8_t *p = &displayBuf[ y / 8 * LCD_W + x ];
y = (y & 0x07);
if (y) {
ASSERT_IN_DISPLAY(p);
uint8_t msk = ~(BITMASK(y)-1);
h -= 8-y;
if (h < 0)
msk -= ~(BITMASK(8+h)-1);
lcdMaskPoint(p, msk & pat, att);
p += LCD_W;
}
while (h>=8) {
ASSERT_IN_DISPLAY(p);
lcdMaskPoint(p, pat, att);
p += LCD_W;
h -= 8;
}
if (h>0) {
ASSERT_IN_DISPLAY(p);
lcdMaskPoint(p, (BITMASK(h)-1) & pat, att);
}
}
void lcdDrawSolidVerticalLine(coord_t x, scoord_t y, scoord_t h, LcdFlags att)
{
lcdDrawVerticalLine(x, y, h, SOLID, att);
}
void lcdDrawRect(coord_t x, coord_t y, coord_t w, coord_t h, uint8_t pat, LcdFlags att)
{
lcdDrawVerticalLine(x, y, h, pat, att);
lcdDrawVerticalLine(x+w-1, y, h, pat, att);
if (~att & ROUND) { x+=1; w-=2; }
lcdDrawHorizontalLine(x, y+h-1, w, pat, att);
lcdDrawHorizontalLine(x, y, w, pat, att);
}
#endif
#if !defined(BOOT)
void lcdDrawFilledRect(coord_t x, scoord_t y, coord_t w, coord_t h, uint8_t pat, LcdFlags att)
@ -781,7 +868,7 @@ void drawSource(coord_t x, coord_t y, uint32_t idx, LcdFlags att)
}
else if (idx <= MIXSRC_LAST_INPUT) {
lcdDrawChar(x+2, y+1, CHR_INPUT, TINSIZE);
lcdDrawFilledRect(x, y, 7, 7);
lcdDrawSolidFilledRect(x, y, 7, 7);
if (ZEXIST(g_model.inputNames[idx-MIXSRC_FIRST_INPUT]))
lcdDrawSizedText(x+8, y, g_model.inputNames[idx-MIXSRC_FIRST_INPUT], LEN_INPUT_NAME, ZCHAR|att);
else
@ -1411,43 +1498,6 @@ void lcdDrawChar(coord_t x, uint8_t y, const unsigned char c, LcdFlags flags)
}
#endif
#if defined(CPUM64)
void lcdDrawVerticalLine(coord_t x, int8_t y, int8_t h, uint8_t pat)
{
if (x >= LCD_W) return;
if (h<0) { y+=h; h=-h; }
if (y<0) { h+=y; y=0; }
if (y+h > LCD_H) { h = LCD_H - y; }
if (pat==DOTTED && !(y%2))
pat = ~pat;
uint8_t *p = &displayBuf[ y / 8 * LCD_W + x ];
y = (y & 0x07);
if (y) {
ASSERT_IN_DISPLAY(p);
*p ^= ~(BITMASK(y)-1) & pat;
p += LCD_W;
h -= 8-y;
}
while (h>0) {
ASSERT_IN_DISPLAY(p);
*p ^= pat;
p += LCD_W;
h -= 8;
}
if (h < 0) h += 8;
if (h) {
p -= LCD_W;
ASSERT_IN_DISPLAY(p);
*p ^= ~(BITMASK(h)-1) & pat;
}
}
#else
// allows the att parameter...
#endif
#define LCD_IMG_FUNCTION(NAME, TYPE, READ_BYTE) \
void NAME(coord_t x, coord_t y, TYPE img, uint8_t idx, LcdFlags att) \
{ \
@ -1523,44 +1573,6 @@ void lcdDrawHorizontalLine(coord_t x, coord_t y, coord_t w, uint8_t pat, LcdFlag
}
}
void lcdDrawVerticalLine(coord_t x, scoord_t y, scoord_t h, uint8_t pat, LcdFlags att)
{
if (x >= LCD_W) return;
#if defined(CPUARM)
// should never happen on 9X
if (y >= LCD_H) return;
#endif
if (h<0) { y+=h; h=-h; }
if (y<0) { h+=y; y=0; }
if (y+h > LCD_H) { h = LCD_H - y; }
if (pat==DOTTED && !(y%2))
pat = ~pat;
uint8_t *p = &displayBuf[ y / 8 * LCD_W + x ];
y = (y & 0x07);
if (y) {
ASSERT_IN_DISPLAY(p);
uint8_t msk = ~(BITMASK(y)-1);
h -= 8-y;
if (h < 0)
msk -= ~(BITMASK(8+h)-1);
lcdMaskPoint(p, msk & pat, att);
p += LCD_W;
}
while (h>=8) {
ASSERT_IN_DISPLAY(p);
lcdMaskPoint(p, pat, att);
p += LCD_W;
h -= 8;
}
if (h>0) {
ASSERT_IN_DISPLAY(p);
lcdMaskPoint(p, (BITMASK(h)-1) & pat, att);
}
}
#if defined(PWR_PRESS_BUTTON)
void drawShutdownAnimation(uint32_t index)
{

View file

@ -226,10 +226,11 @@ void lcdDrawPoint(coord_t x, coord_t y, LcdFlags att=0);
void lcdMaskPoint(uint8_t *p, uint8_t mask, LcdFlags att=0);
void lcdDrawSolidHorizontalLine(coord_t x, coord_t y, coord_t w, LcdFlags att=0);
void lcdDrawHorizontalLine(coord_t x, coord_t y, coord_t w, uint8_t pat, LcdFlags att=0);
void lcdDrawSolidVerticalLine(coord_t x, scoord_t y, scoord_t h);
#if defined(CPUM64)
void lcdDrawSolidVerticalLine(coord_t x, scoord_t y, scoord_t h);
void lcdDrawVerticalLine(coord_t x, scoord_t y, int8_t h, uint8_t pat);
#else
void lcdDrawSolidVerticalLine(coord_t x, scoord_t y, scoord_t h, LcdFlags att=0);
void lcdDrawVerticalLine(coord_t x, scoord_t y, scoord_t h, uint8_t pat, LcdFlags att=0);
#endif
@ -237,7 +238,11 @@ void lcdDrawSolidVerticalLine(coord_t x, scoord_t y, scoord_t h);
void lcdDrawLine(coord_t x1, coord_t y1, coord_t x2, coord_t y2, uint8_t pat=SOLID, LcdFlags att=0);
#endif
void lcdDrawFilledRect(coord_t x, scoord_t y, coord_t w, coord_t h, uint8_t pat=SOLID, LcdFlags att=0);
void lcdDrawFilledRect(coord_t x, scoord_t y, coord_t w, coord_t h, uint8_t pat, LcdFlags att=0);
inline void lcdDrawSolidFilledRect(coord_t x, scoord_t y, coord_t w, coord_t h, LcdFlags att=0)
{
lcdDrawFilledRect(x, y, w, h, SOLID, att);
}
void lcdDrawRect(coord_t x, coord_t y, coord_t w, coord_t h, uint8_t pat=SOLID, LcdFlags att=0);
void lcdInvertLine(int8_t line);

View file

@ -540,7 +540,7 @@ void menuModelExposAll(event_t event)
}
if (cur == sub) {
/* invert the raw when it's the current one */
lcdDrawFilledRect(EXPO_LINE_SELECT_POS+1, y, LCD_W-EXPO_LINE_SELECT_POS-2, 7);
lcdDrawSolidFilledRect(EXPO_LINE_SELECT_POS+1, y, LCD_W-EXPO_LINE_SELECT_POS-2, 7);
}
}
}

View file

@ -380,7 +380,7 @@ void drawOffsetBar(uint8_t x, uint8_t y, MixData * md)
if (barMin <= barMax) {
int8_t right = (barMax * GAUGE_WIDTH) / 200;
int8_t left = ((barMin * GAUGE_WIDTH) / 200)-1;
lcdDrawFilledRect(x+GAUGE_WIDTH/2+left, y+2, right-left, GAUGE_HEIGHT-3);
lcdDrawSolidFilledRect(x+GAUGE_WIDTH/2+left, y+2, right-left, GAUGE_HEIGHT-3);
}
lcdDrawSolidVerticalLine(x+GAUGE_WIDTH/2-1, y, GAUGE_HEIGHT+1);
if (barMin == -101) {
@ -882,7 +882,7 @@ void menuModelExpoMix(uint8_t expo, event_t event)
}
if (cur == sub) {
/* invert the raw when it's the current one */
lcdDrawFilledRect(expo ? EXPO_LINE_SELECT_POS+1 : 23, y, expo ? (LCD_W-EXPO_LINE_SELECT_POS-2) : (LCD_W-24), 7);
lcdDrawSolidFilledRect(expo ? EXPO_LINE_SELECT_POS+1 : 23, y, expo ? (LCD_W-EXPO_LINE_SELECT_POS-2) : (LCD_W-24), 7);
}
}
}

View file

@ -178,7 +178,7 @@ void drawOffsetBar(uint8_t x, uint8_t y, MixData * md)
if (barMin <= barMax) {
int8_t right = (barMax * gaugeWidth) / 200;
int8_t left = ((barMin * gaugeWidth) / 200)-1;
lcdDrawFilledRect(x+gaugeWidth/2+left, y+2, right-left, gaugeHeight-3);
lcdDrawSolidFilledRect(x+gaugeWidth/2+left, y+2, right-left, gaugeHeight-3);
}
lcdDrawSolidVerticalLine(x+gaugeWidth/2-1, y, gaugeHeight+1);
if (barMin == -101) {
@ -569,7 +569,7 @@ void menuModelMixAll(event_t event)
}
if (cur == sub) {
/* invert the raw when it's the current one */
lcdDrawFilledRect(23, y, LCD_W-24, 7);
lcdDrawSolidFilledRect(23, y, LCD_W-24, 7);
}
}
}

View file

@ -375,7 +375,7 @@ void menuModelSelect(event_t event)
}
if (s_copyMode && (vertpos_t)sub==i+menuVerticalOffset) {
lcdDrawFilledRect(9, y, MODELSEL_W-1-9, 7);
lcdDrawSolidFilledRect(9, y, MODELSEL_W-1-9, 7);
lcdDrawRect(8, y-1, MODELSEL_W-1-7, 9, s_copyMode == COPY_MODE ? SOLID : DOTTED);
}
}

View file

@ -886,7 +886,7 @@ void menuModelSetup(event_t event)
}
}
else {
lcdDrawFilledRect(MODEL_SETUP_2ND_COLUMN, y, LCD_W - MODEL_SETUP_2ND_COLUMN, 8);
lcdDrawSolidFilledRect(MODEL_SETUP_2ND_COLUMN, y, LCD_W - MODEL_SETUP_2ND_COLUMN, 8);
}
}
}

View file

@ -72,7 +72,7 @@ void drawAlertBox(const pm_char * title, const pm_char * text, const char * acti
lcdDrawText(MESSAGE_LCD_OFFSET, 2*FH, STR_WARNING, DBLSIZE);
#endif
lcdDrawFilledRect(0, 0, LCD_W, 32);
lcdDrawSolidFilledRect(0, 0, LCD_W, 32);
if (text) {
lcdDrawTextAlignedLeft(5*FH, text);
}
@ -150,7 +150,7 @@ const char * runPopupMenu(event_t event)
for (uint8_t i=0; i<display_count; i++) {
lcdDrawText(MENU_X+6, i*(FH+1) + y + 2, popupMenuItems[i], popupMenuFlags);
if (i == s_menu_item) lcdDrawFilledRect(MENU_X+1, i*(FH+1) + y + 1, MENU_W-2, 9);
if (i == s_menu_item) lcdDrawSolidFilledRect(MENU_X+1, i*(FH+1) + y + 1, MENU_W-2, 9);
}
if (popupMenuNoItems > display_count) {

View file

@ -32,6 +32,8 @@ void drawMessageBox();
void showMessageBox(const pm_char * title);
void runPopupWarning(event_t event);
#define DRAW_MESSAGE_BOX(title) (warningText = title, drawMessageBox(), warningText = NULL)
#if defined(CPUARM)
extern void (*popupFunc)(event_t event);
extern int16_t warningInputValue;

View file

@ -56,6 +56,13 @@ inline bool isFilenameLower(bool isfile, const char * fn, const char * line)
return (!isfile && line[SD_SCREEN_FILE_LENGTH+1]) || (isfile==(bool)line[SD_SCREEN_FILE_LENGTH+1] && strcasecmp(fn, line) < 0);
}
void getSelectionFullPath(char * lfn)
{
f_getcwd(lfn, _MAX_LFN);
strcat(lfn, PSTR("/"));
strcat(lfn, reusableBuffer.sdmanager.lines[menuVerticalPosition - HEADER_LINE - menuVerticalOffset]);
}
void onSdManagerMenu(const char * result)
{
TCHAR lfn[_MAX_LFN+1];
@ -68,9 +75,7 @@ void onSdManagerMenu(const char * result)
POPUP_CONFIRMATION(STR_CONFIRM_FORMAT);
}
else if (result == STR_DELETE_FILE) {
f_getcwd(lfn, _MAX_LFN);
strcat_P(lfn, PSTR("/"));
strcat(lfn, reusableBuffer.sdmanager.lines[index]);
getSelectionFullPath(lfn);
f_unlink(lfn);
strncpy(statusLineMsg, reusableBuffer.sdmanager.lines[index], 13);
strcpy_P(statusLineMsg+min((uint8_t)strlen(statusLineMsg), (uint8_t)13), STR_REMOVED);
@ -80,19 +85,21 @@ void onSdManagerMenu(const char * result)
}
#if defined(CPUARM)
/* TODO else if (result == STR_LOAD_FILE) {
f_getcwd(lfn, _MAX_LFN);
strcat(lfn, "/");
strcat(lfn, reusableBuffer.sdmanager.lines[index]);
getSelectionFullPath(lfn);
POPUP_WARNING(eeLoadModelSD(lfn));
} */
else if (result == STR_PLAY_FILE) {
f_getcwd(lfn, _MAX_LFN);
strcat(lfn, "/");
strcat(lfn, reusableBuffer.sdmanager.lines[index]);
getSelectionFullPath(lfn);
audioQueue.stopAll();
audioQueue.playFile(lfn, 0, ID_PLAY_FROM_SD_MANAGER);
}
#endif
#if defined(LUA)
else if (result == STR_EXECUTE_FILE) {
getSelectionFullPath(lfn);
luaExec(lfn);
}
#endif
}
void menuRadioSdManager(event_t _event)
@ -180,6 +187,11 @@ void menuRadioSdManager(event_t _event)
else */ if (!strcasecmp(ext, SOUNDS_EXT)) {
POPUP_MENU_ADD_ITEM(STR_PLAY_FILE);
}
#endif
#if defined(LUA)
else if (!strcasecmp(ext, SCRIPTS_EXT)) {
POPUP_MENU_ADD_ITEM(STR_EXECUTE_FILE);
}
#endif
if (!READ_ONLY()) {
POPUP_MENU_ADD_ITEM(STR_DELETE_FILE);

View file

@ -188,13 +188,13 @@ void displayBattVoltage()
{
#if defined(BATTGRAPH)
putsVBat(VBATT_X-8, VBATT_Y+1, RIGHT);
lcdDrawFilledRect(VBATT_X-25, VBATT_Y+9, 21, 5);
lcdDrawSolidFilledRect(VBATT_X-25, VBATT_Y+9, 21, 5);
lcdDrawSolidVerticalLine(VBATT_X-4, VBATT_Y+10, 3);
uint8_t count = GET_TXBATT_BARS();
for (uint8_t i=0; i<count; i+=2)
lcdDrawSolidVerticalLine(VBATT_X-24+i, VBATT_Y+10, 3);
if (!IS_TXBATT_WARNING() || BLINK_ON_PHASE)
lcdDrawFilledRect(VBATT_X-26, VBATT_Y, 24, 15);
lcdDrawSolidFilledRect(VBATT_X-26, VBATT_Y, 24, 15);
#else
LcdFlags att = (IS_TXBATT_WARNING() ? BLINK|INVERS : 0) | BIGSIZE;
putsVBat(VBATT_X-1, VBATT_Y, att|NO_UNIT);

View file

@ -38,7 +38,7 @@ void drawCheckBox(coord_t x, coord_t y, uint8_t value, LcdFlags attr)
if (value)
lcdDrawChar(x+1, y, '#');
if (attr)
lcdDrawFilledRect(x, y, 7, 7);
lcdDrawSolidFilledRect(x, y, 7, 7);
else
lcdDrawSquare(x, y, 7);
#else
@ -103,14 +103,14 @@ void drawSlider(coord_t x, coord_t y, uint8_t value, uint8_t max, uint8_t attr)
{
lcdDrawChar(x+(value*4*FW)/max, y, '$');
lcdDrawSolidHorizontalLine(x, y+3, 5*FW-1, FORCE);
if (attr && (!(attr & BLINK) || !BLINK_ON_PHASE)) lcdDrawFilledRect(x, y, 5*FW-1, FH-1);
if (attr && (!(attr & BLINK) || !BLINK_ON_PHASE)) lcdDrawSolidFilledRect(x, y, 5*FW-1, FH-1);
}
#elif defined(GRAPHICS)
void display5posSlider(coord_t x, coord_t y, uint8_t value, uint8_t attr)
{
lcdDrawChar(x+2*FW+(value*FW), y, '$');
lcdDrawSolidHorizontalLine(x, y+3, 5*FW-1, SOLID);
if (attr && (!(attr & BLINK) || !BLINK_ON_PHASE)) lcdDrawFilledRect(x, y, 5*FW-1, FH-1);
if (attr && (!(attr & BLINK) || !BLINK_ON_PHASE)) lcdDrawSolidFilledRect(x, y, 5*FW-1, FH-1);
}
#endif

View file

@ -31,6 +31,7 @@
void drawMessageBox(const char * title);
void showMessageBox(const char * title);
void runPopupWarning(event_t event);
#define DRAW_MESSAGE_BOX(title) drawMessageBox(title)
extern void (*popupFunc)(event_t event);
extern int16_t warningInputValue;

View file

@ -61,7 +61,7 @@ inline bool isFilenameLower(bool isfile, const char * fn, const char * line)
return (!isfile && IS_FILE(line)) || (isfile==IS_FILE(line) && strcasecmp(fn, line) < 0);
}
void getSelectionFullPath(char *lfn)
void getSelectionFullPath(char * lfn)
{
f_getcwd(lfn, _MAX_LFN);
strcat(lfn, PSTR("/"));

View file

@ -38,6 +38,7 @@ set(LUA_INCLUDES_STM32F4
-I${RADIO_SRC_DIRECTORY}/${STM32LIB_DIR}/CMSIS/Device/ST/STM32F4xx/Include
)
add_lua_export_target(taranis ${LUA_INCLUDES_STM32F2} -DPCBTARANIS)
add_lua_export_target(taranis_x9e ${LUA_INCLUDES_STM32F4} -DPCBTARANIS -DPCBX9E -DSTM32F40_41xxx)
add_lua_export_target(x7d ${LUA_INCLUDES_STM32F2} -DPCBTARANIS -DPCBX7D)
add_lua_export_target(x9d ${LUA_INCLUDES_STM32F2} -DPCBTARANIS -DPCBX9D)
add_lua_export_target(x9e ${LUA_INCLUDES_STM32F4} -DPCBTARANIS -DPCBX9E -DSTM32F40_41xxx)
add_lua_export_target(horus ${LUA_INCLUDES_STM32F4} -DPCBHORUS -DSTM32F40_41xxx)

View file

@ -30,9 +30,11 @@
#elif defined(PCBFLAMENCO)
#include "lua/lua_exports_flamenco.inc"
#elif defined(PCBX9E)
#include "lua/lua_exports_taranis_x9e.inc"
#include "lua/lua_exports_x9e.inc"
#elif defined(PCBX7D)
#include "lua/lua_exports_x7d.inc"
#elif defined(PCBTARANIS)
#include "lua/lua_exports_taranis.inc"
#include "lua/lua_exports_x9d.inc"
#endif
#if defined(SIMU)
@ -832,7 +834,7 @@ static int luaKillEvents(lua_State * L)
return 0;
}
#if !defined(COLORLCD)
#if LCD_DEPTH > 1 && !defined(COLORLCD)
/*luadoc
@function GREY()
@ -1141,7 +1143,7 @@ const luaL_Reg opentxLib[] = {
{ "defaultChannel", luaDefaultChannel },
{ "getRSSI", luaGetRSSI },
{ "killEvents", luaKillEvents },
#if !defined(COLORLCD)
#if LCD_DEPTH > 1 && !defined(COLORLCD)
{ "GREY", luaGrey },
#endif
{ "sportTelemetryPop", luaSportTelemetryPop },
@ -1243,8 +1245,10 @@ const luaR_value_entry opentxConstants[] = {
{ "EVT_MINUS_FIRST", EVT_KEY_FIRST(KEY_MINUS) },
{ "EVT_PLUS_REPT", EVT_KEY_REPT(KEY_PLUS) },
{ "EVT_MINUS_REPT", EVT_KEY_REPT(KEY_MINUS) },
#if LCD_DEPTH > 1
{ "FILL_WHITE", FILL_WHITE },
{ "GREY_DEFAULT", GREY_DEFAULT },
#endif
{ "FORCE", FORCE },
{ "ERASE", ERASE },
{ "ROUND", ROUND },

View file

@ -423,7 +423,7 @@ static int luaLcdDrawBitmap(lua_State *L)
return 0;
}
#else
#elif LCD_DEPTH > 1
/*luadoc
@function lcd.drawPixmap(x, y, name)
@ -555,7 +555,7 @@ static int luaLcdDrawGauge(lua_State *L)
}
#if !defined(COLORLCD)
#if LCD_DEPTH > 1 && !defined(COLORLCD)
/*luadoc
@function lcd.drawScreenTitle(title, page, pages)
@ -587,7 +587,7 @@ static int luaLcdDrawScreenTitle(lua_State *L)
}
#endif
#if !defined(COLORLCD)
#if LCD_DEPTH > 1 && !defined(COLORLCD)
/*luadoc
@function lcd.drawCombobox(x, y, w, list, idx [, flags])
@ -761,7 +761,7 @@ const luaL_Reg lcdLib[] = {
{ "drawBitmap", luaLcdDrawBitmap },
{ "setColor", luaLcdSetColor },
{ "RGB", luaRGB },
#else
#elif LCD_DEPTH > 1
{ "getLastPos", luaLcdGetLastPos },
{ "drawPixmap", luaLcdDrawPixmap },
{ "drawScreenTitle", luaLcdDrawScreenTitle },

View file

@ -39,7 +39,9 @@ static int luaModelGetInfo(lua_State *L)
{
lua_newtable(L);
lua_pushtablezstring(L, "name", g_model.header.name);
#if LCD_DEPTH > 1
lua_pushtablenzstring(L, "bitmap", g_model.header.bitmap);
#endif
return 1;
}
@ -68,10 +70,12 @@ static int luaModelSetInfo(lua_State *L)
memcpy(modelHeaders[g_eeGeneral.currModel].name, g_model.header.name, sizeof(g_model.header.name));
#endif
}
#if LCD_DEPTH > 1
else if (!strcmp(key, "bitmap")) {
const char * name = luaL_checkstring(L, -1);
strncpy(g_model.header.bitmap, name, sizeof(g_model.header.bitmap));
}
#endif
}
storageDirty(EE_MODEL);
return 0;

View file

@ -426,7 +426,7 @@ void luaLoadPermanentScripts()
void displayLuaError(const char * title)
{
#if !defined(COLORLCD)
drawMessageBox(title);
DRAW_MESSAGE_BOX(title);
#endif
if (lua_warning_info[0]) {
char * split = strstr(lua_warning_info, ": ");

View file

@ -7,7 +7,7 @@ if(PCB STREQUAL X9E)
set(CPU_TYPE STM32F4)
set(LINKER_SCRIPT targets/taranis/stm32f4_flash.ld)
set(HAPTIC YES)
set(LUA_EXPORT lua_export_taranis_x9e)
set(LUA_EXPORT lua_export_x9e)
set(FLAVOUR x9e)
add_definitions(-DSTM32F40_41xxx -DPCBX9E)
add_definitions(-DEEPROM_VARIANT=32768)
@ -29,7 +29,7 @@ elseif(PCB STREQUAL X9D+)
set(CPU_TYPE STM32F2)
set(LINKER_SCRIPT targets/taranis/stm32f2_flash.ld)
set(HAPTIC YES)
set(LUA_EXPORT lua_export_taranis)
set(LUA_EXPORT lua_export_x9d)
set(FLAVOUR x9d+)
add_definitions(-DPCBX9DP)
add_definitions(-DEEPROM_VARIANT=0)
@ -42,7 +42,7 @@ elseif(PCB STREQUAL X9D)
set(CPU_TYPE STM32F2)
set(LINKER_SCRIPT targets/taranis/stm32f2_flash.ld)
option(HAPTIC "Haptic support" OFF)
set(LUA_EXPORT lua_export_taranis)
set(LUA_EXPORT lua_export_x9d)
set(FLAVOUR x9d)
add_definitions(-DPCBX9D)
add_definitions(-DEEPROM_VARIANT=0)
@ -55,7 +55,7 @@ elseif(PCB STREQUAL X7D)
set(CPU_TYPE STM32F2)
set(LINKER_SCRIPT targets/taranis/stm32f2_flash.ld)
set(HAPTIC YES)
set(LUA_EXPORT lua_export_taranis)
set(LUA_EXPORT lua_export_x7d)
set(FLAVOUR x7d)
add_definitions(-DPCBX7D -DSOFTWARE_VOLUME)
add_definitions(-DEEPROM_VARIANT=0)

View file

@ -552,7 +552,7 @@ int main()
progress = (200*eepromWritten) / EEPROM_SIZE;
}
lcdDrawRect( 3, 6*FH+4, 204, 7);
lcdDrawRect(3, 6*FH+4, 204, 7);
lcdDrawSolidHorizontalLine(5, 6*FH+6, progress, FORCE);
lcdDrawSolidHorizontalLine(5, 6*FH+7, progress, FORCE);
lcdDrawSolidHorizontalLine(5, 6*FH+8, progress, FORCE);