Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions skeleton/BOOT/common/updater
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ case $INFO in
*"SStar"*)
PLATFORM="miyoomini"
;;
*"TG5040"*|*"TG3040"*)
PLATFORM="tg5040" # Trimui Smart Pro or Brick
*"TG5040"*|*"TG3040"*|*"TG4040"*)
PLATFORM="tg5040" # Trimui Smart Pro, Brick, Brick Pro
;;
*"TG5050"*)
PLATFORM="tg5050" # Trimui Smart Pro S
Expand Down
2 changes: 1 addition & 1 deletion skeleton/BOOT/trimui/app/runtrimui.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh

# becomes /usr/trimui/bin/runtrimui.sh on tg5040/tg3040/tg5050
# becomes /usr/trimui/bin/runtrimui.sh on tg5040/tg3040/tg5050/tg4040

#wait for SDCARD mounted
echo before mount `cat /proc/uptime` >> /tmp/nextui_boottime
Expand Down
3 changes: 2 additions & 1 deletion skeleton/EXTRAS/Tools/tg5040/Files.pak/launch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
cd $(dirname "$0")

HOME="$SDCARD_PATH"
if [ "$DEVICE" = "brick" ]; then
# brick and brickpro
if [ "$DEVICE" = "brick" ] || [ "$DEVICE" = "brickpro" ]; then
CFG="tg3040.cfg"
else
CFG="tg5040.cfg"
Expand Down
8 changes: 8 additions & 0 deletions skeleton/EXTRAS/Tools/tg5040/LedControl.pak/launch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,12 @@ else
echo "File already exists in TARGET_PATH" >> launch.log
fi

TARGET_PATH="/mnt/SDCARD/.userdata/shared/ledsettings_brickpro.txt"
if [ ! -f "$TARGET_PATH" ]; then
cp ./ledsettings_brickpro.txt /mnt/SDCARD/.userdata/shared/ledsettings_brickpro.txt >> launch.log
echo "File copied to $TARGET_PATH" >> launch.log
else
echo "File already exists in $TARGET_PATH" >> launch.log
fi

./ledcontrol.elf > ledcontrol.log 2>&1
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
[f1]
effect=4
color1=0x440044
color2=0x440044
speed=1000
brightness=100
trigger=1
filename=f1
inbrightness=100

[f2]
effect=4
color1=0x440044
color2=0x440044
speed=1000
brightness=100
trigger=1
filename=f2
inbrightness=100

[m]
effect=4
color1=0x440044
color2=0x440044
speed=1000
brightness=100
trigger=1
filename=m
inbrightness=100

[lr]
effect=4
color1=0x440044
color2=0x440044
speed=1000
brightness=100
trigger=1
filename=lr
inbrightness=100

[rear]
effect=4
color1=0x440044
color2=0x440044
speed=1000
brightness=100
trigger=1
filename=rear
inbrightness=100

2 changes: 2 additions & 0 deletions skeleton/SYSTEM/tg5040/dbg/launch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ export DATETIME_PATH="$SHARED_USERDATA_PATH/datetime.txt"
export TRIMUI_MODEL=`strings /usr/trimui/bin/MainUI | grep ^Trimui`
if [ "$TRIMUI_MODEL" = "Trimui Brick" ]; then
export DEVICE="brick"
elif [ "$TRIMUI_MODEL" = "Trimui Brick Pro" ]; then
export DEVICE="brickpro"
fi

export IS_NEXT="yes"
Expand Down
2 changes: 2 additions & 0 deletions skeleton/SYSTEM/tg5040/paks/MinUI.pak/launch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ mkdir -p "$SHARED_USERDATA_PATH/.minui"
export TRIMUI_MODEL=`strings /usr/trimui/bin/MainUI | grep ^Trimui`
if [ "$TRIMUI_MODEL" = "Trimui Brick" ]; then
export DEVICE="brick"
elif [ "$TRIMUI_MODEL" = "Trimui Brick Pro" ]; then
export DEVICE="brickpro"
else
export DEVICE="smartpro"
fi
Expand Down
2 changes: 1 addition & 1 deletion workspace/all/bootlogo/bootlogo.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ int loadImages()
// This needs to get a bit more flexible down the line, but for now we either expect the files
// in the pak root directory or in the "brick" subfolder.
char basepath[MAX_PATH];
if(exactMatch("brick", device)) {
if(exactMatch("brick", device) || exactMatch("brickpro", device)) {
snprintf(basepath, sizeof(basepath), "%s/Bootlogo.pak/brick/", TOOLS_PATH);
}
else {
Expand Down
34 changes: 27 additions & 7 deletions workspace/all/common/api.c
Original file line number Diff line number Diff line change
Expand Up @@ -3327,7 +3327,7 @@ FALLBACK_IMPLEMENTATION void PLAT_pollInput(void)
{
uint8_t code = event.key.keysym.scancode;
pressed = event.type == SDL_KEYDOWN;
// LOG_info("key event: %i (%i)\n", code,pressed);
LOG_info("key event: %i (%i)\n", code,pressed);
if (code == CODE_UP)
{
btn = BTN_DPAD_UP;
Expand Down Expand Up @@ -3403,6 +3403,11 @@ FALLBACK_IMPLEMENTATION void PLAT_pollInput(void)
btn = BTN_L3;
id = BTN_ID_L3;
}
else if (code == CODE_L4)
{
btn = BTN_L4;
id = BTN_ID_L4;
}
else if (code == CODE_R1)
{
btn = BTN_R1;
Expand All @@ -3418,6 +3423,11 @@ FALLBACK_IMPLEMENTATION void PLAT_pollInput(void)
btn = BTN_R3;
id = BTN_ID_R3;
}
else if (code == CODE_R4)
{
btn = BTN_R4;
id = BTN_ID_R4;
}
else if (code == CODE_PLUS)
{
btn = BTN_PLUS;
Expand All @@ -3443,7 +3453,7 @@ FALLBACK_IMPLEMENTATION void PLAT_pollInput(void)
{
uint8_t joy = event.jbutton.button;
pressed = event.type == SDL_JOYBUTTONDOWN;
// LOG_info("joy event: %i (%i)\n", joy,pressed);
LOG_info("joy event: %i (%i)\n", joy,pressed);
if (joy == JOY_UP)
{
btn = BTN_DPAD_UP;
Expand Down Expand Up @@ -3524,6 +3534,11 @@ FALLBACK_IMPLEMENTATION void PLAT_pollInput(void)
btn = BTN_L3;
id = BTN_ID_L3;
}
else if (joy == JOY_L4)
{
btn = BTN_L4;
id = BTN_ID_L4;
}
else if (joy == JOY_R1)
{
btn = BTN_R1;
Expand All @@ -3539,6 +3554,11 @@ FALLBACK_IMPLEMENTATION void PLAT_pollInput(void)
btn = BTN_R3;
id = BTN_ID_R3;
}
else if (joy == JOY_R4)
{
btn = BTN_R4;
id = BTN_ID_R4;
}
else if (joy == JOY_PLUS)
{
btn = BTN_PLUS;
Expand All @@ -3559,7 +3579,7 @@ FALLBACK_IMPLEMENTATION void PLAT_pollInput(void)
{
int hats[4] = {-1, -1, -1, -1}; // -1=no change,0=up,1=down,2=left,3=right btn_ids
int hat = event.jhat.value;
// LOG_info("hat event: %i\n", hat);
LOG_info("hat event: %i\n", hat);
// TODO: safe to assume hats will always be the primary dpad?
// TODO: this is literally a bitmask, make it one (oh, except there's 3 states...)
switch (hat)
Expand Down Expand Up @@ -4512,11 +4532,11 @@ void LEDS_updateLeds(bool indicator_only)
return;
}

int lightsize = 3;
char *device = getenv("DEVICE");
int is_brick = exactMatch("brick", device);
if (is_brick)
lightsize = 4;
int lightsize = exactMatch("brick", device) ? 4
: exactMatch("brickpro", device) ? 5
: 3; // smartpro, smartpro s

if(!lights)
{
LOG_error("LEDS_updateLeds called but lights is NULL\n");
Expand Down
4 changes: 4 additions & 0 deletions workspace/all/common/defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ enum {
BTN_ID_R2,
BTN_ID_L3,
BTN_ID_R3,
BTN_ID_L4,
BTN_ID_R4,
BTN_ID_MENU,
BTN_ID_PLUS,
BTN_ID_MINUS,
Expand Down Expand Up @@ -211,6 +213,8 @@ enum {
BTN_R2 = 1 << BTN_ID_R2,
BTN_L3 = 1 << BTN_ID_L3,
BTN_R3 = 1 << BTN_ID_R3,
BTN_L4 = 1 << BTN_ID_L4,
BTN_R4 = 1 << BTN_ID_R4,
BTN_MENU = 1 << BTN_ID_MENU,
BTN_PLUS = 1 << BTN_ID_PLUS,
BTN_MINUS = 1 << BTN_ID_MINUS,
Expand Down
14 changes: 13 additions & 1 deletion workspace/all/common/displaycal.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,19 @@ static const struct DisplayCalDefaults DisplayCalDefaults_SmartPro = {
DISPLAYCAL_SMARTPRO_DEFAULT_BLUE_GAIN
};

// TrimUI Brick Pro, TODO
static const struct DisplayCalDefaults DisplayCalDefaults_BrickPro = {
DISPLAYCAL_BRICK_DEFAULT_ENABLED,
DISPLAYCAL_BRICK_DEFAULT_RED_GAIN,
DISPLAYCAL_BRICK_DEFAULT_GREEN_GAIN,
DISPLAYCAL_BRICK_DEFAULT_BLUE_GAIN
};

enum DisplayCalPreset {
DISPLAYCAL_PRESET_DEFAULT = 0,
DISPLAYCAL_PRESET_BRICK,
DISPLAYCAL_PRESET_SMARTPRO
DISPLAYCAL_PRESET_SMARTPRO,
DISPLAYCAL_PRESET_BRICKPRO,
};

static inline DisplayCalDefaults DisplayCal_getDefaultSettings(enum DisplayCalPreset preset) {
Expand All @@ -59,6 +68,9 @@ static inline DisplayCalDefaults DisplayCal_getDefaultSettings(enum DisplayCalPr
if(preset == DISPLAYCAL_PRESET_BRICK) {
return DisplayCalDefaults_Brick;
}
if(preset == DISPLAYCAL_PRESET_BRICKPRO) {
return DisplayCalDefaults_BrickPro;
}
// Default preset
DisplayCalDefaults defaults = {
DISPLAYCAL_DEFAULT_ENABLED,
Expand Down
37 changes: 23 additions & 14 deletions workspace/all/ledcontrol/ledcontrol.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#define NUM_MAIN_OPTIONS 5
#define MAX_NAME_LEN 255

const char *lightnames[4];
const char *lightnames[5];
#define NROF_TRIGGERS 14
const char *triggernames[] = {
"B", "A", "Y", "X", "L", "R", "FN1", "FN2", "MENU", "SELECT", "START", "ALL", "LR", "DPAD"};
Expand All @@ -33,14 +33,17 @@ void save_settings() {
LOG_debug("saving settings plat\n");
char diskfilename[256];
char* device = getenv("DEVICE");
int is_brick = exactMatch("brick", device);
int maxlights = 4;
int maxlights = 3;
// TODO: this shouldnt be in shared userdata
if(is_brick) {
if(exactMatch("brick", device)) {
maxlights = 4;
snprintf(diskfilename, sizeof(diskfilename), SHARED_USERDATA_PATH "/ledsettings_brick.txt");
}
else if (exactMatch("brickpro", device)) {
maxlights = 5;
snprintf(diskfilename, sizeof(diskfilename), SHARED_USERDATA_PATH "/ledsettings_brickpro.txt");
}
else {
maxlights = 3;
snprintf(diskfilename, sizeof(diskfilename), SHARED_USERDATA_PATH "/ledsettings.txt");
}

Expand Down Expand Up @@ -214,14 +217,23 @@ void handle_light_input(LightSettings *light, SDL_Event *event, int selected_set
int main(int argc, char *argv[])
{
char* device = getenv("DEVICE");
int is_brick = exactMatch("brick", device);

InitSettings();
PWR_setCPUSpeed(CPU_SPEED_AUTO);

if (is_brick) {
int numOfLights = 3;
int combinedBrightness = 1;
if (exactMatch("brick", device)) {
const char *brick_names[] = {"F1 key", "F2 key", "Top bar", "L&R triggers"};
memcpy(lightnames, brick_names, sizeof(brick_names)); // Copy values
numOfLights = 4;
combinedBrightness = 0;
}
else if (exactMatch("brickpro", device)) {
const char *brickpro_names[] = {"F1 key", "F2 key", "Top bar", "Joysticks", "Triggers"};
memcpy(lightnames, brickpro_names, sizeof(brickpro_names)); // Copy values
numOfLights = 5;
combinedBrightness = 0;
} else {
const char *default_names[] = {"Joystick L","Joystick R", "Logo"};
memcpy(lightnames, default_names, sizeof(default_names)); // Copy values
Expand Down Expand Up @@ -264,9 +276,6 @@ int main(int argc, char *argv[])
dirty = 1;
had_bt = has_bt;

int numOfLights = 3;
if(is_brick) numOfLights = 4;

if (PAD_justPressed(BTN_B)) {
quit = 1;
}
Expand Down Expand Up @@ -321,12 +330,12 @@ int main(int argc, char *argv[])
// const char *settings_labels[6] = {"Effect", "Color", "Color2", "Speed", "Brightness", "Trigger"};
// this stuff is really not multiplatform at all, need to figure out a way so its not so TrimUI specific
const char *settings_labels[5]; // Define array with correct size
if (is_brick) {
const char *brick_labels[] = {"Effect", "Color", "Speed", "Brightness", "Info brightness"};
memcpy(settings_labels, brick_labels, sizeof(brick_labels)); // Copy values
} else {
if (combinedBrightness) {
const char *non_brick_labels[] = {"Effect", "Color", "Speed", "Brightness (All Leds)", "Info brightness (All Leds)"};
memcpy(settings_labels, non_brick_labels, sizeof(non_brick_labels)); // Copy values
} else {
const char *brick_labels[] = {"Effect", "Color", "Speed", "Brightness", "Info brightness"};
memcpy(settings_labels, brick_labels, sizeof(brick_labels)); // Copy values
}
int settings_values[5] = {
lightsDefault[selected_light].effect,
Expand Down
Loading
Loading