mirror of
https://github.com/TomHarte/CLK.git
synced 2025-02-16 18:30:32 +00:00
Disambiguates whether Step will occur in addition to below zero/beyond maximum.
This commit is contained in:
parent
a43ca0db35
commit
0cb5362c6f
@ -33,7 +33,7 @@ class Observer {
|
||||
virtual void set_led_status(const std::string &name, bool lit) = 0;
|
||||
|
||||
enum class DriveEvent {
|
||||
Step,
|
||||
StepNormal,
|
||||
StepBelowZero,
|
||||
StepBeyondMaximum
|
||||
};
|
||||
|
@ -50,10 +50,11 @@ bool Drive::get_is_track_zero() {
|
||||
void Drive::step(HeadPosition offset) {
|
||||
HeadPosition old_head_position = head_position_;
|
||||
head_position_ += offset;
|
||||
if(observer_) observer_->announce_drive_event(drive_name_, Activity::Observer::DriveEvent::Step);
|
||||
if(head_position_ < HeadPosition(0)) {
|
||||
head_position_ = HeadPosition(0);
|
||||
if(observer_) observer_->announce_drive_event(drive_name_, Activity::Observer::DriveEvent::StepBelowZero);
|
||||
} else {
|
||||
if(observer_) observer_->announce_drive_event(drive_name_, Activity::Observer::DriveEvent::StepNormal);
|
||||
}
|
||||
|
||||
// If the head moved, flush the old track.
|
||||
|
Loading…
x
Reference in New Issue
Block a user