Skip to content

Commit bb67bf8

Browse files
authored
minor changes
1 parent 5adc2c5 commit bb67bf8

File tree

1 file changed

+9
-14
lines changed

1 file changed

+9
-14
lines changed

builder/frameworks/arduino.py

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ def validate_threshold(threshold, mcu):
163163
platform_default = get_platform_default_threshold(mcu)
164164
if threshold < platform_default * 0.7: # More than 30% below bleeding edge default
165165
print(f"*** Info: Include path threshold {threshold} is conservative compared to bleeding edge default {platform_default} for {mcu} ***")
166-
print(f"*** Consider using higher values for maximum performance ***")
166+
print("*** Consider using higher values for maximum performance ***")
167167

168168
if original_threshold != threshold:
169169
logging.warning(f"Threshold adjusted from {original_threshold} to bleeding edge value {threshold} for {mcu}")
@@ -267,22 +267,16 @@ def get_threshold_info(env, config, current_env_section):
267267

268268
# Collect all possible sources
269269
if config.has_option(current_env_section, setting_name):
270-
try:
270+
with suppress(ValueError):
271271
info["env_specific"] = config.getint(current_env_section, setting_name)
272-
except ValueError:
273-
pass
274272

275273
if config.has_option("env", setting_name):
276-
try:
274+
with suppress(ValueError):
277275
info["global_env"] = config.getint("env", setting_name)
278-
except ValueError:
279-
pass
280-
276+
281277
if config.has_option("platformio", setting_name):
282-
try:
278+
with suppress(ValueError):
283279
info["platformio_section"] = config.getint("platformio", setting_name)
284-
except ValueError:
285-
pass
286280

287281
# Determine final threshold and source
288282
info["final_threshold"] = get_include_path_threshold(env, config, current_env_section)
@@ -805,7 +799,8 @@ def apply_include_shortening(env, node, includes, total_length):
805799
with _PATH_SHORTENING_LOCK:
806800
if not _PATH_SHORTENING_MESSAGES['shortening_applied']:
807801
if shortened_includes:
808-
new_total_length = original_length - saved_chars + len(f"-iprefix{FRAMEWORK_SDK_DIR}")
802+
removed_i_flags = len(shortened_includes) * 2 # Each -I is 2 chars
803+
new_total_length = original_length - saved_chars + len(f"-iprefix{FRAMEWORK_SDK_DIR}") - removed_i_flags
809804
print(f"*** Applied include path shortening for {len(shortened_includes)} framework paths ***")
810805
print(f"*** Path length reduced from {original_length} to ~{new_total_length} characters ***")
811806
print(f"*** Estimated savings: {saved_chars} characters ***")
@@ -852,12 +847,12 @@ def smart_include_length_shorten(env, node):
852847

853848
# Extended debug information about bleeding edge threshold configuration
854849
threshold_info = get_threshold_info(env, config, current_env_section)
855-
print(f"*** Bleeding Edge Threshold Configuration Debug ***")
850+
print("*** Bleeding Edge Threshold Configuration Debug ***")
856851
print(f"*** MCU: {threshold_info['mcu']} ***")
857852
print(f"*** Bleeding Edge Platform Default: {threshold_info['platform_default']} ***")
858853
print(f"*** Final Bleeding Edge Threshold: {threshold_info['final_threshold']} ***")
859854
print(f"*** Source: {threshold_info['source']} ***")
860-
print(f"*** Performance Mode: Maximum Aggressive ***")
855+
print("*** Performance Mode: Maximum Aggressive ***")
861856
if threshold_info['env_variable']:
862857
print(f"*** Env Variable: {threshold_info['env_variable']} ***")
863858
if threshold_info['env_specific']:

0 commit comments

Comments
 (0)