Skip to content

Commit

Permalink
Update PF-build.sh to work after @DRracer Remove FW version parsing PR
Browse files Browse the repository at this point in the history
  • Loading branch information
3d-gussner committed Jun 17, 2021
1 parent 589b781 commit 56889ba
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 5 deletions.
12 changes: 11 additions & 1 deletion Firmware/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,17 @@ extern uint16_t nPrinterType;
extern PGM_P sPrinterName;

// Firmware version
#define FW_VERSION "3.10.0"
#define FW_MAJOR 3
#define FW_MINOR 10
#define FW_REVISION 0
//#define FW_FLAVOR RC //uncomment if DEBUG, DEVEL, APLHA, BETA or RC
//#define FW_FLAVERSION 1 //uncomment if FW_FLAVOR is defined and versioning is needed.
#ifndef FW_FLAVOR
#define FW_VERSION STR(FW_MAJOR) "." STR(FW_MINOR) "." STR(FW_REVISION)
#else
#define FW_VERSION STR(FW_MAJOR) "." STR(FW_MINOR) "." STR(FW_REVISION) "-" STR(FW_FLAVOR) "" STR(FW_FLAVERSION)
#endif

#define FW_COMMIT_NR 4481
// FW_VERSION_UNKNOWN means this is an unofficial build.
// The firmware should only be checked into github with this symbol.
Expand Down
25 changes: 21 additions & 4 deletions PF-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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: 1.2.0-Build_49
# Version: 1.2.0-Build_53
# 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
Expand Down Expand Up @@ -148,6 +148,7 @@
# 61-62 MK404
# 03 May 2021, 3d-gussner, Update documentation and change version to v1.2.0
# 03 May 2021, 3d-gussner, Add SIM atmega404
# 17 Jun 2021, 3d-gussner, Update PF-build.sh to work after DRracer Remove FW version parsing PR

#### Start check if OSTYPE is supported
OS_FOUND=$( command -v uname)
Expand Down Expand Up @@ -745,7 +746,11 @@ do
VARIANT=$(basename "$v" ".h")
MK404_PRINTER=$(grep --max-count=1 "\bPRINTER_TYPE\b" $SCRIPT_PATH/Firmware/variants/$VARIANT.h | sed -e's/ */ /g' |cut -d ' ' -f3 | cut -d '_' -f2)
# Find firmware version in Configuration.h file and use it to generate the hex filename
FW=$(grep --max-count=1 "\bFW_VERSION\b" $SCRIPT_PATH/Firmware/Configuration.h | sed -e's/ */ /g'|cut -d '"' -f2|sed 's/\.//g')
FW_MAJOR=$(grep --max-count=1 "\bFW_MAJOR\b" $SCRIPT_PATH/Firmware/Configuration.h | sed -e's/ */ /g'|cut -d ' ' -f3)
FW_MINOR=$(grep --max-count=1 "\bFW_MINOR\b" $SCRIPT_PATH/Firmware/Configuration.h | sed -e's/ */ /g'|cut -d ' ' -f3)
FW_REVISION=$(grep --max-count=1 "\bFW_REVISION\b" $SCRIPT_PATH/Firmware/Configuration.h| sed -e's/ */ /g'|cut -d ' ' -f3)
FW="$FW_MAJOR$FW_MINOR$FW_REVISION"
#FW=$(grep --max-count=1 "\bFW_VERSION\b" $SCRIPT_PATH/Firmware/Configuration.h | sed -e's/ */ /g'|cut -d '"' -f2|sed 's/\.//g')
if [ -z "$BUILD" ] ; then
# Find build version in Configuration.h file and use it to generate the hex filename
BUILD=$(grep --max-count=1 "\bFW_COMMIT_NR\b" $SCRIPT_PATH/Firmware/Configuration.h | sed -e's/ */ /g'|cut -d ' ' -f3)
Expand All @@ -758,13 +763,25 @@ do
# Check if the motherboard is an EINSY and if so only one hex file will generated
MOTHERBOARD=$(grep --max-count=1 "\bMOTHERBOARD\b" $SCRIPT_PATH/Firmware/variants/$VARIANT.h | sed -e's/ */ /g' |cut -d ' ' -f3)
# Check development status
FW_FLAV=$(grep --max-count=1 "//#define FW_FLAVOR\b" $SCRIPT_PATH/Firmware/Configuration.h|cut -d ' ' -f1)
if [[ "$FW_FLAV" != "//#define" ]] ; then
FW_FLAVOR=$(grep --max-count=1 "\bFW_FLAVOR\b" $SCRIPT_PATH/Firmware/Configuration.h| sed -e's/ */ /g'|cut -d ' ' -f3)
FW_FLAVERSION=$(grep --max-count=1 "\bFW_FLAVERSION\b" $SCRIPT_PATH/Firmware/Configuration.h| sed -e's/ */ /g'|cut -d ' ' -f3)
if [[ "$FW_FLAVOR" != "//#define FW_FLAVOR" ]] ; then
FW="$FW-$FW_FLAVOR"
DEV_CHECK="$FW_FLAVOR"
if [ ! -z "$FW_FLAVERSION" ] ; then
FW="$FW$FW_FLAVERSION"
fi
fi
fi
DEV_CHECK=$(grep --max-count=1 "\bFW_VERSION\b" $SCRIPT_PATH/Firmware/Configuration.h | sed -e's/ */ /g'|cut -d '"' -f2|sed 's/\.//g'|cut -d '-' -f2)
if [ -z "$DEV_STATUS_SELECTED" ] ; then
if [[ "$DEV_CHECK" == *"RC"* ]] ; then
DEV_STATUS="RC"
elif [[ "$DEV_CHECK" == "ALPHA" ]]; then
elif [[ "$DEV_CHECK" == *"ALPHA"* ]]; then
DEV_STATUS="ALPHA"
elif [[ "$DEV_CHECK" == "BETA" ]]; then
elif [[ "$DEV_CHECK" == *"BETA"* ]]; then
DEV_STATUS="BETA"
elif [[ "$DEV_CHECK" == "DEVEL" ]]; then
DEV_STATUS="DEVEL"
Expand Down

0 comments on commit 56889ba

Please sign in to comment.