Prototype Minster Music Software

This Forum is for discussion about the development of the software to control the playing of the music in the Minster Nave and the bells in the Tower.

There will be two programs; both based on the original software but now running on two Pis.
hamishmb
Posts: 1891
Joined: 16/05/2017, 16:41

Re: Prototype Minster Music Software

Post by hamishmb »

I've taken a look at the code (current version on GitLab) and have found the following (not directly related to the problem):
  • The calls to logger.critical() upon receipt of invalid data should be logger.error() or logger.warning() - critical is used to indicate that the program cannot continue to run, which doesn't seem to be the case here.
  • There are a couple of duplicate logger calls about system startup near line 110.
I didn't find anything seriously wrong in minsterbells.py, so I then looked in minstermusic.py, where it looks like instead of asking for the bells pi status, you're sending it the list of status information at line 443:

Code: Select all

bells_socket.write(Status)            # Request the Bells Pi status
I think this should instead be:

Code: Select all

bells_socket.write("Status")            # Request the Bells Pi status
This is perhaps one of the disadvantages of using global data to hold state, but in a simple(ish) program like this it's not too much of an issue. Hopefully that solves your problem.
Hamish
TerryJC
Posts: 2616
Joined: 16/05/2017, 17:17

Re: Prototype Minster Music Software

Post by TerryJC »

hamishmb wrote: 18/02/2021, 15:19This is perhaps one of the disadvantages of using global data to hold state, but in a simple(ish) program like this it's not too much of an issue. Hopefully that solves your problem.
Thanks Hamish. I think you are right.

WRT using global Vars; this was originally to make it easy for novice coders to change stuff without having to go through the code to find where things were defined.

In this case the Status[] List Var was done that way because all three programs would want the same information. It's the way that the Tutor at Harvard did it to store data used by the Flask App that he was demonstrating so I did the same.

In this case, I don't think it would have helped avoid this error if I'd made everything local because I simply copied the command from somewhere else, (eg it was a CutnPaste error). For consistency the command should actually been:

Code: Select all

bells_socket.write("Send Bells Status")
Terry
hamishmb
Posts: 1891
Joined: 16/05/2017, 16:41

Re: Prototype Minster Music Software

Post by hamishmb »

Ah glad, we've figured it out. And yeah, you're right, it's better to use global variables in this case :)
Hamish
Post Reply