/elec/propeller-clock

To get this branch, use:
bzr branch http://bzr.ed.am/elec/propeller-clock

« back to all changes in this revision

Viewing changes to src/text.cc

  • Committer: Tim Marston
  • Date: 2012-03-09 23:42:20 UTC
  • Revision ID: tim@ed.am-20120309234220-xr1vxzve0o5n2oss
added support for eclipse project and converted to a manual Makefile

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
#include "config.h"
26
26
#include "Arduino.h"
27
27
#include <avr/pgmspace.h>
 
28
#include "display.h"
28
29
 
29
30
 
30
31
// the buffer for the message
48
49
// recalculate message params, based on _duration
49
50
static bool _do_draw_reset;
50
51
 
51
 
// recalculate messages parameters (after message reset)
52
 
static unsigned char _message_recalc_flags;
53
 
 
54
52
 
55
53
void reset_message_param( int message_num )
56
54
{
105
103
void Text::reset_message( int message_num, char mode )
106
104
{
107
105
        _message_modes[ message_num ] = mode;
108
 
        _message_recalc_flags |= 1 << message_num;
 
106
        reset_message_param( message_num );
109
107
}
110
108
 
111
109
 
115
113
        _duration = 0;
116
114
        _last_millis = ::millis();
117
115
        _do_draw_reset = false;
118
 
        _message_recalc_flags = 0;
119
116
 
120
117
        // reset the text renderer's output buffer
121
118
        TextRenderer::reset_buffer();
136
133
 
137
134
void Text::draw( int message_num, int segment )
138
135
{
139
 
        TextRenderer::buffer_in_use();
140
 
 
141
136
        // perform a mid-frame reset, as necessary
142
137
        if( _do_draw_reset && segment > NUM_SEGMENTS / 2 ) {
143
138
                _do_draw_reset = false;
144
139
 
145
 
                // reset message param?
146
 
                if( _message_recalc_flags & ( 1 << message_num ) ) {
147
 
                        _message_recalc_flags &= ~( 1 << message_num );
148
 
                        reset_message_param( message_num );
149
 
                }
150
 
 
151
 
                // add to horizontal scroll position
152
 
                if( _message_modes[ message_num ] & MODE_HSCROLL ) {
 
140
                if( _message_modes[ message_num ] & MODE_HSCROLL )
 
141
                {
 
142
                        // add to horizontal scroll position
153
143
                        _message_params[ message_num ] +=
154
144
                                _duration * TEXT_SCROLL_SPEED / 1000;
155
145
                        long excess = _message_params[ message_num ] -