Skip to content

Commit

Permalink
MySensors 2.1.1 release (#752)
Browse files Browse the repository at this point in the history
* Bump version to 2.2.0-beta (#713)

* OTA: Add incoming FW block check (#718)

* Linux: Add support for SPIDEV (#734)

RPi and Linux refactor.

Add GPIO Sysfs for GPIO operations.

Update configure script.

Fix some cppcheck warnings.

Add serial emulation that prints to stdout.

Fix some file headers.

* Fix getControllerConfig() (#737)

* Rename MyHwATmega328 to MyHwAVR (#738)

* AVR: Restrict fast pin function use (#739)

* Fix signing presentation bug (#740)

* Consolidate open PRs for bugfix release (#741)

* Revert "Bump version to 2.2.0-beta" (#744)

* Merge Master into Dev (#745)

* Fix spi flash error when compiling in Arduino IDE 1.6.6

* Bump minor version

* Fixed "invalid suffix on literal" warning

* Fix addressing bug in _doSign bitfield

* Make sure nodes not supporting signing informs GW

A node that does not support signing, still needs to inform the
gateway about this to make sure the gateway carries a valid signing
requirement table when a node Id that was requiering signing stops
doing this.
This fixes #286.

* Prevent SecureActuator from accepting ACKs as commands

As ACKs are not currently signed, allowing ACKs as commands
is a considerable security hole for this sketch. This is now resolved.

* Backport of bugfix (#259) in repeaters when forwarding signed messages

* Bumped version to 1.5.2

* Corrected doSign variable name (was _doSign)

* Bumped version to 1.5.3

* Add NULL termination to payloads

Messages addressed to "this" node, will have a null char
appended to the payload after message verification is
done, because some "getters" assume the message being a
string.

* MySensors 2.1.1 release
  • Loading branch information
tekka007 authored and henrikekblad committed Jan 18, 2017
1 parent 808f9d8 commit 8bb3cfb
Show file tree
Hide file tree
Showing 59 changed files with 1,665 additions and 719 deletions.
16 changes: 16 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,22 @@ GATEWAY_OBJECTS+=$(patsubst %.c,$(BUILDDIR)/%.o,$(RPI_C_SOURCES)) $(patsubst %.c
INCLUDES+=-I./drivers/RPi
endif

ifeq ($(SPI_DRIVER), BCM)
SPI_DRIVER_C_SOURCES=$(wildcard drivers/BCM/*.c)
SPI_DRIVER_CPP_SOURCES=$(wildcard drivers/BCM/*.cpp)
GATEWAY_OBJECTS+=$(patsubst %.c,$(BUILDDIR)/%.o,$(SPI_DRIVER_C_SOURCES)) $(patsubst %.cpp,$(BUILDDIR)/%.o,$(SPI_DRIVER_CPP_SOURCES))

INCLUDES+=-I./drivers/BCM
endif

ifeq ($(SPI_DRIVER), SPIDEV)
SPI_DRIVER_C_SOURCES=$(wildcard drivers/SPIDEV/*.c)
SPI_DRIVER_CPP_SOURCES=$(wildcard drivers/SPIDEV/*.cpp)
GATEWAY_OBJECTS+=$(patsubst %.c,$(BUILDDIR)/%.o,$(SPI_DRIVER_C_SOURCES)) $(patsubst %.cpp,$(BUILDDIR)/%.o,$(SPI_DRIVER_CPP_SOURCES))

INCLUDES+=-I./drivers/SPIDEV
endif

# Gets include flags for library
get_library_includes = $(if $(and $(wildcard $(1)/src), $(wildcard $(1)/library.properties)), \
-I$(1)/src, \
Expand Down
6 changes: 3 additions & 3 deletions MyConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -903,12 +903,12 @@
#endif

/**
* @def MY_IS_SERIAL_PTY
* @def MY_LINUX_IS_SERIAL_PTY
* @brief Set serial as a pseudo terminal.
*
* Enable this if you need to connect to a controller running on the same device.
*/
//#define MY_IS_SERIAL_PTY
//#define MY_LINUX_IS_SERIAL_PTY

/**
* @def MY_LINUX_SERIAL_PTY
Expand Down Expand Up @@ -956,7 +956,7 @@
#define MY_NODE_LOCK_FEATURE
#define MY_REPEATER_FEATURE
#define MY_LINUX_SERIAL_GROUPNAME
#define MY_IS_SERIAL_PTY
#define MY_LINUX_IS_SERIAL_PTY
#define MY_RFM95_ATC_MODE_DISABLED
#define MY_RFM95_RST_PIN
#endif
8 changes: 2 additions & 6 deletions MySensors.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,12 @@
#include "core/MyHwESP8266.cpp"
#elif defined(ARDUINO_ARCH_AVR)
#include "drivers/AVR/DigitalWriteFast/digitalWriteFast.h"
#include "core/MyHwATMega328.cpp"
#include "core/MyHwAVR.cpp"
#elif defined(ARDUINO_ARCH_SAMD)
#include "core/MyHwSAMD.cpp"
#elif defined(__linux__)
#ifdef LINUX_ARCH_RASPBERRYPI
#include "core/MyHwRPi.cpp"
#else
#include "core/MyHwLinuxGeneric.cpp"
#endif
#endif

// LEDS
#if !defined(MY_DEFAULT_ERR_LED_PIN) && defined(MY_HW_ERR_LED_PIN)
Expand Down Expand Up @@ -254,7 +250,7 @@ MY_DEFAULT_RX_LED_PIN in your sketch instead to enable LEDs
#include "drivers/AVR/DigitalIO/DigitalIO.h"
#endif

#if defined(MY_RADIO_NRF24) && defined(__linux__) && !defined(LINUX_ARCH_RASPBERRYPI)
#if defined(MY_RADIO_NRF24) && defined(__linux__) && !(defined(LINUX_SPI_BCM) || defined(LINUX_SPI_SPIDEV))
#error No support for nRF24 radio on this platform
#endif

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
MySensors Library v2.1.0
MySensors Library v2.1.1

Please visit www.mysensors.org for more information

Expand Down
82 changes: 65 additions & 17 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ Options:
Help:
-h, --help print this message
SPI driver options:
--spi-driver=[BCM|SPIDEV]
--spi-spidev-device=<DEVICE>
Device path. [/dev/spidev0.0]
Building options:
--soc=[BCM2835|BCM2836|AM33XX|A10|A13|A20|H3]
SoC type to be used. [configure autodetected]
Expand Down Expand Up @@ -58,6 +63,8 @@ MySensors options:
--my-rf24-channel=<0-125> RF channel for the sensor net, 0-125. [76]
--my-rf24-pa-level=[RF24_PA_MAX|RF24_PA_LOW]
RF24 PA level. [RF24_PA_MAX]
--my-rf24-ce-pin=<PIN> Pin number to use for rf24 Chip-Enable.
--my-rf24-cs-pin=<PIN> Pin number to use for rf24 Chip-Select.
--my-rf24-irq-pin=<PIN> Pin number connected to nRF24L01 IRQ pin.
--my-rf24-encryption-enabled
Enables RF24 encryption.
Expand Down Expand Up @@ -209,7 +216,7 @@ function gcc_cpu_flags {
flags="-march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard"
;;
H3)
flags="-march=armv8-a -mtune=cortex-a53 -mfpu=neon-vfpv4 -mfloat-abi=hard"
flags="-march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard"
;;
*)
flags=""
Expand All @@ -224,7 +231,7 @@ transport_type=nrf24
signing=none
signing_request_signatures=false

params="SOC CFLAGS CXXFLAGS CPPFLAGS LDFLAGS PREFIX CC CXX ARDUINO_LIB_DIR BUILDDIR BINDIR GATEWAY_DIR INIT_SYSTEM"
params="SOC CFLAGS CXXFLAGS CPPFLAGS LDFLAGS PREFIX CC CXX ARDUINO_LIB_DIR BUILDDIR BINDIR GATEWAY_DIR INIT_SYSTEM SPI_DRIVER"

for opt do
if [ "$opt" = "-h" ] || [ "$opt" = "--help" ]; then
Expand All @@ -233,6 +240,12 @@ for opt do
fi
optarg="${opt#*=}"
case "$opt" in
--spi-driver=*)
SPI_DRIVER="$optarg"
;;
--spi-spidev-device=*)
CPPFLAGS="-DSPI_SPIDEV_DEVICE=\\\"${optarg}\\\" $CPPFLAGS"
;;
--soc=*)
SOC="$optarg"
;;
Expand Down Expand Up @@ -308,7 +321,7 @@ for opt do
CPPFLAGS="-DMY_BAUD_RATE=${optarg} $CPPFLAGS"
;;
--my-serial-is-pty*)
CPPFLAGS="-DMY_IS_SERIAL_PTY $CPPFLAGS"
CPPFLAGS="-DMY_LINUX_IS_SERIAL_PTY $CPPFLAGS"
;;
--my-serial-pty=*)
CPPFLAGS="-DMY_LINUX_SERIAL_PTY=\\\"${optarg}\\\" $CPPFLAGS"
Expand All @@ -322,6 +335,12 @@ for opt do
--my-rf24-pa-level=*)
CPPFLAGS="-DMY_RF24_PA_LEVEL=${optarg} $CPPFLAGS"
;;
--my-rf24-ce-pin=*)
CPPFLAGS="-DMY_RF24_CE_PIN=${optarg} $CPPFLAGS"
;;
--my-rf24-cs-pin=*)
CPPFLAGS="-DMY_RF24_CS_PIN=${optarg} $CPPFLAGS"
;;
--my-controller-url-address=*)
CPPFLAGS="-DMY_CONTROLLER_URL_ADDRESS=\\\"${optarg}\\\" $CPPFLAGS"
;;
Expand Down Expand Up @@ -406,7 +425,7 @@ if [ -z "${SOC}" ]; then
SOC=${info[0]}
TYPE=${info[1]}
CPU=${info[2]}
echo "[OK] machine detected: SoC=${SOC}, Type=${TYPE}, CPU=${CPU}."
echo " [OK] machine detected: SoC=${SOC}, Type=${TYPE}, CPU=${CPU}."
fi

if [ -z "${CPUFLAGS}" ]; then
Expand All @@ -415,6 +434,40 @@ fi

if [[ $SOC == "BCM2835" || $SOC == "BCM2836" ]]; then
CPPFLAGS="-DLINUX_ARCH_RASPBERRYPI $CPPFLAGS"
else
echo "[SECTION] Checking GPIO Sysfs."
if [[ $(eval 'ls /sys/class/gpio/export 2>/dev/null') ]]; then
echo " [OK] /sys/class/gpio/export found"
else
echo " [WARNING] /sys/class/gpio/export not found."
fi
fi

if [ -z "${SPI_DRIVER}" ]; then
echo "[SECTION] Detecting SPI driver."
if [[ $SOC == "BCM2835" || $SOC == "BCM2836" ]]; then
SPI_DRIVER=BCM
elif [[ $(eval 'ls /dev/spidev* 2>/dev/null') ]]; then
SPI_DRIVER=SPIDEV
fi
if [ -n "${SPI_DRIVER}" ]; then
echo " [OK] SPI driver detected:${SPI_DRIVER}."
else
echo " [WARNING] No supported SPI driver detected."
fi
fi
if [ -n "${SPI_DRIVER}" ]; then
case ${SPI_DRIVER} in
BCM)
CPPFLAGS="-DLINUX_SPI_BCM $CPPFLAGS"
;;
SPIDEV)
CPPFLAGS="-DLINUX_SPI_SPIDEV $CPPFLAGS"
;;
*)
die "Unsupported SPI driver: ${SPI_DRIVER}." 1
;;
esac
fi

if [[ ${debug} == "enable" ]]; then
Expand All @@ -431,9 +484,7 @@ elif [[ ${gateway_type} == "serial" ]]; then
elif [[ ${gateway_type} == "mqtt" ]]; then
CPPFLAGS="-DMY_GATEWAY_LINUX -DMY_GATEWAY_MQTT_CLIENT $CPPFLAGS"
else
echo "Invalid gateway type."
echo "Aborting."
exit 1
die "Invalid gateway type." 2
fi

if [[ ${transport_type} == "none" ]]; then
Expand All @@ -446,9 +497,7 @@ elif [[ ${transport_type} == "rs485" ]]; then
elif [[ ${transport_type} == "rfm95" ]]; then
CPPFLAGS="-DMY_RADIO_RFM95 $CPPFLAGS"
else
echo "Invalid transport type."
echo "Aborting."
exit 1
die "Invalid transport type." 3
fi

if [[ ${signing} == "none" ]]; then
Expand All @@ -460,24 +509,23 @@ elif [[ ${signing} == "software" ]]; then
CPPFLAGS="-DMY_SIGNING_REQUEST_SIGNATURES $CPPFLAGS"
fi
else
echo "Invalid message signing option."
echo "Aborting."
exit 1
die "Invalid message signing option." 4
fi

LDFLAGS="-pthread $LDFLAGS"
CPPFLAGS="$CPUFLAGS $CPPFLAGS"

echo "[SECTION] Detecting init system."
if [ "${NO_INIT}" ]; then
echo "[OK] no init system chosen."
echo " [OK] no init system chosen."
elif [ -x /usr/bin/systemctl ] || [ -x /bin/systemctl ]; then
INIT_SYSTEM=systemd
echo "[OK] init system detected: systemd"
echo " [OK] init system detected: systemd."
elif [ -f /etc/init.d/cron ] && [ ! -h /etc/init.d/cron ]; then
INIT_SYSTEM=sysvinit
echo "[OK] init system detected: sysvinit"
echo " [OK] init system detected: sysvinit."
else
echo "[FAILED] unknown init system"
echo " [FAILED] unknown init system."
fi

echo "[SECTION] Saving configuration."
Expand Down
2 changes: 1 addition & 1 deletion core/MyHwATMega328.cpp → core/MyHwAVR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

#ifdef ARDUINO_ARCH_AVR

#include "MyHwATMega328.h"
#include "MyHwAVR.h"

#define INVALID_INTERRUPT_NUM (0xFFu)

Expand Down
6 changes: 2 additions & 4 deletions core/MyHwATMega328.h → core/MyHwAVR.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
* version 2 as published by the Free Software Foundation.
*/

#ifndef MyHwATMega328_h
#define MyHwATMega328_h
#ifndef MyHwAVR_h
#define MyHwAVR_h

#include "MyHw.h"
#include <avr/eeprom.h>
Expand Down Expand Up @@ -58,12 +58,10 @@


// Define these as macros to save valuable space

#define hwDigitalWrite(__pin, __value) digitalWriteFast(__pin, __value)
#define hwDigitalRead(__pin) digitalReadFast(__pin)
#define hwPinMode(__pin, __value) pinModeFast(__pin, __value)


#if defined(MY_DISABLED_SERIAL)
#define hwInit()
#else
Expand Down
17 changes: 16 additions & 1 deletion core/MyHwLinuxGeneric.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ static SoftEeprom eeprom = SoftEeprom(MY_LINUX_CONFIG_FILE, 1024); // ATMega328

void hwInit()
{
#ifdef MY_GATEWAY_SERIAL
MY_SERIALDEVICE.begin(MY_BAUD_RATE);
#ifdef MY_GATEWAY_SERIAL
#ifdef MY_LINUX_SERIAL_GROUPNAME
if (!MY_SERIALDEVICE.setGroupPerm(MY_LINUX_SERIAL_GROUPNAME)) {
logError("Unable to change permission for serial port device.\n");
Expand Down Expand Up @@ -120,6 +120,21 @@ uint16_t hwFreeMem()
}
#endif

void hwDigitalWrite(uint8_t pin, uint8_t value)
{
digitalWrite(pin, value);
}

int hwDigitalRead(uint8_t pin)
{
return digitalRead(pin);
}

void hwPinMode(uint8_t pin, uint8_t mode)
{
pinMode(pin, mode);
}

#ifdef MY_DEBUG
void hwDebugPrint(const char *fmt, ...)
{
Expand Down
13 changes: 9 additions & 4 deletions core/MyHwLinuxGeneric.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,17 @@
#include <pthread.h>
#include "MyHw.h"
#include "SerialPort.h"
#include "SerialSimulator.h"

#ifdef MY_IS_SERIAL_PTY
#ifdef MY_GATEWAY_SERIAL
#ifdef MY_LINUX_IS_SERIAL_PTY
SerialPort Serial = SerialPort(MY_LINUX_SERIAL_PTY, true);
#else
SerialPort Serial = SerialPort(MY_LINUX_SERIAL_PORT);
#endif
#else
SerialSimulator Serial = SerialSimulator();
#endif

#ifndef MY_SERIALDEVICE
#define MY_SERIALDEVICE Serial
Expand All @@ -39,9 +44,9 @@ SerialPort Serial = SerialPort(MY_LINUX_SERIAL_PORT);
#define hwWatchdogReset()
#define hwReboot()

#define hwDigitalWrite(__pin, __value) _Pragma("GCC error \"Not supported on linux-generic\"")
#define hwDigitalRead(__pin) _Pragma("GCC error \"Not supported on linux-generic\"")
#define hwPinMode(__pin, __value) _Pragma("GCC error \"Not supported on linux-generic\"")
inline void hwDigitalWrite(uint8_t, uint8_t);
inline int hwDigitalRead(uint8_t);
inline void hwPinMode(uint8_t, uint8_t);

void hwInit();
inline void hwReadConfigBlock(void* buf, void* addr, size_t length);
Expand Down
Loading

0 comments on commit 8bb3cfb

Please sign in to comment.