Skip to content

Commit

Permalink
[RM] call initApplication() before bcu.begin(.)
Browse files Browse the repository at this point in the history
- deleted obsolete serial startup code
  • Loading branch information
Darthyson committed Oct 21, 2023
1 parent ba2da00 commit 8aab1cb
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
6 changes: 6 additions & 0 deletions misc/Rauchmelder-bcu1/inc/rm_app.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,10 @@ unsigned long read_obj_value(unsigned char objno);
*/
void objectUpdated(int objno);

/**
* Setup and start periodid timer @ref timer32_0
* @param milliseconds Timer interval in milliseconds
*/
void setupPeriodicTimer(uint32_t milliseconds);

#endif /*rm_app_h*/
2 changes: 1 addition & 1 deletion misc/Rauchmelder-bcu1/inc/rm_const.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
#define rm_const_h

#include <stdint.h>
#include <sblib/io_pin_names.h>


const uint32_t TIMER_INTERVAL_MS = 500; //!< Periodic timer interval in milliseconds (handles all periodic tasks)
const uint32_t STARTUP_DELAY_MS = 500; //!< Delay time in milliseconds we wait for the serial port initialization of the smoke detector
const uint32_t SUPPLY_VOLTAGE_DELAY_MS = 500; //!< Delay time in milliseconds we wait after enabling the 12V supply
const uint32_t SUPPLY_VOLTAGE_TIMEOUT_MS = 120000; //!< Maximum waiting time in milliseconds to enable 12V supply

Expand Down
4 changes: 3 additions & 1 deletion misc/Rauchmelder-bcu1/src/app_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/

#include <sblib/timeout.h>
#include "rm_const.h"
#include "rm_com.h"
#include "rm_app.h"

Expand All @@ -25,13 +26,14 @@ APP_VERSION("S_RM_H6 ", "1", "03");
*/
BcuBase* setup()
{
initApplication();
bcu.begin(0x004C, 0x03F2, 0x24); //Herstellercode 0x004C = Robert Bosch, Devicetype 1010 (0x03F2), Version 2.4

// Handle power-up delay
//Timeout delay;
//delay.start(userEeprom.addrTab[0]*20); //aus LPC922 Rauchmelder übernommen

initApplication();
setupPeriodicTimer(TIMER_INTERVAL_MS);
return (&bcu);
}

Expand Down
8 changes: 0 additions & 8 deletions misc/Rauchmelder-bcu1/src/rm_app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -986,15 +986,7 @@ void initApplication()
digitalWrite(RM_COMM_ENABLE_PIN, RM_COMM_ENABLE); // Kommunikation mit dem RM aktivieren
pinMode(RM_SUPPORT_VOLTAGE_PIN, OUTPUT);
digitalWrite(RM_SUPPORT_VOLTAGE_PIN, RM_SUPPORT_VOLTAGE_OFF); // zuerst die Spannungsversorgung ausschalten
// rm_send_ack();
// rm_send_ack(); // sending twice a ACK came from original LPC922 source, because
// smoke detector will answer with it's automatic message (hex) after enabling the serial e.g.:
// 00 02 38 32 32 30 30 30 30 30 30 30 45 43 03 = <STX>8220000000EC<ETX>

delay(STARTUP_DELAY_MS);

rm_recv_byte();
setupPeriodicTimer(TIMER_INTERVAL_MS);

// TODO Alarm-Status vom Rauchmelder abfragen
}

0 comments on commit 8aab1cb

Please sign in to comment.