Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vickash committed Oct 2, 2024
1 parent 57b53b9 commit 347262a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
6 changes: 3 additions & 3 deletions lib/denko/spi/input_register.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ def enable_proxy
# Override Callbacks#update to make sure we handle :force_update
# within the main mutex lock.
#
def update(byte_string)
# Make sure to call #pre_callback_filter since overriding #update.
byte_array = pre_callback_filter(byte_string)
def update(message)
# Since overriding update, make sure this is a byte array first.
byte_array = ensure_byte_array(message)

bits = byte_array_to_bit_array(byte_array)

Expand Down
5 changes: 2 additions & 3 deletions lib/denko/spi/peripheral.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def spi_stop
bus.stop(select_pin)
end

def string_to_bytes(message)
def ensure_byte_array(message)
if message.class == Array
# Byte array coming from PiBoard.
return message
Expand All @@ -53,8 +53,7 @@ def string_to_bytes(message)
end

def update(message)
puts message
super(string_to_bytes(message))
super(ensure_byte_array(message))
end
end

Expand Down

0 comments on commit 347262a

Please sign in to comment.