Giter VIP home page Giter VIP logo

Comments (16)

 avatar commented on June 3, 2024

I have exactly the same problem and was just about to post a new issue.
I'm using node v4.4.2 in a Raspberry Pi 2 and I'm using this library through the RFM69 library.
This problem looks to be the same as it was in issue #16.

from pi-spi.

natevw avatar natevw commented on June 3, 2024

Can you try the latest from this repo via npm install natevw/pi-spi? I don't think it's related to #16, although I did update to the latest nan just in case.

If that checks out (I don't have a pi handy at the moment) then I can push as a new version.

UPDATE: working on a known issue after testing on a different [non-Pi] Linux install I did have handy.

UPDATE 2: okay, that issue should be resolved in 79243e2. It should build without warnings again now on Linux, and only the expected warning on macOS. Haven't actually tested SPI functionality yet, but theoretically that should still be working exactly as before.

from pi-spi.

 avatar commented on June 3, 2024

I tested with npm install natevw/pi-spi now and got:


[email protected] install /home/pi/Desktop/DEV/project/node_modules/pi-spi
node-gyp rebuild

make: Entering directory '/home/pi/Desktop/DEV/project/node_modules/pi-spi/build'
CXX(target) Release/obj.target/spi_binding/spi_binding.o
../spi_binding.cc: In member function \u2018virtual void SpiTransfer::Execute()\u2019:
../spi_binding.cc:61:50: warning: missing initializer for member \u2018spi_ioc_transfer::tx_buf\u2019 [-Wmissing-field-initializers]
struct spi_ioc_transfer msg = {};
^
../spi_binding.cc:61:50: warning: missing initializer for member \u2018spi_ioc_transfer::rx_buf\u2019 [-Wmissing-field-initializers]
../spi_binding.cc:61:50: warning: missing initializer for member \u2018spi_ioc_transfer::len\u2019 [-Wmissing-field-initializers]
../spi_binding.cc:61:50: warning: missing initializer for member \u2018spi_ioc_transfer::speed_hz\u2019 [-Wmissing-field-initializers]
../spi_binding.cc:61:50: warning: missing initializer for member \u2018spi_ioc_transfer::delay_usecs\u2019 [-Wmissing-field-initializers]
../spi_binding.cc:61:50: warning: missing initializer for member \u2018spi_ioc_transfer::bits_per_word\u2019 [-Wmissing-field-initializers]
../spi_binding.cc:61:50: warning: missing initializer for member \u2018spi_ioc_transfer::cs_change\u2019 [-Wmissing-field-initializers]
../spi_binding.cc:61:50: warning: missing initializer for member \u2018spi_ioc_transfer::tx_nbits\u2019 [-Wmissing-field-initializers]
../spi_binding.cc:61:50: warning: missing initializer for member \u2018spi_ioc_transfer::rx_nbits\u2019 [-Wmissing-field-initializers]
../spi_binding.cc:61:50: warning: missing initializer for member \u2018spi_ioc_transfer::pad\u2019 [-Wmissing-field-initializers]
SOLINK_MODULE(target) Release/obj.target/spi_binding.node
COPY Release/spi_binding.node
make: Leaving directory '/home/pi/Desktop/DEV/project/node_modules/pi-spi/build'
[email protected] node_modules/pi-spi
\u2514\u2500\u2500 [email protected]

from pi-spi.

johngrabner avatar johngrabner commented on June 3, 2024

i got the following

[email protected] install /home/pi/share/expresstut/node_modules/pi-spi
node-gyp rebuild

make: Entering directory '/home/pi/share/expresstut/node_modules/pi-spi/build'
CXX(target) Release/obj.target/spi_binding/spi_binding.o
../spi_binding.cc: In member function ‘virtual void SpiTransfer::Execute()’:
../spi_binding.cc:72:19: warning: missing initializer for member ‘spi_ioc_transfer::rx_nbits’ [-Wmissing-field-initializers]
};
^
../spi_binding.cc:72:19: warning: missing initializer for member ‘spi_ioc_transfer::pad’ [-Wmissing-field-initializers]
SOLINK_MODULE(target) Release/obj.target/spi_binding.node
COPY Release/spi_binding.node
make: Leaving directory '/home/pi/share/expresstut/node_modules/pi-spi/build'
[email protected] node_modules/pi-spi
└── [email protected]

from pi-spi.

johngrabner avatar johngrabner commented on June 3, 2024

version number had not changed, so maybe npm does not propagate the updates too fast.
How do i install by downloading directly from github?

from pi-spi.

johngrabner avatar johngrabner commented on June 3, 2024

I downloaded a zip from git, updated the version number and did a build. The error persists.
See

pi@raspberrypi ~/share/expresstut $ npm rebuild pi-spi

[email protected] install /home/pi/share/expresstut/node_modules/pi-spi
node-gyp rebuild

make: Entering directory '/home/pi/share/expresstut/node_modules/pi-spi/build'
CXX(target) Release/obj.target/spi_binding/spi_binding.o
../spi_binding.cc: In member function ‘virtual void SpiTransfer::Execute()’:
../spi_binding.cc:61:50: warning: missing initializer for member ‘spi_ioc_transfer::tx_buf’ [-Wmissing-field-initializers]
struct spi_ioc_transfer msg = {};
^
../spi_binding.cc:61:50: warning: missing initializer for member ‘spi_ioc_transfer::rx_buf’ [-Wmissing-field-initializers]
../spi_binding.cc:61:50: warning: missing initializer for member ‘spi_ioc_transfer::len’ [-Wmissing-field-initializers]
../spi_binding.cc:61:50: warning: missing initializer for member ‘spi_ioc_transfer::speed_hz’ [-Wmissing-field-initializers]
../spi_binding.cc:61:50: warning: missing initializer for member ‘spi_ioc_transfer::delay_usecs’ [-Wmissing-field-initializers]
../spi_binding.cc:61:50: warning: missing initializer for member ‘spi_ioc_transfer::bits_per_word’ [-Wmissing-field-initializers]
../spi_binding.cc:61:50: warning: missing initializer for member ‘spi_ioc_transfer::cs_change’ [-Wmissing-field-initializers]
../spi_binding.cc:61:50: warning: missing initializer for member ‘spi_ioc_transfer::tx_nbits’ [-Wmissing-field-initializers]
../spi_binding.cc:61:50: warning: missing initializer for member ‘spi_ioc_transfer::rx_nbits’ [-Wmissing-field-initializers]
../spi_binding.cc:61:50: warning: missing initializer for member ‘spi_ioc_transfer::pad’ [-Wmissing-field-initializers]
SOLINK_MODULE(target) Release/obj.target/spi_binding.node
COPY Release/spi_binding.node
make: Leaving directory '/home/pi/share/expresstut/node_modules/pi-spi/build'
[email protected] /home/pi/share/expresstut/node_modules/pi-spi
pi@raspberrypi ~/share/expresstut $

from pi-spi.

natevw avatar natevw commented on June 3, 2024

Whoops, missed this feedback for some reason. Thanks @Pipokid and @johngrabner for the testing, apparently I need to do more. For some reason I was not getting these warnings on the platforms I tested.

One thing, can you provide what node --version and npm --version as well as the uname -a of the system you're using on?

from pi-spi.

 avatar commented on June 3, 2024

Raspberry Pi 2 Model B (raspbian jessie, release from 2016-03-18)
node --version = v4.4.2
npm --version = 2.15.0
uname -a = Linux raspberry 4.1.19-v7+ #858 SMP Tue Mar 15 15:56:00 GMT 2016 armv7l GNU/Linux

Hope it helps @natevw. Let me know when you need to test it.

from pi-spi.

johngrabner avatar johngrabner commented on June 3, 2024

pi@raspberrypi ~/Documents/git/Nodejs-PAN $ uname -aLinux raspberrypi 4.4.11-v7+ #888 SMP Mon May 23 20:10:33 BST 2016 armv7l GNU/Linux
pi@raspberrypi ~/Documents/git/Nodejs-PAN $ node -vv4.4.5
pi@raspberrypi ~/Documents/git/Nodejs-PAN $ npm -v2.15.5

Date: Sat, 18 Jun 2016 08:18:01 -0700
From: [email protected]
To: [email protected]
CC: [email protected]; [email protected]
Subject: Re: [natevw/pi-spi] warning installing on raspberry (#21)

Whoops, missed this feedback for some reason. Thanks @Pipokid and @johngrabner for the testing, apparently I need to do more. For some reason I was not getting these warnings on the platforms I tested.

One thing, can you provide what node --version and npm --version as well as the uname -a of the system you're using on?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.

from pi-spi.

 avatar commented on June 3, 2024

@natevw Any news?
I really needed this library to work because it's a dependency of RFM69 which, as far as i know, is the only Javascript library able to talk with the HopeRF RFM69 radios.

from pi-spi.

johngrabner avatar johngrabner commented on June 3, 2024

The version in github works and so does the version in npm . The npm version generates a warning on install but works. I am running spi in a tight loop and no issues.

So your radio should be fine too.

from pi-spi.

 avatar commented on June 3, 2024

@johngrabner So, what you are saying is that this library should work even with the "missing initializers" warnings?
If that's the case, can you provide a piece of code that would allow me to test it?
Because if it does work, then i need to probably create an issue in the RFM69 repo.

from pi-spi.

johngrabner avatar johngrabner commented on June 3, 2024

Exactly, it works.
I'll send you my code when I get home tonight.

Sent from my iPhone

On Jun 29, 2016, at 2:38 PM, Filipe Silva [email protected] wrote:

@johngrabner So, what you are saying is that this library should work even with the "missing initializers" warnings?
If that's the case, can you provide a piece of code that would allow me to test it?
Because if it does work, then i need to probably create an issue in the RFM69 repo.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.

from pi-spi.

johngrabner avatar johngrabner commented on June 3, 2024

Here is my code

jjg_PAN/jjg_pan_spi/jjg_pan_spi.js

// variables for epoll interface to GPIO
var Epoll = require('epoll').Epoll,
fs = require('fs'),
valuefd = fs.openSync('/sys/class/gpio/gpio5/value', 'r'),
buffer = new Buffer(1);

// flow control between PI and PIC
var PIC_asked_PI_to_slow_down = 0
var Read_SPI_data_after_flow_control_cleared = false;

// Create a new Epoll. The callback is the interrupt handler.
var poller = new Epoll(function (err, fd, events) {
// Read GPIO value file. Reading also clears the interrupt.
fs.readSync(fd, buffer, 0, 1, 0);
console.log("change in PIC flow control, new value = " + buffer.toString());
PIC_asked_PI_to_slow_down = buffer[0]

// if pic is ok, and infinit recursion was stopped because of previous pic asking to slow down
// then start infinit recursion again
if (Read_SPI_data_after_flow_control_cleared && (PIC_asked_PI_to_slow_down == 0)) {
Read_SPI_data_after_flow_control_cleared = false
Exchange_SPI_Data();
}
});

// allow for registration of events from this object
var data_available_event_receipients = [];

exports.register_for_data_available_event = function (fn) {
//console.log("register a function of type = " + typeof(fn))
//console.log("the funciton is " + fn)

data_available_event_receipients.push(fn)

}
exports.unregister_for_data_available_events = function (fn){
var remaining = []
var i
for (i in data_available_event_receipients) {
if (i != fn){remaining.push(i)}
}
data_available_event_receipients = remaining
}

// hardware will be connected to pins matching a certain Linux SPI device
var SPI_DEV = "/dev/spidev0.0"

var spi = require('pi-spi')
var spiInstance = spi.initialize(SPI_DEV); // this sets up the SPI device for use in node.js
spiInstance.clockSpeed(500000);
spiInstance.dataMode(spi.mode.CPHA);
// DataBitLength = 8;

// todo, implement sending data into queue that buffer_out pulls from
var buffer_out = new Buffer(1)
buffer_out[0]=0

var Exchange_SPI_Data = function () {

spiInstance.transfer(buffer_out, 1, function (e, d){

if (e) {
console.error(e);
var x
for (x = 0; x < data_available_event_receipients.length; x++) {
data_available_event_receipients[x](e, null)
}
}
else {
//console.log("pushing -> " + buffer_out.toString('hex') + ", got -> " + d.toString('hex'))
// inform all listeners that data has arrived
var x
for (x =0; x< data_available_event_receipients.length; x++) {
data_available_event_receipients[x](null, d)
}
}

// read SPI immediatly or wait till flow control clears
if (PIC_asked_PI_to_slow_down) {
Read_SPI_data_after_flow_control_cleared = true
console.log("waiting for flow control to clear before reading more")
} else {
// do this function over again, but after others have had a chance to run
process.nextTick(Exchange_SPI_Data);
}
}); // spiInstance.transfer(debug_out, 1, function (e, d){
}

// trigger the infinit recursion
Exchange_SPI_Data();
Desktop version

Sent from my iPhone

On Jun 29, 2016, at 2:38 PM, Filipe Silva [email protected] wrote:

@johngrabner So, what you are saying is that this library should work even with the "missing initializers" warnings?
If that's the case, can you provide a piece of code that would allow me to test it?
Because if it does work, then i need to probably create an issue in the RFM69 repo.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.

from pi-spi.

natevw avatar natevw commented on June 3, 2024

@Pipokid Sorry, I haven't followed up on the issues with the attempted fix, but it was my understanding (and @johngrabner confirms above, thanks!) that the original bug was simply a warning that gets logged and not a blocker to actually using the library. Still hope to make it compile more cleanly, but haven't had a chance to get a Pi updated to the right stack yet (since apparently my quick tests under Ubuntu weren't representative enough).

from pi-spi.

natevw avatar natevw commented on June 3, 2024

I think this should be fixed as of [email protected] but please let me know if not. I didn't really make changes recently, just published the work I had already done here.

It's obviously been a while since I got caught up with this library, so it might be best to file a new issue if there's still some specific problems. Thanks!

from pi-spi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.