Check the arguments to accel.ff(600,10);
The datasheet shows the 600 would be much smaller, Values between 300 mg and 600 mg
(0x05 to 0x09) are recommended.
page 26
Register 0x28—THRESH_FF (Read/Write)
The THRESH_FF register is eight bits and holds the threshold
value, in unsigned format, for free-fall detection. The acceleration on
all axes is compared with the value in THRESH_FF to determine if
a free-fall event occurred. The scale factor is 62.5 mg/LSB. Note
that a value of 0 mg may result in undesirable behavior if the freefall
interrupt is enabled. Values between 300 mg and 600 mg
(0x05 to 0x09) are recommended.
Register 0x29—TIME_FF (Read/Write)
The TIME_FF register is eight bits and stores an unsigned time
value representing the minimum time that the value of all axes
must be less than THRESH_FF to generate a free-fall interrupt.
The scale factor is 5 ms/LSB. A value of 0 may result in undesirable
behavior if the free-fall interrupt is enabled. Values between 100 ms
and 350 ms (0x14 to 0x46) are recommended.
The interrupt polarity could be flipped.
Register 0x31 bit D5
INT_INVERT Bit
A value of 0 in the INT_INVERT bit sets the interrupts to active
high, and a value of 1 sets the interrupts to active low.
I might be wrong of course, but I was expecting the ff function to convert my values. The docs on Espruino ADXL345 mention that the values are mg. It's also kind of working, it just happends the free fall event is only triggered once the device moves again.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Here are some things to try.
The datasheet shows the 600 would be much smaller, Values between 300 mg and 600 mg
(0x05 to 0x09) are recommended.
and 350 ms (0x14 to 0x46) are recommended
http://www.analog.com/media/en/technical-documentation/data-sheets/ADXL345.pdf
page 26
Register 0x28—THRESH_FF (Read/Write)
The THRESH_FF register is eight bits and holds the threshold
value, in unsigned format, for free-fall detection. The acceleration on
all axes is compared with the value in THRESH_FF to determine if
a free-fall event occurred. The scale factor is 62.5 mg/LSB. Note
that a value of 0 mg may result in undesirable behavior if the freefall
interrupt is enabled. Values between 300 mg and 600 mg
(0x05 to 0x09) are recommended.
Register 0x29—TIME_FF (Read/Write)
The TIME_FF register is eight bits and stores an unsigned time
value representing the minimum time that the value of all axes
must be less than THRESH_FF to generate a free-fall interrupt.
The scale factor is 5 ms/LSB. A value of 0 may result in undesirable
behavior if the free-fall interrupt is enabled. Values between 100 ms
and 350 ms (0x14 to 0x46) are recommended.
Register 0x31 bit D5
INT_INVERT Bit
A value of 0 in the INT_INVERT bit sets the interrupts to active
high, and a value of 1 sets the interrupts to active low.