Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/slater1/treadmill into ma…
Browse files Browse the repository at this point in the history
…ster
  • Loading branch information
Doug Slater committed Aug 22, 2020
2 parents 1924bb0 + f6e0bb9 commit 1b27d2f
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
6 changes: 3 additions & 3 deletions services/i2c/src/i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ void parse_i2c(int SCL, int SDA)
case SCL_STEADY + SDA_RISING:
if (SCL)
{
printf("message end. len=%d, bit=%d\n",received_length,bit);
// printf("message end. len=%d, bit=%d\n",received_length,bit);
in_data = 0;
byte = 0;
bit = 0;
Expand Down Expand Up @@ -135,7 +135,7 @@ void handle_interrupt(int _)

void handle_scl_changed(int gpio, int level, uint32_t tick)
{
//printf("handle_scl_changed: %d\n", level);
// printf("handle_scl_changed: %d\n", level);
if (gpio != scl_pin)
return;

Expand All @@ -145,7 +145,7 @@ void handle_scl_changed(int gpio, int level, uint32_t tick)

void handle_sda_changed(int gpio, int level, uint32_t tick)
{
//printf("handle_sda_changed: %d\n", level);
// printf("handle_sda_changed: %d\n", level);
if (gpio != sda_pin)
return;

Expand Down
Binary file added services/i2c/src/i2c.exe
Binary file not shown.
2 changes: 1 addition & 1 deletion services/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ run:
$(MAKE) -C i2c
sudo nice -n 0 ./i2c/bin/i2c >> i2c.log 2>&1 &
python3 -u main.py >> main.log 2>&1 &
tail -f main.log
tail -n 0 -f main.log

stop:
sudo pkill -f main.py
Expand Down
20 changes: 10 additions & 10 deletions services/precor956i.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,12 @@ def pulse(self, led, duration_s = 0.1, then_wait_s = 0.1):
sleep(then_wait_s)

def diff_speed(self):
#return self.speed_feedback - self.speed_setpoint
return self.speed_expected - self.speed_setpoint
return self.speed_feedback - self.speed_setpoint
# return self.speed_expected - self.speed_setpoint

def diff_incline(self):
#return self.incline_feedback - self.incline_setpoint
return self.incline_expected - self.incline_setpoint
return self.incline_feedback - self.incline_setpoint
# return self.incline_expected - self.incline_setpoint

def rate_limit_speed(self):
diff = self.diff_speed()
Expand Down Expand Up @@ -143,13 +143,13 @@ def control_loop(self, rate_limit_func, interrupt_func, increment_func, decremen

def validate_state(self):

# if (self.state in [TreadmillState.Started] and self.speed_feedback < ZERO):
# print(f"speed is zero. Assuming paused.")
# self.state = TreadmillState.Paused
if (self.state in [TreadmillState.Started] and self.speed_feedback < ZERO):
print(f"speed is zero. Assuming paused.")
self.state = TreadmillState.Paused

# if (self.state not in [TreadmillState.Started] and self.speed_feedback > ZERO):
# print(f"speed is nonzero. Assuming started.")
# self.state = TreadmillState.Started
if (self.state not in [TreadmillState.Started] and self.speed_feedback > ZERO):
print(f"speed is nonzero. Assuming started.")
self.state = TreadmillState.Started
pass

# Do not change speed or incline outside of the Started state
Expand Down

0 comments on commit 1b27d2f

Please sign in to comment.