diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7664704 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.bak \ No newline at end of file diff --git a/BootLoaders/Boards/avr/boards.txt b/BootLoaders/Boards/avr/boards.txt index 1cdde33..41d4f11 100644 --- a/BootLoaders/Boards/avr/boards.txt +++ b/BootLoaders/Boards/avr/boards.txt @@ -20,6 +20,7 @@ multiatmega328p.build.f_cpu=16000000L multiatmega328p.build.core=arduino:arduino multiatmega328p.build.variant=arduino:eightanaloginputs multiatmega328p.build.extra_flags=-Wl,--relax + multiatmega328p.build.board=MULTI_AVR=102 multiatmega328p.board.compiler.c.flags=-c -g -Os {compiler.warning_flags} -std=gnu11 -ffunction-sections -fdata-sections -MMD -flto -fno-fat-lto-objects @@ -37,6 +38,7 @@ multiatmega328p.bootloader.unlock_bits=0x3F multiatmega328p.bootloader.lock_bits=0x0F multiatmega328p.menu.bootloader.none=No bootloader + multiatmega328p.menu.bootloader.none.build.board=MULTI_NO_BOOT=102 multiatmega328p.menu.bootloader.none.upload.maximum_size=32768 @@ -44,6 +46,7 @@ multiatmega328p.menu.bootloader.none.bootloader.file=Multi4in1/AtmegaMultiEmpty. multiatmega328p.menu.bootloader.none.bootloader.high_fuses=0xD7 multiatmega328p.menu.bootloader.optiboot=Flash from TX + multiatmega328p.menu.bootloader.optiboot.build.board=MULTI_FLASH_FROM_TX=102 multiatmega328p.menu.bootloader.optiboot.upload.maximum_size=32256 @@ -52,6 +55,7 @@ multiatmega328p.menu.bootloader.optiboot.bootloader.high_fuses=0xD6 ############################################################## + ############################################################## ## Multi 4-in-1 (OrangeRX) ## -------------------------------------------------- diff --git a/BootLoaders/Boards/avr/platform.local.txt b/BootLoaders/Boards/avr/platform.local.txt index 2b786ce..3bc726c 100644 --- a/BootLoaders/Boards/avr/platform.local.txt +++ b/BootLoaders/Boards/avr/platform.local.txt @@ -1,3 +1,4 @@ + ## Override some platform.txt settings to create a .bin instead of a .hex file ## The two lines below can be uncommented to have the compiler create a .bin file instead of a .hex file #compiler.elf2hex.flags=-O binary -R .eeprom @@ -6,3 +7,4 @@ ## Make a .bin version of the .hex file ## The line below can be uncommented to have a .bin file made as well as the .hex file #recipe.hooks.objcopy.postobjcopy.00.pattern.windows="{compiler.path}{compiler.objcopy.cmd}" -I ihex "{build.path}/{build.project_name}.hex" -O binary "{build.path}/{build.project_name}.bin" + diff --git a/BootLoaders/Boards/avr/platform.txt b/BootLoaders/Boards/avr/platform.txt index 0f28cb3..68fb565 100644 --- a/BootLoaders/Boards/avr/platform.txt +++ b/BootLoaders/Boards/avr/platform.txt @@ -1,11 +1,14 @@ # + # Customized for the Atmega328p and OrangeRX (XMEGA) multi 4-in-1 boards. # Both are AVR boards but need different compiler and upload flags and parameters. + # # For more info: # https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5---3rd-party-Hardware-specification name=Multi 4-in-1 AVR + version=1.0.2 compiler.warning_flags=-w @@ -136,4 +139,3 @@ tools.avrdude_remote.upload.pattern=/usr/bin/run-avrdude /tmp/sketch.hex {upload build.usb_manufacturer="Unknown" build.usb_flags=-DUSB_VID={build.vid} -DUSB_PID={build.pid} '-DUSB_MANUFACTURER={build.usb_manufacturer}' '-DUSB_PRODUCT={build.usb_product}' - diff --git a/BootLoaders/Boards/stm32/boards.txt b/BootLoaders/Boards/stm32/boards.txt index 74ada39..6a91c7f 100644 --- a/BootLoaders/Boards/stm32/boards.txt +++ b/BootLoaders/Boards/stm32/boards.txt @@ -16,7 +16,9 @@ multistm32f103c.pid.0=0x0004 multistm32f103c.build.variant=generic_stm32f103c multistm32f103c.build.vect=VECT_TAB_ADDR=0x8000000 multistm32f103c.build.core=maple + multistm32f103c.build.board=MULTI_STM32_FLASH_FROM_TX=103 + multistm32f103c.upload.use_1200bps_touch=false multistm32f103c.upload.file_type=bin multistm32f103c.upload.auto_reset=true @@ -42,10 +44,12 @@ multistm32f103c.menu.upload_method.TxFlashMethod.upload.tool=tx_upload multistm32f103c.menu.upload_method.TxFlashMethod.build.upload_flags=-DSERIAL_USB -DGENERIC_BOOTLOADER multistm32f103c.menu.upload_method.TxFlashMethod.build.vect=VECT_TAB_ADDR=0x8002000 multistm32f103c.menu.upload_method.TxFlashMethod.build.ldscript=ld/bootloader_20.ld + multistm32f103c.menu.upload_method.TxFlashMethod.bootloader.file=Multi4in1/StmMultiBoot.bin multistm32f103c.menu.upload_method.DFUUploadMethod=Upload via USB multistm32f103c.menu.upload_method.DFUUploadMethod.build.board=MULTI_STM32_NO_BOOT=103 + multistm32f103c.menu.upload_method.DFUUploadMethod.upload.protocol=maple_dfu multistm32f103c.menu.upload_method.DFUUploadMethod.upload.tool=maple_upload multistm32f103c.menu.upload_method.DFUUploadMethod.build.upload_flags=-DSERIAL_USB -DGENERIC_BOOTLOADER @@ -61,4 +65,6 @@ multistm32f103c.menu.upload_method.serialMethod.upload.tool=serial_upload multistm32f103c.menu.upload_method.serialMethod.build.upload_flags=-DCONFIG_MAPLE_MINI_NO_DISABLE_DEBUG multistm32f103c.menu.upload_method.serialMethod.build.board=MULTI_STM32_NO_BOOT=103 + + ############################################################## diff --git a/BootLoaders/Boards/stm32/platform.txt b/BootLoaders/Boards/stm32/platform.txt index d008733..4662f79 100644 --- a/BootLoaders/Boards/stm32/platform.txt +++ b/BootLoaders/Boards/stm32/platform.txt @@ -1,3 +1,4 @@ + # # Customized for the STM32 multi 4-in-1 board. # Based on an STM32F103CB MCU. @@ -6,6 +7,7 @@ # https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5---3rd-party-Hardware-specification name=Multi 4-in-1 STM32 + version=1.0.3 compiler.warning_flags=-w -DDEBUG_LEVEL=DEBUG_NONE @@ -48,6 +50,7 @@ build.hs_flag= build.upload_flags= build.extra_flags= {build.upload_flags} {build.cpu_flags} {build.hs_flag} {build.common_flags} + # These can be overridden in platform.local.txt compiler.c.extra_flags= compiler.c.elf.extra_flags="-L{build.variant.path}/ld" @@ -56,6 +59,7 @@ compiler.S.extra_flags= compiler.ar.extra_flags= compiler.elf2hex.extra_flags= + compiler.libs.c.flags="-I{build.system.path}/libmaple" "-I{build.system.path}/libmaple/include" "-I{build.system.path}/libmaple/stm32f1/include" "-I{build.system.path}/libmaple/usb/stm32f1" "-I{build.system.path}/libmaple/usb/usb_lib" # USB Flags @@ -99,6 +103,7 @@ recipe.size.regex.data=^(?:\.data|\.bss|\.noinit)\s+([0-9]+).* ## Save Compiled Binary recipe.output.tmp_file={build.project_name}.bin #recipe.output.save_file={build.project_name}.{build.variant}.bin + recipe.output.save_file=multi-stm.bin ## Copy hex @@ -114,6 +119,7 @@ recipe.hooks.savehex.postsavehex.01.pattern.linux="{runtime.platform.path}/tools recipe.hooks.savehex.postsavehex.01.pattern.linux64="{runtime.platform.path}/tools/linux64/do_version" "{build.path}" "{build.project_name}" "{build.source.path}" {build.board} EXPORT recipe.hooks.savehex.postsavehex.01.pattern.macosx="{runtime.platform.path}/tools/macosx/do_version" "{build.path}" "{build.project_name}" "{build.source.path}" {build.board} EXPORT + # Uploader tools # ------------------- diff --git a/BootLoaders/Boards/stm32/variants/generic_stm32f103c/wirish/syscalls.c b/BootLoaders/Boards/stm32/variants/generic_stm32f103c/wirish/syscalls.c index ec1c34d..af6b7de 100644 --- a/BootLoaders/Boards/stm32/variants/generic_stm32f103c/wirish/syscalls.c +++ b/BootLoaders/Boards/stm32/variants/generic_stm32f103c/wirish/syscalls.c @@ -76,6 +76,7 @@ void *_sbrk(int incr) { return ret; } + __weak int _open(const char *path __attribute__((unused)), int flags __attribute__((unused)), ...) { return 1; } @@ -85,10 +86,12 @@ __weak int _close(int fd __attribute__((unused))) { } __weak int _fstat(int fd __attribute__((unused)), struct stat *st) { + st->st_mode = S_IFCHR; return 0; } + __weak int _isatty(int fd __attribute__((unused))) { return 1; } @@ -98,6 +101,7 @@ __weak int isatty(int fd __attribute__((unused))) { } __weak int _lseek(int fd __attribute__((unused)), off_t pos __attribute__((unused)), int whence __attribute__((unused))) { + return -1; } @@ -106,13 +110,18 @@ __weak unsigned char getch(void) { } + __weak int _read(int fd __attribute__((unused)), char *buf, size_t cnt __attribute__((unused))) { + + *buf = getch(); return 1; } + __weak void putch(unsigned char c __attribute__((unused))) { + } __weak void cgets(char *s, int bufsize) { @@ -155,7 +164,9 @@ __weak void cgets(char *s, int bufsize) { return; } + __weak int _write(int fd __attribute__((unused)), const char *buf, size_t cnt) { + int i; for (i = 0; i < cnt; i++) @@ -165,12 +176,16 @@ __weak int _write(int fd __attribute__((unused)), const char *buf, size_t cnt) { } /* Override fgets() in newlib with a version that does line editing */ + __weak char *fgets(char *s, int bufsize, void *f __attribute__((unused))) { + cgets(s, bufsize); return s; } + __weak void _exit(int exitcode __attribute__((unused))) { + while (1) ; } diff --git a/BootLoaders/README.md b/BootLoaders/README.md index 8a14bc6..9e65638 100644 --- a/BootLoaders/README.md +++ b/BootLoaders/README.md @@ -1,4 +1,5 @@ # Arduino IDE board definitions for Multi 4-in-1 + Board definitions are available for the Atmega328p, STM32, and OrangeRX modules. The board definitions make it easier to compile and install the multiprotocol module firmware. **Note:** The Orange RX module is now included in the **Multi 4-in-1 AVR Boards** package, it no longer has a dedicated package. If you have the dedicated OrangeRX package installed you should remove it and install the most recent AVR package (v1.0.2 or newer). @@ -34,15 +35,19 @@ The board definitions are installed using the Arduino IDE Boards Manager. ## Verify the boards are installed 1. Click **Tools -> Board** 2. Scroll down the list to the **Multi 4-in-1** board headings verify that the boards you installed are available: + ![Image](/docs/images/boards-menu.jpg) * **Multi 4-in-1 (STM32F103CB)** for the STM32 module * **Multi 4-in-1 (Atmega328p, 3.3V, 16MHz)** for the Atmega module * **Multi 4-in-1 (OrangeRX)** for the OrangeRX module + ## Compiling and Uploading Refer to the hardware-specific pages for information on compiling the firmware and uploading it to the multiprotocol module: * [Compiling for Atmega](/docs/Compiling.md) * [Compiling for STM32](/docs/Compiling_STM32.md) + * [Compiling for OrangeRX](/docs/Compiling_OrangeTx.md) + diff --git a/BootLoaders/package_multi_4in1_board_index.json b/BootLoaders/package_multi_4in1_board_index.json index 07c5689..b72b436 100644 --- a/BootLoaders/package_multi_4in1_board_index.json +++ b/BootLoaders/package_multi_4in1_board_index.json @@ -8,6 +8,7 @@ "online": "https://github.com/pascallanger/DIY-Multiprotocol-TX-Module" }, "platforms": [{ + "name": "Multi 4-in-1 AVR Boards", "architecture": "avr", "version": "1.0.0", @@ -16,6 +17,7 @@ "online": "https://github.com/pascallanger/DIY-Multiprotocol-TX-Module" }, "url": "https://github.com/pascallanger/DIY-Multiprotocol-TX-Module/raw/master/BootLoaders/Archives/package_multi_4in1_board_v1.0.0.zip", + "archiveFileName": "package_multi_4in1_board_v1.0.0.zip", "checksum": "SHA-256:3DE301E9FC3C8A81CB2CEDE3458A68C626A9A5C37A73FA9C85BE9D841935684D", "size": "3205", @@ -25,6 +27,7 @@ "toolsDependencies": [] }, { + "name": "Multi 4-in-1 AVR Boards", "architecture": "avr", "version": "1.0.1", @@ -60,6 +63,7 @@ "toolsDependencies": [] }, { + "name": "Multi 4-in-1 STM32 Board", "architecture": "STM32F1", "version": "1.0.0", diff --git a/BootLoaders/package_multi_4in1_board_v1.0.0.zip b/BootLoaders/package_multi_4in1_board_v1.0.0.zip new file mode 100644 index 0000000..a3bfedb Binary files /dev/null and b/BootLoaders/package_multi_4in1_board_v1.0.0.zip differ diff --git a/BootLoaders/package_multi_4in1_stm32_board_v1.0.0.zip b/BootLoaders/package_multi_4in1_stm32_board_v1.0.0.zip new file mode 100644 index 0000000..ef6fcd9 Binary files /dev/null and b/BootLoaders/package_multi_4in1_stm32_board_v1.0.0.zip differ diff --git a/Multiprotocol/AFHDS2A_a7105.ino b/Multiprotocol/AFHDS2A_a7105.ino index 15fa0cf..9dcabe6 100644 --- a/Multiprotocol/AFHDS2A_a7105.ino +++ b/Multiprotocol/AFHDS2A_a7105.ino @@ -179,6 +179,7 @@ static void AFHDS2A_build_packet(uint8_t type) packet[0] = 0x56; for(uint8_t ch=0; ch<14; ch++) { + #ifdef FAILSAFE_ENABLE uint16_t failsafeMicros = (Failsafe_data[CH_AETR[ch]]*5)/8+860; if( failsafeMicros!=FAILSAFE_CHANNEL_HOLD+860) @@ -192,6 +193,7 @@ static void AFHDS2A_build_packet(uint8_t type) packet[9 + ch*2] = 0xff; packet[10+ ch*2] = 0xff; } + } break; case AFHDS2A_PACKET_SETTINGS: diff --git a/Multiprotocol/FrSkyX_cc2500.ino b/Multiprotocol/FrSkyX_cc2500.ino index 7ec1895..55b35ad 100644 --- a/Multiprotocol/FrSkyX_cc2500.ino +++ b/Multiprotocol/FrSkyX_cc2500.ino @@ -1,3 +1,4 @@ + /* ************************** * By Midelic on RCGroups * ************************** @@ -350,4 +351,5 @@ uint16_t initFrSkyX() FrX_receive_seq = 0 ; return 10000; } + #endif \ No newline at end of file diff --git a/Multiprotocol/Multiprotocol.h b/Multiprotocol/Multiprotocol.h index 0b79894..d7317ec 100644 --- a/Multiprotocol/Multiprotocol.h +++ b/Multiprotocol/Multiprotocol.h @@ -17,6 +17,7 @@ // Version //****************** #define VERSION_MAJOR 1 + #define VERSION_MINOR 2 #define VERSION_REVISION 0 #define VERSION_PATCH_LEVEL 0 diff --git a/Multiprotocol/Multiprotocol.ino b/Multiprotocol/Multiprotocol.ino index 01e186e..f8535bb 100644 --- a/Multiprotocol/Multiprotocol.ino +++ b/Multiprotocol/Multiprotocol.ino @@ -1,3 +1,4 @@ + /********************************************************* Multiprotocol Tx code by Midelic and Pascal Langer(hpnuts) @@ -1656,6 +1657,4 @@ static uint32_t random_id(uint16_t address, uint8_t create_new) WDTCSR = 0; // Disable Watchdog interrupt } } -#endif - - +#endif \ No newline at end of file diff --git a/Multiprotocol/Telemetry.ino b/Multiprotocol/Telemetry.ino index 77f5a36..04f5600 100644 --- a/Multiprotocol/Telemetry.ino +++ b/Multiprotocol/Telemetry.ino @@ -1,3 +1,4 @@ + /* This project is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/docs/Models.md b/docs/Models.md index 9e24af6..0aaa547 100644 --- a/docs/Models.md +++ b/docs/Models.md @@ -7,7 +7,6 @@ The Deviation project (on which this project was based) have a useful list of mo ## Channel Map - CH1|CH2|CH3|CH4|CH5|CH6|CH7|CH8|CH9 ---|---|---|---|---|---|---|---|--- A|E|T|R|FLIP|RATES|PICTURE|VIDEO|HEADLESS