@skywatch Yes ... RTFM ... So simple
Posts made by barrydou
-
RE: [SOLVED]Atmega 328P reset to start
-
RE: [SOLVED]Atmega 328P reset to start
I've just found it !
I added a 100nf caps between VCC and GND, just near pin 7 and 8, like documented on the MiniCore github page.
https://github.com/MCUdude/MiniCore => DIP-28 package ATmega8/48/88/168/328And now, it's work as expected. I just plug VCC and GND, and the led blink twice per second.
Don't know why, but it's OK
Thank you for all your ideas
-
RE: [SOLVED]Atmega 328P reset to start
@skywatch said in Atmega 328P reset to start:
@barrydou said in Atmega 328P reset to start:
@skywatch
Yes after flashing MiniCore, the led flash twice per second.That is good!
If I keep only VCC, GND, pullup on Reset and the led on D13, I unplug / replug the power => Nothing, until I force a reset (GND on Reset pin)
How are you removing the power and for how long? Try 30 seconds before reconnect.....
I unplug the vcc dupond cable from breadboard (beetween power source and breadboard). And I plug it again.
Before this message, I unplug during a few seconds. I try 1 minute now, it's the same.When I force, the led flash twice per second (even without clock, but the fuses are set to 8Mhz Internal)
That is contradictory - it is not 'without clock' if the fuses are set to 8MHx internal - it has 8MHz internal clock running.....OR maybe I mis-understand?
Sorry, I mean without external clock. I remove external Quartz and Caps just after flashing the minicore
-
RE: [SOLVED]Atmega 328P reset to start
@skywatch
Yes after flashing MiniCore, the led flash twice per second.
If I keep only VCC, GND, pullup on Reset and the led on D13, I unplug / replug the power => Nothing, until I force a reset (GND on Reset pin)
When I force, the led flash twice per second (even without clock, but the fuses are set to 8Mhz Internal) -
RE: [SOLVED]Atmega 328P reset to start
Hello
I have 4.8V on the reset pin (directly mesured on the DIL package). I use a 10k pullup resistor.
The atmega was on a single board with uno bootloader before. It was working great, and the reset pin was not connected at all (only vcc/gnd/D2/D4 and clock where connected before I put it on the breadborard)I've tried with 10k resistor, without resistor (reset floating), with caps. Always the same thing
-
[SOLVED]Atmega 328P reset to start
Hello
I just get a Atmega 328P in DIL package. It was configured with external 16Mhz clock.
I set up it with internal 8mhz and minicore bootloader with Arduino IDE and Arduino as ISP
Here is the configuration I used
Burning the bootloader works well. I follow this guide for wiring, and I add a led on D13 with a 1k resistor to GND.After burning the bootloader, the led was blinking as usual. I was happy
But, after that, I unplug the arduino as ISP, the clock source, and replug only power source. The led was not blinking anymore.
I replug the arduino as ISP (not the clock), and use AVRDUDESS to read fuse, and miracle the led restart to blink
Here is the fuses readed
I unplug everything again, and replug only power source ... no blink . And I don't know why, I try to send reset (GND to Reset Pin), and blink started.I've tested it and retested it, the led don't start to blink until I send reset.
Any ideas of why I need to reset to start the arduino ? Is there any fuse or lock that configure it ? Something I miss ?
Thank you for your help
-
RE: DIY RFM69 Build
Hello
Have you seen this thread ? Thery talk about G4C .
https://lowpowerlab.com/forum/rf-range-antennas-rfm69-library/designing-a-better-rfm69-radio-module/Here is other informations about GaAs
https://www.psemi.com/pdf/app_notes/an18.pdfNot sure to have understood everything
-
RE: RFM69hcw (arduino pro mini) not finding parent (esp8266)
Hello
Where is connected the RST pin of the radio board ? It seems to be connected to pin 9 of arduino.
On the connecting radio page, it's said : "* Adafruit modules need RST connected to GND".
Have you try it ?You could also try to add RFM69 trace.
#define MY_DEBUG_VERBOSE_RFM69 #define MY_DEBUG_VERBOSE_RFM69_REGISTERS
But I don't know how to read those debug traces...
Editing : I've not seen that it's already activated, sorryHope it could help, I'm still mysensors newbie
-
RE: Help to identify Arduino pro mini clone components
Thank you so much.
I did not found any schematic for those boards. And the diode and polyfuse are not on the sparkfun design.
The diode let me crazy when trying to verify and trace the signal with multimeter. I take a long time before understanding why my multimeter some times say connected, sometime say not connected. And this night, I tell myself : it's a diode
Thank you again !
-
Help to identify Arduino pro mini clone components
Hello
I have some Arduino pro mini Chineese clones which are not exactly made like original. I know it's normal
I m trying to recognize components but i m note sure.
Here is a picture of the part or the card.
I Hope the number i ve added are visible.
So what is
1: no Idea.
2: a diode
3: voltage regulator
4: led indicating power on
5: resistor for the led 4 ?
6: "small" capacitor on vcc ?
7: "Big" capacitor on raw pin ?
8: "Big" capacitor on vcc ?
9: "small" capacitor on rst pin ?
10 : oscillatorWithout ?, I'm quite sure. With ? I'm not sure but don't see what else it could be, and no Idea => no Idea
Thank you for your knowledge
-
RE: [Solved]RFM69 Sleep Mode - high current when sleeping
Sorry for not giving news.
So I've done lot of tests, triple check everything and still found "nothing"
I test with deepSleep sketch from lowpowerlab, and still have high current.I finally receive new rfm69 and change it. And it's ok now !!!
I have 25uA when sleeping !!!Don't know why, but with new one, it's ok
Thank you again for your help and your ideas
-
RPI GW - Configure an ethernet RPI GW that drive an USB Arduino GW
Hello
I've build a serial gateway with an Arduino Nano connected to my Rpi running Domoticz. Everything is working fine.
But now, I'm looking at FOTA. And I realised that a serial gateway is not really easy to use (my pi and the gateway are in the attic)So instead of running a RPI GW driving a radio on GPIO pin, I'd like to know if it could be possible to configure the RPI GW as ethernet (or MQTT), and drive the Arduino GW on USB. Like that, i'll not have to build a new RPI Hat with a new radio.
The RPI GW, configure as ethernet or MQTT will "hide" the real one.It could do something like :
RFM69(orNRF24) =(wire)=> Arduino Nano =(USB)=> PI GW ==(IP)==> Controllers(Pi/MySController...)What do you think of such feature ?
-
RE: [Solved]RFM69 Sleep Mode - high current when sleeping
@evb it's for doing a gasmeter, counting with a reed sensor.
But for my tests, the read sensor is not connected. So nothing wakeup the interrupt.
I just send every 10 minutes the counter, as a keepalive. (Domoticz don't put the sensors as "red" )First, I was doing test with newbie pcb, and I had strange values.
So I remove everything, and I do test with breadboard and dupont cable.I just have the arduino pro mini, and the rfm69 solder on a nrf2rfm69 board and a 0.1uF capacitor.
I have 2AA alkaline battery, connected to the VCC/GND pin of arduino and to 3.3V/GND of NRF2RFM adapter.
I measure the current on the cable between battery + and 3,3V of NRF2RFM69 (like in your photo)I have no scope, so I can't check NSS/MOSI/... and so on. But the transmissions are OK, and everything is working well, except current when sleeping.
I had no time today to do more test today. I will double check everything as soon as possible, try your sketch
-
RE: [Solved]RFM69 Sleep Mode - high current when sleeping
Hello
Thank you for your time. Here is my complete sketch.
If arduino goes to sleep and wakeup and so on, I think that I'll see lot of messages sended.
I suspect my RFM69 to have some quality problems. But i'm not sure. I'll try to change it. as soon as i will receive new one from china.// Enable debug prints to serial monitor #define MY_DEBUG // Enable and select radio type attached #define MY_RADIO_RFM69 #define MY_RFM69_NEW_DRIVER #include <MySensors.h> #define DIGITAL_INPUT_SENSOR 3 // The digital input you attached your sensor. (Only 2 and 3 generates interrupt!) #define CHILD_ID 1 // Id of the sensor child MyMessage volumeMsg(CHILD_ID, V_VOLUME); MyMessage lastCounterMsg(CHILD_ID, V_VAR1); volatile uint32_t pulseCount = 0; bool pcReceived = false; unsigned long loopNumber = 0; //========================= // BATTERY MEASURER // VOLTAGE DIVIDER SETUP // 1M, 470K divider across battery and using internal ADC ref of 1.1V // Sense point is bypassed with 0.1 uF cap to reduce noise at that point // ((1e6+470e3)/470e3)*1.1 = Vmax = 3.44 Volts // 3.44/1023 = Volts per bit = 0.003363075 #define VBAT_PER_BITS 0.003363075 #define VMIN 2.0 // Vmin (radio Min Volt)=1.9V (564v) #define VMAX 3.2 // Vmax = (2xAA bat)=3.0V (892v) int batLoop = 0; // Loop to help calc average int batArray[4]; // Array to store value for average calc. int BATTERY_SENSE_PIN = A0; // select the input pin for the battery sense point //========================= void setup() { // initialize our digital pins internal pullup resistor so one pulse switches from high to low (less distortion) pinMode(DIGITAL_INPUT_SENSOR, INPUT_PULLUP); pulseCount = 0; // Fetch last known pulse count value from gw request(CHILD_ID, V_VAR1); //Battery analogReference(INTERNAL); //On attend le resultat avant de passer dans la boucle wait(1000); } void presentation() { // Send the sketch version information to the gateway and Controller sendSketchInfo("Gas Meter", "2.0"); // Register this device as Water flow sensor present(CHILD_ID, S_GAS); } //========================= // BATTERY MEASURER void MeasureBattery() //The battery calculations { delay(500); // Battery monitoring reading int sensorValue = analogRead(BATTERY_SENSE_PIN); delay(500); // Calculate the battery in % float Vbat = sensorValue * VBAT_PER_BITS; int batteryPcnt = static_cast<int>(((Vbat - VMIN) / (VMAX - VMIN)) * 100.); #ifdef MY_DEBUG Serial.print("Battery percent: "); Serial.print(batteryPcnt); Serial.print(" %"); Serial.print("Battery Voltage: "); Serial.print(Vbat); Serial.println(" Volts"); #endif if (batteryPcnt > 100) { batteryPcnt = 100; } if (batteryPcnt < 0) { batteryPcnt = 0; } // Add it to array so we get an average of 3 (3x20min) batArray[batLoop] = batteryPcnt; if (batLoop > 2) { batteryPcnt = (batArray[0] + batArray[1] + batArray[2] + batArray[3]); batteryPcnt = batteryPcnt / 4; #ifdef MY_DEBUG Serial.print("Battery Average (Send): "); Serial.print(batteryPcnt); Serial.println(" %"); #endif sendBatteryLevel(batteryPcnt); batLoop = 0; } else { batLoop++; } } void loop() { if (!pcReceived) { //Last Pulsecount not yet received from controller, request it again request(CHILD_ID, V_VAR1); wait(1000); return; } if (loopNumber % 12 == 0) { Serial.println("Measuring Battery"); //========================= // BATTERY MEASURER MeasureBattery(); //========================= } #ifdef MY_DEBUG Serial.println("I'm sleeping"); #endif int8_t cause = sleep(digitalPinToInterrupt(DIGITAL_INPUT_SENSOR), FALLING, 600000); #ifdef MY_DEBUG Serial.print("WakeUp , cause:"); Serial.print(cause); Serial.print("(pin interrupt :"); Serial.print(digitalPinToInterrupt(DIGITAL_INPUT_SENSOR)); Serial.println(";-1=timer)"); #endif if (cause == digitalPinToInterrupt(DIGITAL_INPUT_SENSOR)) { pulseCount++; // softwaredebounce, on ignore toute entree pendant 100ms wait(100); } #ifdef MY_DEBUG Serial.print("Pulsecount="); Serial.println(pulseCount); Serial.println("Sending pulse Count"); #endif double volume = 0; volume = ((double)pulseCount / ((double)1000)); send(volumeMsg.set(volume, 4)); send(lastCounterMsg.set(pulseCount)); loopNumber++; } void receive(const MyMessage &message) { if (message.type == V_VAR1) { uint32_t gwPulseCount = message.getULong(); if (!pcReceived) { pulseCount = gwPulseCount; #ifdef MY_DEBUG Serial.print("Received last pulse count from gw:"); Serial.println(pulseCount); #endif pcReceived = true; } } }
-
[Solved]RFM69 Sleep Mode - high current when sleeping
Re: RFM69 sleep mode
Hello
I'm back with my high current in sleep mode. After changing my multimeter, challenging my arduino configuration, doing lot of test loosing my hairs, i finally found that it is my rfm69w that consume 2mA in sleep mode.
I use
#define MY_RADIO_RFM69 #define MY_RFM69_NEW_DRIVER
to configure RFM69
I sleep wit the sleep functon
int8_t cause = sleep(digitalPinToInterrupt(DIGITAL_INPUT_SENSOR), FALLING, 600000);
I measure the current directly in the 3.3V of the rfm69. In the meantime, the arduino mini is less than 50uA.
What could I do debug such a situation ?
Thank you for your help
-
RE: [Solved] Easy PCB - current when sleeping
Thank you for your answer
I'm trying to compare with only pro mini and rfm69 on a test plate, and 2 AA batteries. I have strange result, and i'm doubting about my multimeter.
I'll continue testing and will tell you -
[Solved] Easy PCB - current when sleeping
Re: Easy/Newbie PCB for MySensors
Hello
I'm building a gas meter sensor with easy pcb, with 3.3v / 8mhz arduino pro mini, a rfm69w (with an nrf2rfm adapter).
I remove led and voltage regulator on the arduino board.
The easy pcb is configured with battery booster and voltage divider (1mohm and 470kohm).
I use internal pullup to get read sensor of the gas meter (pin 3 used with interrupt)Everything is working fine, but when sleeping, my multimeter said 400uA.
In the main time, I have this board from aliexpress, and with the same sketch use 40uA (ten times less), with a voltage regulator included and 16mhz clock
https://fr.aliexpress.com/item/33006101437.html?spm=a2g0o.productlist.0.0.1424881cHzQI0F&algo_pvid=16f38802-af52-43e2-a2d1-7e3c2a84733f&algo_expid=16f38802-af52-43e2-a2d1-7e3c2a84733f-0&btsid=2100bb5116098762728804034e5d33&ws_ab_test=searchweb0_0,searchweb201602_,searchweb201603_Is it normal ? Is it Arduino pro mini that consume much more than the development board? is there a special way to investigate it ?
Thank you for your ideas and advice.
-
RE: Kicad library for dc-dc step up booster
@sundberg84 thank you again. I'll do like you say
-
RE: Kicad library for dc-dc step up booster
@bjacobse I've seen them, but as @sundberg84 asked me, it's already finished booster, the one linked in mysensors store.
I'm looking something like the one used on Easy/Newbie PCB.Can I use something like "Conn_01x03_MountingPin" ?
I'm starting kicad, I already have used easy/newbie pcb for my first sensors, but I need to design a board for an existing raingauge not working anymore (used by an old meteo station). I want to keep the mechanical part, and replace the electronical board.
Thank's for your help
-
Kicad library for dc-dc step up booster
Hello
Does somebody have library for dc-dc step up booster please ?
-
RE: 💬 Building a Raspberry Pi Gateway
@mfalkvidd Thank you.
I've found that too https://www.mysensors.org/apidocs/RFM69_8h_source.html
It's clearly indicated that DIO0 is IRQ.So I think with "--my-rfm69-irq-pin=" it will do the job.
I'll test it as soon as i'll receive RFM69.
Thank you again
-
RE: 💬 Building a Raspberry Pi Gateway
@mfalkvidd I don't know what DI00 is, and if it's equivalent to IRQ ? If Yes, it's exactly what I need ! Thank you !!! I will test it as soon as I get my RFM69
Here is the pin mapping between RFM69W/NRF24 and Arduino/Raspberry
Arduino mini - NRF24 - RFM69 - Raspberry GW NRF - Raspberry GW RFM 9 - CE - N/A - 22 - N/A 10 - CSN/CS - NSS - 24 - 24 13 - SCK - SCK - 23 - 23 11 - MOSI - MOSI - 19 - 19 12 - MISO - MISO - 21 - 21 2 - IRQ - DI00 - 15 - 22
So, the only mismatch breaking pin compatibility (and preventing to use adaptors on the raspberry pi gateway) is on IRQ/DI00. Adaptors wire RFM69 DI00 on NRF24 IRQ pin, but they don't use, by default, the same pin on raspberry, depending the radio type.
-
RE: 💬 Building a Raspberry Pi Gateway
@gohan Sorry I miss your answer a few days ago
I don't want to a gateway with both rfm69 and nrf24..I'm planning to change my nrf24 sensors with rfm69, to have a better transmission distance. My two nodes are outside, and i have communication trouble if i put them where i wanted, specially for my rain gauge.
So I wanted to use those adaptors https://www.openhardware.io/view/16/NRF2RFM69.
I received them, and I'm still waiting RFM69 board to test it.But as the pinout is not the same between nrf24 and rfm69 on raspberry gateway, I could not use the adaptor on the gateway. So before making a new board for my raspberry, I wanted to know if it's possible to change the default pin configuration, to have exactly the same as nrf24, and use an adaptor on the gateway too.
For that, I "just" need to redefine DIO0 on pin 15 (default is 22). So I wonder if it's possible to do it.And "bonus question", I'd like to know why pin configuration is not the same between arduino and raspberry. Why pin 15 is not used for DIO0 on raspberry (equivalent to pin 2 on arduino). I'm telling myself it should be a good reason, but I don't get it.
-
RE: ISR Pulse Meter Question
Hello
Here is my last code for my gas meter. If it could help somebody
/* * The MySensors Arduino library handles the wireless radio link and protocol * between your home built sensors/actuators and HA controller of choice. * The sensors forms a self healing radio network with optional repeaters. Each * repeater and gateway builds a routing tables in EEPROM which keeps track of the * network topology allowing messages to be routed to nodes. * * Created by Henrik Ekblad <henrik.ekblad@mysensors.org> * Copyright (C) 2013-2018 Sensnology AB * Full contributor list: https://github.com/mysensors/MySensors/graphs/contributors * * Documentation: http://www.mysensors.org * Support Forum: http://forum.mysensors.org * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * version 2 as published by the Free Software Foundation. * ******************************* * * REVISION HISTORY * Version 1.0 - Henrik Ekblad * Version 1.1 - GizMoCuz * * DESCRIPTION * Use this sensor to measure volume and flow of your house water meter. * You need to set the correct pulsefactor of your meter (pulses per m3). * The sensor starts by fetching current volume reading from gateway (VAR 1). * Reports both volume and flow back to gateway. * * Unfortunately millis() won't increment when the Arduino is in * sleepmode. So we cannot make this sensor sleep if we also want * to calculate/report flow. * http://www.mysensors.org/build/pulse_water */ // Enable debug prints to serial monitor #define MY_DEBUG // Enable and select radio type attached #define MY_RADIO_RF24 #include <MySensors.h> #define DIGITAL_INPUT_SENSOR 3 // The digital input you attached your sensor. (Only 2 and 3 generates interrupt!) #define CHILD_ID 1 // Id of the sensor child unsigned long loopNumber = 0; unsigned long lastLoopSend = 0; MyMessage volumeMsg(CHILD_ID, V_VOLUME); MyMessage lastCounterMsg(CHILD_ID, V_VAR1); volatile uint32_t pulseCount = 0; bool pcReceived = false; double volume = 0; //========================= // BATTERY MEASURER // VOLTAGE DIVIDER SETUP // 1M, 470K divider across battery and using internal ADC ref of 1.1V // Sense point is bypassed with 0.1 uF cap to reduce noise at that point // ((1e6+470e3)/470e3)*1.1 = Vmax = 3.44 Volts // 3.44/1023 = Volts per bit = 0.003363075 #define VBAT_PER_BITS 0.003363075 #define VMIN 2.2 // Vmin (radio Min Volt)=1.9V (564v) #define VMAX 3.2 // Vmax = (2xAA bat)=3.0V (892v) int batteryPcnt = 0; // Calc value for battery % int batLoop = 0; // Loop to help calc average int batArray[4]; // Array to store value for average calc. int BATTERY_SENSE_PIN = A0; // select the input pin for the battery sense point //========================= void setup() { // initialize our digital pins internal pullup resistor so one pulse switches from high to low (less distortion) pinMode(DIGITAL_INPUT_SENSOR, INPUT_PULLUP); pulseCount = 0; // Fetch last known pulse count value from gw request(CHILD_ID, V_VAR1); //Battery analogReference(INTERNAL); Serial.print("With Battery VMax (100%) = "); Serial.print(VMAX); Serial.print("volts and Vmin (0%) = "); Serial.print(VMIN); Serial.println(" volts"); Serial.print("Battery Percent 25%/50%/75% calculates to: "); Serial.print(((VMAX - VMIN) / 4) + VMIN); Serial.print("/"); Serial.print(((VMAX - VMIN) / 2) + VMIN); Serial.print("/"); Serial.println(VMAX - ((VMAX - VMIN) / 4)); delay(1000); int sensorValue = analogRead(BATTERY_SENSE_PIN); delay(50); float Vbat = sensorValue * VBAT_PER_BITS; int batteryPcnt = static_cast<int>(((Vbat - VMIN) / (VMAX - VMIN)) * 100.); Serial.print("Current battery are measured to (please confirm!): "); Serial.print(batteryPcnt); Serial.print(" % - Or "); Serial.print(Vbat); Serial.println(" Volts"); } void presentation() { // Send the sketch version information to the gateway and Controller sendSketchInfo("Gas Meter", "2.0"); // Register this device as Water flow sensor present(CHILD_ID, S_GAS); } //========================= // BATTERY MEASURER void MeasureBattery() //The battery calculations { delay(500); // Battery monitoring reading int sensorValue = analogRead(BATTERY_SENSE_PIN); delay(500); // Calculate the battery in % float Vbat = sensorValue * VBAT_PER_BITS; int batteryPcnt = static_cast<int>(((Vbat - VMIN) / (VMAX - VMIN)) * 100.); Serial.print("Battery percent: "); Serial.print(batteryPcnt); Serial.print(" %"); Serial.print("Battery Voltage: "); Serial.print(Vbat); Serial.println(" Volts"); // Add it to array so we get an average of 3 (3x20min) batArray[batLoop] = batteryPcnt; if (batLoop > 2) { batteryPcnt = (batArray[0] + batArray[1] + batArray[2] + batArray[3]); batteryPcnt = batteryPcnt / 4; if (batteryPcnt > 100) { batteryPcnt = 100; } Serial.print("Battery Average (Send): "); Serial.print(batteryPcnt); Serial.println(" %"); sendBatteryLevel(batteryPcnt); batLoop = 0; } else { batLoop++; } } void loop() { if (!pcReceived) { //Last Pulsecount not yet received from controller, request it again request(CHILD_ID, V_VAR1); wait(1000); return; } Serial.print("loopNumer="); Serial.println(loopNumber); if (loopNumber % 60 == 0) { Serial.println("Measuring Battery"); //========================= // BATTERY MEASURER MeasureBattery(); //========================= } if (loopNumber % 10 == 0) { Serial.println("Sending pulse Count"); volume = ((double)pulseCount / ((double)1000)); send(volumeMsg.set(volume,4)); send(lastCounterMsg.set(pulseCount)); } Serial.println("I'm sleeping"); int8_t cause = sleep(digitalPinToInterrupt(DIGITAL_INPUT_SENSOR), FALLING, 60000); Serial.print("WakeUp , cause:"); Serial.print(cause); Serial.print("(pin interrupt :"); Serial.print(digitalPinToInterrupt(DIGITAL_INPUT_SENSOR)); Serial.println(";-1=timer)"); if (cause == digitalPinToInterrupt(DIGITAL_INPUT_SENSOR)) { pulseCount++; wait(100); } Serial.print("Pulsecount="); Serial.println(pulseCount); loopNumber++; } void receive(const MyMessage &message) { if (message.type==V_VAR1) { uint32_t gwPulseCount=message.getULong(); pulseCount += gwPulseCount; Serial.print("Received last pulse count from gw:"); Serial.println(pulseCount); pcReceived = true; } }```
-
RE: 💬 Easy/Newbie PCB for MySensors
@mfalkvidd : I think you have to change the condition in if too :
if (batLoop > 1) {
With that, batLoop = 2 when entering in the if (so the 3 values of the array are filled : 0, 1, 2), calculating the average and reseting the batLoop to 0.
If not modify, the array will be set with batArray[3] just before entering theif (batLoop > 2) {
Other way is to set the batArray size to 4 values, and divide by 4 (I'm actually trying that).
-
RE: 💬 Easy/Newbie PCB for MySensors
Hello
I think there is a mistake in your code (on github) to mesure battery.
The array have 4 values, but you divide by 3. So you get to high result.
https://github.com/sundberg84/HomeAutomation/blob/master/BatteryMeasurer/BatteryMeasurer.ino
On line 77Everything else is ok in my case the board works well with 2 battery AA, and 47uF cap (not with 4.7uF) .
-
RE: 💬 Building a Raspberry Pi Gateway
Hello
Is it possible to redefine pin used for DI00 with rfm69 (with configure option for example) ?
Indeed, DI00 is on pin 22 on raspberry, and pin 2 on arduino.
But with NRF, pin 2 on arduino is for IRQ, which is connected to pin 15 on raspberry.So if it was possible to force pin 15 for DI00, we could use adaptator card like this one https://www.mysensors.org/hardware/nrf2rfm69.
-
RE: ISR Pulse Meter Question
No no, my intention is just to send the pulse count, every 10 or 15 minutes, with battery powered sensor (and resend the last value even if it not change, due to domoticz not reporting heartbeat, but that is another story )
Hourly and daily value are ok for me.
I was using this sketch as an example just to see how it work and if it could directly do the job.
I enabled sleep_mode.
I was doing that with a testing arduino, directly connected to radio with jumper, and using jumper to simulate reed.
Each time I was doing a pulse that way, the node send the information directly. I was not understanding why. So I run a minimal sketch to try to understand, and I found this thread ...Finally with all those informations, i think i'll do something like that:
- The loop sleeps for 1 minute, or for the reed interrupt.
- When the loop restart, it checked if the reed interrupt occured with the return value of sleep
-- if yes, it increments pulse count, waits a few ms for debounce, and continues
-- if no it continues - every 10 loops, a msg is send with the pulse count
- every 60 loops, the battery level is checked
- and then it sleeps again for 1 minute or if the reed interrupt occurs
Thank you again for this great help
-
RE: ISR Pulse Meter Question
Ok thank you very much for all the informations.
The high rate of interrupts is due to the way I generate the interrupt for the test : with a breadboard jumper manually connected on the pin, so it generates a lot of bounces.
In a normal behaviour, I will have a reed switch for my gas counter. So it should not occur so much.
I have not realised that the sleep function "hide" WDT for sleeping (but it's quite logic).
In fact, in my example, my high rate of interrupts causes the loop to start again. With one event and 6 bounces (so 7 interrupts), the wait period is considered elapsed, even if it was sleeping only from a few seconds.I never realised that before
-
RE: ISR Pulse Meter Question
Hi
Thank you for your response.
Does it means that if I sleep longer, 300 sec for example, and I debounce the switch on interrupt not get a huge increase on a single event, It will sleep 300sec with no pulse, 292 sec with one pule, 284 sec for two pulse (and so on )?
Thank you again for your help and explanation
-
RE: ISR Pulse Meter Question
Hello
I'm asking exactly the same question.
I mixed this sketch with another one for battery measurement (and added fonction to resend last volume for updating domoticz, software debounce, but that's not the main point).Each time I have a pulse, the loop start again, even if it was sleeping.
I have also tried this simple code
// Enable debug prints to serial monitor #define MY_DEBUG // Enable and select radio type attached #define MY_RADIO_RF24 #include <MySensors.h> #define DIGITAL_INPUT_SENSOR 3 // The digital input you attached your sensor. (Only 2 and 3 generates interrupt!) #define CHILD_ID 1 // Id of the sensor child unsigned long SEND_FREQUENCY = 60000; // Minimum time between send (in milliseconds). We don't want to spam the gateway. volatile uint32_t pulseCount = 0; uint32_t oldPulseCount = 0; void setup() { // initialize our digital pins internal pullup resistor so one pulse switches from high to low (less distortion) pinMode(DIGITAL_INPUT_SENSOR, INPUT_PULLUP); pulseCount = oldPulseCount = 0; attachInterrupt(digitalPinToInterrupt(DIGITAL_INPUT_SENSOR), onPulse, FALLING); } void presentation() { // Send the sketch version information to the gateway and Controller sendSketchInfo("TEST", "1.1"); // Register this device as Water flow sensor present(CHILD_ID, S_GAS); } void loop() { // Pulse count has changed if ((pulseCount != oldPulseCount)) { oldPulseCount = pulseCount; Serial.print("pulsecount:"); Serial.println(pulseCount); } else { Serial.println("pulsecount not changed"); } sleep(SEND_FREQUENCY); } void onPulse() { pulseCount++; }
And here is the log
18:33:44.593 -> 3229 MCO:BGN:INIT OK,TSP=1 18:33:44.593 -> pulsecount not changed 18:33:44.593 -> 3233 MCO:SLP:MS=60000,SMS=0,I1=255,M1=255,I2=255,M2=255 18:33:44.593 -> 3239 TSF:TDI:TSL 18:34:48.589 -> 3241 MCO:SLP:WUP=-1 18:34:48.589 -> 3244 TSF:TRI:TSB 18:34:48.635 -> pulsecount not changed 18:34:48.635 -> 3250 MCO:SLP:MS=60000,SMS=0,I1=255,M1=255,I2=255,M2=255 18:34:48.635 -> 3258 TSF:TDI:TSL 18:34:57.719 -> 3260 MCO:SLP:WUP=-1 18:34:57.719 -> 3262 TSF:TRI:TSB 18:34:57.763 -> pulsecount:159 18:34:57.763 -> 3270 MCO:SLP:MS=60000,SMS=0,I1=255,M1=255,I2=255,M2=255 18:34:57.763 -> 3276 TSF:TDI:TSL 18:34:58.212 -> 3280 MCO:SLP:WUP=-1 18:34:58.212 -> 3282 TSF:TRI:TSB 18:34:58.212 -> pulsecount:364 18:34:58.212 -> 3289 MCO:SLP:MS=60000,SMS=0,I1=255,M1=255,I2=255,M2=255 18:34:58.212 -> 3295 TSF:TDI:TSL 18:35:04.813 -> 3299 MCO:SLP:WUP=-1 18:35:04.813 -> 3301 TSF:TRI:TSB 18:35:04.813 -> pulsecount:380 18:35:04.813 -> 3307 MCO:SLP:MS=60000,SMS=0,I1=255,M1=255,I2=255,M2=255 18:35:04.861 -> 3313 TSF:TDI:TSL 18:35:05.211 -> 3315 MCO:SLP:WUP=-1 18:35:05.211 -> 3319 TSF:TRI:TSB 18:35:05.211 -> pulsecount:394 18:35:05.211 -> 3325 MCO:SLP:MS=60000,SMS=0,I1=255,M1=255,I2=255,M2=255 18:35:05.211 -> 3332 TSF:TDI:TSL 18:35:10.827 -> 3334 MCO:SLP:WUP=-1 18:35:10.827 -> 3336 TSF:TRI:TSB 18:35:10.827 -> pulsecount:402 18:35:10.827 -> 3344 MCO:SLP:MS=60000,SMS=0,I1=255,M1=255,I2=255,M2=255 18:35:10.827 -> 3350 TSF:TDI:TSL 18:36:14.864 -> 3352 MCO:SLP:WUP=-1 18:36:14.864 -> 3354 TSF:TRI:TSB 18:36:14.864 -> pulsecount not changed 18:36:14.864 -> 3360 MCO:SLP:MS=60000,SMS=0,I1=255,M1=255,I2=255,M2=255 18:36:14.864 -> 3368 TSF:TDI:TSL
As you can see with timestamp, you don't get value every minute, but every minute AND each time ISR is run. The main loop continue don't wait the end of the time to continue. What do I miss ?
Thank you for your help
-
RE: Unable to compile Raspberry Pi Gateway when signing enable
Hello
A fix was done in the source code. It's ok
Still in dev branch
-
Unable to compile Raspberry Pi Gateway when signing enable
Hello
I'm trying to build a Raspberry Pi gateway with signing enable
I run./configure --my-transport=rf24 --my-gateway=ethernet --my-port=5003 --my-rf24-encryption-enabled --my-signing=software --my-signing-request-signatures make
Then I get an error not founding the min function. The log is included after. I'm running raspian stretch
Any idea of what is missing ?
Thank's for your help
Here is the output
./configure --my-transport=rf24 --my-gateway=ethernet --my-port=5003 --my-rf24-encryption-enabled --my-signing=software --my-signing-request-signatures [SECTION] Detecting target machine. [OK] machine detected: SoC=BCM2836, Type=rpi2, CPU=armv7l. [SECTION] Detecting SPI driver. [OK] SPI driver detected:BCM. [SECTION] Gateway configuration. [OK] Type: ethernet. [OK] Transport: rf24. [OK] Signing: Enabled - Using key from config file. [OK] Encryption: Enabled - Using key from config file. [OK] CPPFLAGS: -DMY_SIGNING_REQUEST_SIGNATURES -DMY_SIGNING_SOFT -DMY_RADIO_RF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DMY_RF24_ENABLE_ENCRYPTION -DMY_PORT=5003 [SECTION] Detecting init system. [OK] Init system detected: systemd. [SECTION] Saving configuration. [OK] Saved. [SECTION] Cleaning previous builds. [OK] Finished. make gcc -MT build/drivers/Linux/log.o -MMD -MP -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -DMY_SIGNING_REQUEST_SIGNATURES -DMY_SIGNING_SOFT -DMY_RADIO_RF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DMY_RF24_ENABLE_ENCRYPTION -DMY_PORT=5003 -Ofast -g -Wall -Wextra -I. -I./core -I./drivers/Linux -I./drivers/BCM -c drivers/Linux/log.c -o build/drivers/Linux/log.o gcc -MT build/drivers/Linux/config.o -MMD -MP -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -DMY_SIGNING_REQUEST_SIGNATURES -DMY_SIGNING_SOFT -DMY_RADIO_RF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DMY_RF24_ENABLE_ENCRYPTION -DMY_PORT=5003 -Ofast -g -Wall -Wextra -I. -I./core -I./drivers/Linux -I./drivers/BCM -c drivers/Linux/config.c -o build/drivers/Linux/config.o g++ -MT build/drivers/Linux/StdInOutStream.o -MMD -MP -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -DMY_SIGNING_REQUEST_SIGNATURES -DMY_SIGNING_SOFT -DMY_RADIO_RF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DMY_RF24_ENABLE_ENCRYPTION -DMY_PORT=5003 -Ofast -g -Wall -Wextra -I. -I./core -I./drivers/Linux -I./drivers/BCM -c drivers/Linux/StdInOutStream.cpp -o build/drivers/Linux/StdInOutStream.o g++ -MT build/drivers/Linux/noniso.o -MMD -MP -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -DMY_SIGNING_REQUEST_SIGNATURES -DMY_SIGNING_SOFT -DMY_RADIO_RF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DMY_RF24_ENABLE_ENCRYPTION -DMY_PORT=5003 -Ofast -g -Wall -Wextra -I. -I./core -I./drivers/Linux -I./drivers/BCM -c drivers/Linux/noniso.cpp -o build/drivers/Linux/noniso.o g++ -MT build/drivers/Linux/GPIO.o -MMD -MP -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -DMY_SIGNING_REQUEST_SIGNATURES -DMY_SIGNING_SOFT -DMY_RADIO_RF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DMY_RF24_ENABLE_ENCRYPTION -DMY_PORT=5003 -Ofast -g -Wall -Wextra -I. -I./core -I./drivers/Linux -I./drivers/BCM -c drivers/Linux/GPIO.cpp -o build/drivers/Linux/GPIO.o g++ -MT build/drivers/Linux/SPIDEV.o -MMD -MP -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -DMY_SIGNING_REQUEST_SIGNATURES -DMY_SIGNING_SOFT -DMY_RADIO_RF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DMY_RF24_ENABLE_ENCRYPTION -DMY_PORT=5003 -Ofast -g -Wall -Wextra -I. -I./core -I./drivers/Linux -I./drivers/BCM -c drivers/Linux/SPIDEV.cpp -o build/drivers/Linux/SPIDEV.o g++ -MT build/drivers/Linux/EthernetClient.o -MMD -MP -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -DMY_SIGNING_REQUEST_SIGNATURES -DMY_SIGNING_SOFT -DMY_RADIO_RF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DMY_RF24_ENABLE_ENCRYPTION -DMY_PORT=5003 -Ofast -g -Wall -Wextra -I. -I./core -I./drivers/Linux -I./drivers/BCM -c drivers/Linux/EthernetClient.cpp -o build/drivers/Linux/EthernetClient.o g++ -MT build/drivers/Linux/Print.o -MMD -MP -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -DMY_SIGNING_REQUEST_SIGNATURES -DMY_SIGNING_SOFT -DMY_RADIO_RF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DMY_RF24_ENABLE_ENCRYPTION -DMY_PORT=5003 -Ofast -g -Wall -Wextra -I. -I./core -I./drivers/Linux -I./drivers/BCM -c drivers/Linux/Print.cpp -o build/drivers/Linux/Print.o g++ -MT build/drivers/Linux/SerialPort.o -MMD -MP -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -DMY_SIGNING_REQUEST_SIGNATURES -DMY_SIGNING_SOFT -DMY_RADIO_RF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DMY_RF24_ENABLE_ENCRYPTION -DMY_PORT=5003 -Ofast -g -Wall -Wextra -I. -I./core -I./drivers/Linux -I./drivers/BCM -c drivers/Linux/SerialPort.cpp -o build/drivers/Linux/SerialPort.o g++ -MT build/drivers/Linux/Stream.o -MMD -MP -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -DMY_SIGNING_REQUEST_SIGNATURES -DMY_SIGNING_SOFT -DMY_RADIO_RF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DMY_RF24_ENABLE_ENCRYPTION -DMY_PORT=5003 -Ofast -g -Wall -Wextra -I. -I./core -I./drivers/Linux -I./drivers/BCM -c drivers/Linux/Stream.cpp -o build/drivers/Linux/Stream.o g++ -MT build/drivers/Linux/IPAddress.o -MMD -MP -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -DMY_SIGNING_REQUEST_SIGNATURES -DMY_SIGNING_SOFT -DMY_RADIO_RF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DMY_RF24_ENABLE_ENCRYPTION -DMY_PORT=5003 -Ofast -g -Wall -Wextra -I. -I./core -I./drivers/Linux -I./drivers/BCM -c drivers/Linux/IPAddress.cpp -o build/drivers/Linux/IPAddress.o g++ -MT build/drivers/Linux/compatibility.o -MMD -MP -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -DMY_SIGNING_REQUEST_SIGNATURES -DMY_SIGNING_SOFT -DMY_RADIO_RF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DMY_RF24_ENABLE_ENCRYPTION -DMY_PORT=5003 -Ofast -g -Wall -Wextra -I. -I./core -I./drivers/Linux -I./drivers/BCM -c drivers/Linux/compatibility.cpp -o build/drivers/Linux/compatibility.o g++ -MT build/drivers/Linux/interrupt.o -MMD -MP -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -DMY_SIGNING_REQUEST_SIGNATURES -DMY_SIGNING_SOFT -DMY_RADIO_RF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DMY_RF24_ENABLE_ENCRYPTION -DMY_PORT=5003 -Ofast -g -Wall -Wextra -I. -I./core -I./drivers/Linux -I./drivers/BCM -c drivers/Linux/interrupt.cpp -o build/drivers/Linux/interrupt.o g++ -MT build/drivers/Linux/SoftEeprom.o -MMD -MP -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -DMY_SIGNING_REQUEST_SIGNATURES -DMY_SIGNING_SOFT -DMY_RADIO_RF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DMY_RF24_ENABLE_ENCRYPTION -DMY_PORT=5003 -Ofast -g -Wall -Wextra -I. -I./core -I./drivers/Linux -I./drivers/BCM -c drivers/Linux/SoftEeprom.cpp -o build/drivers/Linux/SoftEeprom.o g++ -MT build/drivers/Linux/EthernetServer.o -MMD -MP -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -DMY_SIGNING_REQUEST_SIGNATURES -DMY_SIGNING_SOFT -DMY_RADIO_RF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DMY_RF24_ENABLE_ENCRYPTION -DMY_PORT=5003 -Ofast -g -Wall -Wextra -I. -I./core -I./drivers/Linux -I./drivers/BCM -c drivers/Linux/EthernetServer.cpp -o build/drivers/Linux/EthernetServer.o g++ -MT build/examples_linux/mysgw.o -MMD -MP -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -DMY_SIGNING_REQUEST_SIGNATURES -DMY_SIGNING_SOFT -DMY_RADIO_RF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DMY_RF24_ENABLE_ENCRYPTION -DMY_PORT=5003 -Ofast -g -Wall -Wextra -I. -I./core -I./drivers/Linux -I./drivers/BCM -c examples_linux/mysgw.cpp -o build/examples_linux/mysgw.o In file included from ./MySensors.h:148:0, from examples_linux/mysgw.cpp:82: ./core/MySigningAtsha204Soft.cpp: In function ‘bool signerAtsha204SoftGetNonce(MyMessage&)’: ./core/MySigningAtsha204Soft.cpp:173:55: error: no matching function for call to ‘min(unsigned int, int)’ msg.set(_signing_verifying_nonce, MIN(MAX_PAYLOAD, 32)); ^ In file included from /usr/include/c++/6/algorithm:62:0, from ./drivers/Linux/Arduino.h:32, from ./MySensors.h:39, from examples_linux/mysgw.cpp:82: /usr/include/c++/6/bits/stl_algo.h:3453:5: note: candidate: template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare) min(initializer_list<_Tp> __l, _Compare __comp) ^~~ /usr/include/c++/6/bits/stl_algo.h:3453:5: note: template argument deduction/substitution failed: In file included from ./MySensors.h:148:0, from examples_linux/mysgw.cpp:82: ./core/MySigningAtsha204Soft.cpp:173:55: note: mismatched types ‘std::initializer_list<_Tp>’ and ‘unsigned int’ msg.set(_signing_verifying_nonce, MIN(MAX_PAYLOAD, 32)); ^ In file included from /usr/include/c++/6/algorithm:62:0, from ./drivers/Linux/Arduino.h:32, from ./MySensors.h:39, from examples_linux/mysgw.cpp:82: /usr/include/c++/6/bits/stl_algo.h:3447:5: note: candidate: template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>) min(initializer_list<_Tp> __l) ^~~ /usr/include/c++/6/bits/stl_algo.h:3447:5: note: template argument deduction/substitution failed: In file included from ./MySensors.h:148:0, from examples_linux/mysgw.cpp:82: ./core/MySigningAtsha204Soft.cpp:173:55: note: mismatched types ‘std::initializer_list<_Tp>’ and ‘unsigned int’ msg.set(_signing_verifying_nonce, MIN(MAX_PAYLOAD, 32)); ^ In file included from /usr/include/c++/6/bits/char_traits.h:39:0, from /usr/include/c++/6/ios:40, from /usr/include/c++/6/ostream:38, from /usr/include/c++/6/iostream:39, from examples_linux/mysgw.cpp:20: /usr/include/c++/6/bits/stl_algobase.h:243:5: note: candidate: template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare) min(const _Tp& __a, const _Tp& __b, _Compare __comp) ^~~ /usr/include/c++/6/bits/stl_algobase.h:243:5: note: template argument deduction/substitution failed: In file included from ./MySensors.h:148:0, from examples_linux/mysgw.cpp:82: ./core/MySigningAtsha204Soft.cpp:173:55: note: deduced conflicting types for parameter ‘const _Tp’ (‘unsigned int’ and ‘int’) msg.set(_signing_verifying_nonce, MIN(MAX_PAYLOAD, 32)); ^ In file included from /usr/include/c++/6/bits/char_traits.h:39:0, from /usr/include/c++/6/ios:40, from /usr/include/c++/6/ostream:38, from /usr/include/c++/6/iostream:39, from examples_linux/mysgw.cpp:20: /usr/include/c++/6/bits/stl_algobase.h:195:5: note: candidate: template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&) min(const _Tp& __a, const _Tp& __b) ^~~ /usr/include/c++/6/bits/stl_algobase.h:195:5: note: template argument deduction/substitution failed: In file included from ./MySensors.h:148:0, from examples_linux/mysgw.cpp:82: ./core/MySigningAtsha204Soft.cpp:173:55: note: deduced conflicting types for parameter ‘const _Tp’ (‘unsigned int’ and ‘int’) msg.set(_signing_verifying_nonce, MIN(MAX_PAYLOAD, 32)); ^ ./core/MySigningAtsha204Soft.cpp: In function ‘void signerAtsha204SoftPutNonce(MyMessage&)’: ./core/MySigningAtsha204Soft.cpp:190:89: error: no matching function for call to ‘min(unsigned int, int)’ (void)memcpy((void *)_signing_nonce, (const void *)msg.getCustom(), MIN(MAX_PAYLOAD, 32)); ^ In file included from /usr/include/c++/6/algorithm:62:0, from ./drivers/Linux/Arduino.h:32, from ./MySensors.h:39, from examples_linux/mysgw.cpp:82: /usr/include/c++/6/bits/stl_algo.h:3453:5: note: candidate: template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare) min(initializer_list<_Tp> __l, _Compare __comp) ^~~ /usr/include/c++/6/bits/stl_algo.h:3453:5: note: template argument deduction/substitution failed: In file included from ./MySensors.h:148:0, from examples_linux/mysgw.cpp:82: ./core/MySigningAtsha204Soft.cpp:190:89: note: mismatched types ‘std::initializer_list<_Tp>’ and ‘unsigned int’ (void)memcpy((void *)_signing_nonce, (const void *)msg.getCustom(), MIN(MAX_PAYLOAD, 32)); ^ In file included from /usr/include/c++/6/algorithm:62:0, from ./drivers/Linux/Arduino.h:32, from ./MySensors.h:39, from examples_linux/mysgw.cpp:82: /usr/include/c++/6/bits/stl_algo.h:3447:5: note: candidate: template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>) min(initializer_list<_Tp> __l) ^~~ /usr/include/c++/6/bits/stl_algo.h:3447:5: note: template argument deduction/substitution failed: In file included from ./MySensors.h:148:0, from examples_linux/mysgw.cpp:82: ./core/MySigningAtsha204Soft.cpp:190:89: note: mismatched types ‘std::initializer_list<_Tp>’ and ‘unsigned int’ (void)memcpy((void *)_signing_nonce, (const void *)msg.getCustom(), MIN(MAX_PAYLOAD, 32)); ^ In file included from /usr/include/c++/6/bits/char_traits.h:39:0, from /usr/include/c++/6/ios:40, from /usr/include/c++/6/ostream:38, from /usr/include/c++/6/iostream:39, from examples_linux/mysgw.cpp:20: /usr/include/c++/6/bits/stl_algobase.h:243:5: note: candidate: template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare) min(const _Tp& __a, const _Tp& __b, _Compare __comp) ^~~ /usr/include/c++/6/bits/stl_algobase.h:243:5: note: template argument deduction/substitution failed: In file included from ./MySensors.h:148:0, from examples_linux/mysgw.cpp:82: ./core/MySigningAtsha204Soft.cpp:190:89: note: deduced conflicting types for parameter ‘const _Tp’ (‘unsigned int’ and ‘int’) (void)memcpy((void *)_signing_nonce, (const void *)msg.getCustom(), MIN(MAX_PAYLOAD, 32)); ^ In file included from /usr/include/c++/6/bits/char_traits.h:39:0, from /usr/include/c++/6/ios:40, from /usr/include/c++/6/ostream:38, from /usr/include/c++/6/iostream:39, from examples_linux/mysgw.cpp:20: /usr/include/c++/6/bits/stl_algobase.h:195:5: note: candidate: template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&) min(const _Tp& __a, const _Tp& __b) ^~~ /usr/include/c++/6/bits/stl_algobase.h:195:5: note: template argument deduction/substitution failed: In file included from ./MySensors.h:148:0, from examples_linux/mysgw.cpp:82: ./core/MySigningAtsha204Soft.cpp:190:89: note: deduced conflicting types for parameter ‘const _Tp’ (‘unsigned int’ and ‘int’) (void)memcpy((void *)_signing_nonce, (const void *)msg.getCustom(), MIN(MAX_PAYLOAD, 32)); ^ ./core/MySigningAtsha204Soft.cpp: In function ‘bool signerAtsha204SoftSignMsg(MyMessage&)’: ./core/MySigningAtsha204Soft.cpp:229:50: error: no matching function for call to ‘min(unsigned int, int)’ MIN(MAX_PAYLOAD-mGetLength(msg), 32)); ^ In file included from /usr/include/c++/6/algorithm:62:0, from ./drivers/Linux/Arduino.h:32, from ./MySensors.h:39, from examples_linux/mysgw.cpp:82: /usr/include/c++/6/bits/stl_algo.h:3453:5: note: candidate: template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare) min(initializer_list<_Tp> __l, _Compare __comp) ^~~ /usr/include/c++/6/bits/stl_algo.h:3453:5: note: template argument deduction/substitution failed: In file included from ./MySensors.h:148:0, from examples_linux/mysgw.cpp:82: ./core/MySigningAtsha204Soft.cpp:229:50: note: mismatched types ‘std::initializer_list<_Tp>’ and ‘unsigned int’ MIN(MAX_PAYLOAD-mGetLength(msg), 32)); ^ In file included from /usr/include/c++/6/algorithm:62:0, from ./drivers/Linux/Arduino.h:32, from ./MySensors.h:39, from examples_linux/mysgw.cpp:82: /usr/include/c++/6/bits/stl_algo.h:3447:5: note: candidate: template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>) min(initializer_list<_Tp> __l) ^~~ /usr/include/c++/6/bits/stl_algo.h:3447:5: note: template argument deduction/substitution failed: In file included from ./MySensors.h:148:0, from examples_linux/mysgw.cpp:82: ./core/MySigningAtsha204Soft.cpp:229:50: note: mismatched types ‘std::initializer_list<_Tp>’ and ‘unsigned int’ MIN(MAX_PAYLOAD-mGetLength(msg), 32)); ^ In file included from /usr/include/c++/6/bits/char_traits.h:39:0, from /usr/include/c++/6/ios:40, from /usr/include/c++/6/ostream:38, from /usr/include/c++/6/iostream:39, from examples_linux/mysgw.cpp:20: /usr/include/c++/6/bits/stl_algobase.h:243:5: note: candidate: template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare) min(const _Tp& __a, const _Tp& __b, _Compare __comp) ^~~ /usr/include/c++/6/bits/stl_algobase.h:243:5: note: template argument deduction/substitution failed: In file included from ./MySensors.h:148:0, from examples_linux/mysgw.cpp:82: ./core/MySigningAtsha204Soft.cpp:229:50: note: deduced conflicting types for parameter ‘const _Tp’ (‘unsigned int’ and ‘int’) MIN(MAX_PAYLOAD-mGetLength(msg), 32)); ^ In file included from /usr/include/c++/6/bits/char_traits.h:39:0, from /usr/include/c++/6/ios:40, from /usr/include/c++/6/ostream:38, from /usr/include/c++/6/iostream:39, from examples_linux/mysgw.cpp:20: /usr/include/c++/6/bits/stl_algobase.h:195:5: note: candidate: template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&) min(const _Tp& __a, const _Tp& __b) ^~~ /usr/include/c++/6/bits/stl_algobase.h:195:5: note: template argument deduction/substitution failed: In file included from ./MySensors.h:148:0, from examples_linux/mysgw.cpp:82: ./core/MySigningAtsha204Soft.cpp:229:50: note: deduced conflicting types for parameter ‘const _Tp’ (‘unsigned int’ and ‘int’) MIN(MAX_PAYLOAD-mGetLength(msg), 32)); ^ ./core/MySigningAtsha204Soft.cpp: In function ‘bool signerAtsha204SoftVerifyMsg(MyMessage&)’: ./core/MySigningAtsha204Soft.cpp:283:55: error: no matching function for call to ‘min(unsigned int, int)’ MIN(MAX_PAYLOAD-mGetLength(msg), 32))) { ^ In file included from /usr/include/c++/6/algorithm:62:0, from ./drivers/Linux/Arduino.h:32, from ./MySensors.h:39, from examples_linux/mysgw.cpp:82: /usr/include/c++/6/bits/stl_algo.h:3453:5: note: candidate: template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare) min(initializer_list<_Tp> __l, _Compare __comp) ^~~ /usr/include/c++/6/bits/stl_algo.h:3453:5: note: template argument deduction/substitution failed: In file included from ./MySensors.h:148:0, from examples_linux/mysgw.cpp:82: ./core/MySigningAtsha204Soft.cpp:283:55: note: mismatched types ‘std::initializer_list<_Tp>’ and ‘unsigned int’ MIN(MAX_PAYLOAD-mGetLength(msg), 32))) { ^ In file included from /usr/include/c++/6/algorithm:62:0, from ./drivers/Linux/Arduino.h:32, from ./MySensors.h:39, from examples_linux/mysgw.cpp:82: /usr/include/c++/6/bits/stl_algo.h:3447:5: note: candidate: template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>) min(initializer_list<_Tp> __l) ^~~ /usr/include/c++/6/bits/stl_algo.h:3447:5: note: template argument deduction/substitution failed: In file included from ./MySensors.h:148:0, from examples_linux/mysgw.cpp:82: ./core/MySigningAtsha204Soft.cpp:283:55: note: mismatched types ‘std::initializer_list<_Tp>’ and ‘unsigned int’ MIN(MAX_PAYLOAD-mGetLength(msg), 32))) { ^ In file included from /usr/include/c++/6/bits/char_traits.h:39:0, from /usr/include/c++/6/ios:40, from /usr/include/c++/6/ostream:38, from /usr/include/c++/6/iostream:39, from examples_linux/mysgw.cpp:20: /usr/include/c++/6/bits/stl_algobase.h:243:5: note: candidate: template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare) min(const _Tp& __a, const _Tp& __b, _Compare __comp) ^~~ /usr/include/c++/6/bits/stl_algobase.h:243:5: note: template argument deduction/substitution failed: In file included from ./MySensors.h:148:0, from examples_linux/mysgw.cpp:82: ./core/MySigningAtsha204Soft.cpp:283:55: note: deduced conflicting types for parameter ‘const _Tp’ (‘unsigned int’ and ‘int’) MIN(MAX_PAYLOAD-mGetLength(msg), 32))) { ^ In file included from /usr/include/c++/6/bits/char_traits.h:39:0, from /usr/include/c++/6/ios:40, from /usr/include/c++/6/ostream:38, from /usr/include/c++/6/iostream:39, from examples_linux/mysgw.cpp:20: /usr/include/c++/6/bits/stl_algobase.h:195:5: note: candidate: template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&) min(const _Tp& __a, const _Tp& __b) ^~~ /usr/include/c++/6/bits/stl_algobase.h:195:5: note: template argument deduction/substitution failed: In file included from ./MySensors.h:148:0, from examples_linux/mysgw.cpp:82: ./core/MySigningAtsha204Soft.cpp:283:55: note: deduced conflicting types for parameter ‘const _Tp’ (‘unsigned int’ and ‘int’) MIN(MAX_PAYLOAD-mGetLength(msg), 32))) { ^ ./core/MySigningAtsha204Soft.cpp: In function ‘void signerCalculateSignature(MyMessage&, bool)’: ./core/MySigningAtsha204Soft.cpp:307:48: error: no matching function for call to ‘min(uint8_t&, int)’ uint8_t bytes_to_include = MIN(bytes_left, 32); ^ In file included from /usr/include/c++/6/algorithm:62:0, from ./drivers/Linux/Arduino.h:32, from ./MySensors.h:39, from examples_linux/mysgw.cpp:82: /usr/include/c++/6/bits/stl_algo.h:3453:5: note: candidate: template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare) min(initializer_list<_Tp> __l, _Compare __comp) ^~~ /usr/include/c++/6/bits/stl_algo.h:3453:5: note: template argument deduction/substitution failed: In file included from ./MySensors.h:148:0, from examples_linux/mysgw.cpp:82: ./core/MySigningAtsha204Soft.cpp:307:48: note: mismatched types ‘std::initializer_list<_Tp>’ and ‘unsigned char’ uint8_t bytes_to_include = MIN(bytes_left, 32); ^ In file included from /usr/include/c++/6/algorithm:62:0, from ./drivers/Linux/Arduino.h:32, from ./MySensors.h:39, from examples_linux/mysgw.cpp:82: /usr/include/c++/6/bits/stl_algo.h:3447:5: note: candidate: template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>) min(initializer_list<_Tp> __l) ^~~ /usr/include/c++/6/bits/stl_algo.h:3447:5: note: template argument deduction/substitution failed: In file included from ./MySensors.h:148:0, from examples_linux/mysgw.cpp:82: ./core/MySigningAtsha204Soft.cpp:307:48: note: mismatched types ‘std::initializer_list<_Tp>’ and ‘unsigned char’ uint8_t bytes_to_include = MIN(bytes_left, 32); ^ In file included from /usr/include/c++/6/bits/char_traits.h:39:0, from /usr/include/c++/6/ios:40, from /usr/include/c++/6/ostream:38, from /usr/include/c++/6/iostream:39, from examples_linux/mysgw.cpp:20: /usr/include/c++/6/bits/stl_algobase.h:243:5: note: candidate: template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare) min(const _Tp& __a, const _Tp& __b, _Compare __comp) ^~~ /usr/include/c++/6/bits/stl_algobase.h:243:5: note: template argument deduction/substitution failed: In file included from ./MySensors.h:148:0, from examples_linux/mysgw.cpp:82: ./core/MySigningAtsha204Soft.cpp:307:48: note: deduced conflicting types for parameter ‘const _Tp’ (‘unsigned char’ and ‘int’) uint8_t bytes_to_include = MIN(bytes_left, 32); ^ In file included from /usr/include/c++/6/bits/char_traits.h:39:0, from /usr/include/c++/6/ios:40, from /usr/include/c++/6/ostream:38, from /usr/include/c++/6/iostream:39, from examples_linux/mysgw.cpp:20: /usr/include/c++/6/bits/stl_algobase.h:195:5: note: candidate: template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&) min(const _Tp& __a, const _Tp& __b) ^~~ /usr/include/c++/6/bits/stl_algobase.h:195:5: note: template argument deduction/substitution failed: In file included from ./MySensors.h:148:0, from examples_linux/mysgw.cpp:82: ./core/MySigningAtsha204Soft.cpp:307:48: note: deduced conflicting types for parameter ‘const _Tp’ (‘unsigned char’ and ‘int’) uint8_t bytes_to_include = MIN(bytes_left, 32); ^ ./core/MySigningAtsha204Soft.cpp: In function ‘bool signerAtsha204SoftVerifyMsg(MyMessage&)’: ./core/MySigningAtsha204Soft.cpp:289:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ Makefile:98 : la recette pour la cible « build/examples_linux/mysgw.o » a échouée make: *** [build/examples_linux/mysgw.o] Erreur 1