Ladder99 / fanuc-driver

Configurable Fanuc Focas data collector and post processor.
Apache License 2.0
72 stars 25 forks source link

`fanuc/{machine}/stat_info/{path}`: Potentially missing properties #36

Open tukusejssirs opened 2 years ago

tukusejssirs commented 2 years ago

According to the docs of cnc_statinfo, there are four groups based on the Fanuc series:

I suggest to support them all.

Note that some have two separate bytes (or bits?) for automatic and manual mode, others a single one.

Moreover, I suggest to modify the data structure a bit:

"data": {
  "alarm": "(No alarm)"
  "battery": "???",
  "edit": "****(Not editing)",
  "emergency": "(Not emergency)",
  "hdck": "???",
  "labelskip": "???",
  "mode": "automatic"  // automatic | manual
  "mode_type": "MDI"   // Change the property name if you find a better name
  "motion": "***",
  "mstb": "***",
  "run": "STOP",
  "tmmode": "???"
  "warning": "???",
  "write": "???",
}

Just a note: I have access to machines with the following Fanuc versions. I can test this on them.

Fanuc series Fanuc model Paths
Fanuc Series 0i-TD MODEL D 1
Fanuc Series 0i-TD MODEL D 2
Fanuc Series 0i-TF MODEL F 1
Fanuc Series 0i-TF Plus MODEL F 1
Fanuc Series 31i MODEL B 1
MRIIOT commented 2 years ago

These are the two structures available.

https://github.com/Ladder99/fanuc-driver/blob/12301dad1ca31ccb6e3dafcfcfbdf13bfede95c2/fanuc/fwlib.cs#L3319-L3354

tukusejssirs commented 2 years ago

It is already an improvement, but we still miss some other controller model data. :wink:

I suggest to add into the structure comment (e.g. /* cnc_statinfo:read CNC status information */) also the controller models which support that particular if branch. FS15D might be enough for you, but I still suggest to comment the code properly.

A nitpick: you still don’t use same code style: on L3321 use write Pack=4 (and L3324 SizeConst=2), in L3341 Pack = 4.

MRIIOT commented 2 years ago

fwlib.cs does need to be refactored.