Compare commits

..

No commits in common. "323fa682227c9b283a80a33668a55283875e36f4" and "b2502e7f0a20793971972cdec319bf185ce4f299" have entirely different histories.

5 changed files with 11 additions and 42 deletions

View File

@ -2,7 +2,7 @@
<BaliProject version="3.2" title="lmg6202" device="LCMXO2-1200HC-5SG32C" default_implementation="impl1"> <BaliProject version="3.2" title="lmg6202" device="LCMXO2-1200HC-5SG32C" default_implementation="impl1">
<Options/> <Options/>
<Implementation title="impl1" dir="impl1" description="impl1" synthesis="synplify" default_strategy="Strategy1"> <Implementation title="impl1" dir="impl1" description="impl1" synthesis="synplify" default_strategy="Strategy1">
<Options def_top="design.top" lib="design" top="design.top"/> <Options def_top="design.top" top="design.top"/>
<Source name="../ip/gram0/gram0.ipx" type="IPX_Module" type_short="IPX"> <Source name="../ip/gram0/gram0.ipx" type="IPX_Module" type_short="IPX">
<Options/> <Options/>
</Source> </Source>
@ -18,12 +18,6 @@
<Source name="../design/spi_if.vhd" type="VHDL" type_short="VHDL"> <Source name="../design/spi_if.vhd" type="VHDL" type_short="VHDL">
<Options lib="design"/> <Options lib="design"/>
</Source> </Source>
<Source name="../ip/pll0/pll0.vhd" type="VHDL" type_short="VHDL">
<Options lib="ip"/>
</Source>
<Source name="../generics/synchronizer.vhd" type="VHDL" type_short="VHDL">
<Options lib="generics"/>
</Source>
<Source name="impl1/impl1.xcf" type="Programming Project File" type_short="Programming"> <Source name="impl1/impl1.xcf" type="Programming Project File" type_short="Programming">
<Options/> <Options/>
</Source> </Source>

View File

@ -190,7 +190,7 @@
<Property name="PROP_SYN_ResolvedMixedDrivers" value="False" time="0"/> <Property name="PROP_SYN_ResolvedMixedDrivers" value="False" time="0"/>
<Property name="PROP_SYN_UpdateCompilePtTimData" value="False" time="0"/> <Property name="PROP_SYN_UpdateCompilePtTimData" value="False" time="0"/>
<Property name="PROP_SYN_UseLPF" value="True" time="0"/> <Property name="PROP_SYN_UseLPF" value="True" time="0"/>
<Property name="PROP_SYN_VHDL2008" value="True" time="0"/> <Property name="PROP_SYN_VHDL2008" value="False" time="0"/>
<Property name="PROP_THERMAL_DefaultFreq" value="0" time="0"/> <Property name="PROP_THERMAL_DefaultFreq" value="0" time="0"/>
<Property name="PROP_TIM_MaxDelSimDes" value="" time="0"/> <Property name="PROP_TIM_MaxDelSimDes" value="" time="0"/>
<Property name="PROP_TIM_MinSpeedGrade" value="False" time="0"/> <Property name="PROP_TIM_MinSpeedGrade" value="False" time="0"/>

Binary file not shown.

View File

@ -292,9 +292,8 @@ static int lw35ioc_chardev_open(struct inode *inodep, struct file *filep) {
break; break;
case PASSIVE: case PASSIVE:
lw35ioc_reset_ioc_hw(serdev); lw35ioc_reset_ioc_hw(serdev);
usleep_range(2100000, 2210000); usleep_range(1000000, 1010000);
dev_info(&serdev->dev, "Put ioc into active mode.\n"); dev_info(&serdev->dev, "Put ioc into active mode.\n");
serdev_device_write(serdev, "\xFF", 1, 0);
priv->state = ACTIVE; priv->state = ACTIVE;
break; break;
case ACTIVE: case ACTIVE:

View File

@ -112,7 +112,7 @@ void hardfault() {
#define PRINTER_CONTROL_CHAR 56 #define PRINTER_CONTROL_CHAR 56
#define PRINTER_NO_CHAR 128 #define PRINTER_NO_CHAR 128
#define ASCII_TRANSLATION_TABLE_SIZE (128 + 12) #define ASCII_TRANSLATION_TABLE_SIZE 128 + 12
const uint8_t ascii_translation_table[ASCII_TRANSLATION_TABLE_SIZE] PROGMEM = { const uint8_t ascii_translation_table[ASCII_TRANSLATION_TABLE_SIZE] PROGMEM = {
PRINTER_CONTROL_CHAR, PRINTER_CONTROL_CHAR,
PRINTER_CONTROL_CHAR, PRINTER_CONTROL_CHAR,
@ -277,9 +277,6 @@ const uint8_t ascii_translation_table[ASCII_TRANSLATION_TABLE_SIZE] PROGMEM = {
#define PIN_CORRECTION (1 << 1) #define PIN_CORRECTION (1 << 1)
#define PIN_ARMHAMMER (1 << 0) #define PIN_ARMHAMMER (1 << 0)
/* Misc I/O */
#define MISCIO(t) t##D
#define PIN_BACKLIGHT (1 << 2)
/* Stepper drive */ /* Stepper drive */
@ -674,22 +671,11 @@ void move_carriage_to_far_left(uint8_t reset)
if (LIMITSWITCH) { if (LIMITSWITCH) {
debug_write("[car] Clearing switch area...\r\n"); debug_write("[car] Clearing switch area...\r\n");
cnt = 32; while (LIMITSWITCH) {
while (LIMITSWITCH && (cnt> 0)) {
if (block_for(TIM_CARRIAGE, STEPPER_CFG_CARRIAGE.delay)) { if (block_for(TIM_CARRIAGE, STEPPER_CFG_CARRIAGE.delay)) {
STEPPER_NEXT(CARRIAGE, 1); STEPPER_NEXT(CARRIAGE, 1);
cnt--;
} }
} }
if (LIMITSWITCH && !cnt) { // We're probably in correction mode
DCMOTOR_EN;
arm_correction();
_delay_ms(1000);
DCMOTOR_STOP;
}
if (LIMITSWITCH) { // If the switch is still not released, there's some problem we can't fix from SW
hardfault();
}
for (cnt = 0; cnt < 16; cnt++) { for (cnt = 0; cnt < 16; cnt++) {
STEPPER_NEXT(CARRIAGE, 1); STEPPER_NEXT(CARRIAGE, 1);
} }
@ -925,7 +911,7 @@ void printer_process()
switch (state) { switch (state) {
case IDLE: case IDLE:
if (print_buffer_rd != print_buffer_wr) { // TODO: maybe add "|| current_is_linebreak" if (print_buffer_rd != print_buffer_wr) { // maybe add "|| current_is_linebreak"
if (!DCMOTOR_ISACTIVE) { if (!DCMOTOR_ISACTIVE) {
DCMOTOR_EN; DCMOTOR_EN;
_delay_ms(100); /* Let the motor get up to speed */ _delay_ms(100); /* Let the motor get up to speed */
@ -1033,8 +1019,7 @@ void printer_process()
// stepper_status_WHEEL.target_pos += 10; // stepper_status_WHEEL.target_pos += 10;
// // ----------- // // -----------
if (stepper_status_CARRIAGE.target_pos > PRINTER_STOP_RIGHT || if (stepper_status_CARRIAGE.target_pos > PRINTER_STOP_RIGHT) { // Right margin safety
stepper_status_CARRIAGE.target_pos < 0) { // Margin safety
hardfault(); hardfault();
} }
stepper_perform_movement(&stepper_status_LINEFEED, &STEPPER_CFG_LINEFEED); stepper_perform_movement(&stepper_status_LINEFEED, &STEPPER_CFG_LINEFEED);
@ -1289,10 +1274,6 @@ int main()
STEPPER_SET_IO(WHEEL); STEPPER_SET_IO(WHEEL);
STEPPER_SET_IO(LINEFEED); STEPPER_SET_IO(LINEFEED);
/* Set up miscellaneous I/O */
MISCIO(DDR) |= PIN_BACKLIGHT;
MISCIO(PORT) |= PIN_BACKLIGHT; /* Permanently enable backlight */
/* Set up SysTick Timer */ /* Set up SysTick Timer */
TCCR1B = (1 << WGM12) | (1 << CS11); // f_tim = 8 MHz / 8 TCCR1B = (1 << WGM12) | (1 << CS11); // f_tim = 8 MHz / 8
OCR1A = 2000 / TIMESCALE; OCR1A = 2000 / TIMESCALE;
@ -1302,11 +1283,6 @@ int main()
sync_uart(); sync_uart();
update_status(0); update_status(0);
debug_write("\n\n\r[sys] STARTING IO CONTROLLER...\r\n"); debug_write("\n\n\r[sys] STARTING IO CONTROLLER...\r\n");
#ifndef DEBUG_BUILD
while (!((UCSRA & (1 << RXC)) && (UDR == 0xFF))); /* Wait for init command from driver */
update_status(0);
_delay_ms(250);
#endif
debug_write("[sys] Enabling interrupts.\r\n"); debug_write("[sys] Enabling interrupts.\r\n");
sei(); sei();