[Horus] UI continued

This commit is contained in:
Bertrand Songis
2016-02-16 20:45:25 +01:00
parent e72a049683
commit 33910c8721
35 changed files with 301 additions and 75 deletions
Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

+3 -3
View File
@@ -259,11 +259,11 @@ const uint8_t LBM_STAR1[] __DMA = {
*/
const uint8_t LBM_HORUS[] __DMA = {
#include "bmp_horus.lbm"
#include "alpha_horus.lbm"
};
const uint8_t LBM_STICK_BACKGROUND[] __DMA = {
#include "bmp_stick_background.lbm"
#include "alpha_stick_background.lbm"
};
const uint8_t LBM_STICK_POINTER[] __DMA = {
@@ -299,7 +299,7 @@ const uint8_t LBM_SHUTDOWN[] __DMA = {
};
const uint8_t LBM_SLEEP[] __DMA = {
#include "bmp_sleep.lbm"
#include "alpha_sleep.lbm"
};
const uint8_t LBM_SHUTDOWN_CIRCLE[] __DMA = {
+14
View File
@@ -75,3 +75,17 @@ Layout * loadLayout(const char * name, Layout::PersistentData * persistentData)
}
return NULL;
}
void loadCustomScreens()
{
for (unsigned int i=0; i<MAX_CUSTOM_SCREENS; i++) {
char name[sizeof(g_model.screenData[i].layoutName)+1];
memset(name, 0, sizeof(name));
strncpy(name, g_model.screenData[i].layoutName, sizeof(g_model.screenData[i].layoutName));
customScreens[i] = loadLayout(name, &g_model.screenData[i].layoutData);
}
if (customScreens[0] == NULL) {
customScreens[0] = registeredLayouts[0]->create(&g_model.screenData[0].layoutData);
}
}
+1
View File
@@ -161,5 +161,6 @@ class BaseLayoutFactory: public LayoutFactory
extern unsigned int countRegisteredLayouts;
extern const LayoutFactory * registeredLayouts[MAX_REGISTERED_LAYOUTS];
Layout * loadLayout(const char * name, Layout::PersistentData * persistentData);
void loadCustomScreens();
#endif // _LAYOUT_H_
+1 -1
View File
@@ -182,7 +182,7 @@ bool menuCommonCalib(evt_t event)
break;
}
lcdDrawBitmap((LCD_W-206)/2, LCD_H-220, LBM_HORUS);
lcdDrawAlphaBitmap((LCD_W-206)/2, LCD_H-220, LBM_HORUS);
drawSticks();
drawPots();
+42 -10
View File
@@ -301,10 +301,9 @@ bool menuScreensTheme(evt_t event)
lcdDrawText(MENUS_MARGIN_LEFT, y + FH / 2, "Theme");
const Theme * new_theme = editThemeChoice<const Theme>(SCREENS_SETUP_2ND_COLUMN, y, registeredThemes, countRegisteredThemes, theme, needsOffsetCheck, attr, event);
if (new_theme) {
theme = new_theme;
theme->load();
// strncpy(g_model.screenData[T].layoutName, factory->getName(), sizeof(g_model.screenData[T].layoutName));
storageDirty(EE_MODEL);
loadTheme(new_theme);
strncpy(g_eeGeneral.themeName, new_theme->getName(), sizeof(g_eeGeneral.themeName));
storageDirty(EE_GENERAL);
}
break;
}
@@ -317,12 +316,8 @@ bool menuScreensTheme(evt_t event)
return true;
}
bool menuScreenAdd(evt_t event)
{
menuPageCount = updateMainviewsMenu();
MENU_WITH_OPTIONS("Add main view", LBM_MAINVIEWS_ICONS, menuTabMainviews, menuPageCount, menuPageCount-1, 0, { uint8_t(NAVIGATION_LINE_BY_LINE|uint8_t(countRegisteredLayouts-1)), ORPHAN_ROW, 0, 0, 0, 0 });
return true;
}
bool menuScreenAdd(evt_t event);
void onScreenSetupMenu(const char * result);
template <int T>
bool menuScreenSetup(evt_t event)
@@ -342,6 +337,8 @@ bool menuScreenSetup(evt_t event)
menuPageCount = updateMainviewsMenu();
MENU_WITH_OPTIONS(title, LBM_MAINVIEWS_ICONS, menuTabMainviews, menuPageCount, T+1, linesCount, { uint8_t(NAVIGATION_LINE_BY_LINE|uint8_t(countRegisteredLayouts-1)), ORPHAN_ROW, 0, 0, 0, 0 });
for (int i=0; i<NUM_BODY_LINES; i++) {
coord_t y = MENU_CONTENT_TOP + i * FH;
int k = i + menuVerticalOffset;
@@ -384,6 +381,13 @@ bool menuScreenSetup(evt_t event)
}
}
if (menuVerticalPosition == -1 && T > 0 && event == EVT_KEY_LONG(KEY_ENTER)) {
killEvents(KEY_ENTER);
menuHorizontalPosition = T;
POPUP_MENU_ADD_ITEM(STR_REMOVE_SCREEN);
popupMenuHandler = onScreenSetupMenu;
}
return true;
}
@@ -419,3 +423,31 @@ int updateMainviewsMenu()
}
return 1+MAX_CUSTOM_SCREENS;
}
bool menuScreenAdd(evt_t event)
{
menuPageCount = updateMainviewsMenu();
if (event == EVT_KEY_BREAK(KEY_ENTER)) {
customScreens[menuPageCount-2] = registeredLayouts[0]->create(&g_model.screenData[menuPageCount-2].layoutData);
chainMenu(menuMainviews[menuPageCount-2]);
return false;
}
MENU_WITH_OPTIONS("Add main view", LBM_MAINVIEWS_ICONS, menuTabMainviews, menuPageCount, menuPageCount-1, 0, { uint8_t(NAVIGATION_LINE_BY_LINE|uint8_t(countRegisteredLayouts-1)), ORPHAN_ROW, 0, 0, 0, 0 });
return true;
}
void onScreenSetupMenu(const char * result)
{
if (result == STR_REMOVE_SCREEN) {
if (menuHorizontalPosition != MAX_CUSTOM_SCREENS-1) {
memmove(&g_model.screenData[menuHorizontalPosition], &g_model.screenData[menuHorizontalPosition + 1], sizeof(CustomScreenData) * (MAX_CUSTOM_SCREENS - menuHorizontalPosition - 1));
memmove(&customScreens[menuHorizontalPosition], &customScreens[menuHorizontalPosition + 1], sizeof(Layout *) * (MAX_CUSTOM_SCREENS - menuHorizontalPosition - 1));
}
memset(&g_model.screenData[MAX_CUSTOM_SCREENS-1], 0, sizeof(CustomScreenData));
customScreens[MAX_CUSTOM_SCREENS-1] = NULL;
chainMenu(menuMainviews[menuHorizontalPosition > 0 ? menuHorizontalPosition-1 : 0]);
}
}
+14
View File
@@ -40,3 +40,17 @@ const Theme * getTheme(const char * name)
return NULL;
}
void loadTheme(const Theme * new_theme)
{
theme = new_theme;
theme->load();
}
void loadTheme()
{
char name[sizeof(g_eeGeneral.themeName)+1];
memset(name, 0, sizeof(name));
strncpy(name, g_eeGeneral.themeName, sizeof(g_eeGeneral.themeName));
const Theme * new_theme = getTheme(name);
loadTheme(new_theme ? new_theme : theme);
}
+5
View File
@@ -61,6 +61,11 @@ extern const Theme * theme;
#define MAX_REGISTERED_THEMES 10
extern unsigned int countRegisteredThemes;
void registerTheme(const Theme * theme);
extern const Theme * registeredThemes[MAX_REGISTERED_THEMES]; // TODO dynamic
const Theme * getTheme(const char * name);
void loadTheme(const Theme * theme);
void loadTheme();
#endif // _THEME_H_
+2 -2
View File
@@ -50,7 +50,7 @@ void drawTopbarDatetime()
#define STICK_PANEL_WIDTH 68
void drawStick(coord_t x, coord_t y, int16_t xval, int16_t yval)
{
lcdDrawBitmap(x, y, LBM_STICK_BACKGROUND);
lcdDrawAlphaBitmap(x, y, LBM_STICK_BACKGROUND);
lcdDrawAlphaBitmap(x + 2 + STICK_PANEL_WIDTH/2 + STICK_PANEL_WIDTH/2 * xval/RESX, y + 2 + STICK_PANEL_WIDTH/2 - STICK_PANEL_WIDTH/2 * yval/RESX, LBM_STICK_POINTER);
}
@@ -426,7 +426,7 @@ int16_t editGVarFieldValue(coord_t x, coord_t y, int16_t value, int16_t min, int
void drawSleepBitmap()
{
lcdClear();
lcdDrawBitmap((LCD_W-SLEEP_BITMAP_WIDTH)/2, (LCD_H-SLEEP_BITMAP_HEIGHT)/2, LBM_SLEEP);
lcdDrawAlphaBitmap((LCD_W-SLEEP_BITMAP_WIDTH)/2, (LCD_H-SLEEP_BITMAP_HEIGHT)/2, LBM_SLEEP);
lcdRefresh();
}
+2 -2
View File
@@ -498,9 +498,9 @@ void lcdDrawLine(coord_t x1, coord_t y1, coord_t x2, coord_t y2, uint8_t pat, Lc
}
}
void lcdDrawSolidVerticalLine(coord_t x, scoord_t y, scoord_t h)
void lcdDrawSolidVerticalLine(coord_t x, scoord_t y, scoord_t h, LcdFlags att)
{
lcdDrawVerticalLine(x, y, h, SOLID);
lcdDrawVerticalLine(x, y, h, SOLID, att);
}
#endif
+1 -1
View File
@@ -179,7 +179,7 @@ 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);
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);
void lcdDrawLine(coord_t x1, coord_t y1, coord_t x2, coord_t y2, uint8_t pat=SOLID, LcdFlags att=0);
void lcdDrawFilledRect(coord_t x, scoord_t y, coord_t w, coord_t h, uint8_t pat=SOLID, LcdFlags att=0);
+168 -5
View File
@@ -39,7 +39,7 @@
#include "opentx.h"
#include "bin_allocator.h"
#include "lua/lua_api.h"
#if defined(LUA_COMPILER) && defined(SIMU)
#include <lundump.h>
#include <lstate.h>
@@ -185,7 +185,12 @@ void luaRegisterAll()
void luaInit()
{
TRACE("luaInit");
#if !defined(COLORLCD)
luaClose();
#endif
if (luaState != INTERPRETER_PANIC) {
#if defined(USE_BIN_ALLOCATOR)
L = lua_newstate(bin_l_alloc, NULL); //we use our own allocator!
@@ -212,6 +217,10 @@ void luaInit()
luaDisable();
}
}
#if defined(COLORLCD)
luaLoadThemes();
#endif
}
void luaFree(ScriptInternalData & sid)
@@ -271,7 +280,7 @@ static void luaCompileAndSave(const char *bytecodeName)
}
#endif
int luaLoad(const char *filename, ScriptInternalData & sid, ScriptInputsOutputs * sio=NULL)
int luaLoad(const char * filename, ScriptInternalData & sid, ScriptInputsOutputs * sio=NULL)
{
int init = 0;
@@ -301,7 +310,7 @@ int luaLoad(const char *filename, ScriptInternalData & sid, ScriptInputsOutputs
luaL_checktype(L, -1, LUA_TTABLE);
for (lua_pushnil(L); lua_next(L, -2); lua_pop(L, 1)) {
const char *key = lua_tostring(L, -2);
const char * key = lua_tostring(L, -2);
if (!strcmp(key, "init")) {
init = luaL_ref(L, LUA_REGISTRYINDEX);
lua_pushnil(L);
@@ -529,9 +538,12 @@ void luaError(uint8_t error, bool acknowledge)
}
}
void luaExec(const char *filename)
void luaExec(const char * filename)
{
#if !defined(COLORLCD)
luaInit();
#endif
if (luaState != INTERPRETER_PANIC) {
standaloneScript.state = SCRIPT_NOFILE;
int result = luaLoad(filename, standaloneScript);
@@ -618,7 +630,7 @@ void luaDoOneRunStandalone(evt_t evt)
}
}
}
bool luaDoOneRunPermanentScript(uint8_t evt, int i, uint32_t scriptType)
{
ScriptInternalData & sid = scriptInternalData[i];
@@ -761,10 +773,12 @@ bool luaTask(uint8_t evt, uint8_t scriptType, bool allowLcdUsage)
// run permanent scripts
if (luaState & INTERPRETER_RELOAD_PERMANENT_SCRIPTS) {
luaState = 0;
#if !defined(COLORLCD)
luaInit();
if (luaState == INTERPRETER_PANIC) return false;
luaLoadPermanentScripts();
if (luaState == INTERPRETER_PANIC) return false;
#endif
}
for (int i=0; i<luaScriptsCount; i++) {
@@ -787,3 +801,152 @@ int luaGetMemUsed()
{
return (lua_gc(L, LUA_GCCOUNT, 0) << 10) + lua_gc(L, LUA_GCCOUNTB, 0);
}
#if defined(COLORLCD)
#define THEME_FILENAME_MAXLEN (42) // max length (example: /SCRIPTS/THEMES/mytheme.lua)
class LuaTheme: public Theme
{
friend int luaLoadTheme(const char * filename);
public:
LuaTheme(const char * name, const uint8_t * bitmap):
Theme(name, bitmap),
loadFunction(0),
drawBackgroundFunction(0),
drawTopbarBackgroundFunction(0)
{
}
void exec(int function) const
{
if (function) {
SET_LUA_INSTRUCTIONS_COUNT(PERMANENT_SCRIPTS_MAX_INSTRUCTIONS);
lua_rawgeti(L, LUA_REGISTRYINDEX, function);
if (lua_pcall(L, 0, 0, 0) != 0) {
TRACE("Error in theme %s: %s", name, lua_tostring(L, -1));
}
}
}
virtual void load() const
{
luaLcdAllowed = true;
exec(loadFunction);
}
virtual void drawBackground() const
{
exec(drawBackgroundFunction);
}
virtual void drawTopbarBackground(const uint8_t * icon) const
{
exec(drawTopbarBackgroundFunction);
}
protected:
int loadFunction;
int drawBackgroundFunction;
int drawTopbarBackgroundFunction;
};
int luaLoadTheme(const char * filename)
{
TRACE("luaLoadTheme from file %s", filename);
int init = 0;
if (luaState == INTERPRETER_PANIC) {
return SCRIPT_PANIC;
}
#if defined(LUA_COMPILER) && defined(SIMU)
luaCompileAndSave(filename);
#endif
SET_LUA_INSTRUCTIONS_COUNT(MANUAL_SCRIPTS_MAX_INSTRUCTIONS);
PROTECT_LUA() {
if (luaL_loadfile(L, filename) == 0 &&
lua_pcall(L, 0, 1, 0) == 0 &&
lua_istable(L, -1)) {
const char * name=NULL, * bitmap=NULL;
int loadFunction=0, drawBackgroundFunction=0, drawTopbarBackgroundFunction=0;
luaL_checktype(L, -1, LUA_TTABLE);
for (lua_pushnil(L); lua_next(L, -2); lua_pop(L, 1)) {
const char * key = lua_tostring(L, -2);
if (!strcmp(key, "name")) {
name = luaL_checkstring(L, -1);
}
else if (!strcmp(key, "bitmap")) {
bitmap = luaL_checkstring(L, -1);
}
else if (!strcmp(key, "load")) {
loadFunction = luaL_ref(L, LUA_REGISTRYINDEX);
lua_pushnil(L);
}
else if (!strcmp(key, "drawBackground")) {
drawBackgroundFunction = luaL_ref(L, LUA_REGISTRYINDEX);
lua_pushnil(L);
}
else if (!strcmp(key, "drawTopbarBackground")) {
drawTopbarBackgroundFunction = luaL_ref(L, LUA_REGISTRYINDEX);
lua_pushnil(L);
}
}
if (name && bitmap) {
char path[THEME_FILENAME_MAXLEN+1] = THEMES_PATH;
path[sizeof(THEMES_PATH)-1] = '/';
strcpy(path+sizeof(THEMES_PATH), bitmap);
uint8_t * bitmapData = (uint8_t *)malloc(BITMAP_BUFFER_SIZE(51, 31));
bmpLoad(bitmapData, path, 51, 31);
LuaTheme * theme = new LuaTheme(name, bitmapData);
theme->loadFunction = loadFunction;
theme->drawBackgroundFunction = drawBackgroundFunction;
theme->drawTopbarBackgroundFunction = drawTopbarBackgroundFunction;
}
}
else {
TRACE("Error in script %s: %s", filename, lua_tostring(L, -1));
}
}
else {
luaDisable();
return SCRIPT_PANIC;
}
UNPROTECT_LUA();
}
void luaLoadThemes()
{
char path[THEME_FILENAME_MAXLEN+1] = THEMES_PATH;
FILINFO fno;
DIR dir;
char * fn; /* This function is assuming non-Unicode cfg. */
TCHAR lfn[_MAX_LFN + 1];
fno.lfname = lfn;
fno.lfsize = sizeof(lfn);
FRESULT res = f_opendir(&dir, path); /* Open the directory */
if (res == FR_OK) {
for (;;) {
res = f_readdir(&dir, &fno); /* Read a directory item */
if (res != FR_OK || fno.fname[0] == 0) break; /* Break on error or end of dir */
fn = * fno.lfname ? fno.lfname : fno.fname;
uint8_t len = strlen(fn);
bool found = false;
// Eliminates directories / non wav files
if (len < 5 || strcasecmp(fn+len-4, SCRIPTS_EXT) || (fno.fattrib & AM_DIR)) continue;
path[sizeof(THEMES_PATH)-1] = '/';
strcpy(path+sizeof(THEMES_PATH), fn);
luaLoadTheme(path);
}
}
}
#endif
+3
View File
@@ -152,8 +152,11 @@ struct LuaField {
char desc[50];
};
bool luaFindFieldByName(const char * name, LuaField & field, unsigned int flags=0);
void luaLoadThemes();
#else // defined(LUA)
#define luaInit()
#define LUA_LOAD_MODEL_SCRIPTS()
#define luaLoadThemes()
#endif // defined(LUA)
#endif // _LUA_API_H_
+2 -1
View File
@@ -440,7 +440,8 @@ enum UartModes {
char anaNames[NUM_STICKS+NUM_POTS][LEN_ANA_NAME]; \
char currModelFilename[LEN_MODEL_FILENAME+1]; \
uint8_t bluetoothEnable; \
char bluetoothName[LEN_BLUETOOTH_NAME];
char bluetoothName[LEN_BLUETOOTH_NAME]; \
char themeName[8];
#elif defined(PCBFLAMENCO)
#define LEN_SWITCH_NAME 3
#define LEN_ANA_NAME 3
+5 -24
View File
@@ -1880,24 +1880,6 @@ void doMixerCalculations()
s_mixer_first_run_done = true;
}
#if defined(COLORLCD)
void loadCustomScreens()
{
for (unsigned int i=0; i<MAX_CUSTOM_SCREENS; i++) {
char name[sizeof(g_model.screenData[i].layoutName)+1];
memset(name, 0, sizeof(name));
strncpy(name, g_model.screenData[i].layoutName, sizeof(g_model.screenData[i].layoutName));
customScreens[i] = loadLayout(name, &g_model.screenData[i].layoutData);
}
if (customScreens[0] == NULL) {
customScreens[0] = registeredLayouts[0]->create(&g_model.screenData[0].layoutData);
}
}
#else
#define loadCustomScreens()
#endif
#if defined(NAVIGATION_STICKS)
uint8_t StickScrollAllowed;
uint8_t StickScrollTimer;
@@ -1938,13 +1920,16 @@ void opentxStart()
}
#endif
#if defined(COLORLCD)
luaInit();
loadTheme();
#endif
#if defined(GUI)
checkAlarm();
checkAll();
#endif
loadCustomScreens();
#if defined(GUI)
if (g_eeGeneral.chkSum != evalChkSum()) {
chainMenu(menuFirstCalib);
@@ -2601,10 +2586,6 @@ int main(void)
lcdInit();
#endif
#if defined(COLORLCD)
theme->load();
#endif
stackPaint();
#if defined(GUI)
+2 -1
View File
@@ -2,7 +2,7 @@
* Copyright (C) OpenTX
*
* Based on code named
* th9x - http://code.google.com/p/th9x
* th9x - http://code.google.com/p/th9x
* er9x - http://code.google.com/p/er9x
* gruvin9x - http://code.google.com/p/gruvin9x
*
@@ -36,6 +36,7 @@
#define EEPROMS_PATH ROOT_PATH "EEPROMS"
#define SCRIPTS_PATH ROOT_PATH "SCRIPTS"
#define WIZARD_PATH SCRIPTS_PATH "/WIZARD"
#define THEMES_PATH SCRIPTS_PATH "/THEMES"
#define WIZARD_NAME "wizard.lua"
#define TEMPLATES_PATH SCRIPTS_PATH "/TEMPLATES"
#define SCRIPTS_MIXES_PATH SCRIPTS_PATH "/MIXES"
+5 -2
View File
@@ -2,7 +2,7 @@
* Copyright (C) OpenTX
*
* Based on code named
* th9x - http://code.google.com/p/th9x
* th9x - http://code.google.com/p/th9x
* er9x - http://code.google.com/p/er9x
* gruvin9x - http://code.google.com/p/gruvin9x
*
@@ -87,9 +87,12 @@ void postModelLoad(bool newModel)
referenceModelAudioFiles();
#endif
#if defined(COLORLCD)
loadCustomScreens();
#endif
LOAD_MODEL_BITMAP();
LUA_LOAD_MODEL_SCRIPTS();
SEND_FAILSAFE_1S();
PLAY_MODEL_NAME();
}
+15 -19
View File
@@ -2,7 +2,7 @@
* Copyright (C) OpenTX
*
* Based on code named
* th9x - http://code.google.com/p/th9x
* th9x - http://code.google.com/p/th9x
* er9x - http://code.google.com/p/er9x
* gruvin9x - http://code.google.com/p/gruvin9x
*
@@ -300,7 +300,7 @@ void *eeprom_write_function(void *)
}
eeprom_pointer++;
eeprom_buffer_data++;
if (fp && eeprom_buffer_size == 1) {
fflush(fp);
}
@@ -326,14 +326,10 @@ void * main_thread(void *)
try {
#endif
#if defined(PCBHORUS)
theme->load();
#endif
#if defined(CPUARM)
stackPaint();
#endif
s_current_protocol[0] = 255;
menuLevel = 0;
@@ -415,11 +411,11 @@ void StartMainThread(bool tests)
#endif
/*
g_tmr10ms must be non-zero otherwise some SF functions (that use this timer as a marker when it was last executed)
g_tmr10ms must be non-zero otherwise some SF functions (that use this timer as a marker when it was last executed)
will be executed twice on startup. Normal radio does not see this issue because g_tmr10ms is already a big number
before the first call to the Special Functions. Not so in the simulator.
There is another issue, some other function static variables depend on this value. If simulator is started
There is another issue, some other function static variables depend on this value. If simulator is started
multiple times in one Companion session, they are set to their initial values only first time the simulator
is started. Therefore g_tmr10ms must also be set to non-zero value only the first time, then it must be left
alone to continue from the previous simulator session value. See the issue #2446
@@ -428,11 +424,11 @@ void StartMainThread(bool tests)
if (g_tmr10ms == 0) {
g_tmr10ms = 1;
}
#if defined(RTCLOCK)
g_rtcTime = time(0);
#endif
main_thread_running = (tests ? 1 : 2);
pthread_create(&main_thread_pid, NULL, &main_thread, NULL);
}
@@ -484,10 +480,10 @@ int32_t getVolume()
#if defined(SIMU_AUDIO) && defined(CPUARM)
void copyBuffer(uint8_t * dest, uint16_t * buff, unsigned int samples)
void copyBuffer(uint8_t * dest, uint16_t * buff, unsigned int samples)
{
for(unsigned int i=0; i<samples; i++) {
int sample = ((int32_t)(uint32_t)(buff[i]) - 0x8000); // conversion from uint16_t
int sample = ((int32_t)(uint32_t)(buff[i]) - 0x8000); // conversion from uint16_t
*((uint16_t*)dest) = (int16_t)((sample * simuAudio.currentVolume)/127);
dest += 2;
}
@@ -579,7 +575,7 @@ void * audioThread(void *)
}
void StartAudioThread(int volumeGain)
{
{
simuAudio.leftoverLen = 0;
simuAudio.threadRunning = true;
simuAudio.volumeGain = volumeGain;
@@ -759,7 +755,7 @@ char *findTrueFileName(const char *path)
strcat(result, ffd.cFileName);
TRACE("\tfound: %s", ffd.cFileName);
fileMap.insert(filemap_t:: value_type(path, result));
return result;
return result;
}
}
}
@@ -789,7 +785,7 @@ char *findTrueFileName(const char *path)
TRACE("\tfound: %s", res->d_name);
fileMap.insert(filemap_t:: value_type(path, result));
simu::closedir(dir);
return result;
return result;
}
}
}
@@ -1047,7 +1043,7 @@ FRESULT f_getfree (const TCHAR* path, DWORD* nclst, FATFS** fatfs)
{
// just fake that we always have some clusters free
*nclst = 10;
return FR_OK;
return FR_OK;
}
#if defined(PCBSKY9X)
@@ -1107,7 +1103,7 @@ void traceDiskStatus()
{
if (noDiskStatus > 0) {
TRACE("disk_status() called %d times", noDiskStatus);
noDiskStatus = 0;
noDiskStatus = 0;
}
}
@@ -1186,7 +1182,7 @@ DRESULT disk_ioctl (BYTE pdrv, BYTE cmd, void* buff)
DWORD noSectors = buf.st_size / 512;
*(DWORD*)buff = noSectors;
TRACE("disk_ioctl(GET_SECTOR_COUNT) = %u", noSectors);
return RES_OK;
return RES_OK;
}
return RES_ERROR;
}
-1
View File
@@ -44,7 +44,6 @@
extern const char * zchar2string(const char * zstring, int size);
#define EXPECT_ZSTREQ(c_string, z_string) EXPECT_STREQ(c_string, zchar2string(z_string, sizeof(z_string)))
extern void luaInit();
::testing::AssertionResult __luaExecStr(const char * str)
{
+3 -3
View File
@@ -32,7 +32,7 @@ static luaR_result luaR_findkey(const void *where, const char *key, int type, in
/* Find a global "read only table" in the constant lua_rotable array */
luaR_result luaR_findglobal(const char *name, lu_byte *ptype) {
unsigned i;
unsigned i;
*ptype = LUA_TNIL;
if (strlen(name) > LUA_MAX_ROTABLE_NAME)
return 0;
@@ -60,13 +60,13 @@ int luaR_findfunction(lua_State *L, const luaL_Reg *ptable) {
lua_pushlightfunction(L, (void*)(size_t)res);
else
lua_pushnil(L);
return 1;
return 1;
}
luaR_result luaR_findentry(void *data, const char *key, lu_byte *ptype) {
int found;
unsigned idx = (unsigned)(size_t)data - 1;
luaR_result res;
luaR_result res;
*ptype = LUA_TNIL;
/* First look at the functions */
res = luaR_findkey(lua_rotable[idx].pfuncs, key, LUAR_FINDFUNCTION, &found);
+1
View File
@@ -578,6 +578,7 @@ const pm_char STR_MODEL_SELECT[] PROGMEM = TR_MODEL_SELECT;
const pm_char STR_SELECT_WIDGET[] PROGMEM = TR_SELECT_WIDGET;
const pm_char STR_REMOVE_WIDGET[] PROGMEM = TR_REMOVE_WIDGET;
const pm_char STR_WIDGET_SETTINGS[] PROGMEM = TR_WIDGET_SETTINGS;
const pm_char STR_REMOVE_SCREEN[] PROGMEM = TR_REMOVE_SCREEN;
#endif
#if defined(PCBTARANIS) || defined(PCBFLAMENCO) || defined(PCBHORUS)
+1
View File
@@ -829,6 +829,7 @@ extern const pm_char STR_BLCOLOR[];
extern const pm_char STR_SELECT_WIDGET[];
extern const pm_char STR_REMOVE_WIDGET[];
extern const pm_char STR_WIDGET_SETTINGS[];
extern const pm_char STR_REMOVE_SCREEN[];
#endif
#if defined(PCBTARANIS) || defined(PCBFLAMENCO) || defined(PCBHORUS)
+1
View File
@@ -1102,6 +1102,7 @@
#define TR_SELECT_WIDGET "Select widget"
#define TR_REMOVE_WIDGET "Remove widget"
#define TR_WIDGET_SETTINGS "Widget settings"
#define TR_REMOVE_SCREEN "Remove screen"
#define TR_MENU_INPUTS "\314Vstupy"
#define TR_MENU_LUA "\322Lua skripty"
+1
View File
@@ -1105,6 +1105,7 @@
#define TR_SELECT_WIDGET "Select widget"
#define TR_REMOVE_WIDGET "Remove widget"
#define TR_WIDGET_SETTINGS "Widget settings"
#define TR_REMOVE_SCREEN "Remove screen"
// ----------------------------- Symbole für Auswahlliste----------
#define TR_MENU_INPUTS "\314Inputs"
#define TR_MENU_LUA "\322Lua Scripte"
+1
View File
@@ -1131,6 +1131,7 @@
#define TR_SELECT_WIDGET "Select widget"
#define TR_REMOVE_WIDGET "Remove widget"
#define TR_WIDGET_SETTINGS "Widget settings"
#define TR_REMOVE_SCREEN "Remove screen"
#define TR_MENU_INPUTS "\314Inputs"
#define TR_MENU_LUA "\322Lua scripts"
+1
View File
@@ -1057,6 +1057,7 @@
#define TR_SELECT_WIDGET "Select widget"
#define TR_REMOVE_WIDGET "Remove widget"
#define TR_WIDGET_SETTINGS "Widget settings"
#define TR_REMOVE_SCREEN "Remove screen"
#define TR_MENU_INPUTS "\314Inputs"
#define TR_MENU_LUA "\322Lua scripts"
+1
View File
@@ -1057,6 +1057,7 @@
#define TR_SELECT_WIDGET "Select widget"
#define TR_REMOVE_WIDGET "Remove widget"
#define TR_WIDGET_SETTINGS "Widget settings"
#define TR_REMOVE_SCREEN "Remove screen"
#define TR_MENU_INPUTS "\314Inputs"
#define TR_MENU_LUA "\322Lua scripts"
+1
View File
@@ -1092,6 +1092,7 @@
#define TR_SELECT_WIDGET "Select widget"
#define TR_REMOVE_WIDGET "Remove widget"
#define TR_WIDGET_SETTINGS "Widget settings"
#define TR_REMOVE_SCREEN "Remove screen"
#define TR_MENU_INPUTS "\314Entrées"
#define TR_MENU_LUA "\322Scripts Lua"
+1
View File
@@ -1104,6 +1104,7 @@
#define TR_SELECT_WIDGET "Select widget"
#define TR_REMOVE_WIDGET "Remove widget"
#define TR_WIDGET_SETTINGS "Widget settings"
#define TR_REMOVE_SCREEN "Remove screen"
#define TR_MENU_INPUTS "\314Ingressi"
#define TR_MENU_LUA "\322Lua scripts"
+1
View File
@@ -1123,6 +1123,7 @@
#define TR_SELECT_WIDGET "Select widget"
#define TR_REMOVE_WIDGET "Remove widget"
#define TR_WIDGET_SETTINGS "Widget settings"
#define TR_REMOVE_SCREEN "Remove screen"
#define TR_MENU_INPUTS "\314Inputs"
+1
View File
@@ -1105,6 +1105,7 @@
#define TR_SELECT_WIDGET "Select widget"
#define TR_REMOVE_WIDGET "Remove widget"
#define TR_WIDGET_SETTINGS "Widget settings"
#define TR_REMOVE_SCREEN "Remove screen"
#define TR_MENU_INPUTS "\314Wejści"
#define TR_MENU_LUA "\322SkryptyLUA"
+1
View File
@@ -1051,6 +1051,7 @@
#define TR_SELECT_WIDGET "Select widget"
#define TR_REMOVE_WIDGET "Remove widget"
#define TR_WIDGET_SETTINGS "Widget settings"
#define TR_REMOVE_SCREEN "Remove screen"
#define TR_MENU_INPUTS "\314Inputs"
#define TR_MENU_LUA "\322Lua scripts"
+1
View File
@@ -1128,6 +1128,7 @@
#define TR_SELECT_WIDGET "Select widget"
#define TR_REMOVE_WIDGET "Remove widget"
#define TR_WIDGET_SETTINGS "Widget settings"
#define TR_REMOVE_SCREEN "Remove screen"
#define TR_MENU_INPUTS "\314Inputs"
#define TR_MENU_LUA "\322Lua scripts"