Switched Bose internal protocol timing for 0 and 1 -> old 1 timing is now 0 and vice versa.

This commit is contained in:
Armin 2022-02-19 23:00:52 +01:00
parent 0ef17d23ae
commit 3d1de339f3
9 changed files with 79 additions and 44 deletions

View File

@ -1,7 +1,7 @@
# IRremote Arduino Library
This library enables you to send and receive using infra-red signals on an Arduino.
### [Version 3.6.0](https://github.com/Arduino-IRremote/Arduino-IRremote/archive/master.zip) - work in progress
### [Version 3.6.2](https://github.com/Arduino-IRremote/Arduino-IRremote/archive/master.zip) - work in progress
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Commits since latest](https://img.shields.io/github/commits-since/Arduino-IRremote/Arduino-IRremote/latest)](https://github.com/Arduino-IRremote/Arduino-IRremote/commits/master)

View File

@ -2,6 +2,9 @@
The latest version may not be released!
See also the commit log at github: https://github.com/Arduino-IRremote/Arduino-IRremote/commits/master
## 3.6.1
- Switched Bose internal protocol timing for 0 and 1 -> old 1 timing is now 0 and vice versa.
## 3.6.0
- Separated enable flag of send and receive feedback LED. Inspired by PR#970 from luvaihassanali.
- RP2040 support added.

View File

@ -10,7 +10,7 @@
************************************************************************************
* MIT License
*
* Copyright (c) 2020 Thomas Koch
* Copyright (c) 2020 Thomas Koch - 2022 AJ converted to inverted bits
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@ -70,13 +70,43 @@
#define BOSE_CMD_PRESET_4 0x10
#define BOSE_CMD_PRESET_5 0x11
// Codes for Wave Music System
// https://github.com/Arduino-IRremote/Arduino-IRremote/blob/master/pictures/BoseWaveMusicSystem.jpg)
//#define BOSE_CMD_ON_OFF 0x4C
//#define BOSE_CMD_MUTE 0x01
//#define BOSE_CMD_VOL_UP 0x03
//#define BOSE_CMD_VOL_DOWN 0x02
//#define BOSE_CMD_SLEEP 0x54
//#define BOSE_CMD_FM_AM 0x06
//#define BOSE_CMD_CD 0x53
//#define BOSE_CMD_AUX 0x0F
//#define BOSE_CMD_TRACK_BW 0x18
//#define BOSE_CMD_TRACK_FW 0x19
//#define BOSE_CMD_PLAY_PAUSE 0x1B
//#define BOSE_CMD_STOP_EJECT 0x1A
//#define BOSE_CMD_TUNE_UP 0x58
//#define BOSE_CMD_TUNE_DOWN 0x57
//#define BOSE_CMD_PRESET_1 0x07
//#define BOSE_CMD_PRESET_2 0x08
//#define BOSE_CMD_PRESET_3 0x09
//#define BOSE_CMD_PRESET_4 0x0A
//#define BOSE_CMD_PRESET_5 0x0B
//#define BOSE_CMD_PRESET_6 0x0C
//#define BOSE_CMD_TIME_MINUS 0x9E
//#define BOSE_CMD_TIME_PLUS 0x24
//#define BOSE_CMD_PLAY_MODE 0x21
//#define BOSE_CMD_ALARM_ON_OFF 0x22
//#define BOSE_CMD_ALARM_WAKE_TO 0x70
//#define BOSE_CMD_ALARM_TIME 0x23
// On the Zero and others we switch explicitly to SerialUSB
#if defined(ARDUINO_ARCH_SAMD)
#define Serial SerialUSB
#endif
bool prompt;
void menu();
bool sPrintMenu;
void printMenu();
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
@ -93,64 +123,65 @@ void setup() {
Serial.print(F("Ready to send IR signals at pin "));
Serial.println(IR_SEND_PIN);
prompt = true;
sPrintMenu = true;
}
void loop() {
if (prompt) {
prompt = false;
menu();
if (sPrintMenu) {
sPrintMenu = false;
printMenu();
}
int tSerialCommandCharacter;
if (Serial.available()) {
int answer = Serial.read();
prompt = true;
if (answer == -1) {
delay(300);
} else if (answer == 48) { // 0
tSerialCommandCharacter = Serial.read();
sPrintMenu = true;
if (tSerialCommandCharacter == -1) {
Serial.print(F("available() was true, but no character read")); // should not happen
} else if (tSerialCommandCharacter == 48) { // 0
IrSender.sendBoseWave(BOSE_CMD_ON_OFF); // On/Off
} else if (answer == 49) { // 1
} else if (tSerialCommandCharacter == 49) { // 1
IrSender.sendBoseWave(BOSE_CMD_VOL_UP); // Volume Up
} else if (answer == 50) { // 2
} else if (tSerialCommandCharacter == 50) { // 2
IrSender.sendBoseWave(BOSE_CMD_VOL_DOWN); // Volume Down
} else if (answer == 51) { // 3
} else if (tSerialCommandCharacter == 51) { // 3
IrSender.sendBoseWave(BOSE_CMD_TUNE_UP); // Tune Up
} else if (answer == 52) { // 4
} else if (tSerialCommandCharacter == 52) { // 4
IrSender.sendBoseWave(BOSE_CMD_TUNE_DOWN); // Tune Down
} else if (answer == 53) { // 5
} else if (tSerialCommandCharacter == 53) { // 5
IrSender.sendBoseWave(BOSE_CMD_AM); // AM
} else if (answer == 54) { // 6
} else if (tSerialCommandCharacter == 54) { // 6
IrSender.sendBoseWave(BOSE_CMD_FM); // FM
} else if (answer == 55) { // 7
} else if (tSerialCommandCharacter == 55) { // 7
IrSender.sendBoseWave(BOSE_CMD_PRESET_1); // Preset 1
} else if (answer == 56) { // 8
} else if (tSerialCommandCharacter == 56) { // 8
IrSender.sendBoseWave(BOSE_CMD_PRESET_2); // Preset 2
} else if (answer == 57) { // 9
} else if (tSerialCommandCharacter == 57) { // 9
IrSender.sendBoseWave(BOSE_CMD_PRESET_3); // Preset 3
} else if (answer == 97) { // a
} else if (tSerialCommandCharacter == 97) { // a
IrSender.sendBoseWave(BOSE_CMD_PRESET_4); // Preset 4
} else if (answer == 98) { // b
} else if (tSerialCommandCharacter == 98) { // b
IrSender.sendBoseWave(BOSE_CMD_PRESET_5); // Preset 5
} else if (answer == 99) { // c
} else if (tSerialCommandCharacter == 99) { // c
IrSender.sendBoseWave(BOSE_CMD_PRESET_6); // Preset 6
} else if (answer == 100) { // d
} else if (tSerialCommandCharacter == 100) { // d
IrSender.sendBoseWave(BOSE_CMD_MUTE); // Mute
} else if (answer == 101) { // e
} else if (tSerialCommandCharacter == 101) { // e
IrSender.sendBoseWave(BOSE_CMD_PLAY_PAUSE); // Pause
} else if (answer == 102) { // f
} else if (tSerialCommandCharacter == 102) { // f
IrSender.sendBoseWave(BOSE_CMD_STOP); // Stop
} else if (answer == 103) { // g
} else if (tSerialCommandCharacter == 103) { // g
IrSender.sendBoseWave(BOSE_CMD_AUX); // Aux
} else if (answer == 104) { // h
} else if (tSerialCommandCharacter == 104) { // h
IrSender.sendBoseWave(BOSE_CMD_SLEEP); // Sleep
} else {
prompt = false;
sPrintMenu = false;
}
delay(300);
}
}
void menu() {
void printMenu() {
Serial.println("0: On / Off");
Serial.println("1: Volume Up");
Serial.println("2: Volume Down");

View File

@ -7,7 +7,7 @@
"type": "git",
"url": "https://github.com/z3t0/Arduino-IRremote.git"
},
"version": "3.6.0",
"version": "3.6.1",
"frameworks": "arduino",
"platforms": ["atmelavr", "atmelmegaavr", "atmelsam", "espressif8266", "espressif32", "ststm32"],
"authors" :

View File

@ -1,9 +1,9 @@
name=IRremote
version=3.6.0
version=3.6.1
author=shirriff, z3t0, ArminJo
maintainer=Armin Joachimsmeyer <armin.arduino@gmail.com>
sentence=Send and receive infrared signals with multiple protocols
paragraph=Currently included protocols: Denon / Sharp, JVC, LG / LG2, NEC / Onkyo / Apple, Panasonic / Kaseikyo, RC5, RC6, Samsung, Sony, (Pronto), BoseWave, Lego, Whynter, MagiQuest.<br/><br/><b>New: </b>RP2040 support and major refactoring of IRTimer.hpp.<br/><a href="https://github.com/Arduino-IRremote/Arduino-IRremote/blob/master/changelog.md">Release notes</a><br/>
paragraph=Currently included protocols: Denon / Sharp, JVC, LG / LG2, NEC / Onkyo / Apple, Panasonic / Kaseikyo, RC5, RC6, Samsung, Sony, (Pronto), BoseWave, Lego, Whynter, MagiQuest.<br/><br/><b>New: </b>RP2040 support and major refactoring of IRTimer.hpp. Switched Bose timing for 0 and 1.<br/><a href="https://github.com/Arduino-IRremote/Arduino-IRremote/blob/master/changelog.md">Release notes</a><br/>
category=Communication
url=https://github.com/Arduino-IRremote/Arduino-IRremote
architectures=avr,megaavr,samd,esp8266,esp32,stm32,STM32F1,mbed,mbed_nano,rp2040

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

View File

@ -65,7 +65,7 @@
#ifndef IRremote_hpp
#define IRremote_hpp
#define VERSION_IRREMOTE "3.6.0"
#define VERSION_IRREMOTE "3.6.1"
#define VERSION_IRREMOTE_MAJOR 3
#define VERSION_IRREMOTE_MINOR 6

View File

@ -25,6 +25,7 @@
// BBBB OOO SSSS EEEEE
//==============================================================================
// see http://lirc.sourceforge.net/remotes/bose/WAVERADIO
// see: https://www.mikrocontroller.net/articles/IRMP_-_english#BOSE
//
// Support for Bose Wave Radio CD initially provided by https://github.com/uvotguy.
//
@ -35,13 +36,13 @@
// LSB first, 1 start bit + 8 bit data + 8 bit inverted data + 1 stop bit.
#define BOSEWAVE_BITS 16 // Command and inverted command
#define BOSEWAVE_HEADER_MARK 1060
#define BOSEWAVE_HEADER_SPACE 1450
#define BOSEWAVE_BIT_MARK 534
#define BOSEWAVE_ONE_SPACE 468
#define BOSEWAVE_ZERO_SPACE 1447
#define BOSEWAVE_HEADER_MARK 1014 // 1014 are 39 clock periods (I counted 3 times!)
#define BOSEWAVE_HEADER_SPACE 1468 // 1468(measured), 1456 are 56 clock periods
#define BOSEWAVE_BIT_MARK 520 // 520 are 20 clock periods
#define BOSEWAVE_ZERO_SPACE 468 // 468 are 18 clock periods
#define BOSEWAVE_ONE_SPACE 1468 // 1468(measured), 1456 are 56 clock periods
#define BOSEWAVE_REPEAT_SPACE 52000
#define BOSEWAVE_REPEAT_SPACE 50000
//+=============================================================================
@ -110,7 +111,7 @@ bool IRrecv::decodeBoseWave() {
// Success
// decodedIRData.flags = IRDATA_FLAGS_IS_LSB_FIRST; // Not required, since this is the start value
uint16_t tDecodedValue = decodedIRData.decodedRawData;
uint8_t tCommandNotInverted = tDecodedValue & 0xFF;
uint8_t tCommandNotInverted = tDecodedValue & 0xFF; // comes first and is in the lower bits (LSB first :-))
uint8_t tCommandInverted = tDecodedValue >> 8;
// parity check for command. Use this variant to avoid compiler warning "comparison of promoted ~unsigned with unsigned [-Wsign-compare]"
if ((tCommandNotInverted ^ tCommandInverted) != 0xFF) {

View File

@ -255,7 +255,7 @@ bool IRrecv::decodeNEC() {
} else {
/*
* NEC
* NEC LSB first, so first sent bit is also LSB of decodedIRData.decodedRawData
*/
if (tValue.UByte.LowByte == (uint8_t) (~tValue.UByte.MidLowByte)) {
// standard 8 bit address NEC protocol