Open tylerval18 opened 2 years ago
What thread_delay have you set? I have mine at 7 and have no issue
What thread_delay have you set? I have mine at 7 and have no issue
was at 5, changed it to 10 and its slightly better but still repeats sometimes
In your config file, stagger each account's start coords. I've found that it helps a lot with it not repeating pixels. [0,0], [0,1], [0,2], [1,0], [1,1], [1,2], etc....
I am having the same issue, thread delay 8. When I start it up it will replace pixels with the same color they already are.
patch that uses a lock and a delay
diff --git a/main.py b/main.py
index 17ca04b..769a77f 100755
--- a/main.py
+++ b/main.py
@@ -58,6 +58,9 @@ class PlaceClient:
# Initialize-functions
self.load_image()
+ # place lock
+ self._image_lock = threading.Lock()
+
""" Utils """
# Convert rgb tuple to hexadecimal string
@@ -481,37 +484,40 @@ class PlaceClient:
# get target color
# target_rgb = pix[current_r, current_c]
- # get current pixel position from input image and replacement color
- current_r, current_c, new_rgb = self.get_unset_pixel(
- self.get_board(self.access_tokens[index]),
- current_r,
- current_c,
- index,
- )
+ with self._image_lock:
+ # get current pixel position from input image and replacement color
+ current_r, current_c, new_rgb = self.get_unset_pixel(
+ self.get_board(self.access_tokens[index]),
+ current_r,
+ current_c,
+ index,
+ )
- # get converted color
- new_rgb_hex = self.rgb_to_hex(new_rgb)
- pixel_color_index = color_map[new_rgb_hex]
-
- logger.info("\nAccount Placing: ", name, "\n")
-
- # draw the pixel onto r/place
- # There's a better way to do this
- canvas = 0
- pixel_x_start = self.pixel_x_start + current_r
- pixel_y_start = self.pixel_y_start + current_c
- while pixel_x_start > 999:
- pixel_x_start -= 1000
- canvas += 1
-
- # draw the pixel onto r/place
- next_pixel_placement_time = self.set_pixel_and_check_ratelimit(
- self.access_tokens[index],
- pixel_x_start,
- pixel_y_start,
- pixel_color_index,
- canvas,
- )
+ # get converted color
+ new_rgb_hex = self.rgb_to_hex(new_rgb)
+ pixel_color_index = color_map[new_rgb_hex]
+
+ logger.info("\nAccount Placing: "+ name+ "\n")
+
+ # draw the pixel onto r/place
+ # There's a better way to do this
+ canvas = 0
+ pixel_x_start = self.pixel_x_start + current_r
+ pixel_y_start = self.pixel_y_start + current_c
+ while pixel_x_start > 999:
+ pixel_x_start -= 1000
+ canvas += 1
+
+ # draw the pixel onto r/place
+ next_pixel_placement_time = self.set_pixel_and_check_ratelimit(
+ self.access_tokens[index],
+ pixel_x_start,
+ pixel_y_start,
+ pixel_color_index,
+ canvas,
+ )
+ # Sleep with lock to give board time to update
+ time.sleep(5)
current_r += 1
Latest version seems to have fixed this.
I've got this same issue
EDIT: Raising thread delay helped