Light control - On but not Off

I have followed the basic instructions at https://www.instructables.com/id/3D-Printer-RGB-LED-Feedback/ to set up a light on/off control for my lights - simplifying to one circuit as I've only got white light strips. (personal goal, re-write that page to take out the problems I had) 

This works perfectly using the M42 command (M42 P4 S255 or M42 P4 S0) to turn on and off the lights, however, the UI and Repetier controls via the server does not turn off, but turns on. 

I'm using Repetier Firmware on my Ramps 1.4 board to set this up. Repetier Firmware has the relevant settings as: 
#define CASE_LIGHTS_PIN 4
#define CASE_LIGHT_DEFAULT_ON 0

My printer is currently running displayless, as the display smoked as part of a wiring error (I've replaced all components other than the display). 

There does not seem to be any settings within Repetier Server to adjust it. As it's me, I'm sure I'm doing something wrong. anyone wanna help? Thanks. 

Comments

  • Check in console with enabled commands which commands get send after hitting it multiple times. Then you know if correct commands get send and we know if it firmware or server side problem.
  • pressing the "Light on/off" switch on the touchscreen on my pi, or the light switch on the control screen of the web server, it sends "M355 S1" only. 

    If I manually send M355 S0 it turns off the lights. 
  • 1:30:11.288: N100 M355 S1
    1:30:12.045: N101 M355 S1
    1:30:12.659: N102 M355 S1
    1:30:13.324: N103 M355 S1
    1:30:13.676: N104 M355 S1
  • Where do you switch the lights. I tested it and it worked for main gui and touchscreen. Only thing was the touchscreen required some time (2-3 seconds) to recognise the change so pressing fast several times did not change anything but sooner or later it changed between S0 and S1 when I pressed.

  • edited September 3
    I'm doing the change from the Pi touchscreen or the Web interface. I could wait as far as 15 minutes with no change. It'll always send S1. 

    I've rigged together the old display to work with the RAMPS setup, so I could see if direct control works, which it does, although the status doesn't update on the screen, using freshly downloaded Repetier firmware. It always indicates the lights are off in the Control menu. 
  • Strange. Testing I get this here:


    19:07:39.420: N25 M355 S0
    19:07:39.426: ok 25
    19:07:39.426: Info:Case lights off
    19:07:40.425: wait
    19:07:40.880: N26 M355 S1
    19:07:40.884: ok 26
    19:07:40.884: Info:Case lights on
    19:07:41.631: N27 M355 S0
    19:07:41.634: ok 27
    19:07:41.638: Info:Case lights off
    19:07:42.611: N28 M355 S1
    19:07:42.617: ok 28
    19:07:42.617: Info:Case lights on
    19:07:43.266: N29 M355 S0
    19:07:43.321: ok 29

    so you see firmware reports new state and next command gets toggled.
    What server version are you using? I tested with latest 0.92.1.

  • edited September 3
    I'm on 0.92.0 - upgrading, then testing again. 

  • Haven't changed anything on lights since that version.

    So at the moment I see no reason for it to fail in your case. Can you post your printer xml config. Would be the only thing that might maybe break some thing also I don't know what. But at least it contains all your settings so if I'm able to reproduce, then with that config.
  • OK - Finally got it tested again (been busy) - Same result. 

    Would you want my configuration.h file from the firmware as well? 

    Here's the data: 

    2:49:16.158: N20 M80
    2:49:16.163: ok 20
    2:49:56.739: wait (40)
    2:49:56.831: N21 M355 S1
    2:49:56.837: ok 21
    2:49:56.838: Info:Case lights off
    2:50:16.016: wait (19)
    2:50:16.319: N22 M355 S1
    2:50:16.326: ok 22
    2:50:16.326: Info:Case lights off
    2:50:50.775: wait (34)
    2:50:50.957: N23 M81
    2:50:50.961: ok 23
    2:51:16.454: wait (25)

    XML file: 

    <?xml version="1.0" encoding="UTF-8"?>
    <printer>
    <shape>
    <grid color="#454545" spacing="10"/>
    <rectangle color="#dddddd" xMax="200" xMin="0" yMax="200" yMin="0"/>
    </shape>
    <general>
    <name>MMS IIIP</name>
    <slug>MMS_IIIP</slug>
    <model/>
    <firmwareName>Repetier-Firmware</firmwareName>
    <printerVariant>cartesian</printerVariant>
    <active>true</active>
    <numFans>1</numFans>
    <tempUpdateEvery>1</tempUpdateEvery>
    <pauseHandling>0</pauseHandling>
    <pauseSeconds>120</pauseSeconds>
    <sdcard>true</sdcard>
    <softwarePower>true</softwarePower>
    <defaultVolumetric>false</defaultVolumetric>
    <logHistory>true</logHistory>
    <useOwnModelRepository>true</useOwnModelRepository>
    <useModelFromSlug/>
    </general>
    <connection>
    <connectionMethod>0</connectionMethod>
    <pipe>
    <file/>
    </pipe>
    <ip>
    <port>23</port>
    <address/>
    </ip>
    <serial>
    <baudrate>115200</baudrate>
    <rts>0</rts>
    <dtr>0</dtr>
    <device>/dev/ttyUSB0</device>
    <pingPong>false</pingPong>
    <visibleWithoutRunning>false</visibleWithoutRunning>
    <malyanHack>false</malyanHack>
    <inputBufferSize>127</inputBufferSize>
    <communicationTimeout>3</communicationTimeout>
    </serial>
    <lcdTimeMode>4</lcdTimeMode>
    <resetScript/>
    </connection>
    <movement>
    <xMin>0</xMin>
    <xMax>200</xMax>
    <xHome>0</xHome>
    <yMin>0</yMin>
    <yMax>200</yMax>
    <yHome>0</yHome>
    <zMin>0</zMin>
    <zMax>180</zMax>
    <zHome>0</zHome>
    <xyJerk>20</xyJerk>
    <zJerk>0.71</zJerk>
    <timeMultiplier>1</timeMultiplier>
    <movebuffer>16</movebuffer>
    <xySpeed max="200">100</xySpeed>
    <zSpeed max="20">2</zSpeed>
    <defaultAcceleration>10000</defaultAcceleration>
    <defaultTravelAcceleration>10000</defaultTravelAcceleration>
    <defaultRetractAcceleration>4000</defaultRetractAcceleration>
    <xyPrintAcceleration>1000</xyPrintAcceleration>
    <xyTravelAcceleration>1000</xyTravelAcceleration>
    <zPrintAcceleration>100</zPrintAcceleration>
    <zTravelAcceleration>100</zTravelAcceleration>
    <endstops all="true" x="true" y="true" z="true"/>
    <invert x="false" y="false" z="false"/>
    <G10Speed>40</G10Speed>
    <G10Distance>3</G10Distance>
    <G10LongDistance>40</G10LongDistance>
    <G11Speed>20</G11Speed>
    <G11ExtraDistance>0</G11ExtraDistance>
    <G11ExtraLongDistance>0</G11ExtraLongDistance>
    <G10ZLift>0</G10ZLift>
    </movement>
    <recover>
    <enabled>false</enabled>
    <replayExtruderSwitches>false</replayExtruderSwitches>
    <maxTimeForAutocontinue>300</maxTimeForAutocontinue>
    <reactivateBedOnConnect>true</reactivateBedOnConnect>
    <firmwarePowerlossSignal/>
    <procedure>G28 X0 Y0</procedure>
    <runOnConnect>G28 X0 Y0</runOnConnect>
    <extraZOnFirmwareDetect>0</extraZOnFirmwareDetect>
    <delayBeforeReconnect>30</delayBeforeReconnect>
    </recover>
    <extruders>
    <extruder changeFastDistance="20" changeSlowDistance="20" filamentDiameter="1.75" lastTemp="190" maxTemp="260" num="0" tempMaster="0">
    <alias/>
    <maxSpeed acceleration="5000" jerk="20" max="50"/>
    <extrude speed="2"/>
    <retract speed="30"/>
    <tempChange cooldownPerSecond="0.5" heatupPerSecond="2"/>
    <offsets x="0" y="0"/>
    <temperatures>
    <temperature value="245">ABS 245</temperature>
    <temperature value="210">PLA 210</temperature>
    <temperature value="195">PLA 195</temperature>
    </temperatures>
    </extruder>
    </extruders>
    <heatedBeds>
    <heatedBed lastTemp="50" maxTemp="120" num="0">
    <alias/>
    <tempChange cooldownPerSecond="0.1" heatupPerSecond="0.1"/>
    <temperatures/>
    </heatedBed>
    </heatedBeds>
    <heatedChambers/>
    <quickCommands/>
    <responseEvents/>
    <webcams/>
    <properties/>
    <scripts>
    <script name="start"> M355 s1</script>
    <script name="end">M355 S0</script>
    <script name="kill">M355 S0</script>
    </scripts>
    </printer>

  • Update: my server install failed, started rebooting continuously without coming up - so I'm downloading a new image and reinstalling from scratch. 
  • Testing with your config just setting port to virtual worked fine as well.
    Guess I wait until your new install. Can you also test with virtual port?
    I did the tests without printing anything before. Just connect and starting to switch light with the toggle light button in control or light on/off button in status page of touch screen in case you do it somewhere else.
  • Using the web interface, it works using the virtual port, so I guess it's somewhere in my firmware config, maybe? You want that in full? 

    Using the virtual port "VirtualCartisan": 

    14:52:58.426: N32 M117 192.168.1.190:3344
    14:53:18.604: ok (22)
    14:53:19.321: N54 M355 S1
    14:53:19.611: ok (2)
    14:53:20.565: N56 M355 S0
    14:53:21.602: ok (3)
    14:53:21.718: N59 M355 S1
    14:53:22.608: ok (2)
    14:53:22.846: N61 M355 S0
    14:53:23.615: ok (2)
    14:53:24.272: N63 M355 S1
    14:53:25.627: ok (3)
    14:53:25.649: N66 M355 S0
    14:53:26.615: ok (2)
    14:53:27.578: N68 M355 S1
    14:53:27.621: ok (2)
    14:53:28.620: N71 M355 S0
    14:53:42.657: ok (16)

    Using "/dev/serial/by-id/usb-1a86_USB2.0-Serial-if00-port0" : 

    14:53:55.713: wait (6)
    14:53:55.936: N19 M355 S1
    14:53:55.944: ok 19
    14:53:55.945: Info:Case lights off
    14:53:57.960: wait (2)
    14:53:58.284: N20 M355 S1
    14:53:58.292: ok 20
    14:53:58.292: Info:Case lights off
    14:53:58.687: @getip
    14:53:58.691: N21 M117 192.168.1.190:3344
    14:53:58.697: ok 21
    14:54:00.749: wait (2)
    14:54:01.255: N22 M355 S1
    14:54:01.262: ok 22
    14:54:01.263: Info:Case lights off
    14:54:03.278: wait (2)
    14:54:03.653: N23 M355 S1
    14:54:03.661: ok 23
    14:54:03.661: Info:Case lights off
    14:54:15.771: wait (12)
  • Ok that explains it at least
    14:54:03.653: N23 M355 S1
    14:54:03.661: ok 23
    14:54:03.661: Info:Case lights off

    Server parses "Info:Case lights off" and that is the opposite of what it should be. S1 is enable and firmware says it is off and server believes it.

    So firmware reports wrong status here. What version are you using? When It tested with 1.0.4dev I got the right response.
  • edited September 6
    Just to confirm I was using current - I redownloaded it from repetier.com and re-flashed the firmware. The website is claiming 1.0.3 with the config tool. 

    Same result as before. 



  • Ok, then I have fixed it only in dev version so far. That is what I used to test. Here the correct code in Printer.cpp

    void Printer::setCaseLight(bool on) {
    #if CASE_LIGHTS_PIN > -1
    WRITE(CASE_LIGHTS_PIN, on);
    lightOn = on;
    reportCaseLightStatus();
    }

    void Printer::reportCaseLightStatus() {
    #if CASE_LIGHTS_PIN > -1
    if (lightOn)
    Com::printInfoFLN(PSTR("Case lights on"));
    else
    Com::printInfoFLN(PSTR("Case lights off"));
    Com::printInfoFLN(PSTR("No case lights"));
    }
  • Tried to edit the code, but, created more errors than fixes, so I just updated to the Development branch. Once I took out the references to Russian language, it works now. 

    Thanks for the help!
  • Tried to edit the code, but, created more errors than fixes, so I just updated to the Development branch. Once I took out the references to Russian language, it works now. 

    Thanks for the help!
Sign In or Register to comment.