Array parameter syntax limitations (M260 & NeoDriver examples)
-
This might possibly be a generalized truth about array parameters, and may even be by design; so this may be a documentation suggestion, but it seems like array parameter syntax is inconsistent depending on whether the value includes any expressions (which is the only way I've found to use hex numbers).
I'm using M260 to send I2C messages to the Adafruit NeoDriver to control NeoPixels.
This particular application has me use 0x60 for the A parameter (I2C address of the card), and the B parameter is an array which needs to start with 0x0E ("function register" for NeoPixels on the card, whose chip can do other things).
I can make it work with A96 or A{0x60}, or set a variable "I2CAddress" to either 96 or 0x60, then A{var.I2CAddress}. But the only one of these techniques which seems to work for the B parameter of M260 is B14. Nothing using hex or variables works, except an array variable or array value for the entire B parameter. Otherwise, only a literal decimal value works for the first value. So these work:
; Example 1
M260 A{var.I2CAddress} B14:4:0:0:255:255:255; Example 2
var B = {14,4,0,0,255,255,255}
M260 A{var.I2CAddress} B{var.B}; Example 3
var BASE_ADDR_NEO_PIX = 0x0E
var B = {var.BASE_ADDR_NEO_PIX,4,0,0,255,255,255}
M260 A{var.I2CAddress} B{var.B}; Example 4
var BASE_ADDR_NEO_PIX = 0x0E
M260 A{var.I2CAddress} B{var.BASE_ADDR_NEO_PIX,4,0,0,255,255,255}but none of these work, although no error messages gets displayed:
; Example 5
M260 A{var.I2CAddress} B{0x0E}:4:0:0:255:255:255; Example 6
var BASE_ADDR_NEO_PIX = 0x0E
M260 A{var.I2CAddress} B{var.BASE_ADDR_NEO_PIX}:4:0:0:255:255:255; Example 7
var BASE_ADDR_NEO_PIX = 14
M260 A{var.I2CAddress} B{var.BASE_ADDR_NEO_PIX}:4:0:0:255:255:255NeoDriver information:
https://learn.adafruit.com/adafruit-seesaw-atsamd09-breakout/neopixel -
@DonStauffer that's as expected in RRF 3.5. Where a parameter expects an array, you must either provide a colon-separated list of plain values, or an array-valued expression; except that if the array is allowed to have length 1 then you may instead provide either a single plain value or a non-array expression of the appropriate type. So in your examples 5, 6 and 7 everything following B{ ... } is ignored.