Skip to content

Commit 6d4bca1

Browse files
committed
fix autohunt
1 parent 0248847 commit 6d4bca1

File tree

1 file changed

+32
-3
lines changed

1 file changed

+32
-3
lines changed

src/main.rs

+32-3
Original file line numberDiff line numberDiff line change
@@ -2536,6 +2536,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
25362536
let mut last_hop_time = Instant::now();
25372537
let mut first_channel = (0u8, 0u32);
25382538
let mut hop_cycle: u32 = 0;
2539+
let mut old_hop_cycle = u32::MAX;
25392540
let mut autohunt_success_hop = u32::MAX;
25402541

25412542
// Set starting channel and create the hopper cycle.
@@ -2619,13 +2620,17 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
26192620

26202621
// Handle Hunting
26212622
let target_chans: HashMap<Target, Vec<(u8, u32)>> = oxide.if_hardware.target_chans.clone();
2622-
if oxide.config.autohunt && !target_chans.values().any(|value| value.is_empty()) {
2623-
// We found atleast one target channel.
2623+
// If we found atleast one
2624+
if oxide.config.autohunt
2625+
&& autohunt_success_hop == u32::MAX
2626+
&& !target_chans.values().any(|value| value.is_empty())
2627+
{
2628+
// We found atleast one target channel. Update autohunt_success_hop
26242629
autohunt_success_hop = hop_cycle;
26252630
}
26262631

26272632
if oxide.config.autohunt
2628-
&& !target_chans.values().any(|value| value.is_empty())
2633+
&& autohunt_success_hop != u32::MAX
26292634
&& hop_cycle >= autohunt_success_hop + 3
26302635
&& inside_geo
26312636
// if we are autohunting
@@ -2669,6 +2674,30 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
26692674
if !cli.notransmit {
26702675
oxide.config.notx = false; // Turn notx back to false unless CLI notransmit is true.
26712676
}
2677+
} else if oxide.config.autohunt && old_hop_cycle != hop_cycle {
2678+
old_hop_cycle = hop_cycle;
2679+
oxide.status_log.add_message(StatusMessage::new(
2680+
MessageType::Priority,
2681+
"=== AutoHunting NOT Complete ===".to_string(),
2682+
));
2683+
oxide.status_log.add_message(StatusMessage::new(
2684+
MessageType::Priority,
2685+
format!(
2686+
"Empty Target Chans: {:?}",
2687+
target_chans.values().filter(|value| value.is_empty())
2688+
),
2689+
));
2690+
oxide.status_log.add_message(StatusMessage::new(
2691+
MessageType::Priority,
2692+
format!(
2693+
"Hop Iteration: {} | First Success Hop: {}",
2694+
hop_cycle, autohunt_success_hop
2695+
),
2696+
));
2697+
oxide.status_log.add_message(StatusMessage::new(
2698+
MessageType::Priority,
2699+
format!("Inside Geo: {}", inside_geo),
2700+
));
26722701
}
26732702

26742703
// Calculate status rates

0 commit comments

Comments
 (0)