@@ -163,7 +163,7 @@ def validate_threshold(threshold, mcu):
163
163
platform_default = get_platform_default_threshold (mcu )
164
164
if threshold < platform_default * 0.7 : # More than 30% below bleeding edge default
165
165
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 ***" )
167
167
168
168
if original_threshold != threshold :
169
169
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):
267
267
268
268
# Collect all possible sources
269
269
if config .has_option (current_env_section , setting_name ):
270
- try :
270
+ with suppress ( ValueError ) :
271
271
info ["env_specific" ] = config .getint (current_env_section , setting_name )
272
- except ValueError :
273
- pass
274
272
275
273
if config .has_option ("env" , setting_name ):
276
- try :
274
+ with suppress ( ValueError ) :
277
275
info ["global_env" ] = config .getint ("env" , setting_name )
278
- except ValueError :
279
- pass
280
-
276
+
281
277
if config .has_option ("platformio" , setting_name ):
282
- try :
278
+ with suppress ( ValueError ) :
283
279
info ["platformio_section" ] = config .getint ("platformio" , setting_name )
284
- except ValueError :
285
- pass
286
280
287
281
# Determine final threshold and source
288
282
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):
805
799
with _PATH_SHORTENING_LOCK :
806
800
if not _PATH_SHORTENING_MESSAGES ['shortening_applied' ]:
807
801
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
809
804
print (f"*** Applied include path shortening for { len (shortened_includes )} framework paths ***" )
810
805
print (f"*** Path length reduced from { original_length } to ~{ new_total_length } characters ***" )
811
806
print (f"*** Estimated savings: { saved_chars } characters ***" )
@@ -852,12 +847,12 @@ def smart_include_length_shorten(env, node):
852
847
853
848
# Extended debug information about bleeding edge threshold configuration
854
849
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 ***" )
856
851
print (f"*** MCU: { threshold_info ['mcu' ]} ***" )
857
852
print (f"*** Bleeding Edge Platform Default: { threshold_info ['platform_default' ]} ***" )
858
853
print (f"*** Final Bleeding Edge Threshold: { threshold_info ['final_threshold' ]} ***" )
859
854
print (f"*** Source: { threshold_info ['source' ]} ***" )
860
- print (f "*** Performance Mode: Maximum Aggressive ***" )
855
+ print ("*** Performance Mode: Maximum Aggressive ***" )
861
856
if threshold_info ['env_variable' ]:
862
857
print (f"*** Env Variable: { threshold_info ['env_variable' ]} ***" )
863
858
if threshold_info ['env_specific' ]:
0 commit comments