@@ -46,8 +46,8 @@ use crate::{
4646 keybinds:: { Action , BaseAction , BuiltinAction , Keybinds , PortAction , ShowPopupAction } ,
4747 notifications:: { EMERGE_TIME , EXPAND_TIME , EXPIRE_TIME , Notifications , PAUSE_AND_SHOW_TIME } ,
4848 serial:: {
49- DeserializedUsb , PrintablePortInfo , ReconnectType , Reconnections , SerialDisconnectReason ,
50- SerialEvent ,
49+ DeserializedUsb , PrintablePortInfo , ReconnectType , ReconnectionStrictness ,
50+ SerialDisconnectReason , SerialEvent ,
5151 handle:: { BlockingCommandError , SerialHandle } ,
5252 port_status:: InnerPortStatus ,
5353 worker:: MOCK_PORT_NAME ,
@@ -792,11 +792,16 @@ impl App {
792792 }
793793 SerialDisconnectReason :: Error ( error) => {
794794 error ! ( "Serial worker reported error on disconnect! {error}" ) ;
795- let reconnect_text = match & self . settings . serial . reconnections {
796- Reconnections :: Disabled => "Not attempting to reconnect" ,
797- Reconnections :: LooseChecks => "Attempting to reconnect (loose checks)" ,
798- Reconnections :: StrictChecks => {
799- "Attempting to reconnect (strict checks)"
795+ let reconnect_text = match & self . settings . serial . reconnection_strictness {
796+ ReconnectionStrictness :: Disabled => "Not attempting to reconnect" ,
797+ ReconnectionStrictness :: Low => {
798+ "Attempting to reconnect (low strictness checks)"
799+ }
800+ ReconnectionStrictness :: Med => {
801+ "Attempting to reconnect (med strictness checks)"
802+ }
803+ ReconnectionStrictness :: High => {
804+ "Attempting to reconnect (high strictness checks)"
800805 }
801806 } ;
802807 self . notifs . notify_str (
@@ -860,8 +865,12 @@ impl App {
860865
861866 let port_status = & self . serial . port_status . load ( ) . status ( ) ;
862867
863- let reconnections_allowed =
864- self . serial . port_settings . load ( ) . reconnections . allowed ( ) ;
868+ let reconnections_allowed = self
869+ . serial
870+ . port_settings
871+ . load ( )
872+ . reconnection_strictness
873+ . allowed ( ) ;
865874 if !port_status. is_connected ( )
866875 && !port_status. is_lent_out ( )
867876 && reconnections_allowed
@@ -1733,13 +1742,17 @@ impl App {
17331742 A :: Port ( PortAction :: DeassertRts ) => {
17341743 self . serial . write_signals ( None , Some ( false ) ) ?;
17351744 }
1736- A :: Port ( PortAction :: AttemptReconnectStrict ) => {
1745+ A :: Port ( PortAction :: AttemptReconnectStrictHigh ) => {
1746+ self . serial
1747+ . request_reconnect ( Some ( ReconnectionStrictness :: High ) ) ?;
1748+ }
1749+ A :: Port ( PortAction :: AttemptReconnectStrictMed ) => {
17371750 self . serial
1738- . request_reconnect ( Some ( Reconnections :: StrictChecks ) ) ?;
1751+ . request_reconnect ( Some ( ReconnectionStrictness :: Med ) ) ?;
17391752 }
1740- A :: Port ( PortAction :: AttemptReconnectLoose ) => {
1753+ A :: Port ( PortAction :: AttemptReconnectStrictLow ) => {
17411754 self . serial
1742- . request_reconnect ( Some ( Reconnections :: LooseChecks ) ) ?;
1755+ . request_reconnect ( Some ( ReconnectionStrictness :: Low ) ) ?;
17431756 }
17441757 A :: Base ( BaseAction :: ToggleTextwrap ) => {
17451758 let state = pretty_bool ( self . settings . rendering . wrap_text . flip ( ) ) ;
@@ -1996,7 +2009,7 @@ impl App {
19962009 // and if auto-reconnections is disabled.
19972010 // (when auto-reconns. are enabled, the normal Disconnect prompt
19982011 // is supposed to show to act as a pause for auto-reconnections)
1999- && !port_settings_guard. reconnections . allowed ( ) )
2012+ && !port_settings_guard. reconnection_strictness . allowed ( ) )
20002013 }
20012014 // fn tab_pressed(&mut self) {}
20022015 fn esc_pressed ( & mut self ) {
@@ -2877,14 +2890,14 @@ impl App {
28772890 self . notifs
28782891 . notify_str ( "Attempting to reconnect! (Loose Checks)" , Color :: Yellow ) ;
28792892 self . serial
2880- . request_reconnect ( Some ( Reconnections :: LooseChecks ) ) ?;
2893+ . request_reconnect ( Some ( ReconnectionStrictness :: Low ) ) ?;
28812894 }
28822895 AttemptReconnectPrompt :: AttemptReconnect => {
28832896 self . repeating_line_flip . flip ( ) ;
28842897 self . notifs
28852898 . notify_str ( "Attempting to reconnect! (Strict Checks)" , Color :: Yellow ) ;
28862899 self . serial
2887- . request_reconnect ( Some ( Reconnections :: StrictChecks ) ) ?;
2900+ . request_reconnect ( Some ( ReconnectionStrictness :: High ) ) ?;
28882901 }
28892902 AttemptReconnectPrompt :: Cancel => self . dismiss_popup ( ) ,
28902903 AttemptReconnectPrompt :: OpenPortSettings => {
@@ -3227,7 +3240,7 @@ impl App {
32273240 }
32283241 Popup :: DisconnectPrompt => {
32293242 let port_state = { self . serial . port_status . load ( ) . status ( ) } ;
3230- let reconns_paused = if self . settings . serial . reconnections . allowed ( )
3243+ let reconns_paused = if self . settings . serial . reconnection_strictness . allowed ( )
32313244 && port_state. is_premature_disconnect ( )
32323245 {
32333246 Some ( "(Auto-reconnections paused while open)" )
0 commit comments