Skip to content

Troubleshooting

Help! Everything just falls apart
2.7k Topics 21.5k Posts
  • MySensors v2.4.0-alpha over PJON transport with a Raspberry PI gateway

    2
    0 Votes
    2 Posts
    45 Views
    mfalkviddM
    Yes, the configure script would have to be modified to support PJON. But I'm not sure that's enough. I ran ./configure and then edited Makefile.inc, where I replaced -DMY_RADIO_RF24 with -DMY_PJON. This was the result: g++ -MT build/examples_linux/mysgw.o -MMD -MP -march=armv8-a+crc -mtune=cortex-a72 -mfpu=neon-fp-armv8 -mfloat-abi=hard -DMY_PJON -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -Ofast -g -Wall -Wextra -std=c++11 -I. -I./core -I./hal/architecture/Linux/drivers/core -I./hal/architecture/Linux/drivers/BCM -c examples_linux/mysgw.cpp -o build/examples_linux/mysgw.o In file included from ./hal/transport/PJON/driver/PJON.h:62, from ./MySensors.h:390, from examples_linux/mysgw.cpp:82: ./hal/transport/PJON/driver/PJONDefines.h: In static member function ‘static void PJONTools::parse_header(const uint8_t*, PJON_Packet_Info&)’: ./hal/transport/PJON/driver/PJONDefines.h:415:31: warning: ‘void* memset(void*, int, size_t)’ clearing an object of non-trivial type ‘struct PJON_Packet_Info’; use assignment or value-initialization instead [-Wclass-memaccess] memset(&info, 0, sizeof info); ^ ./hal/transport/PJON/driver/PJONDefines.h:207:8: note: ‘struct PJON_Packet_Info’ declared here struct PJON_Packet_Info { ^~~~~~~~~~~~~~~~ In file included from ./MySensors.h:390, from examples_linux/mysgw.cpp:82: ./hal/transport/PJON/driver/PJON.h: At global scope: ./hal/transport/PJON/driver/PJON.h:1043:31: error: ‘A0’ was not declared in this scope uint8_t _random_seed = A0; ^~ ./hal/transport/PJON/driver/PJON.h:1043:31: note: suggested alternative: ‘y0’ uint8_t _random_seed = A0; ^~ y0 ./hal/transport/PJON/driver/PJON.h: In member function ‘void PJON<Strategy>::begin()’: ./hal/transport/PJON/driver/PJON.h:149:20: error: there are no arguments to ‘PJON_ANALOG_READ’ that depend on a template parameter, so a declaration of ‘PJON_ANALOG_READ’ must be available [-fpermissive] PJON_RANDOM_SEED(PJON_ANALOG_READ(_random_seed) + tx.id); ^~~~~~~~~~~~~~~~ ./hal/transport/PJON/driver/PJON.h:149:20: note: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated) ./hal/transport/PJON/driver/PJON.h: In member function ‘uint16_t PJON<Strategy>::dispatch(const PJON_Packet_Info&, const void*, uint16_t, uint32_t, uint16_t)’: ./hal/transport/PJON/driver/PJON.h:222:31: error: there are no arguments to ‘PJON_MICROS’ that depend on a template parameter, so a declaration of ‘PJON_MICROS’ must be available [-fpermissive] packets[i].registration = PJON_MICROS(); ^~~~~~~~~~~ ./hal/transport/PJON/driver/PJON.h: In member function ‘uint16_t PJON<Strategy>::receive(uint32_t)’: ./hal/transport/PJON/driver/PJON.h:456:19: error: there are no arguments to ‘PJON_MICROS’ that depend on a template parameter, so a declaration of ‘PJON_MICROS’ must be available [-fpermissive] uint32_t time = PJON_MICROS(); ^~~~~~~~~~~ ./hal/transport/PJON/driver/PJON.h:462:19: error: there are no arguments to ‘PJON_MICROS’ that depend on a template parameter, so a declaration of ‘PJON_MICROS’ must be available [-fpermissive] ((uint32_t)(PJON_MICROS() - time) <= duration) ^~~~~~~~~~~ ./hal/transport/PJON/driver/PJON.h: In member function ‘bool PJON<Strategy>::reset_packet(uint16_t)’: ./hal/transport/PJON/driver/PJON.h:506:31: error: there are no arguments to ‘PJON_MICROS’ that depend on a template parameter, so a declaration of ‘PJON_MICROS’ must be available [-fpermissive] packets[id].registration = PJON_MICROS(); ^~~~~~~~~~~ ./hal/transport/PJON/driver/PJON.h: In member function ‘uint16_t PJON<Strategy>::send_packet_blocking(const PJON_Packet_Info&, const void*, uint16_t, uint32_t)’: ./hal/transport/PJON/driver/PJON.h:695:20: error: there are no arguments to ‘PJON_MICROS’ that depend on a template parameter, so a declaration of ‘PJON_MICROS’ must be available [-fpermissive] uint32_t start = PJON_MICROS(); ^~~~~~~~~~~ ./hal/transport/PJON/driver/PJON.h:701:18: error: there are no arguments to ‘PJON_MICROS’ that depend on a template parameter, so a declaration of ‘PJON_MICROS’ must be available [-fpermissive] (uint32_t)(PJON_MICROS() - start) <= timeout ^~~~~~~~~~~ ./hal/transport/PJON/driver/PJON.h:721:5: error: there are no arguments to ‘PJON_DELAY’ that depend on a template parameter, so a declaration of ‘PJON_DELAY’ must be available [-fpermissive] PJON_DELAY((uint32_t)(strategy.back_off(attempts) / 1000)); ^~~~~~~~~~ ./hal/transport/PJON/driver/PJON.h: In member function ‘uint16_t PJON<Strategy>::update()’: ./hal/transport/PJON/driver/PJON.h:932:19: error: there are no arguments to ‘PJON_MICROS’ that depend on a template parameter, so a declaration of ‘PJON_MICROS’ must be available [-fpermissive] (uint32_t)(PJON_MICROS() - packets[i].registration) > ^~~~~~~~~~~ In file included from ./hal/transport/PJON/driver/PJONSoftwareBitBang.h:5, from ./MySensors.h:391, from examples_linux/mysgw.cpp:82: ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h: In member function ‘bool SoftwareBitBang::begin(uint8_t)’: ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h:66:14: error: ‘PJON_RANDOM’ was not declared in this scope PJON_DELAY(PJON_RANDOM(SWBB_INITIAL_DELAY) + did); ^~~~~~~~~~~ ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h:66:14: note: suggested alternative: ‘PJON_NAK’ PJON_DELAY(PJON_RANDOM(SWBB_INITIAL_DELAY) + did); ^~~~~~~~~~~ PJON_NAK ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h:66:3: error: ‘PJON_DELAY’ was not declared in this scope PJON_DELAY(PJON_RANDOM(SWBB_INITIAL_DELAY) + did); ^~~~~~~~~~ ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h:66:3: note: suggested alternative: ‘PJON_DEBUG’ PJON_DELAY(PJON_RANDOM(SWBB_INITIAL_DELAY) + did); ^~~~~~~~~~ PJON_DEBUG ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h: In member function ‘bool SoftwareBitBang::can_start()’: ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h:76:3: error: ‘PJON_IO_MODE’ was not declared in this scope PJON_IO_MODE(_input_pin, INPUT); ^~~~~~~~~~~~ ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h:76:3: note: suggested alternative: ‘PJON_NO_HEADER’ PJON_IO_MODE(_input_pin, INPUT); ^~~~~~~~~~~~ PJON_NO_HEADER ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h:78:3: error: ‘PJON_DELAY_MICROSECONDS’ was not declared in this scope PJON_DELAY_MICROSECONDS(SWBB_BIT_SPACER / 2); ^~~~~~~~~~~~~~~~~~~~~~~ ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h:79:6: error: ‘PJON_IO_READ’ was not declared in this scope if(PJON_IO_READ(_input_pin)) { ^~~~~~~~~~~~ ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h:79:6: note: suggested alternative: ‘PJON_NO_HEADER’ if(PJON_IO_READ(_input_pin)) { ^~~~~~~~~~~~ PJON_NO_HEADER ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h:83:6: error: ‘PJON_IO_READ’ was not declared in this scope if(PJON_IO_READ(_input_pin)) { ^~~~~~~~~~~~ ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h:83:6: note: suggested alternative: ‘PJON_NO_HEADER’ if(PJON_IO_READ(_input_pin)) { ^~~~~~~~~~~~ PJON_NO_HEADER ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h:88:7: error: ‘PJON_IO_READ’ was not declared in this scope if(PJON_IO_READ(_input_pin)) { ^~~~~~~~~~~~ ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h:88:7: note: suggested alternative: ‘PJON_NO_HEADER’ if(PJON_IO_READ(_input_pin)) { ^~~~~~~~~~~~ PJON_NO_HEADER ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h:93:6: error: ‘PJON_IO_READ’ was not declared in this scope if(PJON_IO_READ(_input_pin)) { ^~~~~~~~~~~~ ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h:93:6: note: suggested alternative: ‘PJON_NO_HEADER’ if(PJON_IO_READ(_input_pin)) { ^~~~~~~~~~~~ PJON_NO_HEADER ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h:98:6: error: ‘PJON_IO_READ’ was not declared in this scope if(PJON_IO_READ(_input_pin)) { ^~~~~~~~~~~~ ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h:98:6: note: suggested alternative: ‘PJON_NO_HEADER’ if(PJON_IO_READ(_input_pin)) { ^~~~~~~~~~~~ PJON_NO_HEADER ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h:102:27: error: ‘PJON_RANDOM’ was not declared in this scope PJON_DELAY_MICROSECONDS(PJON_RANDOM(SWBB_COLLISION_DELAY)); ^~~~~~~~~~~ ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h:102:27: note: suggested alternative: ‘PJON_NAK’ PJON_DELAY_MICROSECONDS(PJON_RANDOM(SWBB_COLLISION_DELAY)); ^~~~~~~~~~~ PJON_NAK ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h:103:6: error: ‘PJON_IO_READ’ was not declared in this scope if(PJON_IO_READ(_input_pin)) { ^~~~~~~~~~~~ ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h:103:6: note: suggested alternative: ‘PJON_NO_HEADER’ if(PJON_IO_READ(_input_pin)) { ^~~~~~~~~~~~ PJON_NO_HEADER ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h: In member function ‘void SoftwareBitBang::handle_collision()’: ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h:130:27: error: ‘PJON_RANDOM’ was not declared in this scope PJON_DELAY_MICROSECONDS(PJON_RANDOM(SWBB_COLLISION_DELAY)); ^~~~~~~~~~~ ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h:130:27: note: suggested alternative: ‘PJON_NAK’ PJON_DELAY_MICROSECONDS(PJON_RANDOM(SWBB_COLLISION_DELAY)); ^~~~~~~~~~~ PJON_NAK ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h:130:3: error: ‘PJON_DELAY_MICROSECONDS’ was not declared in this scope PJON_DELAY_MICROSECONDS(PJON_RANDOM(SWBB_COLLISION_DELAY)); ^~~~~~~~~~~~~~~~~~~~~~~ ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h: In member function ‘uint8_t SoftwareBitBang::read_byte()’: ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h:140:3: error: ‘PJON_DELAY_MICROSECONDS’ was not declared in this scope PJON_DELAY_MICROSECONDS(SWBB_BIT_WIDTH / 2); ^~~~~~~~~~~~~~~~~~~~~~~ ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h:143:18: error: ‘PJON_IO_READ’ was not declared in this scope byte_value += PJON_IO_READ(_input_pin) << i; ^~~~~~~~~~~~ ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h:143:18: note: suggested alternative: ‘PJON_NO_HEADER’ byte_value += PJON_IO_READ(_input_pin) << i; ^~~~~~~~~~~~ PJON_NO_HEADER ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h:148:17: error: ‘PJON_IO_READ’ was not declared in this scope byte_value += PJON_IO_READ(_input_pin) << 7; ^~~~~~~~~~~~ ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h:148:17: note: suggested alternative: ‘PJON_NO_HEADER’ byte_value += PJON_IO_READ(_input_pin) << 7; ^~~~~~~~~~~~ PJON_NO_HEADER ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h: In member function ‘uint16_t SoftwareBitBang::receive_response()’: ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h:175:4: error: ‘PJON_IO_WRITE’ was not declared in this scope PJON_IO_WRITE(_output_pin, LOW); ^~~~~~~~~~~~~ ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h:175:4: note: suggested alternative: ‘PJON_NO_HEADER’ PJON_IO_WRITE(_output_pin, LOW); ^~~~~~~~~~~~~ PJON_NO_HEADER ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h:178:19: error: ‘PJON_MICROS’ was not declared in this scope uint32_t time = PJON_MICROS(); ^~~~~~~~~~~ ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h:178:19: note: suggested alternative: ‘MOD_MICRO’ uint32_t time = PJON_MICROS(); ^~~~~~~~~~~ MOD_MICRO ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h:180:4: error: ‘PJON_IO_WRITE’ was not declared in this scope PJON_IO_WRITE(_input_pin, LOW); ^~~~~~~~~~~~~ ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h:180:4: note: suggested alternative: ‘PJON_NO_HEADER’ PJON_IO_WRITE(_input_pin, LOW); ^~~~~~~~~~~~~ PJON_NO_HEADER ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h:185:5: error: ‘PJON_IO_MODE’ was not declared in this scope PJON_IO_MODE(_output_pin, OUTPUT); ^~~~~~~~~~~~ ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h:185:5: note: suggested alternative: ‘PJON_NO_HEADER’ PJON_IO_MODE(_output_pin, OUTPUT); ^~~~~~~~~~~~ PJON_NO_HEADER ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h:187:5: error: ‘PJON_DELAY_MICROSECONDS’ was not declared in this scope PJON_DELAY_MICROSECONDS(SWBB_BIT_WIDTH / 4); ^~~~~~~~~~~~~~~~~~~~~~~ ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h:188:5: error: ‘PJON_IO_PULL_DOWN’ was not declared in this scope PJON_IO_PULL_DOWN(_output_pin); ^~~~~~~~~~~~~~~~~ ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h:188:5: note: suggested alternative: ‘PJON_INCLUDE_PORT’ PJON_IO_PULL_DOWN(_output_pin); ^~~~~~~~~~~~~~~~~ PJON_INCLUDE_PORT ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h: In member function ‘uint16_t SoftwareBitBang::receive_frame(uint8_t*, uint16_t)’: ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h:203:20: error: ‘PJON_MICROS’ was not declared in this scope uint32_t time = PJON_MICROS(); ^~~~~~~~~~~ ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h:203:20: note: suggested alternative: ‘MOD_MICRO’ uint32_t time = PJON_MICROS(); ^~~~~~~~~~~ MOD_MICRO ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h: In member function ‘void SoftwareBitBang::send_byte(uint8_t)’: ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h:248:4: error: ‘PJON_IO_WRITE’ was not declared in this scope PJON_IO_WRITE(_output_pin, b & mask); ^~~~~~~~~~~~~ ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h:248:4: note: suggested alternative: ‘PJON_NO_HEADER’ PJON_IO_WRITE(_output_pin, b & mask); ^~~~~~~~~~~~~ PJON_NO_HEADER ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h:249:4: error: ‘PJON_DELAY_MICROSECONDS’ was not declared in this scope PJON_DELAY_MICROSECONDS(SWBB_BIT_WIDTH); ^~~~~~~~~~~~~~~~~~~~~~~ ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h: In member function ‘void SoftwareBitBang::send_response(uint8_t)’: ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h:262:3: error: ‘PJON_IO_PULL_DOWN’ was not declared in this scope PJON_IO_PULL_DOWN(_input_pin); ^~~~~~~~~~~~~~~~~ ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h:262:3: note: suggested alternative: ‘PJON_INCLUDE_PORT’ PJON_IO_PULL_DOWN(_input_pin); ^~~~~~~~~~~~~~~~~ PJON_INCLUDE_PORT ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h:263:19: error: ‘PJON_MICROS’ was not declared in this scope uint32_t time = PJON_MICROS(); ^~~~~~~~~~~ ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h:263:19: note: suggested alternative: ‘MOD_MICRO’ uint32_t time = PJON_MICROS(); ^~~~~~~~~~~ MOD_MICRO ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h:266:8: error: ‘PJON_IO_READ’ was not declared in this scope !PJON_IO_READ(_input_pin) ^~~~~~~~~~~~ ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h:266:8: note: suggested alternative: ‘PJON_NO_HEADER’ !PJON_IO_READ(_input_pin) ^~~~~~~~~~~~ PJON_NO_HEADER ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h:271:7: error: ‘PJON_IO_READ’ was not declared in this scope PJON_IO_READ(_input_pin) ^~~~~~~~~~~~ ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h:271:7: note: suggested alternative: ‘PJON_NO_HEADER’ PJON_IO_READ(_input_pin) ^~~~~~~~~~~~ PJON_NO_HEADER ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h:273:3: error: ‘PJON_IO_MODE’ was not declared in this scope PJON_IO_MODE(_output_pin, OUTPUT); ^~~~~~~~~~~~ ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h:273:3: note: suggested alternative: ‘PJON_NO_HEADER’ PJON_IO_MODE(_output_pin, OUTPUT); ^~~~~~~~~~~~ PJON_NO_HEADER ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h: In member function ‘void SoftwareBitBang::send_frame(uint8_t*, uint16_t)’: ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h:296:3: error: ‘PJON_IO_MODE’ was not declared in this scope PJON_IO_MODE(_output_pin, OUTPUT); ^~~~~~~~~~~~ ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h:296:3: note: suggested alternative: ‘PJON_NO_HEADER’ PJON_IO_MODE(_output_pin, OUTPUT); ^~~~~~~~~~~~ PJON_NO_HEADER ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h:301:3: error: ‘PJON_IO_PULL_DOWN’ was not declared in this scope PJON_IO_PULL_DOWN(_output_pin); ^~~~~~~~~~~~~~~~~ ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h:301:3: note: suggested alternative: ‘PJON_INCLUDE_PORT’ PJON_IO_PULL_DOWN(_output_pin); ^~~~~~~~~~~~~~~~~ PJON_INCLUDE_PORT ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h: In member function ‘bool SoftwareBitBang::sync(uint32_t)’: ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h:324:3: error: ‘PJON_IO_PULL_DOWN’ was not declared in this scope PJON_IO_PULL_DOWN(_input_pin); ^~~~~~~~~~~~~~~~~ ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h:324:3: note: suggested alternative: ‘PJON_INCLUDE_PORT’ PJON_IO_PULL_DOWN(_input_pin); ^~~~~~~~~~~~~~~~~ PJON_INCLUDE_PORT ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h:328:19: error: ‘PJON_MICROS’ was not declared in this scope uint32_t time = PJON_MICROS(); ^~~~~~~~~~~ ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h:328:19: note: suggested alternative: ‘MOD_MICRO’ uint32_t time = PJON_MICROS(); ^~~~~~~~~~~ MOD_MICRO ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h:330:7: error: ‘PJON_IO_READ’ was not declared in this scope PJON_IO_READ(_input_pin) && ^~~~~~~~~~~~ ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h:330:7: note: suggested alternative: ‘PJON_NO_HEADER’ PJON_IO_READ(_input_pin) && ^~~~~~~~~~~~ PJON_NO_HEADER ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h:337:4: error: ‘PJON_DELAY_MICROSECONDS’ was not declared in this scope PJON_DELAY_MICROSECONDS((SWBB_BIT_WIDTH / 2) - SWBB_READ_DELAY); ^~~~~~~~~~~~~~~~~~~~~~~ ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h:338:8: error: ‘PJON_IO_READ’ was not declared in this scope if(!PJON_IO_READ(_input_pin)) { ^~~~~~~~~~~~ ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h:338:8: note: suggested alternative: ‘PJON_NO_HEADER’ if(!PJON_IO_READ(_input_pin)) { ^~~~~~~~~~~~ PJON_NO_HEADER ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h: In member function ‘void SoftwareBitBang::pulse(uint8_t)’: ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h:371:4: error: ‘PJON_IO_WRITE’ was not declared in this scope PJON_IO_WRITE(_output_pin, HIGH); ^~~~~~~~~~~~~ ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h:371:4: note: suggested alternative: ‘PJON_NO_HEADER’ PJON_IO_WRITE(_output_pin, HIGH); ^~~~~~~~~~~~~ PJON_NO_HEADER ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h:372:4: error: ‘PJON_DELAY_MICROSECONDS’ was not declared in this scope PJON_DELAY_MICROSECONDS(SWBB_BIT_SPACER); ^~~~~~~~~~~~~~~~~~~~~~~ ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h: In member function ‘void SoftwareBitBang::set_pin(uint8_t)’: ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h:382:3: error: ‘PJON_IO_PULL_DOWN’ was not declared in this scope PJON_IO_PULL_DOWN(pin); ^~~~~~~~~~~~~~~~~ ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h:382:3: note: suggested alternative: ‘PJON_INCLUDE_PORT’ PJON_IO_PULL_DOWN(pin); ^~~~~~~~~~~~~~~~~ PJON_INCLUDE_PORT ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h: In member function ‘void SoftwareBitBang::set_pins(uint8_t, uint8_t)’: ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h:395:3: error: ‘PJON_IO_PULL_DOWN’ was not declared in this scope PJON_IO_PULL_DOWN(input_pin); ^~~~~~~~~~~~~~~~~ ./hal/transport/PJON/driver/strategies/SoftwareBitBang/SoftwareBitBang.h:395:3: note: suggested alternative: ‘PJON_INCLUDE_PORT’ PJON_IO_PULL_DOWN(input_pin); ^~~~~~~~~~~~~~~~~ PJON_INCLUDE_PORT In file included from ./MySensors.h:395, from examples_linux/mysgw.cpp:82: ./hal/transport/PJON/MyTransportPJON.cpp: In function ‘void _receiver_function(uint8_t*, uint16_t, const PJON_Packet_Info&)’: ./hal/transport/PJON/MyTransportPJON.cpp:56:84: warning: unused parameter ‘packet_info’ [-Wunused-parameter] void _receiver_function(uint8_t *payload, uint16_t length, const PJON_Packet_Info &packet_info) ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~ In file included from ./MySensors.h:390, from examples_linux/mysgw.cpp:82: ./hal/transport/PJON/driver/PJON.h: In instantiation of ‘uint16_t PJON<Strategy>::update() [with Strategy = SoftwareBitBang; uint16_t = short unsigned int]’: ./hal/transport/PJON/MyTransportPJON.cpp:47:13: required from here ./hal/transport/PJON/driver/PJON.h:932:30: error: ‘PJON_MICROS’ was not declared in this scope (uint32_t)(PJON_MICROS() - packets[i].registration) > ~~~~~~~~~~~^~ ./hal/transport/PJON/driver/PJON.h:932:30: note: suggested alternative: ‘MOD_MICRO’ (uint32_t)(PJON_MICROS() - packets[i].registration) > ~~~~~~~~~~~^~ MOD_MICRO ./hal/transport/PJON/driver/PJON.h: In instantiation of ‘void PJON<Strategy>::begin() [with Strategy = SoftwareBitBang]’: ./hal/transport/PJON/MyTransportPJON.cpp:69:12: required from here ./hal/transport/PJON/driver/PJON.h:149:36: error: ‘PJON_ANALOG_READ’ was not declared in this scope PJON_RANDOM_SEED(PJON_ANALOG_READ(_random_seed) + tx.id); ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~ ./hal/transport/PJON/driver/PJON.h:149:36: note: suggested alternative: ‘PJON_NO_HEADER’ PJON_RANDOM_SEED(PJON_ANALOG_READ(_random_seed) + tx.id); ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~ PJON_NO_HEADER ./hal/transport/PJON/driver/PJON.h:149:19: error: ‘PJON_RANDOM_SEED’ was not declared in this scope PJON_RANDOM_SEED(PJON_ANALOG_READ(_random_seed) + tx.id); ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ./hal/transport/PJON/driver/PJON.h:149:19: note: suggested alternative: ‘PJON_NO_HEADER’ PJON_RANDOM_SEED(PJON_ANALOG_READ(_random_seed) + tx.id); ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ PJON_NO_HEADER ./hal/transport/PJON/driver/PJON.h: In instantiation of ‘uint16_t PJON<Strategy>::receive(uint32_t) [with Strategy = SoftwareBitBang; uint16_t = short unsigned int; uint32_t = unsigned int]’: ./hal/transport/PJON/MyTransportPJON.cpp:88:35: required from here ./hal/transport/PJON/driver/PJON.h:456:30: error: ‘PJON_MICROS’ was not declared in this scope uint32_t time = PJON_MICROS(); ~~~~~~~~~~~^~ ./hal/transport/PJON/driver/PJON.h:456:30: note: suggested alternative: ‘MOD_MICRO’ uint32_t time = PJON_MICROS(); ~~~~~~~~~~~^~ MOD_MICRO ./hal/transport/PJON/driver/PJON.h: In instantiation of ‘uint16_t PJON<Strategy>::dispatch(const PJON_Packet_Info&, const void*, uint16_t, uint32_t, uint16_t) [with Strategy = SoftwareBitBang; uint16_t = short unsigned int; uint32_t = unsigned int]’: ./hal/transport/PJON/driver/PJON.h:552:10: required from ‘uint16_t PJON<Strategy>::send(uint8_t, const void*, uint16_t, uint8_t, uint16_t, uint16_t) [with Strategy = SoftwareBitBang; uint16_t = short unsigned int; uint8_t = unsigned char]’ ./hal/transport/PJON/MyTransportPJON.cpp:46:85: required from here ./hal/transport/PJON/driver/PJON.h:222:42: error: ‘PJON_MICROS’ was not declared in this scope packets[i].registration = PJON_MICROS(); ~~~~~~~~~~~^~ ./hal/transport/PJON/driver/PJON.h:222:42: note: suggested alternative: ‘MOD_MICRO’ packets[i].registration = PJON_MICROS(); ~~~~~~~~~~~^~ MOD_MICRO make: *** [Makefile:99: build/examples_linux/mysgw.o] Error 1 So it seems more changes are needed. Maybe @Giovanni-Blu-Mitolo or @4ib3r have some information.
  • 0 Votes
    5 Posts
    41 Views
    mfalkviddM
    Great work @Ethan-Chua, thanks for reporting back.
  • Measure multiple voltages

    5
    0 Votes
    5 Posts
    55 Views
    MasMatM
    Check. Gotta redesign. I'll get optos on the AC-voltages and power the Rpi from the 48/12V ground source. Thanks for confirming my doubts.
  • Merging 2 or 3 sketches to one (relays & binary buttons)

    4
    0 Votes
    4 Posts
    65 Views
    R
    I modified the code, so the relay status is sent to the HA only at the beginning. I also changed the child id numbers (those for relays now correspond to the pin numbers). The good news is the sensor part for the pushbuttons is now working, but the relays still not. They do not register to the HA in any way. // Enable debug prints to serial monitor #define MY_DEBUG // Enable and select radio type attached //#define MY_RADIO_RF24 //#define MY_RADIO_NRF5_ESB //#define MY_RADIO_RFM69 //#define MY_RADIO_RFM95 // Set LOW transmit power level as default, if you have an amplified NRF-module and // power your radio separately with a good regulator you can turn up PA level. //#define MY_RF24_PA_LEVEL RF24_PA_LOW // Enable serial gateway #define MY_GATEWAY_SERIAL // Define a lower baud rate for Arduinos running on 8 MHz (Arduino Pro Mini 3.3V & SenseBender) #if F_CPU == 8000000L #define MY_BAUD_RATE 38400 #endif // Enable inclusion mode #define MY_INCLUSION_MODE_FEATURE // Enable Inclusion mode button on gateway //#define MY_INCLUSION_BUTTON_FEATURE // Inverses behavior of inclusion button (if using external pullup) //#define MY_INCLUSION_BUTTON_EXTERNAL_PULLUP // Set inclusion mode duration (in seconds) #define MY_INCLUSION_MODE_DURATION 60 // Digital pin used for inclusion mode button //#define MY_INCLUSION_MODE_BUTTON_PIN 3 // Set blinking period #define MY_DEFAULT_LED_BLINK_PERIOD 300 // Inverses the behavior of leds //#define MY_WITH_LEDS_BLINKING_INVERSE // Flash leds on rx/tx/err // Uncomment to override default HW configurations //#define MY_DEFAULT_ERR_LED_PIN 4 // Error led pin //#define MY_DEFAULT_RX_LED_PIN 6 // Receive led pin //#define MY_DEFAULT_TX_LED_PIN 5 // the PCB, on board LED #include <SPI.h> #include <MySensors.h> #include <Bounce2.h> #define RELAY_22 22 // Arduino Digital I/O pin number for first relay (second on pin+1 etc) #define NUMBER_OF_RELAYS 16 // Total number of attached relays: 4 // Opto Relay Module I was using Active Low - Low (0):ON, High (1): OFF #define RELAY_ON 0 // GPIO value to write to turn on attached relay #define RELAY_OFF 1 // GPIO value to write to turn off attached relay #define FIRST_PIR_ID 1 #define MAX_PIRS 16 const uint8_t pirPin[] = {A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13,A14,A15}; // switch around pins to your desire Bounce debouncer[MAX_PIRS]; MyMessage pirMsg(0, V_TRIPPED); bool oldPir[MAX_PIRS] = {false}; bool initialValueSent = false; //Init MyMessage for Each Child ID MyMessage msg22(22, V_LIGHT); MyMessage msg23(23, V_LIGHT); MyMessage msg24(24, V_LIGHT); MyMessage msg25(25, V_LIGHT); MyMessage msg26(26, V_LIGHT); MyMessage msg27(27, V_LIGHT); MyMessage msg28(28, V_LIGHT); MyMessage msg29(29, V_LIGHT); MyMessage msg30(30, V_LIGHT); MyMessage msg31(31, V_LIGHT); MyMessage msg32(32, V_LIGHT); MyMessage msg33(33, V_LIGHT); MyMessage msg34(34, V_LIGHT); MyMessage msg35(35, V_LIGHT); MyMessage msg36(36, V_LIGHT); MyMessage msg37(37, V_LIGHT); void before() { for (int sensor=22, pin=RELAY_22; sensor<=NUMBER_OF_RELAYS;sensor++, pin++) { // Then set relay pins in output mode pinMode(pin, OUTPUT); // Set relay to last known state (using eeprom storage) digitalWrite(pin, loadState(sensor)?RELAY_ON:RELAY_OFF); } } void setup() { for (uint8_t i = 0; i < MAX_PIRS; i++) { debouncer[i] = Bounce(); // initialize debouncer debouncer[i].attach(pirPin[i], INPUT_PULLUP); debouncer[i].interval(5); oldPir[i] = debouncer[i].read(); } wait(5000); Serial.println("Sending initial value"); send(msg22.set(loadState(22)?RELAY_OFF:RELAY_ON),true); wait(1000); send(msg23.set(loadState(23)?RELAY_OFF:RELAY_ON),true); wait(1000); send(msg24.set(loadState(24)?RELAY_OFF:RELAY_ON),true); wait(1000); send(msg25.set(loadState(25)?RELAY_OFF:RELAY_ON),true); wait(1000); send(msg26.set(loadState(26)?RELAY_OFF:RELAY_ON),true); wait(1000); send(msg27.set(loadState(27)?RELAY_OFF:RELAY_ON),true); wait(1000); send(msg28.set(loadState(28)?RELAY_OFF:RELAY_ON),true); wait(1000); send(msg29.set(loadState(29)?RELAY_OFF:RELAY_ON),true); wait(1000); send(msg30.set(loadState(30)?RELAY_OFF:RELAY_ON),true); wait(1000); send(msg31.set(loadState(31)?RELAY_OFF:RELAY_ON),true); wait(1000); send(msg32.set(loadState(32)?RELAY_OFF:RELAY_ON),true); wait(1000); send(msg33.set(loadState(33)?RELAY_OFF:RELAY_ON),true); wait(1000); send(msg34.set(loadState(34)?RELAY_OFF:RELAY_ON),true); wait(1000); send(msg35.set(loadState(35)?RELAY_OFF:RELAY_ON),true); wait(1000); send(msg36.set(loadState(36)?RELAY_OFF:RELAY_ON),true); wait(1000); send(msg37.set(loadState(37)?RELAY_OFF:RELAY_ON),true); wait(1000); Serial.println("Sending initial value: Completed"); wait(5000); } void presentation() { // Send the sketch version information to the gateway and Controller sendSketchInfo("Combo_22-37_i_A0-A15", "1.0"); for (int sensor=22, pin=RELAY_22; sensor<=NUMBER_OF_RELAYS;sensor++, pin++) { // Register all sensors to gw (they will be created as child devices) present(sensor, S_LIGHT); for (int i = 0; i < MAX_PIRS; i++) { //i < numSensors && present(FIRST_PIR_ID + i, S_MOTION); } } } void loop() { bool pir[MAX_PIRS]; for (uint8_t i = 0; i < MAX_PIRS; i++) { debouncer[i].update(); pir[i] = debouncer[i].read(); if (pir[i] != oldPir[i]) { send(pirMsg.setSensor(FIRST_PIR_ID + i).set( pir[i])); // Send tripped value to gw oldPir[i] = pir[i]; } } } void receive(const MyMessage &message) { Serial.println("=============== Receive Start ======================="); if (message.isAck()) { Serial.println(">>>>> ACK <<<<<"); Serial.println("This is an ack from gateway"); Serial.println("<<<<<< ACK >>>>>>"); } // We only expect one type of message from controller. But we better check anyway. if (message.type==V_LIGHT) { Serial.println(">>>>> V_LIGHT <<<<<"); if (!initialValueSent) { Serial.println("Receiving initial value from controller"); initialValueSent = true; } // Update relay state to HA digitalWrite(message.sensor-1+RELAY_22, message.getBool()?RELAY_ON:RELAY_OFF); switch (message.sensor) { case 22: Serial.print("Incoming change for sensor 1"); send(msg22.set(message.getBool()?RELAY_OFF:RELAY_ON)); break; case 23: Serial.print("Incoming change for sensor 2"); send(msg23.set(message.getBool()?RELAY_OFF:RELAY_ON)); break; case 24: Serial.print("Incoming change for sensor 3"); send(msg24.set(message.getBool()?RELAY_OFF:RELAY_ON)); break; case 25: Serial.print("Incoming change for sensor 4"); send(msg25.set(message.getBool()?RELAY_OFF:RELAY_ON)); break; case 26: Serial.print("Incoming change for sensor 5"); send(msg26.set(message.getBool()?RELAY_OFF:RELAY_ON)); break; case 27: Serial.print("Incoming change for sensor 6"); send(msg27.set(message.getBool()?RELAY_OFF:RELAY_ON)); break; case 28: Serial.print("Incoming change for sensor 7"); send(msg28.set(message.getBool()?RELAY_OFF:RELAY_ON)); break; case 29: Serial.print("Incoming change for sensor 8"); send(msg29.set(message.getBool()?RELAY_OFF:RELAY_ON)); break; case 30: Serial.print("Incoming change for sensor 9"); send(msg30.set(message.getBool()?RELAY_OFF:RELAY_ON)); break; case 31: Serial.print("Incoming change for sensor 10"); send(msg31.set(message.getBool()?RELAY_OFF:RELAY_ON)); break; case 32: Serial.print("Incoming change for sensor 11"); send(msg32.set(message.getBool()?RELAY_OFF:RELAY_ON)); break; case 33: Serial.print("Incoming change for sensor 12"); send(msg33.set(message.getBool()?RELAY_OFF:RELAY_ON)); break; case 34: Serial.print("Incoming change for sensor 13"); send(msg34.set(message.getBool()?RELAY_OFF:RELAY_ON)); break; case 35: Serial.print("Incoming change for sensor 14"); send(msg35.set(message.getBool()?RELAY_OFF:RELAY_ON)); break; case 36: Serial.print("Incoming change for sensor 15"); send(msg36.set(message.getBool()?RELAY_OFF:RELAY_ON)); break; case 37: Serial.print("Incoming change for sensor 16"); send(msg37.set(message.getBool()?RELAY_OFF:RELAY_ON)); break; default: Serial.println("Default Case: Receiving Other Sensor Child ID"); break; } // Store state in Arduino eeprom saveState(message.sensor, message.getBool()); Serial.print("Saved State for sensor: "); Serial.print( message.sensor); Serial.print(", New status: "); Serial.println(message.getBool()); Serial.println("<<<<<< V_LIGHT >>>>>>"); } Serial.println("=============== Receive END ======================="); } No error logs in HA, not a sign of relay entities in the json file.
  • USB Serial missing on Maple Mini

    stm32 usb serial
    1
    0 Votes
    1 Posts
    28 Views
    No one has replied
  • Can a sensor "get lost" between a GW and a repeater?

    repeater
    4
    0 Votes
    4 Posts
    47 Views
    bgunnarbB
    Thanks to @electrik and @mfalkvidd for your answers. I will try next time I have the opportunity. Currently the sensor is 400 km away from home.
  • 0 Votes
    8 Posts
    95 Views
    mfalkviddM
    @VonJoost Yes, naturally. Bad code will result in bad result. I'm trying to understand where the bad code came from.
  • Having problems with RFM69HW in Raspberry Pi

    3
    0 Votes
    3 Posts
    60 Views
    Constantin PetraC
    @frapell I am having the same issue with Raspberry PI zero W, I get an awful range (less than 2 meters) with the default build values. It seems the default power setting for RFM69HCW are 5dB. Also, for RPI Zero W it seems the 3.3V pin supplies only 50mA and I have also added an extra 3.3V regulator (should not be the case for RPI3+). I have now compiled the gateway using the following and got a better range indoors: ./configure --my-transport=rfm69 --my-rfm69-frequency=915 --my-is-rfm69hcw --my-gateway=mqtt --my-controller-ip-address=192.168.1.41 --my-mqtt-publish-topic-prefix=mysensors-out --my-mqtt-subscribe-topic-prefix=mysensors-in --my-mqtt-client-id=mygateway1 --extra-cxxflags="-DMY_RFM69_MAX_POWER_LEVEL_DBM=20 -DMY_RFM69_TX_POWER_DBM=20 -DMY_DEBUG_VERBOSE_RFM69" Look for "LEVEL" in the logs to check that the power level is the correct one. I don't know how mysensors handles the power range (expected to see it increasing it by itself no answers, but I could not get it working otherwise). Maybe it helps. Best Regards, Costa
  • Sketch seemingly "hangs" while executing

    scover stepper motor hanging
    4
    1
    0 Votes
    4 Posts
    53 Views
    Ethan ChuaE
    Hi there, Thanks for the replies! It seemed that the culprit was my stupidity. I forgot that the AccelStepper library's stepper.moveTo() function's argument was the absolute rather than the relative position of the stepper motor. As such my code would end up trying to push the stepper motor to extreme values (because I thought I needed to input a negative to move to the left etc) and this caused weird things to happen, most likely this crashing as well. In any case I'm glad the issue has been resolved. @electrik the programme takes up 72% of storage space and 64% of dynamic memory, so I will definitely cut out the Serial logs once I am done debugging. @mfalkvidd yikes you're right it seems I had forgotten to include the function to run the steppers. Anyways for reference sake I'll drop my final code here (from the last I tested it is working but with the minor issue of the motors having to travel to the end of their move before it can reverse direction, which I have no clue why it happens but I don't mind it): #include <AccelStepper.h> const byte dirPin1 = A0; const byte stepPin1 = A1; const byte enPin1 = A2; const byte dirPin2 = A3; const byte stepPin2 = A4; const byte enPin2 = A5; const byte dirPin3 = 4; const byte stepPin3 = 3; const byte enPin3 = 8; const byte dirPin4 = 7; const byte stepPin4 = 6; const byte enPin4 = 5; const bool enOne = true, enTwo = true, enThree = true, enFour = true; const bool dirOne = true, dirTwo = true, dirThree = true, dirFour = true; const int stepmmOne = 160, stepmmTwo = 160, stepmmThree = 160, stepmmFour = 160; const byte endstopup = A6, endstopdown = A7; //long timer = 0; #define motorInterfaceType 1 AccelStepper stepperOne(motorInterfaceType, stepPin1, dirPin1); AccelStepper stepperTwo(motorInterfaceType, stepPin2, dirPin2); AccelStepper stepperThree(motorInterfaceType, stepPin3, dirPin3); AccelStepper stepperFour(motorInterfaceType, stepPin4, dirPin4); #define MY_DEBUG #define MY_RADIO_RF24 #include <MySensors.h> #define CHILD_ID 0 //#define MY_TRANSPORT_WAIT_READY_MS 1000 int currentShutterLevel = 0, desiredShutterLevel = 0; enum currentState { STOP, UP, DOWN, }; static int currentState = STOP; //the initial state is STOP because it is not moving boolean requested = false; boolean isAlrMoving = false; boolean initialValueSent = false; boolean receivedStop = false; int totalDist = 150; //in mm int stepsPerMM = 160; int currentSteps = 0; int desiredSteps = 0; int stepsToMove = 0, oldStepsToMove = 0; int levelsToMove = 0; int levelsToGo = 0; int savedShutterLevel = 0; int stepSpeed = 50; int stepAccel = 1000; MyMessage upMessage(CHILD_ID, V_UP); MyMessage downMessage(CHILD_ID, V_DOWN); MyMessage stopMessage(CHILD_ID, V_STOP); MyMessage percMessage(CHILD_ID, V_PERCENTAGE); void sendState(){ #ifdef MY_DEBUG Serial.println("Sending states: "); Serial.print("UP: "); Serial.println(currentState == UP); Serial.print("DOWN: "); Serial.println(currentState == DOWN); Serial.print("STOP: "); Serial.println(currentState == STOP); Serial.print("PERC: "); Serial.println(currentShutterLevel); #endif send(upMessage.set(currentState == UP)); send(downMessage.set(currentState == DOWN)); send(stopMessage.set(currentState == STOP)); send(percMessage.set(desiredShutterLevel)); } void setup() { Serial.begin(115200); stepperOne.setEnablePin(enPin1); stepperOne.setPinsInverted(dirOne,false,enOne); stepperOne.setMaxSpeed(stepSpeed); stepperOne.setAcceleration(stepAccel); //stepperOne.setSpeed(50); stepperTwo.setEnablePin(enPin2); stepperTwo.setPinsInverted(dirTwo,false,enTwo); stepperTwo.setMaxSpeed(stepSpeed); stepperTwo.setAcceleration(stepAccel); //stepperTwo.setSpeed(50); stepperThree.setEnablePin(enPin3); stepperThree.setPinsInverted(dirThree,false,enThree); stepperThree.setMaxSpeed(stepSpeed); stepperThree.setAcceleration(stepAccel); //stepperThree.setSpeed(50);; stepperFour.setEnablePin(enPin4); stepperFour.setPinsInverted(dirFour,false,enFour); stepperFour.setMaxSpeed(stepSpeed); stepperFour.setAcceleration(stepAccel); //stepperFour.setSpeed(50); pinMode(endstopup, INPUT_PULLUP); pinMode(endstopdown, INPUT_PULLUP); } void presentation() { sendSketchInfo("Hydroponics Stepper Motors", "1.0"); wait(1000); present(CHILD_ID, S_COVER); } void loop() { /*if(!initialValueSent){ #ifdef MY_DEBUG Serial.println("Sending initial values!"); #endif sendState(); initialValueSent = true; } */ //requesting percentage of height if(!requested){ request(CHILD_ID, V_PERCENTAGE); #ifdef MY_DEBUG Serial.println("Requesting initial position of lights"); #endif } if(currentShutterLevel != desiredShutterLevel || receivedStop){ //allow the setting of new positions if a STOP is called //currentShutterLevel and desiredShutterLevel are used to detect the change in parameters if(!isAlrMoving){ //this ensures the following code is only executed once enableAllSteppers(); stepsToMove = map(desiredShutterLevel,0,100,0,totalDist*stepsPerMM); Serial.print("Moving to: "); Serial.println(stepsToMove); moveAllSteppers(stepsToMove); isAlrMoving = true; sendState(); } if(stepperOne.distanceToGo() != 0){ } else{ currentShutterLevel = desiredShutterLevel; currentState = STOP; sendState(); disableAllSteppers(); } receivedStop = false; }else{ //if desired and current are the same - either because there is no movement or when we call STOP, then check to see //if there was a change in the state of STOP. If there was then send the state. if(receivedStop){ sendState(); receivedStop = false; } disableAllSteppers(); } runAllSteppers(); if(analogRead(endstopup)>10 && currentState == UP){ //if the top endstop is triggered and the shutter was moving up #ifdef MY_DEBUG Serial.println("Top Endstop has been activated!"); #endif receivedStop = true; setCurrentPositionofAll(100); desiredShutterLevel = 100; currentShutterLevel = 100; currentState = STOP; } else if(analogRead(endstopdown)>10 && currentState == DOWN){ //if the bottom endstop is triggered and the shutter was moving down #ifdef MY_DEBUG Serial.println("Bottom Endstop has been activated!"); #endif receivedStop = true; setCurrentPositionofAll(0); desiredShutterLevel = 0; currentShutterLevel = 0; currentState = STOP; } } void receive(const MyMessage &message) { #ifdef MY_DEBUG Serial.print("Received a message from sensor: "); Serial.println(String(message.sensor)); Serial.print("Message type: "); Serial.println(String(message.type)); #endif isAlrMoving = false; //since if we receive a message it means that we need to do something, we can allow the position to be reset if(message.sensor == CHILD_ID){ switch(message.type){ case V_UP: desiredShutterLevel = 100; currentState = UP; #ifdef MY_DEBUG Serial.println("Shutter State is UP"); Serial.print("currentShutterLevel = "); Serial.println(currentShutterLevel); Serial.print("desiredShutterLevel = "); Serial.println(desiredShutterLevel); #endif break; case V_DOWN: desiredShutterLevel = 0; currentState = DOWN; #ifdef MY_DEBUG Serial.println("Shutter State is DOWN"); Serial.print("currentShutterLevel = "); Serial.println(currentShutterLevel); Serial.print("desiredShutterLevel = "); Serial.println(desiredShutterLevel); #endif break; case V_STOP: receivedStop = true; //allow the loop to send states once currentShutterLevel = map(stepperOne.currentPosition(),-totalDist*stepsPerMM,totalDist*stepsPerMM,-100,100); //update the current state with the state that the stepper is actually at desiredShutterLevel = currentShutterLevel; //stop the steppers currentState = STOP; #ifdef MY_DEBUG Serial.print("Halt called! Stopping all motors at pos: "); Serial.println(currentShutterLevel); #endif break; case V_PERCENTAGE: int pos = message.getInt(); if(pos > 100) pos = 100; if(pos < 0) pos = 0; if(!requested){ currentShutterLevel = pos; desiredShutterLevel = pos; setCurrentPositionofAll(map(pos,0,100,0,totalDist*stepsPerMM)); #ifdef MY_DEBUG Serial.print("Initialized! Current Shutter Level Set to: "); Serial.println(currentShutterLevel); #endif requested = true; } else{ desiredShutterLevel = pos; } currentState = (desiredShutterLevel > currentShutterLevel)?UP:DOWN; #ifdef MY_DEBUG Serial.print("Shutter State is PERC = "); Serial.println(desiredShutterLevel); Serial.print("currentShutterLevel = "); Serial.println(currentShutterLevel); Serial.print("desiredShutterLevel = "); Serial.println(desiredShutterLevel); #endif break; } } #ifdef MY_DEBUG Serial.print("Exiting this message with currentState = "); Serial.println(currentState); #endif } void enableAllSteppers(void){ stepperOne.enableOutputs(); stepperTwo.enableOutputs(); stepperThree.enableOutputs(); stepperFour.enableOutputs(); } void moveAllSteppers(int steps){ stepperOne.moveTo(steps); stepperTwo.moveTo(steps); stepperThree.moveTo(steps); stepperFour.moveTo(steps); } void runAllSteppers(void){ stepperOne.run(); stepperTwo.run(); stepperThree.run(); stepperFour.run(); } void disableAllSteppers(void){ stepperOne.disableOutputs(); stepperTwo.disableOutputs(); stepperThree.disableOutputs(); stepperFour.disableOutputs(); } void setCurrentPositionofAll(int pos){ stepperOne.setCurrentPosition(pos); stepperTwo.setCurrentPosition(pos); stepperThree.setCurrentPosition(pos); stepperFour.setCurrentPosition(pos); } Thanks so much for your patience and suggestions!
  • Sporadic issues finding parent gateway

    3
    1 Votes
    3 Posts
    51 Views
    Ethan ChuaE
    Hi there, Thanks for your response! It turns out I needed a better 3.3V power supply because I was powering the NRF24L01 from the Nano's 3.3V pin which is derived from the CH340 USB-Serial converter and is not ideal. Upgrading the supply to an AMS1117 3.3V supply solved the issue completely! Sorry for the late reply and thanks so much for your tips! Will try them out if issues crop up in the future.
  • Adafruit RFM69 Bonnet not working

    14
    0 Votes
    14 Posts
    197 Views
    FarmerEdF
    @FlyingSaucrDude What great timing (for me anyway), only this week I purchased the Adafruit RFM95 Bonnet version, and this thread is the only thing returned in a quick search. Your solution works for RFM95 also. I didn't need to comment out the code that prevented toggling the CS_PIN, but I'm using the development version as the main branch dose not seem to build on Pi OS Bullseye. ./configure --my-transport=rfm95 --my-rfm95-frequency=868 --my-gateway=ethernet --my-port=5003 --my-rfm95-cs-pin=26 --my-rfm95-irq-pin=15 --extra-cxxflags="-DMY_RFM95_RST_PIN=22" --spi-spidev-device=/dev/spidev0.1 --spi-driver=SPIDEV Thanks to your post I got this working in a few min of trying, would have taken me much longer otherwise, so thank you for posting to an ancient thread.
  • Gateway stopped "seeing" the sensors

    3
    0 Votes
    3 Posts
    62 Views
    C
    I have an almost identical issue with me ESP MQTT gateway no longer connecting to nodes. Similar issues to start with in that it was good for a number of months then would stop, restart ok, then multiple restarts to begin working. I have now resorted to changing out the 24RF01 module and the ESP to try and locate the issue. Will let you know how I get on.
  • Multiple messages often fail

    4
    1
    1 Votes
    4 Posts
    86 Views
    B
    Thank you for swift reply. Given the problem takes place in ~20% of cases it seems the problem is really caused by forcing echo. Since MySensors can cope with 80% of triple messages I believe cutting the number of messages by half would solve the problem. I do not observe issues during presentation though my heaviest node has 9 children. It also seems to be a better way than engaging in multicast feature. So the problem becomes more Home Assistant related... Given the ack (Enhaced Shockburst) mechanism, forcing echo seems to be redundant. Instead, the failure of message sending should be reported by the gateway - is there any mechanism possible? I only noticed the send() function returns bool as an advice but did not notice an equivalent returning feedback from gateway via ehternet/serial/mqtt. The documentation says there is an 'optimistic' option, where "Home Assistant will assume any requested changes (turn on light, open cover) are applied immediately without waiting for feedback from the node", so I believe HA does not require echo. Unfortunately when trying to set that nothing really changes , and I get the following HA log: optimistic option for mysensors is deprecated. Please remove optimistic from your configuration file I will post a suggestion to HA forum to restore this option, unless you know a (good) reason for removing optimistic from HA?
  • can't get D1 mini gateway sketch to work

    4
    0 Votes
    4 Posts
    37 Views
    M
    I fixed the issue by using the ESP8266 2.7.4 board software and installing https://github.com/espressif/esptool/archive/v3.0.zip and https://github.com/pyserial/pyserial/archive/v3.4.zip and replacing the esptool and pyserial folders in ~/Library/Arduino15/packages/esp8266/hardware/esp8266/2.7.4/tools/ If anybody has a fix for 3.0.2, it would be very much welcome!
  • Gateway fails with `!TSF:MSG:SIGN VERIFY FAIL` after period of time

    3
    0 Votes
    3 Posts
    67 Views
    Elin AngelowE
    another update: another (same) board found, and tested... problem persists. "Verify fail" starts between 670 and 690 message received ... it looks like something get full and nonce is not included in hmac generation.
  • This topic is deleted!

    1
    0 Votes
    1 Posts
    6 Views
    No one has replied
  • Unable to read data from my (Linky) electricity meter

    3
    3
    0 Votes
    3 Posts
    80 Views
    EncryptE
    Hello everyone! Thank you @mfalkvidd for your answer. I finally found the issue... Timing is particularly critical when reading UART and using the internal RC oscillator isn't a good idea... at all. Especially knowing that its frequency varies (quite a lot in my opinion) with temperature: [image: 1638139089726-capture.png] (Page 274 of the ATMEGA328P datasheet available here: https://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-7810-Automotive-Microcontrollers-ATmega328P_Datasheet.pdf) So, I changed the fuses of the ATMEGA328P to use an external 8 MHz crystal oscillator and now everything works perfectly! :champagne: Regarding the code, I've initialized the "Serial" object with the configuration SERIAL_7E1, it works as expected! Cheers! Encrypt
  • This topic is deleted!

    1
    0 Votes
    1 Posts
    1 Views
    No one has replied
  • send many variables in one messages

    1
    0 Votes
    1 Posts
    33 Views
    No one has replied
  • Problems ethernet GW with ESP8266- NodeMcu V3.4

    11
    0 Votes
    11 Posts
    153 Views
    bgunnarbB
    I also edited according to @Yveaux 's workaround and it works! I found however that in order to get the MQTT GW to listen to messages and forward them to the broker, I had to set wait(2000); in the void loop() If I set wait(0) the GW started but did not listen to messages. If I set wait(100); the GW started spamming the broker with the presentation message. Again, a big thank you to everybody involved. "Now we are cooking with gas again!"

20

Online

11.7k

Users

11.2k

Topics

113.1k

Posts