Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactoring, fixes and improvements #5

Merged
merged 46 commits into from
May 1, 2024
Merged

Refactoring, fixes and improvements #5

merged 46 commits into from
May 1, 2024

Conversation

samsamfire
Copy link
Owner

Features :

  • Refactored main package to use multiple sub packages
  • CAN driver is a seperate package
  • Reworked HTTP gateway, added a gateway interface type
  • Added an embedded default OD
  • Added network scan
  • Some API changes

Bug fixes :

  • Added sync.mutex in all objects to prevent race conditions
  • Fixed bugs in various objects (TIME, HTTP, etc)

Other :

  • Added more tests
  • A lot of refactoring overall

- New way of adding routes, makes it cleaner
- Handlers per route type
- Adding the concept of a BaseGateway for easy extending
- Adding more tests
Added more tests
Added SDO read & write
Added GetVersion
Adding Set default network / node
Regrouped all configurators tests inside node_configurator_test
Unexported configurators & creation because don't need to be created by user directly
- Moved different canopen functions in different modules inside of /pkg, which make things much clearer
- Some modules like fifo, crc have been moved to /internal
Changes :
- Default EDS is now embedded in binary
- Added a lot of helper functions for accessing private methods
- Some unexported members have been re-exported to allow the usage between packages

Currently not all tests have been re-established and some may be failing
Embedded SDO client in node
…ded a space in front of beginning of all comments

Also some else { if {}} replaced by else if {}
Append slices to same slice (change is sdo client and serialize)
Moved NMT config functions to heartbeat which is more appropriate.
Added documentation on OD.
- Changed SetInternalTime to take time as argument for better testing and side effects
- Added SetInternalTime test
- Removed access to IsConsumer and IsProducer, instead use getters
…consumers never processed the timestamp

Fixed : Error in uint cast of milliseconds in SetInternalTime of TIME because was using time.Since
Fixed : When changing node to consumer for TIME, can frame was not properly subscribed to.
Added : InternalTime which returns internal time
Added : SetProducerIntervalMs to update producer interval
Added : tests with multiple slave nodes to make sure that time sync works
Changed : Configurator objects are now pointers for convenience
… is accessed, even if already the case

Added : nrt tests that detected this error
Changed : adding variable in OD returns entry, which is easier to use.
Changed : SYNC has an RxToggle getter
Changed : moved TIME test to other node_test file
…ontaining entries 1006 & 1007 are directly referenced in SYNC object. So add locking also

Fixed : race conditions in RPDO, TPDO and extensions
Fixed : deadlock in NMT when receiving own message
Fixed : race conditions for heartbeats
…rent access between go routines. Especially true for PDOs for example, which update OD without SDO.

Fixed : Wrong type in addPDO for subobj 4 "Reserved"
Fixed : adding some locking in nodes to avoid race conditions
Fixed : failing test because wrong value for obj 0x2002
Fixed : disabled some virtual CAN tests as they can fail for network reasons
Fixed : Concurrent access in virtual CAN
Changed : VariableList now has an array of pointers, for consistency
Changed : Added subObj 3 & 4 in RPDO entries in default EDS ==> this also changed test in configurator to not error
Fixed : canopen_test now reworking
Added : race issue in emcy
…PDOs needs to be called.

Changed : Changed signature of AddRemoteNode ==> useLocal is now passed in StartPDOs
Added : Added Local(id) and Remote(id) to get local respectively remote nodes previously added in the network
Removed : removed redundant Read, Write call functions as these are already inside nodes
…sdo)

Refactored : Simplified ReadEDS
Changed : eds format handler also takes nodeId as argument
Feature : Add network.Scan to scan bus using SDO, added some tests for this
Fixed : CANopen master example updated for new AddRemoteNode signature
Feature : Added some simple tests around add/create/remove node behavior
Fixed : ReadRaw does not return EOF when finishing read
Refactored : use camelCase for naming in common
Refactored : renamed some variables in sdo, removed unused vars
Refactored : removed unnecessary type cast Command()
@samsamfire samsamfire merged commit 71e5bdd into main May 1, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant