Configurations
Configurations copied to clipboard
🔧 Update supported Simulator displays
Description
- Since @ellensp & @p3p got
TFT_LVGL_UI
working in the simulator, add it to the list of supported displays. - As a follow-up to #847, I removed
LIGHTWEIGHT_UI
from the set of conditionals below the supported Simulator display list. - ~~Fix CI with
BOARD_SIMULATED
~~ Moved to: #1050
Benefits
More complete list of supported displays in Simulator config.
Related Issues
- #1050 (required for this PR to pass CI)
- #847
Silly CI test! BOARD_SIMULATED
is valid: https://github.com/MarlinFirmware/Marlin/blob/af8dcc6ee8cdc86b879ce7bc0ee9d799d5597270/Marlin/src/core/boards.h#L533-L537
//
// Simulations
//
#define BOARD_SIMULATED 9999
Hmm. That board number doesn't match what's reported in the CI error:
Error: Can't find target(s) for SIMULATED (999).
@ellensp found a CI workaround: Add a comment after 9999
in boards.h
like the other boards. i.e.:
//
// Simulations
//
#define BOARD_SIMULATED 9999 // Native or Simulation
First issue is with regular expression
BNUM=$( sed -E 's/^.+BOARD_[^ ]+ +([0-9]+).+$/\1/' <<<"$BLINE" )
expects there to be characters after the board number eg
#define BOARD_CUSTOM 9998 // Custom pins definition for development and/or rare boards
but the one we want does not have anything after the number
#define BOARD_SIMULATED 9999
This returns 999
this is the fix
BNUM=$( sed -E 's/^.+BOARD_[^ ]+ +([0-9]+)(.|$)+$/\1/' <<<"$BLINE" )
this is the fix
CI still fails, but it now reports the correct board number (9999).
Second issue
ENVS=( $( grep -EA1 "MB\(.*\b$MB\b.*\)" Marlin/src/pins/pins.h | grep -E "#include.+//.+env:[^ ]+" | grep -oE "env:[^ ]+" | sed -E "s/env://" ) )
Is looking for env: in the pins line for the motherboard.
bur the simulator is special and does not have envs:
#elif MB(SIMULATED)
#include "linux/pins_RAMPS_LINUX.h" // Native or Simulation lin:linux_native mac:simulator_macos_debug mac:simulator_macos_release win:simulator_windows lin:simulator_linux_debug lin:simulator_linux_release
It has lin:
, win:
, and mac:
This updated line seems to fix it…
ENVS=( $( grep -EA1 "MB\(.*\b$MB\b.*\)" Marlin/src/pins/pins.h | grep -E "(#include.+//.+)(env|lin):[^ ]+" | grep -oE "(env|lin):[^ ]+" | sed -E "s/(env|lin)://" ) )
resulting in: Building environment linux_native
for board SIMULATED (9999)...
Edit: linux_native
is not correct for simulator
default env should not be linux native for the simulator force it to use simulator_linux_release try this (reverts the lin: search and checks for the special case SIMULATED)
# For each directory containing a changed config file, copy the .h files and build the code:
- name: Test all changed config files
run: |
cd Marlin
IFS=$'\n'
for dir in $DIRS; do
# Copy all .h files from the directory into the Marlin subfolder
echo "Building Configurations in $dir ..."
cp ../"$dir"/*.h Marlin/
# Strip out #error lines so it can build
sed -i~ -e "20,30{/#error/d}" "Marlin/Configuration.h"
rm -f "Marlin/Configuration.h~"
# Build Marlin with PlatformIO
MB=$( grep -E "^\s*#define MOTHERBOARD" Marlin/Configuration.h | awk '{ print $3 }' | sed 's/BOARD_//;s/\r//' )
[[ -z $MB ]] && { echo "::error::Can't read MOTHERBOARD setting." ; exit 3; }
BLINE=$( grep -E "define\s+BOARD_$MB\b" Marlin/src/core/boards.h )
BNUM=$( sed -E 's/^.+BOARD_[^ ]+ +([0-9]+)(.|$)+$/\1/' <<<"$BLINE" )
BDESC=$( sed -E 's/^.+\/\/ *(.+)$/\1/' <<<"$BLINE" )
[[ -z $BNUM ]] && { echo "::error::Can't find BOARD_$MB in core/boards.h." ; exit 3; }
if [ "$MB" == "SIMULATED" ]
then
ENVS=$"simulator_linux_release"
else
ENVS=( $( grep -EA1 "MB\(.*\b$MB\b.*\)" Marlin/src/pins/pins.h | grep -E "#include.+//.+env:[^ ]+" | grep -oE "env:[^ ]+" | sed -E "s/env://" ) )
fi
[[ -z $ENVS ]] && { echo "::error::Can't find target(s) for $MB ($BNUM)." ; exit 3; }
[[ ${#ENVS[*]} == 1 ]] && TARGET=$ENVS || TARGET="${ENVS[0]}"
echo "Building environment $TARGET for board $MB ($BNUM)..." ; echo
pio run -s -e $TARGET
# Reset the repo directory so the next iteration starts clean
git reset --hard HEAD
done
this is now the virtual machine needing the following installed to build the sim gcc [9.3.0, 10.2.0]: libsdl2-dev[2.0.10], libsdl2-net-dev[2.0.1], libglm-dev[0.9.9.7, 0.9.9.8]
I've moved CI fixes to #1050
Rebased on current import-2.1.x
since https://github.com/MarlinFirmware/Configurations/pull/1050 has been merged.