diff --git a/PF-build.sh b/PF-build.sh index 296463d3..71ce4a90 100755 --- a/PF-build.sh +++ b/PF-build.sh @@ -56,7 +56,7 @@ # Some may argue that this is only used by a script, BUT as soon someone accidentally or on purpose starts Arduino IDE # it will use the default Arduino IDE folders and so can corrupt the build environment. # -# Version: 2.0.0-Build_67 +# Version: 2.0.0-Build_69 # Change log: # 12 Jan 2019, 3d-gussner, Fixed "compiler.c.elf.flags=-w -Os -Wl,-u,vfprintf -lprintf_flt -lm -Wl,--gc-sections" in 'platform.txt' # 16 Jan 2019, 3d-gussner, Build_2, Added development check to modify 'Configuration.h' to prevent unwanted LCD messages that Firmware is unknown @@ -169,8 +169,13 @@ # 21 Jan 2022, 3d-gussner, Sort variants # Add Arduino 1.8.19 as an option # 25 Jan 2022, 3d-gussner, Allow upper and lower case for MK404 +# 09 Feb 2022, 3d-gussner, Add community language firmware files for MK2.5/S +# Add selection of language in MK404 for MK2.5/S +# 10 Feb 2022, 3d-gussner, Add SRCDIR for compatibility with build server + SCRIPT_PATH="$( cd "$(dirname "$0")" ; pwd -P )" +export SRCDIR=$SCRIPT_PATH #### Start: Failures failures() @@ -224,7 +229,7 @@ while getopts b:c:d:g:h:i:j:l:m:n:o:p:v:x:y:?h flag # '?' 'h' argument usage and help if [ "$help_flag" == "1" ] ; then echo "***************************************" -echo "* PF-build.sh Version: 2.0.0-Build_67 *" +echo "* PF-build.sh Version: 2.0.0-Build_69 *" echo "***************************************" echo "Arguments:" echo "$(tput setaf 2)-b$(tput sgr0) Build/commit number" @@ -1321,25 +1326,24 @@ create_multi_firmware() cp -f firmware.hex $SCRIPT_PATH/../$OUTPUT_FOLDER/$OUTPUT_FILENAME.hex cp -f $BUILD_PATH/Firmware.ino.elf $SCRIPT_PATH/../$OUTPUT_FOLDER/$OUTPUT_FILENAME.elf else - echo "$(tput setaf 2)Zip multi language firmware for MK2.5/miniRAMbo board to PF-build-hex folder$(tput sgr 0)" - cp -f firmware_cz.hex $SCRIPT_PATH/../$OUTPUT_FOLDER/$OUTPUT_FILENAME-cz.hex - cp -f firmware_de.hex $SCRIPT_PATH/../$OUTPUT_FOLDER/$OUTPUT_FILENAME-de.hex - cp -f firmware_es.hex $SCRIPT_PATH/../$OUTPUT_FOLDER/$OUTPUT_FILENAME-es.hex - cp -f firmware_fr.hex $SCRIPT_PATH/../$OUTPUT_FOLDER/$OUTPUT_FILENAME-fr.hex - cp -f firmware_it.hex $SCRIPT_PATH/../$OUTPUT_FOLDER/$OUTPUT_FILENAME-it.hex - cp -f firmware_pl.hex $SCRIPT_PATH/../$OUTPUT_FOLDER/$OUTPUT_FILENAME-pl.hex - cp -f firmware_nl.hex $SCRIPT_PATH/../$OUTPUT_FOLDER/$OUTPUT_FILENAME-nl.hex + #Search for created firmware languages + langs=$(find firmware_*.hex | cut -d "_" -f2 | cut -d "." -f1) + #Copy found firmware_*.hex files + for la in $langs; do + cp -f firmware_$la.hex $SCRIPT_PATH/../$OUTPUT_FOLDER/$OUTPUT_FILENAME-$la.hex + done cp -f $BUILD_PATH/Firmware.ino.elf $SCRIPT_PATH/../$OUTPUT_FOLDER/$OUTPUT_FILENAME.elf + echo "$(tput setaf 2)Zip multi language firmware for MK2.5/miniRAMbo board to PF-build-hex folder$(tput sgr 0)" if [ $TARGET_OS == "windows" ]; then zip a $SCRIPT_PATH/../$OUTPUT_FOLDER/$OUTPUT_FILENAME.zip $SCRIPT_PATH/../$OUTPUT_FOLDER/$OUTPUT_FILENAME-??.hex - rm $SCRIPT_PATH/../$OUTPUT_FOLDER/$OUTPUT_FILENAME-??.hex + #rm $SCRIPT_PATH/../$OUTPUT_FOLDER/$OUTPUT_FILENAME-??.hex elif [ $TARGET_OS == "linux" ]; then # Make a copy for MK404 sim of MK2, MK2.5, MK2.5S firmware if [ ! -z "$mk404_flag" ]; then cp -f firmware_de.hex $SCRIPT_PATH/../$OUTPUT_FOLDER/$OUTPUT_FILENAME.hex fi # End of MK2, MK2.5, MK2.5S firmware copy - zip -m -j ../../$OUTPUT_FOLDER/$OUTPUT_FILENAME.zip ../../$OUTPUT_FOLDER/$OUTPUT_FILENAME-??.hex + zip -j ../../$OUTPUT_FOLDER/$OUTPUT_FILENAME.zip ../../$OUTPUT_FOLDER/$OUTPUT_FILENAME-??.hex fi fi @@ -1500,11 +1504,6 @@ fi if [[ ! -z "$mk404_flag" && "$variant_flag" != "All " ]]; then -# For Prusa MK2, MK2.5/S - if [ "$MOTHERBOARD" == "BOARD_RAMBO_MINI_1_3" ]; then - MK404_PRINTER="${MK404_PRINTER}_mR13" - fi - # Run MK404 with 'debugcore' and/or 'bootloader-file' if [ ! -z "$board_mem_flag" ]; then MK404_options="-x $board_mem_flag" @@ -1535,7 +1534,16 @@ if [[ ! -z "$mk404_flag" && "$variant_flag" != "All " ]]; then #Decide which hex file to use EN_ONLY or Multi language if [ "$LANGUAGES" == "ALL" ]; then - MK404_firmware_file=$SCRIPT_PATH/../$OUTPUT_FOLDER/$OUTPUT_FILENAME.hex + if [[ "$MK404_PRINTER" == "MK3" || "$MK404_PRINTER" == "MK3S" ]]; then + MK404_firmware_file=$SCRIPT_PATH/../$OUTPUT_FOLDER/$OUTPUT_FILENAME.hex + else + PS3="Select a language:" + select lan in ${langs[@]} + do + MK404_firmware_file=$SCRIPT_PATH/../$OUTPUT_FOLDER/$OUTPUT_FILENAME-$lan.hex + break + done + fi else MK404_firmware_file=$SCRIPT_PATH/../$OUTPUT_FOLDER/$OUTPUT_FILENAME-EN_ONLY.hex fi diff --git a/lang/config.sh b/lang/config.sh index 13faebb2..a713cea2 100755 --- a/lang/config.sh +++ b/lang/config.sh @@ -1,6 +1,6 @@ #!/bin/bash # -# Version 1.0.1 Build 9 +# Version 1.0.1 Build 10 # # config.sh - multi-language support configuration script # Definition of absolute paths etc. @@ -19,8 +19,16 @@ # and use these. More flexible for different build # scripts # Check correctly if files or dirs exist +# 10 Feb. 2022, 3d-gussner, Add SRCDIR for compatibility with build server ############################################################################# # +if [ -z "$SRCDIR" ]; then + export SRCDIR=".." +fi + +LNGDIR="$( cd "$(dirname "$0")" ; pwd -P )" +export LNGDIR=$LNGDIR + # Arduino main folder: if [ -z "$ARDUINO" ]; then export ARDUINO=../../PF-build-env-1.0.6/1.8.5-1.0.4-linux-64 #C:/arduino-1.8.5 @@ -68,15 +76,15 @@ fi MAX_COMMINITY_LANG=10 # Total 16 - 6 default COMMUNITY_LANGUAGES="" #Search Firmware/config.h for active community group -COMMUNITY_LANG_GROUP=$(grep --max-count=1 "^#define COMMUNITY_LANG_GROUP" ../Firmware/config.h| cut -d ' ' -f3) +COMMUNITY_LANG_GROUP=$(grep --max-count=1 "^#define COMMUNITY_LANG_GROUP" $SRCDIR/Firmware/config.h| cut -d ' ' -f3) # Search Firmware/config.h for active community languanges if [ "$COMMUNITY_LANG_GROUP" = "1" ]; then - COMMUNITY_LANGUAGES=$(grep --max-count=$MAX_COMMINITY_LANG "^#define COMMUNITY_LANG_GROUP1_" ../Firmware/config.h| cut -d '_' -f4 |cut -d ' ' -f1 |tr '[:upper:]' '[:lower:]'| tr '\n' ' ') + COMMUNITY_LANGUAGES=$(grep --max-count=$MAX_COMMINITY_LANG "^#define COMMUNITY_LANG_GROUP1_" $SRCDIR/Firmware/config.h| cut -d '_' -f4 |cut -d ' ' -f1 |tr '[:upper:]' '[:lower:]'| tr '\n' ' ') elif [ "$COMMUNITY_LANG_GROUP" = "2" ]; then - COMMUNITY_LANGUAGES=$(grep --max-count=$MAX_COMMINITY_LANG "^#define COMMUNITY_LANG_GROUP2_" ../Firmware/config.h| cut -d '_' -f4 |cut -d ' ' -f1 |tr '[:upper:]' '[:lower:]'| tr '\n' ' ') + COMMUNITY_LANGUAGES=$(grep --max-count=$MAX_COMMINITY_LANG "^#define COMMUNITY_LANG_GROUP2_" $SRCDIR/Firmware/config.h| cut -d '_' -f4 |cut -d ' ' -f1 |tr '[:upper:]' '[:lower:]'| tr '\n' ' ') elif [ "$COMMUNITY_LANG_GROUP" = "3" ]; then - COMMUNITY_LANGUAGES=$(grep --max-count=$MAX_COMMINITY_LANG "^#define COMMUNITY_LANG_GROUP3_" ../Firmware/config.h| cut -d '_' -f4 |cut -d ' ' -f1 |tr '[:upper:]' '[:lower:]'| tr '\n' ' ') + COMMUNITY_LANGUAGES=$(grep --max-count=$MAX_COMMINITY_LANG "^#define COMMUNITY_LANG_GROUP3_" $SRCDIR/Firmware/config.h| cut -d '_' -f4 |cut -d ' ' -f1 |tr '[:upper:]' '[:lower:]'| tr '\n' ' ') fi if [ -z "$COMMUNITY_LANGUAGES" ]; then diff --git a/lang/lang-build.sh b/lang/lang-build.sh index 21eeb4bd..ac28fa9d 100755 --- a/lang/lang-build.sh +++ b/lang/lang-build.sh @@ -1,6 +1,6 @@ #!/bin/bash # -# Version 1.0.2 Build 25 +# Version 1.0.2 Build 27 # # lang-build.sh - multi-language support script # generate lang_xx.bin (language binary file) @@ -56,6 +56,7 @@ # to get Build Nr # 25 Jan. 2022, 3d-gussner, Fix check # Update documentation +# 10 Feb. 2022, 3d-gussner, Use SRCDIR for compatibility with build server ############################################################################# # # Config: @@ -170,7 +171,7 @@ generate_binary() #Calculate the number of strings and save to temporary file echo $count >lang_en.cnt #read the allowed maxsize from "../Firmware/config.h" and save to temporary file - maxsize=$(($(grep "#define LANG_SIZE_RESERVED" ../Firmware/config.h|sed -e's/ */ /g' |cut -d ' ' -f3))) + maxsize=$(($(grep "#define LANG_SIZE_RESERVED" $SRCDIR/Firmware/config.h|sed -e's/ */ /g' |cut -d ' ' -f3))) echo "maxsize="$maxsize >&2 echo $maxsize >lang_en.max