HAL_ChibiOS: use wildcard ROMFS name for fonts

This commit is contained in:
Andrew Tridgell 2018-07-09 17:58:57 +10:00
parent 822e20f830
commit fd02865a8b
6 changed files with 20 additions and 6 deletions

View File

@ -139,7 +139,7 @@ SPIDEV osd SPI3 DEVID4 MAX7456_CS MODE0 10*MHZ 10*MHZ
# setup for OSD # setup for OSD
define OSD_ENABLED ENABLED define OSD_ENABLED ENABLED
ROMFS osd_font.bin libraries/AP_OSD/fonts/clarity.bin ROMFS_WILDCARD libraries/AP_OSD/fonts/font*.bin
# 8 PWM available by default # 8 PWM available by default
define BOARD_PWM_COUNT_DEFAULT 8 define BOARD_PWM_COUNT_DEFAULT 8

View File

@ -167,7 +167,7 @@ define HAL_COMPASS_HMC5843_ROTATION ROTATION_YAW_90
define ALLOW_ARM_NO_COMPASS define ALLOW_ARM_NO_COMPASS
define OSD_ENABLED ENABLED define OSD_ENABLED ENABLED
ROMFS osd_font.bin libraries/AP_OSD/fonts/clarity.bin ROMFS_WILDCARD libraries/AP_OSD/fonts/font*.bin
define BOARD_PWM_COUNT_DEFAULT 9 define BOARD_PWM_COUNT_DEFAULT 9

View File

@ -166,4 +166,4 @@ define BOARD_PWM_COUNT_DEFAULT 8
# setup for OSD # setup for OSD
define OSD_ENABLED ENABLED define OSD_ENABLED ENABLED
ROMFS osd_font.bin libraries/AP_OSD/fonts/clarity.bin ROMFS_WILDCARD libraries/AP_OSD/fonts/font*.bin

View File

@ -124,4 +124,4 @@ define ALLOW_ARM_NO_COMPASS
define HAL_BARO_DEFAULT HAL_BARO_BMP280_SPI define HAL_BARO_DEFAULT HAL_BARO_BMP280_SPI
define OSD_ENABLED ENABLED define OSD_ENABLED ENABLED
ROMFS osd_font.bin libraries/AP_OSD/fonts/clarity.bin ROMFS_WILDCARD libraries/AP_OSD/fonts/font*.bin

View File

@ -136,4 +136,4 @@ define BOARD_PWM_COUNT_DEFAULT 6
#define CH_DBG_ENABLE_STACK_CHECK TRUE #define CH_DBG_ENABLE_STACK_CHECK TRUE
#font for the osd #font for the osd
ROMFS osd_font.bin libraries/AP_OSD/fonts/clarity.bin ROMFS_WILDCARD libraries/AP_OSD/fonts/font*.bin

View File

@ -1165,6 +1165,18 @@ def write_env_py(filename):
env_vars['CHIBIOS_BUILD_FLAGS'] = ' '.join(build_flags) env_vars['CHIBIOS_BUILD_FLAGS'] = ' '.join(build_flags)
pickle.dump(env_vars, open(filename, "wb")) pickle.dump(env_vars, open(filename, "wb"))
def romfs_add(romfs_filename, filename):
'''add a file to ROMFS'''
romfs.append((romfs_filename, filename))
def romfs_wildcard(pattern):
'''add a set of files to ROMFS by wildcard'''
base_path = os.path.join(os.path.dirname(__file__), '..', '..', '..', '..')
(pattern_dir, pattern) = os.path.split(pattern)
for f in os.listdir(os.path.join(base_path, pattern_dir)):
if fnmatch.fnmatch(f, pattern):
romfs.append((f, os.path.join(pattern_dir, f)))
def process_line(line): def process_line(line):
'''process one line of pin definition file''' '''process one line of pin definition file'''
global allpins global allpins
@ -1205,7 +1217,9 @@ def process_line(line):
if a[0] == 'SPIDEV': if a[0] == 'SPIDEV':
spidev.append(a[1:]) spidev.append(a[1:])
if a[0] == 'ROMFS': if a[0] == 'ROMFS':
romfs.append((a[1],a[2])) romfs_add(a[1],a[2])
if a[0] == 'ROMFS_WILDCARD':
romfs_wildcard(a[1])
if a[0] == 'undef': if a[0] == 'undef':
print("Removing %s" % a[1]) print("Removing %s" % a[1])
config.pop(a[1], '') config.pop(a[1], '')