Skip to content

Commit

Permalink
DCF77-Receiver wieder mit aufgenommen
Browse files Browse the repository at this point in the history
  • Loading branch information
hcanIngo authored and hcanIngo committed Jan 24, 2016
1 parent b19f349 commit e99300d
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 46 deletions.
21 changes: 0 additions & 21 deletions firmwares/controllerboard-1612-v01/dcf77_receiver.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,27 +158,6 @@ inline void dcf77_receiver_timer_handler(device_data_dcf77_receiver *p, uint8_t
}



// Mit Hilfe des Callbacks wird geprüft, ob eine HCAN_RTS Nachricht mit niedrigerem Level gesendet wurde.
void dcf77_receiver_can_callback(const canix_frame *frame)
{

if (frame->data[1] == HCAN_RTS_TIME_INFO) {
uint8_t i;
// Alle DCF77-Empfänger werden durchsucht und separat geprüft:
// (Der Code ist allerdings nicht dafür ausgelegt, daß mehr als ein DCF77-Device angeschlossen wird.)
for (i = 0; i < MAX_PDEVICE_DATA; i++) {
device_data_dcf77_receiver *p = (device_data_dcf77_receiver *) pdevice_data[i];
if (p && p->type == EDS_dcf77_receiver_BLOCK_ID)
// Wenn der Level der empfangenen Nachricht niedriger als der Level des Devices ist,
// wird dessen Zähler auf 0 gesetzt.
if (frame->data[2] < p->config.level)
p->last_time_frame_received = 0;
}
}
}


///////////////////////////////////////////////////////////////////////////////////////////


Expand Down
1 change: 0 additions & 1 deletion firmwares/controllerboard-1612-v01/dcf77_receiver.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ typedef struct

void dcf77_receiver_init(device_data_dcf77_receiver* p, eds_block_p it);
inline void dcf77_receiver_timer_handler(device_data_dcf77_receiver *p, uint8_t zyklus);
void dcf77_receiver_can_callback(const canix_frame *frame);

// Routinen zur Signalauswertung:
void scan_dcf77( device_data_dcf77_receiver *p );
Expand Down
11 changes: 8 additions & 3 deletions firmwares/controllerboard-1612-v01/devices/Hinweis.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@ Schritte zum neuen Device:
2. Ggf. in openHCAN/xml/hcan-protocol.xml neue Messages definieren.

3. In openHCAN/firmwares/controllerboard-1612-v01/devices folgende Dateien anlegen:
- neuesDevice.h
- neuesDevice.c

- NameDesDevice.h
- NameDesDevice.c

4. In openHCAN/firmwares/controllerboard-1612-v01/
make clean; make all
ausfuehren, um die unter openHCAN/firmwares/controllerboard-1612-v01/devices
liegenden Devices einzubinden und alles zu uebersetzen und linken

Hinweis: Devices im Verzeichnis "devicePool" werden nicht eingebunden.
3 changes: 2 additions & 1 deletion firmwares/controllerboard-1612-v01/devices/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ print_deviceList:
devices_xml:
@#rm -f devices.xml
@#> devices.xml
@echo "<C1612-devicelist>" > devices.xml
@echo "<!-- AUTOMATICLY GENERATED FROM /device/Makefile -->" > devices.xml
@echo "<C1612-devicelist>" >> devices.xml
@echo $(OBJ_DEVICES) >> devices.xml
@echo "</C1612-devicelist>" >> devices.xml

Expand Down
1 change: 1 addition & 0 deletions firmwares/controllerboard-1612-v01/devices/devices.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<!-- AUTOMATICLY GENERATED FROM /device/Makefile -->
<C1612-devicelist>
<device name="analogComparator"></device> <device name="heizung"></device> <device name="helligkeitssensor"></device> <device name="lichtzone"></device> <device name="multitaster"></device> <device name="ports"></device> <device name="poti"></device> <device name="powerportAutomat"></device> <device name="powerport"></device> <device name="reedkontakt"></device> <device name="rolladenAutomat"></device> <device name="rolladen"></device> <device name="rolladenSchlitzpos"></device> <device name="schalter"></device> <device name="taster"></device> <device name="tempsensor"></device> <device name="zeitschaltuhr"></device> <device name="zeitzone"></device> <device name="zentralheizungspumpe"></device>
</C1612-devicelist>
4 changes: 0 additions & 4 deletions firmwares/controllerboard-1612-v01/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#include "onewire.h"
#include <timer.h>
#include <timeservice.h>
#include <dcf77_receiver.h>
#include <darlingtonoutput.h>


Expand Down Expand Up @@ -95,9 +94,6 @@ int main(void)
canix_reg_frame_callback(timeservice_can_callback, HCAN_MULTICAST_INFO,
HCAN_PROTO_SFP, HCAN_SRV_RTS);

// canix_reg_frame_callback(dcf77_receiver_can_callback, HCAN_MULTICAST_INFO,
// HCAN_PROTO_SFP, HCAN_SRV_RTS);

devices_load_config();

canix_reg_rtc_callback(timer_handler);
Expand Down
41 changes: 25 additions & 16 deletions firmwares/controllerboard-1612-v01/timeservice.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

#include <devices.h>
#include <timeservice.h>
#include <dcf77_receiver.h>
#include <hcan_multicast.h>

inline void timeservice_timer_handler(device_data_timeservice *p, uint8_t zyklus)
Expand Down Expand Up @@ -69,30 +70,38 @@ void timeservice_can_callback(const canix_frame *frame)
switch (frame->data[1])
{
case HCAN_RTS_TIME_INFO :
{
uint8_t i;
for (i = 0; i < MAX_PDEVICE_DATA; i++)
{
uint8_t i;
for (i = 0; i < MAX_PDEVICE_DATA; i++)
// if this is a timeservice instance:
device_data_timeservice *p = (device_data_timeservice *) pdevice_data[i];
if (p && p->type == EDS_timeservice_BLOCK_ID)
{
device_data_timeservice *p = (device_data_timeservice *)
pdevice_data[i];
// now check, if the level is lower than our
// level:

// if this is a timeservice instance:
if (p && p->type == EDS_timeservice_BLOCK_ID)
if (frame->data[2] < p->config.level)
{
// now check, if the level is lower than our
// level:

if (frame->data[2] < p->config.level)
{
// yes, there is a master outside in the CAN
// universe, so reset our counter:
// yes, there is a master outside in the CAN
// universe, so reset our counter:

p->last_time_frame_received = 0;
}
p->last_time_frame_received = 0;
}
}

// Hier wird geprüft, ob eine HCAN_RTS Nachricht mit niedrigerem Level gesendet wurde:
device_data_dcf77_receiver *p2 = (device_data_dcf77_receiver *) pdevice_data[i];
if (p2 && p2->type == EDS_dcf77_receiver_BLOCK_ID)
{
// Wenn der Level der empfangenen Nachricht niedriger als der Level des Devices ist,
// wird dessen Zähler auf 0 gesetzt.
if (frame->data[2] < p2->config.level)
p2->last_time_frame_received = 0;
}
}
break;
}
break;
}
}

0 comments on commit e99300d

Please sign in to comment.