Skip to content

feat: Planar Clarity Video Wall#65

Draft
GabFitzgerald wants to merge 758 commits into
masterfrom
planar-video-wall
Draft

feat: Planar Clarity Video Wall#65
GabFitzgerald wants to merge 758 commits into
masterfrom
planar-video-wall

Conversation

@GabFitzgerald
Copy link
Copy Markdown

First attempt
Resolves #59

some confusion with options / **options

@GabFitzgerald GabFitzgerald self-assigned this Oct 14, 2020
@GabFitzgerald GabFitzgerald marked this pull request as draft October 14, 2020 06:39
@kimburgess
Copy link
Copy Markdown
Contributor

Having a quick read now. To provide some further reading on **options, that's a use of splatting.

TL;DR it can be used as a continent way to forward an arbitrary set of keyword arguments around. It was used a lot in the previous Ruby drivers, but would recommend avoiding it unless absolutely needed here as it can lead to some sloppy type signatures.

Comment thread drivers/planar/clarity_matrix.cr Outdated
Comment thread drivers/planar/clarity_matrix.cr Outdated
Comment thread drivers/planar/clarity_matrix.cr Outdated
Comment thread drivers/planar/clarity_matrix.cr Outdated
Comment thread drivers/planar/clarity_matrix_spec.cr Outdated
@@ -0,0 +1,10 @@
DriverSpecs.mock_driver "Planar::ClarityMatrix" do
# on connect it should do_poll the device
should_send("op A1 display.power ? \r")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When writing specs, you also want to mock mock the device responses so that you test full request -> response behaviour. For some info on this, see: https://github.com/PlaceOS/drivers/blob/master/docs/writing-a-spec.md#testing-streaming-io.

Comment thread drivers/planar/codes.txt Outdated
@dukenguyenxyz
Copy link
Copy Markdown
Contributor

dukenguyenxyz commented Oct 15, 2020

Having a quick read now. To provide some further reading on **options, that's a use of splatting.

TL;DR it can be used as a continent way to forward an arbitrary set of keyword arguments around. It was used a lot in the previous Ruby drivers, but would recommend avoiding it unless absolutely needed here as it can lead to some sloppy type signatures.

Hi @kimburgess , upon going through this comment I thought it'd be a good idea to implement Hash instead of splat. However, this is not allowed since splatting in drivers is mostly used in

queue(**({
      name: command,
    }.merge(options))) do
...
end

and queue's method is defined in placeos-driver/src/placeos-driver.cr as follows (line 114-117)

  # Queuing
  def queue(**opts, &block : Task -> Nil)
    @__queue__.add(**opts, &block)
  end

which disallows anything but splats and NamedTuple in the argument.

Copy link
Copy Markdown
Contributor

@pkheav pkheav left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've had a look through and have picked up some things on style/feedback that @kimburgess has given me previously. There are probably other things I have missed or not knowledgable enough to give feedback on so best to reach out to @kimburgess for further feedback but this should hopefully be a good start of some things to look out for :)

Comment thread drivers/planar/clarity_matrix.cr Outdated
Comment thread drivers/planar/clarity_matrix.cr Outdated
Comment thread drivers/planar/clarity_matrix.cr Outdated
Comment thread drivers/planar/clarity_matrix.cr Outdated

protected def do_poll
power?
input_status if self["power"] == "ON"
Copy link
Copy Markdown
Contributor

@pkheav pkheav Oct 15, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self[:power] will be of type JSON::Any so this should be changed to:
input_status if self[:power]?&.try as_bool

I've noticed this is necessary in order to use self values that are of type Bool properly in conditional statements.

Explanation of why this is needed is here #19 (comment) and is probably to do with how crystal deals with truthy/falsy values

Copy link
Copy Markdown
Contributor

@pkheav pkheav Oct 15, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self[:key] will return an error if the key does not exist while self[:key]? will return nil so is safer to use generally.

.try is a safe way to deal with objects that may be nil https://crystal-lang.org/api/0.35.1/Object.html#try(&)-instance-method

as_bool https://crystal-lang.org/api/0.19.4/JSON/Any.html#as_bool%3ABool-instance-method is necessary in order to convert self[:power] which is of type JSON::Any to type Bool so it behaves as expected in conditional statements

Comment thread drivers/planar/clarity_matrix.cr Outdated
send "op ** slot.recall #{preset} \r", name: :recall
end

def input_status
Copy link
Copy Markdown
Contributor

@pkheav pkheav Oct 15, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be renamed to input? to keep it consistent with power? but @kimburgess can probably better comment on this

Comment thread drivers/planar/clarity_matrix.cr Outdated
Comment thread drivers/planar/clarity_matrix.cr Outdated
stakach and others added 22 commits February 5, 2021 12:04
improved proxy support
…t makes the upstream api respond much faster for some reason
introduces more flexible proxy configuration
to provide DNA spaces dashboard with status of the streams being consumed
* feat(sharp_pn): initial commit

* feat(sharp_pn): port over rest of driver

* feat(sharp_pn): add basic spec

* feat(sharp_pn): add spec for do_poll

* feat(sharp_pn): add delay/timeout for commands

* fix(sharp_pn): remove debugging

* chore(sharp_pn): crystal tool format
* feat(lg): initial commit

* feat(lg): add more methods

* feat(lg): add delay to some commands

* feat(lg): add cases on data receive

* fix(lg): handle commands that use the same value

* fix(lg): use safe self getter

* feat(lg): add specs for connected/do_poll

* feat(lg): add specs for power on/off

* fix(lg): use string form for query in specs

* feat(lg): group similar response behaviour

* chore(nec): add comments for Command1

* feat(lg): add test for input switching

* chore(lg): use warn instead of debug level logging

Co-authored-by: Kim Burgess <kim@place.technology>

* fix(lg): clear queue after hard_off

Co-authored-by: Kim Burgess <kim@place.technology>

* refactor(lg): use send and callback

* fix(lg): move connected to instance var

* fix(lg): update connected state

* chore(lg): run crystal format

* feat(lg ls5): implement minimal mute interface requirement

Co-authored-by: Philip Kheav <pkheav@Philips-MacBook-Pro.local>
Co-authored-by: Kim Burgess <kim@place.technology>
Co-authored-by: Stephen von Takach <steve@vontaka.ch>
* wip: epson projector conversion from ruby

* --no-edit

* wip

* wip

* docker-compose up --build not working

* wip

* fix(epson_proj): make compilable

* fix(epson_proj): use MuteLayer enum

* feat(epson_proj): add working send

* fix(epson_proj): use Array to store errors

* feat(epson_proj): add specs for do_poll

* feat(epson_proj): add more specs

* fix(epson_proj): store commands in hash

* fix(epson_proj): move unmute_volume to instance var

* feat(epson projector): simplify mute interface

crystal tool format

Co-authored-by: PlaceOS <support@place.technology>
Co-authored-by: Philip Kheav <philip.kheav@hotmail.com>
Co-authored-by: Stephen von Takach <steve@vontaka.ch>
stakach and others added 27 commits July 21, 2021 14:31
* fix(vergesense): Type of Space.People.coordinates

* style(vergesense): whitespace
* fix(vergesense): Type of Space.People.coordinates

* style(vergesense): whitespace

* fix(vergesense): Null space_ref_id seen in the wild
was previously looking for location objects for map details
use locker key as the primary method for accessing lockers
* feat(svsi): port decoder driver

* feat(svsi): port encoder driver

* fix(svsi): minor changes

* feat(svsi): port n_series_switcher

* feat(svsi_virtual_switcher): attempt to port

* fix(svsi): use correct variable name

* fix(svsi_virtual_switcher): use blocks

* fix(svsi_n_series): downcase property

* feat(svsi_virtual_switcher): implement Switchable

* fix(svsi_virtual_switcher): make types clearer

* feat(svsi_virtual_switcher): implement switch_to

* fix(svsi): implement more interfaces

* fix(svsi_virtual_switcher): decoder switch_to

* fix(svsi_virtual_switcher): use switch_to

* fix(svsi_virtual_switcher): workaround for int key

* fix(svsi_virtual_switcher): use correct indexes

* fix(svsi_virtual_switcher): use Int32 for input

* chore(svsi): clearly define delimiter

Co-authored-by: Caspian Baska <caspian@place.tech>

* style(svsi): run formatter

* fix(svsi): use delimiter directly

* refactor(svsi:decoder): use mapped_enum for commands

* refactor(svsi): ensure exhaustive case

* fix(svsi): construct do_send args

* fix(svsi): fix do_send

Co-authored-by: Caspian Baska <caspian@place.tech>
Co-authored-by: Caspian Baska <email@caspian.computer>
@caspiano caspiano changed the title Draft: Planar Clarity Video Wall feat: Planar Clarity Video Wall May 31, 2022
@stakach stakach force-pushed the planar-video-wall branch from 227e396 to 25e6640 Compare May 8, 2026 01:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Planar Clarity Video Wall