A non-transitory computer-readable storage medium for a printing apparatus including a head configured to eject ink on a recording medium, a carriage including the head, an encoder including a scale, a first light emitting element and a first light receiving element, the scale being elongated along a moving direction of the carriage, the first light emitting element being mounted on the carriage and configured to emit light toward the scale, the first light receiving element being mounted on the carriage and configured to receive light emitted from the first light emitting element and reflected from or passing through the scale, the encoder being configured to output a signal corresponding to an amount of light received by the first light receiving element, and a measuring sensor including a second light emitting element and a second light receiving element, the second light emitting element being mounted on the carriage and configured to emit light toward the scale, the second light receiving element being mounted on the carriage and configured to receive light emitted from the second light emitting element and reflected from or passing through the scale,
- wherein the non-transitory computer-readable storage medium contains computer-executable instructions, the computer-executable instructions being configured to, when executed by a controller of the printing apparatus, cause the printing apparatus to perform:
- causing the head to eject ink while moving the carriage based on a signal output by the encoder;
- moving the carriage based on a signal output by the encoder, causing the second light emitting element to emit light onto a measuring position of the scale, and receiving light reflected from or passing through the measuring position using the second light receiving element;
- and
- calculating multiple lifetimes of the scale based on an amount of light received by the second light receiving element.