Skip to content

Double call of update_sensor() when getting altitude #16

@JimMadge

Description

@JimMadge

Hi,

I noticed that update_sensor() appears to be called twice in a row when calling get_altitude. First self.update_sensor() is called followed by self.get_pressure(),

def get_altitude(self, qnh=1013.25):
self.update_sensor()
pressure = self.get_pressure()
altitude = 44330.0 * (1.0 - pow(pressure / qnh, (1.0 / 5.255)))
return altitude

However, the first line of get_pressure is also self.update_sensor(),

def get_pressure(self):
self.update_sensor()
return self.pressure

So, if we unrolled this we would get something like

self.update_sensor()
self.update_sensor()
pressure = self.pressure

I'm happy to open a PR changing this if it isn't intended.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions