F5OEO / rpitx

RF transmitter for Raspberry Pi
GNU General Public License v3.0
3.94k stars 519 forks source link

Running setTime.py continuously #103

Closed mrmattwilkins closed 5 years ago

mrmattwilkins commented 6 years ago

Hi, I would like to use rpitx to run a DCF77 transmitter in my house. I would like it to be running 24 hours a day, just going and going. setTime.py appears to only run a certain number of minutes before quitting. I know I could repeatedly start it up using cron, but is there a nicer solution? Thanks Matt

JsBergbau commented 6 years ago

Call it with "-n" or "--nums" for number of minutes of transmission

usage: setTime.py [-h] [-v] [-4] [-n NUMS]

Call rpitx to set dcf77 clock

optional arguments:
  -h, --help            show this help message and exit
  -v, --verbose         increase output verbosity
  -4, --gpio4           wire on GPIO 4 ( pin 7)
  -n NUMS, --nums NUMS  number of minutes of transmission

default wire on GPIO 18 ( pin 12) and 5 minutes of transmission
mrmattwilkins commented 6 years ago

Hi, I am aware of the -n, but I am wanting to run this forever, in other words for an infinite number of minutes of transmission. Is there a way of using rpitx to output DCF77 continuously, just like a DCF77 transmitter? Thanks Matt

On Sat, Apr 14, 2018 at 9:37 AM, JsBergbau notifications@github.com wrote:

Call it with "-n" or "--nums" for number of minutes of transmission

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/F5OEO/rpitx/issues/103#issuecomment-381266771, or mute the thread https://github.com/notifications/unsubscribe-auth/AKpf9wzBZCDLZB0CNFvh4dYuCZDswwejks5toRqLgaJpZM4TSqUD .

JsBergbau commented 6 years ago

Then I suggest you edit line 159 in setTime.py for i in range(1, NUMS + 1):

to

while True:

mrmattwilkins commented 6 years ago

Hi, Thanks for the suggestion, but I can't see how that will work. Isn't that loop building the file that will be later transmitted? If I'm reading the code correctly, a "while True" will result in an infinitely large file that will never be transmitted? Is the developer of rpitx on this forum? Thanks Matt

On Sat, Apr 14, 2018 at 11:06 AM, JsBergbau notifications@github.com wrote:

Then I suggest you edit line 159 in setTime.py for i in range(1, NUMS + 1):

to

while True:

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/F5OEO/rpitx/issues/103#issuecomment-381280889, or mute the thread https://github.com/notifications/unsubscribe-auth/AKpf9xmQ-r1I6KgXKyRcPo1o1lk05oPUks5toS9YgaJpZM4TSqUD .

JsBergbau commented 6 years ago

Sorry, you're right. The program first writes the file, with while True: infinetely large and thus never transmitted. But thats how the program works. Only looked too quickly, sorry.

I know I could repeatedly start it up using cron, but is there a nicer solution? Thanks

To need less work, try putting it into a bash script


#!/bin/sh

while true
do
./setTime.py -n XX
done

Thus it will be started again after XX minutes (replace how long you like running it continously)