Go to advanced search

by tedani
Fri Nov 30, 2018 4:21 pm
Forum: Automation, sensing and robotics
Topic: Monitor temperature of different rooms
Replies: 6
Views: 2655

Re: Monitor temperature of different rooms

I'm also looking for similar solution. My home has 2 Danfoss TP5000 thermostats, I'm gonna replace them with smart ones. However, the smart heating solutions available in the market need a separate controller to switch on/off the boiler, the thermostat merely monitors the room temperature. I want to...
by tedani
Thu Nov 08, 2018 2:30 am
Forum: C/C++
Topic: serial port problem
Replies: 7
Views: 2480

Re: serial port problem

Stupid me. By removing O_NDELAY flag from open(), setting VTIME = 0 and VMIN = 1, now read() works.

Many thanks to those guys giving me the hints. :idea:
by tedani
Wed Nov 07, 2018 3:36 pm
Forum: C/C++
Topic: serial port problem
Replies: 7
Views: 2480

Re: serial port problem

I have another question. By using a while loop to check the input buffer, my program takes up 26% of the CPU time. If read() worked as expected, would CPU time be less than that?

Thanks.
by tedani
Wed Nov 07, 2018 3:28 pm
Forum: C/C++
Topic: serial port problem
Replies: 7
Views: 2480

Re: serial port problem

It seems I have "sort of" solved the problem by adding ioctl(uart_fd, FIONREAD, &i) before read(). The following is the code added for testing: do { ioctl(uart_fd, FIONREAD, &i); fprintf(stderr, "FIONREAD() got %d\n", i); } while (i == 0); i = read(uart_fd, &chr, 1); The following is the debug outpu...
by tedani
Wed Nov 07, 2018 9:53 am
Forum: C/C++
Topic: serial port problem
Replies: 7
Views: 2480

Re: serial port problem

Just tried examine the return value of read(): i = read(uart_fd, &chr, 1); if (!i) { fprintf(stderr, "read() timeout\n"); continue; } else if (1 < 0) { fprintf(stderr, "read() returns -1\n"); continue; } ... continue to process ... read() actually got something from the buffer. Unplugged the sensor ...
by tedani
Wed Nov 07, 2018 7:48 am
Forum: C/C++
Topic: serial port problem
Replies: 7
Views: 2480

Re: serial port problem

Hi, Stevend. 1. Are you confident that the data bits and parity are correctly set for the BME680? Yes, 100% sure. 2. There's a possibility that cfmakeraw() might override your prior settings (https://linux.die.net/man/3/cfmakeraw) I tried setting the parameters in my own code and using cfmakeraw(), ...
by tedani
Tue Nov 06, 2018 4:42 pm
Forum: C/C++
Topic: serial port problem
Replies: 7
Views: 2480

serial port problem

I have a BME680 module connected to RPi 3B+ through serial port AMA0. Bluetooth and console are disabled, AMA0 is expected to be a clean serial port connected to the extension pins. The BME680 module periodically sends data to RPi in the following format: 2-byte frame header: 0x5a 0x5a 1-byte conten...

Go to advanced search