display single segment prompt
This commit is contained in:
@@ -227,21 +227,7 @@ impl DispalyState {
|
||||
self.0 = seg;
|
||||
}
|
||||
|
||||
pub fn prompt(&mut self) {
|
||||
self.set([
|
||||
SegmentState::Prompt(false),
|
||||
SegmentState::Prompt(true),
|
||||
SegmentState::Prompt(false),
|
||||
SegmentState::Prompt(false),
|
||||
SegmentState::Prompt(false),
|
||||
SegmentState::Prompt(false),
|
||||
SegmentState::Prompt(false),
|
||||
SegmentState::Prompt(false),
|
||||
SegmentState::Prompt(false),
|
||||
])
|
||||
}
|
||||
|
||||
pub fn error(&mut self) {
|
||||
pub fn empty(&mut self) {
|
||||
self.set([
|
||||
SegmentState::Off,
|
||||
SegmentState::Dot,
|
||||
@@ -254,6 +240,28 @@ impl DispalyState {
|
||||
SegmentState::Off,
|
||||
])
|
||||
}
|
||||
|
||||
pub fn prompt(&mut self, segment: usize) {
|
||||
self[segment] = if segment == 1 {
|
||||
SegmentState::Prompt(true)
|
||||
} else {
|
||||
SegmentState::Prompt(false)
|
||||
};
|
||||
}
|
||||
|
||||
pub fn error(&mut self) {
|
||||
self.set([
|
||||
SegmentState::Minus,
|
||||
SegmentState::Minus,
|
||||
SegmentState::Minus,
|
||||
SegmentState::Minus,
|
||||
SegmentState::Minus,
|
||||
SegmentState::Minus,
|
||||
SegmentState::Minus,
|
||||
SegmentState::Minus,
|
||||
SegmentState::Minus,
|
||||
])
|
||||
}
|
||||
}
|
||||
|
||||
// Show data on segment display
|
||||
|
||||
@@ -190,7 +190,12 @@ impl NumberInput {
|
||||
|
||||
impl Show for NumberInput {
|
||||
fn show(&self, display: &mut DispalyState) {
|
||||
display.prompt();
|
||||
display.empty();
|
||||
if !self.enter_exponent && self.significant_pos < DISPLAY_SEGMENTS_SIG {
|
||||
display.prompt(self.significant_pos + 1);
|
||||
} else if self.enter_exponent && self.exponent_pos < DISPLAY_SEGMENTS_EXP {
|
||||
display.prompt(DISPLAY_SEGMENTS_SIG + 2 + self.exponent_pos);
|
||||
}
|
||||
display[DISPLAY_SEGMENT_SIG_MINUS] = if self.minus {
|
||||
SegmentState::Minus
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user